tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg_add CHECK_OS_VERSION variable support



On Wed, Dec 09, 2020 at 12:37:23PM -0500, Greg Troxel wrote:
> 
> Juraj Lutter <otis%NetBSD.org@localhost> writes:
> 
> >> On 9 Dec 2020, at 18:07, Greg Troxel <gdt%lexort.com@localhost> wrote:
> >>
> >> So if this were limited to
> >> 
> >>   For X1.Y1.Z1 and X2.Y2.Z2, skip warning if
> >> 
> >>     X1 == X2 and Y1 != 99 and Y2 != 99, or
> >> 
> >>     X1 == X2 and Y1 == Y2 == 99
> >
> > This is true for NetBSD but may not be true for other platforms we support.
> 
> Good point.  So it needs a case on OS name, and then per-OS "what's
> really different rules".

This topic comes up every couple of years, but nothing happens.

The code is simple. You can find it in
pkgsrc/pkgtools/pkg_install/files/add/perform.c.

The function static int compatible_platform(const char *opsys, const
char *host, const char *package) compares the operating system version
from "host" with the one registered in the "package". The "opsys"
argument is provided so that you can have different checks depending
on the operating system.

The code compares the strings provided. If they are the same -
fine. If not, it calls static int end_of_version(const char *opsys,
const char *version_end) on both remainders of the strings. "opsys",
again, is provided so that the code can be operating system dependent;
"version_end" is the part of the the version that mismatches. On
NetBSD, this is currently compared to the following list and ignored
if it's one of these:

_ALPHA
_BETA
_RC
_STABLE
_PATCH

since these are common strings that are attached to alpha or beta
versions or stable branches or patch releases of NetBSD.

Of course, you could rewrite the code completely.

Either way, it's very simple C code. Go hack!
 Thomas

(P.S.: I am NOT volunteering.)



Home | Main Index | Thread Index | Old Index