diff options
author | joerg <joerg> | 2006-01-25 00:20:09 +0000 |
---|---|---|
committer | joerg <joerg> | 2006-01-25 00:20:09 +0000 |
commit | c5db7b0b8f0a2f512ba6078db6f5bfd0546beb51 (patch) | |
tree | 24f8efc86474a3b71e22e69707b996504875dbfe | |
parent | 67d51e87843bd5137953b47d0005498b5c344f74 (diff) | |
download | pkgsrc-c5db7b0b8f0a2f512ba6078db6f5bfd0546beb51.tar.gz |
Add conditional code to ignore the non-numeric part of an OS version
for the sake of compatibility tests in pkg_add.
E.g. DragonFly versions like
1.4.0-RELEASE
are reduced to
1.4.0
This code is currently enabled for DragonFly only.
-rw-r--r-- | pkgtools/pkg_install/files/add/perform.c | 17 | ||||
-rwxr-xr-x | pkgtools/pkg_install/files/configure | 10 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/configure.ac | 6 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/config.h.in | 3 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
5 files changed, 36 insertions, 4 deletions
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c index b9a4a7de4e1..d81356c3622 100644 --- a/pkgtools/pkg_install/files/add/perform.c +++ b/pkgtools/pkg_install/files/add/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.36 2005/12/08 19:41:04 dillo Exp $ */ +/* $NetBSD: perform.c,v 1.37 2006/01/25 00:20:09 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -14,7 +14,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.36 2005/12/08 19:41:04 dillo Exp $"); +__RCSID("$NetBSD: perform.c,v 1.37 2006/01/25 00:20:09 joerg Exp $"); #endif #endif @@ -103,6 +103,17 @@ enum { Fatal }; +static void +normalise_platform(struct utsname *host_name) +{ +#ifdef NUMERIC_VERSION_ONLY + size_t span; + + span = strspn(host_name->release, "0123456789."); + host_name->release[span] = '\0'; +#endif +} + /* Read package build information */ static int read_buildinfo(char **buildinfo) @@ -409,6 +420,8 @@ pkg_do(const char *pkg, lpkg_head_t *pkgs) } else { int status = Good; + normalise_platform(&host_uname); + /* check that we have read some values from buildinfo */ if (buildinfo[BI_OPSYS] == NULL) { warnx("Missing operating system value from build information"); diff --git a/pkgtools/pkg_install/files/configure b/pkgtools/pkg_install/files/configure index f7d8d22f6c5..f5eeb61c53d 100755 --- a/pkgtools/pkg_install/files/configure +++ b/pkgtools/pkg_install/files/configure @@ -5991,6 +5991,16 @@ _ACEOF +case $host in +*-*-dragonfly*) + +cat >>confdefs.h <<\_ACEOF +#define NUMERIC_VERSION_ONLY 1 +_ACEOF + + ;; +esac + diff --git a/pkgtools/pkg_install/files/configure.ac b/pkgtools/pkg_install/files/configure.ac index d3f14e09cb4..a20d1c98f01 100644 --- a/pkgtools/pkg_install/files/configure.ac +++ b/pkgtools/pkg_install/files/configure.ac @@ -130,6 +130,12 @@ AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) +case $host in +*-*-dragonfly*) + AC_DEFINE([NUMERIC_VERSION_ONLY], [1], [Defined when to retain only the numeric OS version]) + ;; +esac + AH_BOTTOM( #if !HAVE_VFORK # define vfork fork diff --git a/pkgtools/pkg_install/files/lib/config.h.in b/pkgtools/pkg_install/files/lib/config.h.in index 3a189f0c850..477e2cb3041 100644 --- a/pkgtools/pkg_install/files/lib/config.h.in +++ b/pkgtools/pkg_install/files/lib/config.h.in @@ -165,6 +165,9 @@ /* Defined when PRIu64 is missing or broken */ #undef NEED_PRI_MACRO +/* Defined when only the numeric part of the OS version should be used */ +#undef NUMERIC_VERSION_ONLY + /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 9e3f767f671..e6a4a7c1475 100644 --- a/pkgtools/pkg_install/files/lib/version.h +++ b/pkgtools/pkg_install/files/lib/version.h @@ -1,4 +1,4 @@ -/* $NetBSD: version.h,v 1.53 2006/01/04 23:33:23 christos Exp $ */ +/* $NetBSD: version.h,v 1.54 2006/01/25 00:20:09 joerg Exp $ */ /* * Copyright (c) 2001 Thomas Klausner. All rights reserved. @@ -33,6 +33,6 @@ #ifndef _INST_LIB_VERSION_H_ #define _INST_LIB_VERSION_H_ -#define PKGTOOLS_VERSION "20060104" +#define PKGTOOLS_VERSION "20060123" #endif /* _INST_LIB_VERSION_H_ */ |