diff options
author | wiz <wiz@pkgsrc.org> | 2010-12-12 13:18:38 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2010-12-12 13:18:38 +0000 |
commit | 9716d96abf1f1e2a2732f0913cd4a1d05f1660ee (patch) | |
tree | 45fd5d3a01484b55a9c0264ed722ee58f23f2f58 /pkgtools | |
parent | f9ed2a20fd495c586c3588c63c1e46d1af96b952 (diff) | |
download | pkgsrc-9716d96abf1f1e2a2732f0913cd4a1d05f1660ee.tar.gz |
Don't warn about _ALPHA, _BETA, _PATCH, _RC, _STABLE mismatches
when pkg_add'ing on NetBSD. Bump version to 20101212.
Ok jym, gdt
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkg_install/files/add/perform.c | 45 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
2 files changed, 44 insertions, 5 deletions
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c index 8a1967d4bc2..89f402427f5 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.98 2010/09/14 22:26:18 gdt Exp $ */ +/* $NetBSD: perform.c,v 1.99 2010/12/12 13:18:38 wiz Exp $ */ #if HAVE_CONFIG_H #include "config.h" #endif @@ -6,13 +6,14 @@ #if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: perform.c,v 1.98 2010/09/14 22:26:18 gdt Exp $"); +__RCSID("$NetBSD: perform.c,v 1.99 2010/12/12 13:18:38 wiz Exp $"); /*- * Copyright (c) 2003 Grant Beattie <grant@NetBSD.org> * Copyright (c) 2005 Dieter Baron <dillo@NetBSD.org> * Copyright (c) 2007 Roland Illig <rillig@NetBSD.org> * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg@NetBSD.org> + * Copyright (c) 2010 Thomas Klausner <wiz@NetBSD.org> * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -128,6 +129,43 @@ static const struct pkg_meta_desc { static int pkg_do(const char *, int, int); static int +end_of_version(const char *opsys, const char *version_end) +{ + if (*version_end == '\0') + return 1; + + if (strcmp(opsys, "NetBSD") == 0) { + if (strncmp(version_end, "_ALPHA", 6) == 0 + || strncmp(version_end, "_BETA", 5) == 0 + || strncmp(version_end, "_RC", 3) == 0 + || strncmp(version_end, "_STABLE", 7) == 0 + || strncmp(version_end, "_PATCH", 6) == 0) + return 1; + } + + return 0; +} + +static int +compatible_platform(const char *opsys, const char *host, const char *package) +{ + int i = 0; + + /* returns 1 if host and package operating system match */ + if (strcmp(host, package) == 0) + return 1; + + /* find offset of first difference */ + for (i=0; (host[i] != '\0') && (host[i] == package[i]);) + i++; + + if (end_of_version(opsys, host+i) && end_of_version(opsys, package+i)) + return 1; + + return 0; +} + +static int mkdir_p(const char *path) { char *p, *cur_end; @@ -869,7 +907,8 @@ check_platform(struct pkg_task *pkg) fatal = 0; if (fatal || - strcmp(host_uname.release, pkg->buildinfo[BI_OS_VERSION]) != 0) { + compatible_platform(OPSYS_NAME, host_uname.release, + pkg->buildinfo[BI_OS_VERSION]) != 1) { warnx("Warning: package `%s' was built for a platform:", pkg->pkgname); warnx("%s/%s %s (pkg) vs. %s/%s %s (this host)", diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 2053692c4b7..f8131e96fc9 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.159 2010/11/22 09:00:13 joerg Exp $ */ +/* $NetBSD: version.h,v 1.160 2010/12/12 13:18:38 wiz Exp $ */ /* * Copyright (c) 2001 Thomas Klausner. All rights reserved. @@ -27,6 +27,6 @@ #ifndef _INST_LIB_VERSION_H_ #define _INST_LIB_VERSION_H_ -#define PKGTOOLS_VERSION 20101122 +#define PKGTOOLS_VERSION 20101212 #endif /* _INST_LIB_VERSION_H_ */ |