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-20090817:
details: https://anonhg.NetBSD.org/src/rev/59ea74d8a19f
branches: trunk
changeset: 746854:59ea74d8a19f
user: joerg <joerg%NetBSD.org@localhost>
date: Fri Aug 21 15:18:57 2009 +0000
description:
Import pkg_install-20090817:
Add a new command for pkg_admin: findbest. It takes one or more patterns
and searches for the best match in PKG_PATH, just like pkg_add would.
It prints the URLs of the best match for each pattern to stdout.
Rewrite the config file parser to read the file only once.
Fix a bug in pkg_add's -P handling. For dependencies the pkgdb path was
computed incorrectly and included destdir more than once.
Fix the ACTIVE_FTP option to actually set the "a" flag and not the old
"p" flag.
diffstat:
external/bsd/pkg_install/dist/add/add.h | 3 +-
external/bsd/pkg_install/dist/add/main.c | 21 ++++-
external/bsd/pkg_install/dist/add/perform.c | 12 +-
external/bsd/pkg_install/dist/add/pkg_add.1 | 4 +-
external/bsd/pkg_install/dist/admin/main.c | 31 ++++++-
external/bsd/pkg_install/dist/admin/pkg_admin.1 | 12 ++-
external/bsd/pkg_install/dist/delete/pkg_delete.1 | 10 +-
external/bsd/pkg_install/dist/lib/lib.h | 3 +-
external/bsd/pkg_install/dist/lib/parse-config.c | 66 +++++++++++++--
external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in | 4 +-
external/bsd/pkg_install/dist/lib/pkg_io.c | 69 +++++++++-------
external/bsd/pkg_install/dist/lib/version.h | 4 +-
12 files changed, 170 insertions(+), 69 deletions(-)
diffs (truncated from 542 to 300 lines):
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/add/add.h
--- a/external/bsd/pkg_install/dist/add/add.h Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/add/add.h Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: add.h,v 1.1.1.3 2009/08/06 16:55:16 joerg Exp $ */
+/* $NetBSD: add.h,v 1.1.1.4 2009/08/21 15:18:57 joerg Exp $ */
/* from FreeBSD Id: add.h,v 1.8 1997/02/22 16:09:15 peter Exp */
@@ -25,6 +25,7 @@
#ifndef _INST_ADD_H_INCLUDE
#define _INST_ADD_H_INCLUDE
+extern const char *PlainPkgdb;
extern char *Destdir;
extern char *OverrideMachine;
extern char *Prefix;
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/add/main.c
--- a/external/bsd/pkg_install/dist/add/main.c Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/add/main.c Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.1.1.4 2009/08/06 16:55:16 joerg Exp $ */
+/* $NetBSD: main.c,v 1.1.1.5 2009/08/21 15:18:58 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: main.c,v 1.1.1.4 2009/08/06 16:55:16 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.1.1.5 2009/08/21 15:18:58 joerg Exp $");
/*
*
@@ -44,6 +44,7 @@
static char Options[] = "AIK:LP:RVW:fhm:np:t:uvw:";
+const char *PlainPkgdb = NULL;
char *Destdir = NULL;
char *OverrideMachine = NULL;
char *Prefix = NULL;
@@ -73,6 +74,7 @@
{
int ch, error=0;
lpkg_head_t pkgs;
+ const char *pkgdb = NULL;
setprogname(argv[0]);
while ((ch = getopt(argc, argv, Options)) != -1) {
@@ -97,7 +99,7 @@
break;
case 'K':
- _pkgdb_setPKGDB_DIR(optarg);
+ pkgdb = optarg;
break;
case 'L':
@@ -153,6 +155,19 @@
pkg_install_config();
+ if (pkgdb == NULL)
+ pkgdb = _pkgdb_getPKGDB_DIR();
+ PlainPkgdb = xstrdup(pkgdb);
+
+ if (Destdir != NULL) {
+ char *pkgdbdir;
+
+ pkgdbdir = xasprintf("%s/%s", Destdir, pkgdb);
+ _pkgdb_setPKGDB_DIR(pkgdbdir);
+ free(pkgdbdir);
+ } else
+ _pkgdb_setPKGDB_DIR(pkgdb);
+
process_pkg_path();
TAILQ_INIT(&pkgs);
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/add/perform.c
--- a/external/bsd/pkg_install/dist/add/perform.c Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/add/perform.c Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.1.1.10 2009/08/06 16:55:18 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.1.1.11 2009/08/21 15:19:00 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.1.1.10 2009/08/06 16:55:18 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.1.1.11 2009/08/21 15:19:00 joerg Exp $");
/*-
* Copyright (c) 2003 Grant Beattie <grant%NetBSD.org@localhost>
@@ -1322,14 +1322,12 @@
pkg->logdir = xstrdup(pkg->prefix);
_pkgdb_setPKGDB_DIR(dirname_of(pkg->logdir));
} else {
- pkg->logdir = xasprintf("%s/%s", _pkgdb_getPKGDB_DIR(),
- pkg->pkgname);
+ pkg->logdir = xasprintf("%s/%s", PlainPkgdb, pkg->pkgname);
}
- if (Destdir != NULL) {
+ if (Destdir != NULL)
pkg->install_logdir = xasprintf("%s/%s", Destdir, pkg->logdir);
- _pkgdb_setPKGDB_DIR(dirname_of(pkg->install_logdir));
- } else
+ else
pkg->install_logdir = xstrdup(pkg->logdir);
if (NoRecord && !Fake) {
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/add/pkg_add.1
--- a/external/bsd/pkg_install/dist/add/pkg_add.1 Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/add/pkg_add.1 Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.1.1.7 2009/08/06 16:55:18 joerg Exp $
+.\" $NetBSD: pkg_add.1,v 1.1.1.8 2009/08/21 15:19:02 joerg Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" @(#)pkg_add.1
.\"
-.Dd April 10, 2009
+.Dd August 6, 2009
.Dt PKG_ADD 1
.Os
.Sh NAME
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/admin/main.c
--- a/external/bsd/pkg_install/dist/admin/main.c Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/admin/main.c Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.1.1.8 2009/08/06 16:55:19 joerg Exp $ */
+/* $NetBSD: main.c,v 1.1.1.9 2009/08/21 15:19:05 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,10 +7,10 @@
#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
-__RCSID("$NetBSD: main.c,v 1.1.1.8 2009/08/06 16:55:19 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.1.1.9 2009/08/21 15:19:05 joerg Exp $");
/*-
- * Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@@ -74,6 +74,7 @@
#ifndef BOOTSTRAP
#include <archive.h>
+#include <fetch.h>
#endif
#include "admin.h"
@@ -500,7 +501,6 @@
argv++;
}
-
} else if (strcasecmp(argv[0], "list") == 0 ||
strcasecmp(argv[0], "dump") == 0) {
@@ -559,7 +559,28 @@
}
}
#ifndef BOOTSTRAP
- else if (strcasecmp(argv[0], "fetch-pkg-vulnerabilities") == 0) {
+ else if (strcasecmp(argv[0], "findbest") == 0) {
+ struct url *url;
+ char *output;
+ int rc;
+
+ process_pkg_path();
+
+ rc = 0;
+ for (++argv; *argv != NULL; ++argv) {
+ url = find_best_package(NULL, *argv, 1);
+ if (url == NULL) {
+ rc = 1;
+ continue;
+ }
+ output = fetchStringifyURL(url);
+ puts(output);
+ fetchFreeURL(url);
+ free(output);
+ }
+
+ return rc;
+ } else if (strcasecmp(argv[0], "fetch-pkg-vulnerabilities") == 0) {
fetch_pkg_vulnerabilities(--argc, ++argv);
} else if (strcasecmp(argv[0], "check-pkg-vulnerabilities") == 0) {
check_pkg_vulnerabilities(--argc, ++argv);
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/admin/pkg_admin.1
--- a/external/bsd/pkg_install/dist/admin/pkg_admin.1 Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/admin/pkg_admin.1 Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_admin.1,v 1.1.1.7 2009/06/14 23:30:57 joerg Exp $
+.\" $NetBSD: pkg_admin.1,v 1.1.1.8 2009/08/21 15:19:05 joerg Exp $
.\"
.\" Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -34,7 +34,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd April 25, 2009
+.Dd August 16, 2009
.Dt PKG_ADMIN 1
.Os
.Sh NAME
@@ -205,6 +205,14 @@
.Fl u
is given, the fetch is conditional and the file transfer is only done if
the remote version is newer than the one in pkgdb.
+.It Cm findbest Ar pattern ...
+Search the entries of
+.Ev PKG_PATH
+for packages matching
+.Ar pattern .
+Print the URL of the best matching package to stdout for each pattern.
+If a pattern is not matched, it is skipped and the command will return
+a failure.
.It Cm lsall Ar /dir/pkgpattern
.It Cm lsbest Ar /dir/pkgpattern
List all/best package matching pattern in the given directory
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/delete/pkg_delete.1
--- a/external/bsd/pkg_install/dist/delete/pkg_delete.1 Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/delete/pkg_delete.1 Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_delete.1,v 1.1.1.5 2009/08/06 16:55:25 joerg Exp $
+.\" $NetBSD: pkg_delete.1,v 1.1.1.6 2009/08/21 15:19:09 joerg Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" from FreeBSD: @(#)pkg_delete.1
.\"
-.Dd April 24, 2009
+.Dd August 16, 2009
.Dt PKG_DELETE 1
.Os
.Sh NAME
@@ -127,6 +127,9 @@
.Cm preserved
package.
Note that this is a dangerous operation.
+See also the
+.Fl k
+option.
.It Fl K Ar pkg_dbdir
Set
.Ar pkg_dbdir
@@ -136,6 +139,9 @@
.Ev PKG_DBDIR
if it's set, otherwise it defaults to
.Pa /var/db/pkg .
+.It Fl k
+Silently skip all packages that are marked as
+.Cm preserved .
.It Fl N
Remove the package's registration and its entries from the package database,
but leave the files installed.
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/lib/lib.h
--- a/external/bsd/pkg_install/dist/lib/lib.h Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/lib/lib.h Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.1.1.8 2009/08/06 16:55:27 joerg Exp $ */
+/* $NetBSD: lib.h,v 1.1.1.9 2009/08/21 15:19:14 joerg Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -324,6 +324,7 @@
struct archive *open_archive(const char *);
struct archive *find_archive(const char *, int);
void process_pkg_path(void);
+struct url *find_best_package(const char *, const char *, int);
/* Packing list */
plist_t *new_plist_entry(void);
diff -r cc306a3ffd62 -r 59ea74d8a19f external/bsd/pkg_install/dist/lib/parse-config.c
--- a/external/bsd/pkg_install/dist/lib/parse-config.c Fri Aug 21 15:16:45 2009 +0000
+++ b/external/bsd/pkg_install/dist/lib/parse-config.c Fri Aug 21 15:18:57 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse-config.c,v 1.1.1.5 2009/08/06 16:55:27 joerg Exp $ */
+/* $NetBSD: parse-config.c,v 1.1.1.6 2009/08/21 15:19:14 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -7,10 +7,10 @@
Home |
Main Index |
Thread Index |
Old Index