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 disabled by default on NetBSD.
This commit is contained in:
joerg 2006-01-25 00:17:34 +00:00
parent 86e8b6d9d0
commit 32ce5ba905
3 changed files with 20 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: perform.c,v 1.115 2005/12/08 19:26:28 dillo Exp $ */
/* $NetBSD: perform.c,v 1.116 2006/01/25 00:17:34 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.115 2005/12/08 19:26:28 dillo Exp $");
__RCSID("$NetBSD: perform.c,v 1.116 2006/01/25 00:17:34 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");

View File

@ -160,6 +160,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. */
#define PACKAGE_BUGREPORT "grant@NetBSD.org"

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.74 2006/01/04 23:36:14 christos Exp $ */
/* $NetBSD: version.h,v 1.75 2006/01/25 00:17:34 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_ */