Subject: Re: Warning about differing opsys versions when installing binary packages
To: None <tech-pkg@NetBSD.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-pkg
Date: 06/11/2005 18:01:39
On Sat, 11 Jun 2005, Thomas Klausner wrote:
> Currently, pkg_add complains when installing binary packages
> that have been built for a different opsys version than the
> one on which they are installed (but keeps on installing).
> 
> This is annoying if you want to install NetBSD-2.0 packages
> on 2.0.2, because there really is no reason for problems.

A package that you build today cannot know whether or not it will work
with some future version of the operating system.  However, a future
version of pkg_add that is designed to work with a future version of the
operating system *can* know how safe it is to install a package that you
build today.

In other words:  When you build a foo-1.2.3.tgz binary package under
the present-day version of NetBSD-3.99.6, neither the foo pkg nor the
NetBSD-3.99.6 version of pkg_add can possibly know whether or not the
same foo-1.2.3.tgz binary package will work with NetBSD-4.5.6.  However,
a future version of pkg_add that is designed to work with the future
NetBSD-4.5.6 *can* have knowledge of whether or not to warn about binary
packages that were built for NetBSD-3.99.6.

> So I thought about removing this check at least in this particular
> case. However, hardcoding a case for these versions is not a good
> idea. So how do we generalize this?
>
> Do we want to install packages from 2.0(.a) on 2.1(.b) without
> complaints too? I'm not quite sure.

There are three OS versions of interest:

* The OS under which the installed package will run.  (This is usually
  the same as the OS under which pkg_add runs, but in theory one
  could use pkg_add to install onto media that will be booted under a
  different OS.)

* The OS for which the package was built.

* The OS (or list of OSes) for which pkg_add was designed.

If the OS under which the installed package will run is recognised
as one of the OSes for which pkg_add was designed, then pkg_add can
have a table of rules telling it things like "packages built for
NetBSD>=2.0<=2.0.2 may be installed on NetBSD-2.0.2 without any
warning"; "packages built for NetBSD>=1.6<2.0 may be installed on
NetBSD-2.* provided the kernel contains the COMPAT_16 option".

If the OS under which the installed package will run is unrecognised,
or is newer than the OSes for which pkg_add was designed, then pkg_add
can't know whether the package will work.  It could just warn, but have
an option to force installation anyway.

--apb (Alan Barrett)