Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/pkg_install Sync with pkgsrc to get double -u featu...
details: https://anonhg.NetBSD.org/src/rev/c32a27a23c23
branches: trunk
changeset: 571913:c32a27a23c23
user: erh <erh%NetBSD.org@localhost>
date: Fri Dec 10 21:49:31 2004 +0000
description:
Sync with pkgsrc to get double -u feature. Bump version to 20041209.
Add note in README explaining that changes should be made here first,
then merged to pkgsrc.
diffstat:
usr.sbin/pkg_install/README | 5 ++-
usr.sbin/pkg_install/add/add.h | 3 +-
usr.sbin/pkg_install/add/main.c | 22 +++++++------
usr.sbin/pkg_install/add/perform.c | 63 ++++++++++++++++++++++++-------------
usr.sbin/pkg_install/add/pkg_add.1 | 12 +++++-
usr.sbin/pkg_install/lib/lib.h | 3 +-
usr.sbin/pkg_install/lib/str.c | 6 +-
usr.sbin/pkg_install/lib/version.h | 4 +-
8 files changed, 73 insertions(+), 45 deletions(-)
diffs (truncated from 328 to 300 lines):
diff -r f4e13ef78fa8 -r c32a27a23c23 usr.sbin/pkg_install/README
--- a/usr.sbin/pkg_install/README Fri Dec 10 20:05:05 2004 +0000
+++ b/usr.sbin/pkg_install/README Fri Dec 10 21:49:31 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: README,v 1.11 2004/04/11 06:13:46 rh Exp $
+# $NetBSD: README,v 1.12 2004/12/10 21:49:31 erh Exp $
# Original from FreeBSD, no rcs id.
This is the pkg_install suite of tools for doing maintainance of
@@ -16,3 +16,6 @@
When making snapshots, please modify PKGTOOLS_VERSION in lib/version.h
to that day's date.
+
+This is the canonical location for these sources. Any changes should
+be made here first, then merged over to pkgsrc.
diff -r f4e13ef78fa8 -r c32a27a23c23 usr.sbin/pkg_install/add/add.h
--- a/usr.sbin/pkg_install/add/add.h Fri Dec 10 20:05:05 2004 +0000
+++ b/usr.sbin/pkg_install/add/add.h Fri Dec 10 21:49:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: add.h,v 1.6 2003/09/02 07:34:49 jlam Exp $ */
+/* $NetBSD: add.h,v 1.7 2004/12/10 21:49:31 erh Exp $ */
/* from FreeBSD Id: add.h,v 1.8 1997/02/22 16:09:15 peter Exp */
@@ -36,6 +36,7 @@
extern Boolean NoInstall;
extern Boolean NoRecord;
extern Boolean Force;
+extern int Replace;
extern char *Mode;
extern char *Owner;
extern char *Group;
diff -r f4e13ef78fa8 -r c32a27a23c23 usr.sbin/pkg_install/add/main.c
--- a/usr.sbin/pkg_install/add/main.c Fri Dec 10 20:05:05 2004 +0000
+++ b/usr.sbin/pkg_install/add/main.c Fri Dec 10 21:49:31 2004 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: main.c,v 1.32 2003/12/20 02:19:21 grant Exp $ */
+/* $NetBSD: main.c,v 1.33 2004/12/10 21:49:31 erh Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.16 1997/10/08 07:45:43 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.32 2003/12/20 02:19:21 grant Exp $");
+__RCSID("$NetBSD: main.c,v 1.33 2004/12/10 21:49:31 erh Exp $");
#endif
#endif
@@ -53,7 +53,7 @@
char *Directory = NULL;
char FirstPen[FILENAME_MAX];
add_mode_t AddMode = NORMAL;
-Boolean Replace = FALSE;
+int Replace = 0;
static void
usage(void)
@@ -122,7 +122,7 @@
break;
case 'u':
- Replace = 1;
+ Replace++;
break;
case 'V':
@@ -166,12 +166,14 @@
TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
}
- } else if (!ch)
- /* If no packages, yelp */
- warnx("missing package name(s)"), usage();
- else if (ch > 1 && AddMode == MASTER)
- warnx("only one package name may be specified with master mode"),
- usage();
+
+ if (!ch)
+ /* If no packages, yelp */
+ warnx("missing package name(s)"), usage();
+ else if (ch > 1 && AddMode == MASTER)
+ warnx("only one package name may be specified with master mode"),
+ usage();
+ }
/* Increase # of max. open file descriptors as high as possible */
rc = getrlimit(RLIMIT_NOFILE, &rlim);
diff -r f4e13ef78fa8 -r c32a27a23c23 usr.sbin/pkg_install/add/perform.c
--- a/usr.sbin/pkg_install/add/perform.c Fri Dec 10 20:05:05 2004 +0000
+++ b/usr.sbin/pkg_install/add/perform.c Fri Dec 10 21:49:31 2004 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: perform.c,v 1.103 2004/11/02 00:38:23 erh Exp $ */
+/* $NetBSD: perform.c,v 1.104 2004/12/10 21:49:31 erh Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.44 1997/10/13 15:03:46 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.103 2004/11/02 00:38:23 erh Exp $");
+__RCSID("$NetBSD: perform.c,v 1.104 2004/12/10 21:49:31 erh Exp $");
#endif
#endif
@@ -129,7 +129,7 @@
/* install a pre-requisite package. Returns 1 if it installed it */
static int
-installprereq(const char *name, int *errc)
+installprereq(const char *name, int *errc, int doupdate)
{
int ret;
ret = 0;
@@ -140,6 +140,8 @@
if (fexec_skipempty(BINDIR "/pkg_add", "-K", _pkgdb_getPKGDB_DIR(),
"-s", get_verification(),
+ doupdate ? "-u" : "",
+ Fake ? "-n" : "",
NoView ? "-L" : "",
View ? "-w" : "", View ? View : "",
Viewbase ? "-W" : "", Viewbase ? Viewbase : "",
@@ -162,7 +164,7 @@
* Returns 0 if everything is ok, >0 else
*/
static int
-pkg_do(const char *pkg)
+pkg_do(const char *pkg, lpkg_head_t *pkgs)
{
char playpen[FILENAME_MAX];
char replace_from[FILENAME_MAX];
@@ -474,7 +476,8 @@
(void) snprintf(buf, sizeof(buf), "%.*s[0-9]*",
(int)(s - PkgName) + 1, PkgName);
if (findmatchingname(dbdir, buf, note_whats_installed, installed) > 0) {
- if (Replace) {
+ if (Replace && !Fake) {
+ /* XXX Should list the steps in Fake mode */
snprintf(replace_from, sizeof(replace_from), "%s/%s/" REQUIRED_BY_FNAME,
dbdir, installed);
snprintf(replace_via, sizeof(replace_via), "%s/.%s." REQUIRED_BY_FNAME,
@@ -542,7 +545,7 @@
* one at all.
*/
strlcpy(base_new, PkgName, sizeof(base_new));
- s2 = strpbrk(base_new, "<>[]?*{");
+ s2 = strpbrk(base_new, "<>[]?*{"); /* } */
if (s2)
*s2 = '\0';
else {
@@ -551,7 +554,7 @@
*s2 = '\0';
}
strlcpy(base_exist, depp->name, sizeof(base_exist));
- s2 = strpbrk(base_exist, "<>[]?*{");
+ s2 = strpbrk(base_exist, "<>[]?*{"); /* } */
if (s2)
*s2 = '\0';
else {
@@ -667,21 +670,35 @@
(void) snprintf(buf, sizeof(buf),
skip ? "%.*s[0-9]*" : "%.*s-[0-9]*",
(int)(s - p->name) + skip, p->name);
- if (findmatchingname(dbdir, buf, note_whats_installed, installed) > 0) {
- warnx("pkg `%s' required, but `%s' found installed.",
- p->name, installed);
+ if (findmatchingname(dbdir, buf, note_whats_installed, installed) > 0)
+ {
+ int done = 0;
+
+ if (Replace > 1)
+ {
+ int errc0 = 0;
+ char tmp[FILENAME_MAX];
- if (replacing) {
- printf("HF: replace note -- could 'pkg_delete %s', and let the normal\n"
- "dependency handling reinstall the replaced package, assuming one IS\n"
- "available. But then I'd expect proper binary pkgs being available for\n"
- "the replace case.\n", installed);
+ warnx("Attempting to update `%s' using binary package\n", p->name);
+ /* Yes, append .tgz after the version so the */
+ /* pattern can match a filename. */
+ snprintf(tmp, sizeof(tmp), "%s.tgz", p->name);
+ done = installprereq(tmp, &errc0, 1);
+ }
+ else if (Replace)
+ {
+ warnx("To perform necessary upgrades on required packages specify -u twice.\n");
}
- if (Force) {
- warnx("Proceeding anyway.");
- } else {
- err_prescan++;
+ if (!done)
+ {
+ warnx("pkg `%s' required, but `%s' found installed.",
+ p->name, installed);
+ if (Force) {
+ warnx("Proceeding anyway.");
+ } else {
+ err_prescan++;
+ }
}
}
}
@@ -723,10 +740,10 @@
if (exact != NULL) {
/* first try the exact name, from the @blddep */
- done = installprereq(exact, &errc0);
+ done = installprereq(exact, &errc0, 0);
}
if (!done) {
- done = installprereq(p->name, &errc0);
+ done = installprereq(p->name, &errc0, 0);
}
if (!done && !Force) {
errc += errc0;
@@ -1007,11 +1024,11 @@
signal(SIGHUP, cleanup);
if (AddMode == SLAVE)
- err_cnt = pkg_do(NULL);
+ err_cnt = pkg_do(NULL, NULL);
else {
while ((lpp = TAILQ_FIRST(pkgs)) != NULL) {
path_prepend_from_pkgname(lpp->lp_name);
- err_cnt += pkg_do(lpp->lp_name);
+ err_cnt += pkg_do(lpp->lp_name, pkgs);
path_prepend_clear();
TAILQ_REMOVE(pkgs, lpp, lp_link);
free_lpkg(lpp);
diff -r f4e13ef78fa8 -r c32a27a23c23 usr.sbin/pkg_install/add/pkg_add.1
--- a/usr.sbin/pkg_install/add/pkg_add.1 Fri Dec 10 20:05:05 2004 +0000
+++ b/usr.sbin/pkg_install/add/pkg_add.1 Fri Dec 10 21:49:31 2004 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_add.1,v 1.50 2004/04/11 13:31:17 wiz Exp $
+.\" $NetBSD: pkg_add.1,v 1.51 2004/12/10 21:49:31 erh Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -239,7 +239,9 @@
.Pa /usr .
.It Fl u
If the package that's being installed is already installed, either
-in the same or a different version, an update is performed.
+in the same or a different version, an update is performed. If this
+is specified twice, then any dependant packages that are too old will
+also be updated to fulfill the dependecy.
See below for a more detailed description of the process.
.It Fl V
Print version number and exit.
@@ -344,7 +346,11 @@
If any of these required packages are not currently installed,
an attempt is made to find and install it;
if the missing package cannot be found or installed,
-the installation is terminated.
+the installation is terminated. If the
+.Fl u
+option was specified twice, required packages that are installed,
+but with too old of a version, are also updated. The dependant
+packages are found according to the normal PKG_PATH rules.
.It
A search is made for any
.Cm @option
diff -r f4e13ef78fa8 -r c32a27a23c23 usr.sbin/pkg_install/lib/lib.h
--- a/usr.sbin/pkg_install/lib/lib.h Fri Dec 10 20:05:05 2004 +0000
+++ b/usr.sbin/pkg_install/lib/lib.h Fri Dec 10 21:49:31 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.71 2004/11/20 06:40:01 grant Exp $ */
+/* $NetBSD: lib.h,v 1.72 2004/12/10 21:49:31 erh Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -326,6 +326,5 @@
extern Boolean Verbose;
extern Boolean Fake;
extern Boolean Force;
-extern Boolean Replace;
#endif /* _INST_LIB_LIB_H_ */
diff -r f4e13ef78fa8 -r c32a27a23c23 usr.sbin/pkg_install/lib/str.c
--- a/usr.sbin/pkg_install/lib/str.c Fri Dec 10 20:05:05 2004 +0000
+++ b/usr.sbin/pkg_install/lib/str.c Fri Dec 10 21:49:31 2004 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: str.c,v 1.48 2004/11/10 16:51:16 wiz Exp $ */
+/* $NetBSD: str.c,v 1.49 2004/12/10 21:49:31 erh Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
#else
-__RCSID("$NetBSD: str.c,v 1.48 2004/11/10 16:51:16 wiz Exp $");
+__RCSID("$NetBSD: str.c,v 1.49 2004/12/10 21:49:31 erh Exp $");
#endif
Home |
Main Index |
Thread Index |
Old Index