diff options
author | joerg <joerg@pkgsrc.org> | 2010-02-03 14:20:14 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2010-02-03 14:20:14 +0000 |
commit | 2932d87873aa06a4109dd25a63cfaf6841c8ab01 (patch) | |
tree | 8f860491f6f0631b547f8accdb58ce8a2edba8f2 | |
parent | cf4aba0aeddc4279b3178f1ec475fbd12e683087 (diff) | |
download | pkgsrc-2932d87873aa06a4109dd25a63cfaf6841c8ab01.tar.gz |
pkg_install-20100203:
- Restore PKG_PREFIX in pkg_delete (PR 42731)
- Ensure that the current pkg_install version is at least as new as
the version used to build the package
-rw-r--r-- | pkgtools/pkg_install/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/add/perform.c | 37 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/delete/pkg_delete.c | 3 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/lib.h | 5 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.c | 6 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
6 files changed, 47 insertions, 12 deletions
diff --git a/pkgtools/pkg_install/Makefile b/pkgtools/pkg_install/Makefile index 72f975f0edc..d4d4a711faa 100644 --- a/pkgtools/pkg_install/Makefile +++ b/pkgtools/pkg_install/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.171 2010/01/26 15:48:13 joerg Exp $ +# $NetBSD: Makefile,v 1.172 2010/02/03 14:20:14 joerg Exp $ # Notes to package maintainers: # @@ -80,7 +80,7 @@ MESSAGE_SUBST+= PKGVULNDIR=${PKG_DBDIR:Q} \ .include "../../mk/bsd.prefs.mk" -VERSION!= ${AWK} -F '"' '/PKGTOOLS_VERSION/ {print $$2}' \ +VERSION!= ${AWK} '/PKGTOOLS_VERSION/ {print $$3}' \ ${FILESDIR}/lib/version.h # linkresolver interface appeared in libarchive 2.5 and extract diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c index d9994f78200..c7fcbcb8ad8 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.93 2010/01/30 20:09:34 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.94 2010/02/03 14:20:14 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" #endif @@ -6,7 +6,7 @@ #if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: perform.c,v 1.93 2010/01/30 20:09:34 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.94 2010/02/03 14:20:14 joerg Exp $"); /*- * Copyright (c) 2003 Grant Beattie <grant@NetBSD.org> @@ -57,6 +57,7 @@ __RCSID("$NetBSD: perform.c,v 1.93 2010/01/30 20:09:34 joerg Exp $"); #include "lib.h" #include "add.h" +#include "version.h" struct pkg_meta { char *meta_contents; @@ -500,6 +501,9 @@ read_buildinfo(struct pkg_task *pkg) eol); else if (strncmp(data, "LICENSE=", 8) == 0) pkg->buildinfo[BI_LICENSE] = dup_value(data, eol); + else if (strncmp(data, "PKGTOOLS_VERSION=", 17) == 0) + pkg->buildinfo[BI_PKGTOOLS_VERSION] = dup_value(data, + eol); } if (pkg->buildinfo[BI_OPSYS] == NULL || pkg->buildinfo[BI_OS_VERSION] == NULL || @@ -879,6 +883,32 @@ check_platform(struct pkg_task *pkg) return 0; } +static int +check_pkgtools_version(struct pkg_task *pkg) +{ + const char *val = pkg->buildinfo[BI_PKGTOOLS_VERSION]; + int version; + + if (val == NULL) { + warnx("Warning: package `%s' lacks pkg_install version data", + pkg->pkgname); + return 0; + } + + if (strlen(val) != 8 || strspn(val, "0123456789") != 8) { + warnx("Warning: package `%s' contains an invalid pkg_install version", + pkg->pkgname); + return Force ? 0 : -1; + } + version = atoi(val); + if (version > PKGTOOLS_VERSION) { + warnx("%s: package `%s' was built with a newer pkg_install version", + Force ? "Warning" : "Error", pkg->pkgname); + return Force ? 0 : -1; + } + return 0; +} + /* * Run the install script. */ @@ -1336,6 +1366,9 @@ pkg_do(const char *pkgpath, int mark_automatic, int top_level) if (read_buildinfo(pkg)) goto clean_memory; + if (check_pkgtools_version(pkg)) + goto clean_memory; + if (check_vulnerable(pkg)) goto clean_memory; diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.c b/pkgtools/pkg_install/files/delete/pkg_delete.c index 38721878537..fa063518f9b 100644 --- a/pkgtools/pkg_install/files/delete/pkg_delete.c +++ b/pkgtools/pkg_install/files/delete/pkg_delete.c @@ -34,7 +34,7 @@ #if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: pkg_delete.c,v 1.10 2010/01/22 13:30:42 joerg Exp $"); +__RCSID("$NetBSD: pkg_delete.c,v 1.11 2010/02/03 14:20:14 joerg Exp $"); #if HAVE_ERR_H #include <err.h> @@ -683,6 +683,7 @@ remove_pkg(const char *pkg) fname = pkgdb_pkg_dir(pkg); setenv(PKG_METADATA_DIR_VNAME, fname, 1); free(fname); + setenv(PKG_PREFIX_VNAME, p->name, 1); if (!no_deinstall && !unregister_only) { if (run_deinstall_script(pkg, 0) && !Force) diff --git a/pkgtools/pkg_install/files/lib/lib.h b/pkgtools/pkg_install/files/lib/lib.h index f85bf1c0b01..3acc3fe92be 100644 --- a/pkgtools/pkg_install/files/lib/lib.h +++ b/pkgtools/pkg_install/files/lib/lib.h @@ -1,4 +1,4 @@ -/* $NetBSD: lib.h,v 1.59 2010/01/22 13:30:42 joerg Exp $ */ +/* $NetBSD: lib.h,v 1.60 2010/02/03 14:20:14 joerg Exp $ */ /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ @@ -184,7 +184,8 @@ typedef enum bi_ent_t { BI_IGNORE_RECOMMENDED, /* 3 */ BI_USE_ABI_DEPENDS, /* 4 */ BI_LICENSE, /* 5 */ - BI_ENUM_COUNT /* 6 */ + BI_ENUM_COUNT, /* 6 */ + BI_PKGTOOLS_VERSION /* 7 */ } bi_ent_t; /* Types */ diff --git a/pkgtools/pkg_install/files/lib/version.c b/pkgtools/pkg_install/files/lib/version.c index f7cb6ec51ad..da427006cf7 100644 --- a/pkgtools/pkg_install/files/lib/version.c +++ b/pkgtools/pkg_install/files/lib/version.c @@ -1,4 +1,4 @@ -/* $NetBSD: version.c,v 1.6 2009/02/02 12:35:01 joerg Exp $ */ +/* $NetBSD: version.c,v 1.7 2010/02/03 14:20:14 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include <sys/cdefs.h> #endif -__RCSID("$NetBSD: version.c,v 1.6 2009/02/02 12:35:01 joerg Exp $"); +__RCSID("$NetBSD: version.c,v 1.7 2010/02/03 14:20:14 joerg Exp $"); /* * Copyright (c) 2001 Thomas Klausner. All rights reserved. @@ -43,7 +43,7 @@ __RCSID("$NetBSD: version.c,v 1.6 2009/02/02 12:35:01 joerg Exp $"); void show_version(void) { - printf("%s\n", PKGTOOLS_VERSION); + printf("%d\n", PKGTOOLS_VERSION); exit (0); } diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 664accac449..59eeb1e72c4 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.148 2010/01/30 20:09:34 joerg Exp $ */ +/* $NetBSD: version.h,v 1.149 2010/02/03 14:20:14 joerg 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 "20100130" +#define PKGTOOLS_VERSION 20100203 #endif /* _INST_LIB_VERSION_H_ */ |