CVS commit: [netbsd-5] src/external/bsd/pkg_install/dist

2010-02-03 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Thu Feb  4 06:45:59 UTC 2010

Modified Files:
src/external/bsd/pkg_install/dist/add [netbsd-5]: perform.c
src/external/bsd/pkg_install/dist/bpm [netbsd-5]: bpm.1 bpm.sh.in
src/external/bsd/pkg_install/dist/delete [netbsd-5]: pkg_delete.c
src/external/bsd/pkg_install/dist/lib [netbsd-5]: defs.h lib.h
version.c version.h

Log Message:
Apply patch (requested by joerg in ticket #1298):
Update pkg_install to 20100204.
- 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


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.6.3 -r1.1.1.1.6.4 \
src/external/bsd/pkg_install/dist/add/perform.c
cvs rdiff -u -r1.1.1.1.6.2 -r1.1.1.1.6.3 \
src/external/bsd/pkg_install/dist/bpm/bpm.1
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.6.1 \
src/external/bsd/pkg_install/dist/bpm/bpm.sh.in
cvs rdiff -u -r1.1.1.4.6.4 -r1.1.1.4.6.5 \
src/external/bsd/pkg_install/dist/delete/pkg_delete.c
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.6.1 \
src/external/bsd/pkg_install/dist/lib/defs.h
cvs rdiff -u -r1.1.1.1.6.3 -r1.1.1.1.6.4 \
src/external/bsd/pkg_install/dist/lib/lib.h
cvs rdiff -u -r1.1.1.1.6.2 -r1.1.1.1.6.3 \
src/external/bsd/pkg_install/dist/lib/version.c
cvs rdiff -u -r1.1.1.2.6.5 -r1.1.1.2.6.6 \
src/external/bsd/pkg_install/dist/lib/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/pkg_install/dist/add/perform.c
diff -u src/external/bsd/pkg_install/dist/add/perform.c:1.1.1.1.6.3 src/external/bsd/pkg_install/dist/add/perform.c:1.1.1.1.6.4
--- src/external/bsd/pkg_install/dist/add/perform.c:1.1.1.1.6.3	Wed Feb  3 00:38:21 2010
+++ src/external/bsd/pkg_install/dist/add/perform.c	Thu Feb  4 06:45:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: perform.c,v 1.1.1.1.6.3 2010/02/03 00:38:21 snj Exp $	*/
+/*	$NetBSD: perform.c,v 1.1.1.1.6.4 2010/02/04 06:45:58 snj Exp $	*/
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -6,7 +6,7 @@
 #if HAVE_SYS_CDEFS_H
 #include 
 #endif
-__RCSID("$NetBSD: perform.c,v 1.1.1.1.6.3 2010/02/03 00:38:21 snj Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.1.6.4 2010/02/04 06:45:58 snj Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie 
@@ -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;
 

Index: src/external/bsd/pkg_install/dist/bpm/bpm.1
diff -u src/external/bsd/pkg_install/dist/bpm/bpm.1:1.1.1.1.6.2 src/external/bsd/pkg_install/dist/bpm/bpm.1:1.1.1.1.6.3
--- src/external/bsd/pkg_install/dist/bpm/bpm.1:1.1.1.1.6.2	Wed Feb  3 00:38:21 2010
+++ src/external/bsd/pkg_install/dist/bpm/bpm.1	Thu Feb  4 06:45:58 2010
@@ -1,7 +1,10 @@
-.\" $NetBSD: bpm.1,v 1.1.1.1.6.2 2010/02/03 00:38:21 snj Exp $ */
+.\" $NetBSD: bpm.1,v 1.1.1.1.6.3 2010/02/04 06:45:58 snj Exp $ */
 .\"
+.\" Copyright (c) 2003,2009 The NetBSD Foundation, Inc.
+.\" All rights reserved.
 .\"
-.\" Copyright (c) 2003 Alistair G. Crooks.  All rights reserved.
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Alistair Crooks (a...@netbsd.org)
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -11,24 +14,18 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"notice, this list of conditions and the following disclaimer in the
 .\"documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials m

CVS commit: [netbsd-5] src/external/bsd/pkg_install/dist

2009-07-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Jul 27 00:40:11 UTC 2009

Modified Files:
src/external/bsd/pkg_install/dist/info [netbsd-5]: perform.c
src/external/bsd/pkg_install/dist/lib [netbsd-5]: license.c
pkg_install.conf.5.in version.h

Log Message:
Pull up following revision(s) (requested by joerg in ticket #877):
external/bsd/pkg_install/dist/info/perform.c: pkg_install-20090724
external/bsd/pkg_install/dist/lib/license.c: pkg_install-20090724
external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in: 
pkg_install-20090724
external/bsd/pkg_install/dist/lib/version.h: pkg_install-20090724
Import pkg_install-20070724:
- license handling: accept upper case letters. Keep license checks
 case-sensitive as done in the older pkgsrc logic. Document this.
 OK dillo@, schmonz@, wiz@
- pkg_info:
 - fix handling of non-packages, that are valid archives
 - invert order of pkg_info -r to better match the expectations of
   make update.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.6.1 -r1.1.1.1.6.2 \
src/external/bsd/pkg_install/dist/info/perform.c
cvs rdiff -u -r1.1.1.2.4.3 -r1.1.1.2.4.4 \
src/external/bsd/pkg_install/dist/lib/license.c
cvs rdiff -u -r1.1.1.4.6.2 -r1.1.1.4.6.3 \
src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in
cvs rdiff -u -r1.1.1.2.6.2 -r1.1.1.2.6.3 \
src/external/bsd/pkg_install/dist/lib/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/pkg_install/dist/info/perform.c
diff -u src/external/bsd/pkg_install/dist/info/perform.c:1.1.1.1.6.1 src/external/bsd/pkg_install/dist/info/perform.c:1.1.1.1.6.2
--- src/external/bsd/pkg_install/dist/info/perform.c:1.1.1.1.6.1	Sat May 30 16:40:32 2009
+++ src/external/bsd/pkg_install/dist/info/perform.c	Mon Jul 27 00:40:11 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: perform.c,v 1.1.1.1.6.1 2009/05/30 16:40:32 snj Exp $	*/
+/*	$NetBSD: perform.c,v 1.1.1.1.6.2 2009/07/27 00:40:11 snj Exp $	*/
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -13,7 +13,7 @@
 #if HAVE_SYS_WAIT_H
 #include 
 #endif
-__RCSID("$NetBSD: perform.c,v 1.1.1.1.6.1 2009/05/30 16:40:32 snj Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.1.6.2 2009/07/27 00:40:11 snj Exp $");
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger .
@@ -232,7 +232,7 @@
 	}
 
 	meta->is_installed = 0;
-	if (found_required != 0 && r != ARCHIVE_OK && r != ARCHIVE_EOF) {
+	if (found_required != 0 || (r != ARCHIVE_OK && r != ARCHIVE_EOF)) {
 		free_pkg_meta(meta);
 		meta = NULL;
 	}
@@ -326,7 +326,7 @@
 		build_full_reqby(reqby, meta_dep, limit + 1);
 		free_pkg_meta(meta_dep);
 
-		TAILQ_INSERT_TAIL(reqby, lpp, lp_link);
+		TAILQ_INSERT_HEAD(reqby, lpp, lp_link);
 	}
 }
 

Index: src/external/bsd/pkg_install/dist/lib/license.c
diff -u src/external/bsd/pkg_install/dist/lib/license.c:1.1.1.2.4.3 src/external/bsd/pkg_install/dist/lib/license.c:1.1.1.2.4.4
--- src/external/bsd/pkg_install/dist/lib/license.c:1.1.1.2.4.3	Sun Jun 21 11:41:03 2009
+++ src/external/bsd/pkg_install/dist/lib/license.c	Mon Jul 27 00:40:11 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: license.c,v 1.1.1.2.4.3 2009/06/21 11:41:03 bouyer Exp $	*/
+/*	$NetBSD: license.c,v 1.1.1.2.4.4 2009/07/27 00:40:11 snj Exp $	*/
 
 /*-
  * Copyright (c) 2009 Joerg Sonnenberger .
@@ -56,7 +56,9 @@
 "artistic artistic-2.0 "
 "cddl-1.0 "
 "cpl-1.0 "
-"open-font-license ";
+"open-font-license "
+"mpl-1.1 "
+"zpl";
 
 #ifdef DEBUG
 static size_t hash_collisions;
@@ -64,7 +66,8 @@
 
 static char **license_hash[HASH_SIZE];
 static const char license_spaces[] = " \t\n";
-static const char license_chars[] = "abcdefghijklmnopqrstuvwxyz0123456789_-.";
+static const char license_chars[] =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.";
 
 static size_t
 hash_license(const char *license, size_t len)

Index: src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in
diff -u src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in:1.1.1.4.6.2 src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in:1.1.1.4.6.3
--- src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in:1.1.1.4.6.2	Sat May 30 16:40:33 2009
+++ src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in	Mon Jul 27 00:40:11 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pkg_install.conf.5.in,v 1.1.1.4.6.2 2009/05/30 16:40:33 snj Exp $
+.\"	$NetBSD: pkg_install.conf.5.in,v 1.1.1.4.6.3 2009/07/27 00:40:11 snj Exp $
 .\"
 .\" Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -50,6 +50,7 @@
 .Bl -tag -width indent
 .It Dv ACCEPTABLE_LICENSES
 List of licenses packages are allowed to carry.
+License names are case-sensitive.
 .It Dv ACTIVE_FTP
 Force the use of active FTP.
 .It Dv CERTIFICATE_ANCHOR_PKGS
@@ -83,6 +84,9 @@
 .El
 .It Dv DEFAULT_ACCEPTABLE_LICENSES
 List of common Free and Open Source licenses packages are allowed to carry.
+The 

CVS commit: [netbsd-5] src/external/bsd/pkg_install/dist

2009-06-21 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Jun 21 11:41:03 UTC 2009

Modified Files:
src/external/bsd/pkg_install/dist/admin [netbsd-5]: pkg_admin.1
src/external/bsd/pkg_install/dist/lib [netbsd-5]: license.c version.h

Log Message:
Pullup the following revisions (requested by joerg in ticket 815):
external/bsd/pkg_install/dist/admin/pkg_admin.1:1.1.1.7
external/bsd/pkg_install/dist/lib/license.c:1.1.1.3
external/bsd/pkg_install/dist/lib/version.h:1.1.1.16
Merge pkg_install-20090610 from HEAD


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1.6.1 -r1.1.1.1.6.2 \
src/external/bsd/pkg_install/dist/admin/pkg_admin.1
cvs rdiff -u -r1.1.1.2.4.2 -r1.1.1.2.4.3 \
src/external/bsd/pkg_install/dist/lib/license.c
cvs rdiff -u -r1.1.1.2.6.1 -r1.1.1.2.6.2 \
src/external/bsd/pkg_install/dist/lib/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/pkg_install/dist/admin/pkg_admin.1
diff -u src/external/bsd/pkg_install/dist/admin/pkg_admin.1:1.1.1.1.6.1 src/external/bsd/pkg_install/dist/admin/pkg_admin.1:1.1.1.1.6.2
--- src/external/bsd/pkg_install/dist/admin/pkg_admin.1:1.1.1.1.6.1	Sat May 30 16:40:31 2009
+++ src/external/bsd/pkg_install/dist/admin/pkg_admin.1	Sun Jun 21 11:41:02 2009
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pkg_admin.1,v 1.1.1.1.6.1 2009/05/30 16:40:31 snj Exp $
+.\"	$NetBSD: pkg_admin.1,v 1.1.1.1.6.2 2009/06/21 11:41:02 bouyer Exp $
 .\"
 .\" Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -176,7 +176,7 @@
 Reports if
 .Ar file
 is a correctly signed package.
-.It Cm check-single-license Ar liccense
+.It Cm check-single-license Ar license
 Check if
 .Ar license
 is a valid license name and if it is in the set of acceptable licenses.

Index: src/external/bsd/pkg_install/dist/lib/license.c
diff -u src/external/bsd/pkg_install/dist/lib/license.c:1.1.1.2.4.2 src/external/bsd/pkg_install/dist/lib/license.c:1.1.1.2.4.3
--- src/external/bsd/pkg_install/dist/lib/license.c:1.1.1.2.4.2	Sat May 30 16:40:32 2009
+++ src/external/bsd/pkg_install/dist/lib/license.c	Sun Jun 21 11:41:03 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: license.c,v 1.1.1.2.4.2 2009/05/30 16:40:32 snj Exp $	*/
+/*	$NetBSD: license.c,v 1.1.1.2.4.3 2009/06/21 11:41:03 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 2009 Joerg Sonnenberger .
@@ -51,7 +51,7 @@
 "gnu-gpl-v2 gnu-lgpl-v2 gnu-lgpl-v2.1 "
 "gnu-gpl-v3 gnu-lgpl-v3 "
 "original-bsd modified-bsd "
-"x11 "
+"x11 mit miros "
 "apache-1.1 apache-2.0 "
 "artistic artistic-2.0 "
 "cddl-1.0 "
@@ -156,14 +156,16 @@
 	size_t len;
 
 	len = strlen(license);
-	if (strspn(license, license_chars) != len)
+	if (strspn(license, license_chars) != len) {
+		warnx("Invalid character in license name at position %zu", len);
 		return -1;
+	}
 
 	return acceptable_license_internal(license, len);
 }
 
 static int
-acceptable_pkg_license_internal(const char **licensep, int toplevel)
+acceptable_pkg_license_internal(const char **licensep, int toplevel, const char *start)
 {
 	const char *license = *licensep;
 	int need_parenthesis, is_true = 0;
@@ -182,7 +184,7 @@
 
 	for (;;) {
 		if (*license == '(') {
-			switch (acceptable_pkg_license_internal(&license, 0)) {
+			switch (acceptable_pkg_license_internal(&license, 0, start)) {
 			case -1:
 return -1;
 			case 0:
@@ -196,8 +198,10 @@
 			license += strspn(license, license_spaces);
 		} else {
 			len = strspn(license, license_chars);
-			if (len == 0)
+			if (len == 0) {
+warnx("Invalid character in license name at position %zu", license - start + 1);
 return -1;
+			}
 
 			if (acceptable_license_internal(license, len)) {
 if (expr_type != 2)
@@ -209,40 +213,53 @@
 			license += len;
 
 			len = strspn(license, license_spaces);
-			if (len == 0 && *license && *license  != ')')
+			if (len == 0 && *license && *license  != ')') {
+warnx("Missing space at position %zu", license - start + 1);
 return -1;
+			}
 			license += len;
 		}
 
 		if (*license == ')') {
-			if (!need_parenthesis)
+			if (!need_parenthesis) {
+warnx("Missing open parenthesis at position %zu", license - start + 1);
 return -1;
+			}
 			*licensep = license + 1;
 			return is_true;
 		}
 		if (*license == '\0') {
-			if (need_parenthesis)
+			if (need_parenthesis) {
+warnx("Unbalanced parenthesis at position %zu", license - start + 1);
 return -1;
+			}
 			*licensep = license;
 			return is_true;
 		}
 
 		if (strncmp(license, "AND", 3) == 0) {
-			if (expr_type == 1)
+			if (expr_type == 1) {
+warnx("Invalid operator in OR expression at position %zu", license - start + 1);
 return -1;
+			}
 			expr_type = 2;
 			license += 3;
 		} else if (strncmp(license, "OR", 2) == 0) {
-			if (expr_type == 2)
+			if (expr_type == 2) {
+warnx("Invalid operator in AND expression at position