Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/pkg_install/dist Import pkg_install 20110215.



details:   https://anonhg.NetBSD.org/src/rev/1e3359ef1536
branches:  trunk
changeset: 762293:1e3359ef1536
user:      aymeric <aymeric%NetBSD.org@localhost>
date:      Fri Feb 18 22:32:27 2011 +0000

description:
Import pkg_install 20110215.

--- 20110215:
Fix audit-history subcommand to include patterns making use of [x-y] notation.

--- 20101212:
Don't warn about _ALPHA, _BETA, _PATCH, _RC, _STABLE mismatches when
pkg_add'ing on NetBSD.

--- 20101122:
Fix crash in pkg_info -X on hand-written packages.

--- 20100915:
Allow https URLs.

--- 20100914:
Add -D flag to pkg_install, to override the "pkg_add -U" check that
all depending packages have their dependencies satisfied by the new
package.  Essentially, split off this particular behavior as a special
case of -f, so that -f works as before, unforced works as before, and
one can give -D to override exactly this check, leaving all other
checks intact.

The -D flag is in support of make replace, as the workflow for make
replace is that inter-package dependencies are sometimes violated (but
then one must replace the depending packages, which is what
pkg_rolling-replace does via the unsafe_depends flags).

Add missing break statement in option parsing of "pkg_add -C", riding
the version bump.

diffstat:

 external/bsd/pkg_install/dist/add/add.h                 |   3 +-
 external/bsd/pkg_install/dist/add/main.c                |  18 +++++-
 external/bsd/pkg_install/dist/add/perform.c             |  47 +++++++++++++++-
 external/bsd/pkg_install/dist/add/pkg_add.1             |   7 ++-
 external/bsd/pkg_install/dist/admin/audit.c             |  15 +++-
 external/bsd/pkg_install/dist/info/show.c               |  10 ++-
 external/bsd/pkg_install/dist/lib/file.c                |  13 ++-
 external/bsd/pkg_install/dist/lib/license.c             |   6 +-
 external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in |   9 +-
 9 files changed, 100 insertions(+), 28 deletions(-)

diffs (truncated from 356 to 300 lines):

diff -r fd872e1d66bf -r 1e3359ef1536 external/bsd/pkg_install/dist/add/add.h
--- a/external/bsd/pkg_install/dist/add/add.h   Fri Feb 18 22:27:51 2011 +0000
+++ b/external/bsd/pkg_install/dist/add/add.h   Fri Feb 18 22:32:27 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: add.h,v 1.1.1.6 2010/01/30 21:33:08 joerg Exp $ */
+/* $NetBSD: add.h,v 1.1.1.7 2011/02/18 22:32:27 aymeric Exp $ */
 
 /* from FreeBSD Id: add.h,v 1.8 1997/02/22 16:09:15 peter Exp  */
 
@@ -40,6 +40,7 @@
 extern int ReplaceSame;
 
 extern Boolean ForceDepends;
+extern Boolean ForceDepending;
 
 int     make_hierarchy(char *);
 void    apply_perms(char *, char **, int);
diff -r fd872e1d66bf -r 1e3359ef1536 external/bsd/pkg_install/dist/add/main.c
--- a/external/bsd/pkg_install/dist/add/main.c  Fri Feb 18 22:27:51 2011 +0000
+++ b/external/bsd/pkg_install/dist/add/main.c  Fri Feb 18 22:32:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.1.1.9 2010/06/26 00:14:26 joerg Exp $       */
+/*     $NetBSD: main.c,v 1.1.1.10 2011/02/18 22:32:27 aymeric Exp $    */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: main.c,v 1.1.1.9 2010/06/26 00:14:26 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.1.1.10 2011/02/18 22:32:27 aymeric Exp $");
 
 /*
  *
@@ -39,7 +39,7 @@
 #include "lib.h"
 #include "add.h"
 
-static char Options[] = "AC:IK:LP:RVW:fhm:np:t:Uuvw:";
+static char Options[] = "AC:DIK:LP:RVW:fhm:np:t:Uuvw:";
 
 char   *Destdir = NULL;
 char   *OverrideMachine = NULL;
@@ -51,6 +51,12 @@
 Boolean NoRecord = FALSE;
 Boolean Automatic = FALSE;
 Boolean ForceDepends = FALSE;
+/*
+ * Normally, updating fails if the dependencies of a depending package
+ * are not satisfied by the package to be updated.  ForceDepending
+ * turns that failure into a warning.
+ */
+Boolean ForceDepending = FALSE;
 
 int    LicenseCheck = 0;
 int     Replace = 0;
@@ -82,7 +88,12 @@
 
                case 'C':
                        config_file = optarg;
+                       break;
 
+               case 'D':
+                       ForceDepending = TRUE;
+                       break;
+                       
                case 'P':
                        Destdir = optarg;
                        break;
@@ -90,6 +101,7 @@
                case 'f':
                        Force = TRUE;
                        ForceDepends = TRUE;
+                       ForceDepending = TRUE;
                        break;
 
                case 'I':
diff -r fd872e1d66bf -r 1e3359ef1536 external/bsd/pkg_install/dist/add/perform.c
--- a/external/bsd/pkg_install/dist/add/perform.c       Fri Feb 18 22:27:51 2011 +0000
+++ b/external/bsd/pkg_install/dist/add/perform.c       Fri Feb 18 22:32:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: perform.c,v 1.1.1.17 2010/06/26 00:14:26 joerg Exp $   */
+/*     $NetBSD: perform.c,v 1.1.1.18 2011/02/18 22:32:28 aymeric 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.1.1.17 2010/06/26 00:14:26 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.18 2011/02/18 22:32:28 aymeric Exp $");
 
 /*-
  * Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
  * Copyright (c) 2005 Dieter Baron <dillo%NetBSD.org@localhost>
  * Copyright (c) 2007 Roland Illig <rillig%NetBSD.org@localhost>
  * Copyright (c) 2008, 2009 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
+ * Copyright (c) 2010 Thomas Klausner <wiz%NetBSD.org@localhost>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -128,6 +129,43 @@
 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;
@@ -458,7 +496,7 @@
                                continue; /* Both match, ok. */
                        warnx("Dependency of %s fulfilled by %s, but not by %s",
                            iter, pkg->other_version, pkg->pkgname);
-                       if (!Force)
+                       if (!ForceDepending)
                                status = -1;
                        break;
                }
@@ -869,7 +907,8 @@
                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 -r fd872e1d66bf -r 1e3359ef1536 external/bsd/pkg_install/dist/add/pkg_add.1
--- a/external/bsd/pkg_install/dist/add/pkg_add.1       Fri Feb 18 22:27:51 2011 +0000
+++ b/external/bsd/pkg_install/dist/add/pkg_add.1       Fri Feb 18 22:32:27 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.1.1.11 2010/06/26 00:14:27 joerg Exp $
+.\" $NetBSD: pkg_add.1,v 1.1.1.12 2011/02/18 22:32:28 aymeric Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -130,6 +130,11 @@
 a failure to find one will not be fatal.
 This flag also overrides the fatal error when the operating system or
 architecture the package was built on differ from that of the host.
+.It Fl D
+Force updating even if the dependencies of depending packages are not
+satisfied by the new package.
+This is used by "make replace", after which one would typically
+replace the depending packages.
 .It Fl I
 If an installation script exists for a given package, do not execute it.
 .It Fl K Ar pkg_dbdir
diff -r fd872e1d66bf -r 1e3359ef1536 external/bsd/pkg_install/dist/admin/audit.c
--- a/external/bsd/pkg_install/dist/admin/audit.c       Fri Feb 18 22:27:51 2011 +0000
+++ b/external/bsd/pkg_install/dist/admin/audit.c       Fri Feb 18 22:32:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audit.c,v 1.1.1.8 2010/06/26 00:14:27 joerg Exp $      */
+/*     $NetBSD: audit.c,v 1.1.1.9 2011/02/18 22:32:28 aymeric Exp $    */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: audit.c,v 1.1.1.8 2010/06/26 00:14:27 joerg Exp $");
+__RCSID("$NetBSD: audit.c,v 1.1.1.9 2011/02/18 22:32:28 aymeric Exp $");
 
 /*-
  * Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -384,8 +384,15 @@
 {
        const char *delim, *end_base;
 
-       if ((delim = strchr(pattern, '*')) != NULL) {
-               if ((end_base = strrchr(pattern, '-')) == NULL)
+       if (strpbrk(pattern, "*[") != NULL) {
+               end_base = NULL;
+               for (delim = pattern;
+                               *delim != '\0' && *delim != '['; delim++) {
+                       if (*delim == '-')
+                               end_base = delim;
+               }
+
+               if (end_base == NULL)
                        errx(EXIT_FAILURE, "Missing - in wildcard pattern %s",
                            pattern);
                if ((delim = strchr(pattern, '>')) != NULL ||
diff -r fd872e1d66bf -r 1e3359ef1536 external/bsd/pkg_install/dist/info/show.c
--- a/external/bsd/pkg_install/dist/info/show.c Fri Feb 18 22:27:51 2011 +0000
+++ b/external/bsd/pkg_install/dist/info/show.c Fri Feb 18 22:32:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: show.c,v 1.1.1.7 2009/08/06 16:55:25 joerg Exp $       */
+/*     $NetBSD: show.c,v 1.1.1.8 2011/02/18 22:32:30 aymeric Exp $     */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -7,7 +7,7 @@
 #if HAVE_SYS_CDEFS_H
 #include <sys/cdefs.h>
 #endif
-__RCSID("$NetBSD: show.c,v 1.1.1.7 2009/08/06 16:55:25 joerg Exp $");
+__RCSID("$NetBSD: show.c,v 1.1.1.8 2011/02/18 22:32:30 aymeric Exp $");
 
 /*
  * FreeBSD install - a package for the installation and maintainance
@@ -194,7 +194,8 @@
                        case PLIST_PKGCFL:
                        case PLIST_BLDDEP:
                        case PLIST_PKGDIR:
-                               printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose, p->name);
+                               printf(Quiet ? showv[p->type].sh_quiet : showv[p->type].sh_verbose,
+                                       (p->name) ? p->name : "(null)");
                                break;
                        default:
                                warnx("unknown command type %d (%s)", p->type, p->name);
@@ -360,7 +361,8 @@
        }
 
        print_string_as_var("COMMENT", meta->meta_comment);
-       print_string_as_var("SIZE_PKG", meta->meta_size_pkg);
+       if (meta->meta_size_pkg)
+               print_string_as_var("SIZE_PKG", meta->meta_size_pkg);
 
        if (meta->meta_build_info)
                var_copy_list(meta->meta_build_info, bi_vars);
diff -r fd872e1d66bf -r 1e3359ef1536 external/bsd/pkg_install/dist/lib/file.c
--- a/external/bsd/pkg_install/dist/lib/file.c  Fri Feb 18 22:27:51 2011 +0000
+++ b/external/bsd/pkg_install/dist/lib/file.c  Fri Feb 18 22:32:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.c,v 1.1.1.5 2009/10/07 13:19:43 joerg Exp $       */
+/*     $NetBSD: file.c,v 1.1.1.6 2011/02/18 22:32:30 aymeric Exp $     */
 
 #if HAVE_CONFIG_H
 #include "config.h"
@@ -13,7 +13,7 @@
 #if HAVE_SYS_QUEUE_H
 #include <sys/queue.h>
 #endif
-__RCSID("$NetBSD: file.c,v 1.1.1.5 2009/10/07 13:19:43 joerg Exp $");
+__RCSID("$NetBSD: file.c,v 1.1.1.6 2011/02/18 22:32:30 aymeric Exp $");
 
 /*
  * FreeBSD install - a package for the installation and maintainance
@@ -181,9 +181,12 @@
 
 /* A table of valid leading strings for URLs */
 static const url_t urls[] = {
-       {"file://", 7},
-       {"ftp://";, 6},
-       {"http://";, 7},
+#define        STR_AND_SIZE(str)       { str, sizeof(str) - 1 }
+       STR_AND_SIZE("file://"),
+       STR_AND_SIZE("ftp://";),
+       STR_AND_SIZE("http://";),
+       STR_AND_SIZE("https://";),
+#undef STR_AND_SIZE
        {NULL, 0}
 };
 
diff -r fd872e1d66bf -r 1e3359ef1536 external/bsd/pkg_install/dist/lib/license.c
--- a/external/bsd/pkg_install/dist/lib/license.c       Fri Feb 18 22:27:51 2011 +0000
+++ b/external/bsd/pkg_install/dist/lib/license.c       Fri Feb 18 22:32:27 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: license.c,v 1.1.1.9 2010/06/26 00:14:31 joerg Exp $    */



Home | Main Index | Thread Index | Old Index