pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install pkg_install-20100203:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/dae9b7b5bd25
branches:  trunk
changeset: 570791:dae9b7b5bd25
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Wed Feb 03 14:20:14 2010 +0000

description:
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

diffstat:

 pkgtools/pkg_install/Makefile                  |   4 +-
 pkgtools/pkg_install/files/add/perform.c       |  37 ++++++++++++++++++++++++-
 pkgtools/pkg_install/files/delete/pkg_delete.c |   3 +-
 pkgtools/pkg_install/files/lib/lib.h           |   5 ++-
 pkgtools/pkg_install/files/lib/version.c       |   6 ++--
 pkgtools/pkg_install/files/lib/version.h       |   4 +-
 6 files changed, 47 insertions(+), 12 deletions(-)

diffs (180 lines):

diff -r 0202ba09db4e -r dae9b7b5bd25 pkgtools/pkg_install/Makefile
--- a/pkgtools/pkg_install/Makefile     Wed Feb 03 14:14:05 2010 +0000
+++ b/pkgtools/pkg_install/Makefile     Wed Feb 03 14:20:14 2010 +0000
@@ -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 @@
 
 .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 -r 0202ba09db4e -r dae9b7b5bd25 pkgtools/pkg_install/files/add/perform.c
--- a/pkgtools/pkg_install/files/add/perform.c  Wed Feb 03 14:14:05 2010 +0000
+++ b/pkgtools/pkg_install/files/add/perform.c  Wed Feb 03 14:20:14 2010 +0000
@@ -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@localhost>
@@ -57,6 +57,7 @@
 
 #include "lib.h"
 #include "add.h"
+#include "version.h"
 
 struct pkg_meta {
        char *meta_contents;
@@ -500,6 +501,9 @@
                            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 @@
        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 @@
        if (read_buildinfo(pkg))
                goto clean_memory;
 
+       if (check_pkgtools_version(pkg))
+               goto clean_memory;
+
        if (check_vulnerable(pkg))
                goto clean_memory;
 
diff -r 0202ba09db4e -r dae9b7b5bd25 pkgtools/pkg_install/files/delete/pkg_delete.c
--- a/pkgtools/pkg_install/files/delete/pkg_delete.c    Wed Feb 03 14:14:05 2010 +0000
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.c    Wed Feb 03 14:20:14 2010 +0000
@@ -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 @@
        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 -r 0202ba09db4e -r dae9b7b5bd25 pkgtools/pkg_install/files/lib/lib.h
--- a/pkgtools/pkg_install/files/lib/lib.h      Wed Feb 03 14:14:05 2010 +0000
+++ b/pkgtools/pkg_install/files/lib/lib.h      Wed Feb 03 14:20:14 2010 +0000
@@ -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 @@
        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 -r 0202ba09db4e -r dae9b7b5bd25 pkgtools/pkg_install/files/lib/version.c
--- a/pkgtools/pkg_install/files/lib/version.c  Wed Feb 03 14:14:05 2010 +0000
+++ b/pkgtools/pkg_install/files/lib/version.c  Wed Feb 03 14:20:14 2010 +0000
@@ -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 @@
 void
 show_version(void)
 {
-       printf("%s\n", PKGTOOLS_VERSION);
+       printf("%d\n", PKGTOOLS_VERSION);
        exit (0);
 }
 
diff -r 0202ba09db4e -r dae9b7b5bd25 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Wed Feb 03 14:14:05 2010 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Wed Feb 03 14:20:14 2010 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index