Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/pkgviews]: src/usr.sbin/pkg_install Merge from the HEAD into the pkgview...
details: https://anonhg.NetBSD.org/src/rev/052382f987bd
branches: pkgviews
changeset: 534210:052382f987bd
user: jlam <jlam%NetBSD.org@localhost>
date: Sun Jul 13 09:45:19 2003 +0000
description:
Merge from the HEAD into the pkgviews branch for src/usr.sbin/pkg_install.
diffstat:
usr.sbin/pkg_install/Makefile.inc | 66 ++++------
usr.sbin/pkg_install/add/extract.c | 28 ++--
usr.sbin/pkg_install/add/futil.c | 12 +-
usr.sbin/pkg_install/add/main.c | 35 ++++-
usr.sbin/pkg_install/add/perform.c | 190 +++++++++++++++++++++++++-----
usr.sbin/pkg_install/add/pkg_add.1 | 120 +++++++++++-------
usr.sbin/pkg_install/admin/main.c | 112 ++++++++++--------
usr.sbin/pkg_install/admin/pkg_admin.1 | 33 +++--
usr.sbin/pkg_install/create/create.h | 3 +-
usr.sbin/pkg_install/create/main.c | 12 +-
usr.sbin/pkg_install/create/perform.c | 25 ++-
usr.sbin/pkg_install/create/pkg_create.1 | 175 ++++++++++++++++-----------
usr.sbin/pkg_install/create/pl.c | 20 ++-
usr.sbin/pkg_install/delete/main.c | 134 ++++++++++-----------
usr.sbin/pkg_install/delete/perform.c | 31 ++--
usr.sbin/pkg_install/delete/pkg_delete.1 | 66 ++++++---
usr.sbin/pkg_install/info/main.c | 36 +++-
usr.sbin/pkg_install/info/perform.c | 36 +++--
usr.sbin/pkg_install/info/pkg_info.1 | 70 +++++++----
usr.sbin/pkg_install/info/show.c | 7 +-
usr.sbin/pkg_install/lib/Makefile | 10 +-
usr.sbin/pkg_install/lib/file.c | 48 ++++---
usr.sbin/pkg_install/lib/ftpio.c | 86 ++++++++-----
usr.sbin/pkg_install/lib/lib.h | 40 ++++-
usr.sbin/pkg_install/lib/lpkg.c | 6 +-
usr.sbin/pkg_install/lib/path.c | 119 ++++++++++++++-----
usr.sbin/pkg_install/lib/path.h | 4 +-
usr.sbin/pkg_install/lib/pen.c | 16 +-
usr.sbin/pkg_install/lib/pkgdb.c | 130 +++++++++++---------
usr.sbin/pkg_install/lib/plist.c | 14 +-
usr.sbin/pkg_install/lib/str.c | 55 ++++----
usr.sbin/pkg_install/lib/version.h | 4 +-
32 files changed, 1062 insertions(+), 681 deletions(-)
diffs (truncated from 3983 to 300 lines):
diff -r 0185ba8cf0df -r 052382f987bd usr.sbin/pkg_install/Makefile.inc
--- a/usr.sbin/pkg_install/Makefile.inc Mon Jul 22 16:47:33 2002 +0000
+++ b/usr.sbin/pkg_install/Makefile.inc Sun Jul 13 09:45:19 2003 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.18 2002/06/21 14:49:40 agc Exp $
+# $NetBSD: Makefile.inc,v 1.18.2.1 2003/07/13 09:45:19 jlam Exp $
# Original from FreeBSD, no rcs id.
.include <bsd.own.mk>
@@ -6,55 +6,41 @@
LIBINSTALL != cd ${.CURDIR}/../lib && ${PRINTOBJDIR}
CPPFLAGS+=-I${.CURDIR}/../lib ${DEBUG} -DBINDIR='"${BINDIR}"'
-.if !defined(OPSYS)
-.if exists(/usr/bin/uname)
-OPSYS!= /usr/bin/uname -s
-.elif exists(/bin/uname)
-OPSYS!= /bin/uname -s
-.else
-OPSYS="unknown"
-.endif
-.endif
+# If building for Zoularis on Solaris, some other Makefile should do:
+#LOCALBASE?= /usr/pkg
+#ZOULARISBASE?= ${LOCALBASE}/bsd
+#BINDIR=${ZOULARISBASE}/bin
+#TAR_CMD?= ${BINDIR}/tar
+#FTP_CMD?= ${BINDIR}/ftp
+#CPPFLAGS+=-DTAR_CMD='"${TAR_CMD}"' -DFTP_CMD='"${FTP_CMD}"'
+#CHMOD_CMD?= /usr/bin/chmod
+#CHOWN_CMD?= /usr/bin/chown
+#CHGRP_CMD?= /usr/bin/chgrp
+#WARNS=0
-.if ${OPSYS} == "NetBSD"
-CHMOD?= /bin/chmod
-CHOWN?= /usr/sbin/chown
-CHGRP?= /usr/bin/chgrp
+# If building for Zoularis on Linux, some other Makefile should do:
+#CHMOD_CMD?= /bin/chmod
+#CHOWN_CMD?= /bin/chown
+#CHGRP_CMD?= /bin/chgrp
+
+# UNDER NO CIRCUMSTANCES SHOULD THIS MAKEFILE TEST THE OUTPUT OF uname!!
+# DOING SO BREAKS CROSS COMPILING.
+
+#CHMOD_CMD?= /bin/chmod
+#CHOWN_CMD?= /usr/sbin/chown
+#CHGRP_CMD?= /usr/bin/chgrp
WARNS=2
-.elif ${OPSYS} == "SunOS"
-LOCALBASE?= /usr/pkg
-TAR_CMD?= tar
-FTP_CMD?= tar
-ZOULARISBASE?= ${LOCALBASE}/bsd
-TAR_FULLPATHNAME?= ${ZOULARISBASE}/bin/${TAR_CMD}
-FTP_FULLPATHNAME?= ${ZOULARISBASE}/bin/${FTP_CMD}
-CPPFLAGS+=-DTAR_CMD='"${TAR_CMD}"' -DTAR_FULLPATHNAME='"${TAR_FULLPATHNAME}"'
-CPPFLAGS+=-DFTP_CMD='"${FTP_CMD}"' -DFTP_FULLPATHNAME='"${FTP_FULLPATHNAME}"'
-BINDIR=${ZOULARISBASE}/bin
-CHMOD?= /usr/bin/chmod
-CHOWN?= /usr/bin/chown
-CHGRP?= /usr/bin/chgrp
-WARNS=0
-.elif ${OPSYS} == "Linux"
-CHMOD?= /bin/chmod
-CHOWN?= /bin/chown
-CHGRP?= /bin/chgrp
-.endif
-CPPFLAGS+= -DCHMOD='"${CHMOD}"' -DCHOWN='"${CHOWN}"' -DCHGRP='"${CHGRP}"'
+#CPPFLAGS+= -DCHMOD_CMD='"${CHMOD_CMD}"' -DCHOWN_CMD='"${CHOWN_CMD}"'
+#CPPFLAGS+= -DCHGRP_CMD='"${CHGRP_CMD}"'
DPADD+= ${LIBINSTALL}/libinstall.a
-LDADD+= -L${LIBINSTALL} -linstall
+LDADD+= -L${LIBINSTALL} -linstall -ltermcap
.if exists(${.CURDIR}/../../Makefile.inc)
.include "${.CURDIR}/../../Makefile.inc"
.endif
-
-
-
-
-
#CFLAGS+= -g
#STRIPFLAG= # unset
#LDFLAGS+= -L/usr/pkg/lib -lefence
diff -r 0185ba8cf0df -r 052382f987bd usr.sbin/pkg_install/add/extract.c
--- a/usr.sbin/pkg_install/add/extract.c Mon Jul 22 16:47:33 2002 +0000
+++ b/usr.sbin/pkg_install/add/extract.c Sun Jul 13 09:45:19 2003 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: extract.c,v 1.23 2001/09/26 13:48:27 hubertf Exp $ */
+/* $NetBSD: extract.c,v 1.23.4.1 2003/07/13 09:45:20 jlam Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "FreeBSD - Id: extract.c,v 1.17 1997/10/08 07:45:35 charnier Exp";
#else
-__RCSID("$NetBSD: extract.c,v 1.23 2001/09/26 13:48:27 hubertf Exp $");
+__RCSID("$NetBSD: extract.c,v 1.23.4.1 2003/07/13 09:45:20 jlam Exp $");
#endif
#endif
@@ -34,7 +34,7 @@
#include "add.h"
#define TAR_ARGS " cf - "
-#define TARX_CMD "|" TAR_FULLPATHNAME " xf - -C "
+#define TARX_CMD "|" TAR_CMD " xpf - -C "
/*
* This macro is used to determine if the 'where_args' buffer is big enough to add the
@@ -50,16 +50,16 @@
|| (strlen(str) + 3 + perm_count >= maxargs))
#define PUSHOUT(todir) /* push out string */ \
- if (where_count > sizeof(TAR_FULLPATHNAME) + sizeof(TAR_ARGS)-1) { \
+ if (where_count > sizeof(TAR_CMD) + sizeof(TAR_ARGS)-1) { \
strcat(where_args, TARX_CMD); \
strcat(where_args, todir); \
if (system(where_args)) { \
cleanup(0); \
errx(2, "can not invoke %lu byte %s pipeline: %s", \
- (u_long)strlen(where_args), TAR_FULLPATHNAME, \
+ (u_long)strlen(where_args), TAR_CMD, \
where_args); \
} \
- strcpy(where_args, TAR_FULLPATHNAME TAR_ARGS); \
+ strcpy(where_args, TAR_CMD TAR_ARGS); \
where_count = strlen(where_args); \
} \
if (perm_count) { \
@@ -108,17 +108,17 @@
Boolean preserve;
maxargs = sysconf(_SC_ARG_MAX) / 2; /* Just use half the argument space */
- where_args = alloca(maxargs);
+ where_args = malloc(maxargs);
if (!where_args) {
cleanup(0);
errx(2, "can't get argument list space");
}
- perm_args = alloca(maxargs);
+ perm_args = malloc(maxargs);
if (!perm_args) {
cleanup(0);
errx(2, "can't get argument list space");
}
- strcpy(where_args, TAR_FULLPATHNAME TAR_ARGS);
+ strcpy(where_args, TAR_CMD TAR_ARGS);
/*
* we keep track of how many characters are stored in 'where_args' with 'where_count'.
* Note this doesn't include the trailing null character.
@@ -143,9 +143,9 @@
Directory = home;
/* Open Package Database for writing */
- if (pkgdb_open(0) == -1) {
+ if (!pkgdb_open(ReadWrite)) {
cleanup(0);
- err(1, "can't open pkgdb");
+ err(EXIT_FAILURE, "can't open pkgdb");
}
/* Do it */
while (p) {
@@ -294,10 +294,6 @@
break;
case PLIST_CMD:
- if (last_file == NULL && strchr(p->name, '%') != NULL) {
- cleanup(0);
- errx(2, "no last file specified for '%s' command", p->name);
- }
format_cmd(cmd, sizeof(cmd), p->name, Directory, last_file);
PUSHOUT(Directory);
if (Verbose)
@@ -335,5 +331,7 @@
}
PUSHOUT(Directory);
pkgdb_close();
+ free(perm_args);
+ free(where_args);
return 1;
}
diff -r 0185ba8cf0df -r 052382f987bd usr.sbin/pkg_install/add/futil.c
--- a/usr.sbin/pkg_install/add/futil.c Mon Jul 22 16:47:33 2002 +0000
+++ b/usr.sbin/pkg_install/add/futil.c Sun Jul 13 09:45:19 2003 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: futil.c,v 1.8 1999/08/24 00:48:38 hubertf Exp $ */
+/* $NetBSD: futil.c,v 1.8.12.1 2003/07/13 09:45:20 jlam Exp $ */
#include <sys/cdefs.h>
#ifndef lint
#if 0
static const char *rcsid = "from FreeBSD Id: futil.c,v 1.7 1997/10/08 07:45:39 charnier Exp";
#else
-__RCSID("$NetBSD: futil.c,v 1.8 1999/08/24 00:48:38 hubertf Exp $");
+__RCSID("$NetBSD: futil.c,v 1.8.12.1 2003/07/13 09:45:20 jlam Exp $");
#endif
#endif
@@ -80,19 +80,19 @@
cd_to = dir;
if (Mode)
- if (vsystem("cd %s && %s -R %s %s", cd_to, CHMOD, Mode, arg))
+ if (vsystem("cd %s && %s -R %s %s", cd_to, CHMOD_CMD, Mode, arg))
warnx("couldn't change modes of '%s' to '%s'", arg, Mode);
if (Owner && Group) {
- if (vsystem("cd %s && %s -R %s.%s %s", cd_to, CHOWN, Owner, Group, arg))
+ if (vsystem("cd %s && %s -R %s.%s %s", cd_to, CHOWN_CMD, Owner, Group, arg))
warnx("couldn't change owner/group of '%s' to '%s.%s'",
arg, Owner, Group);
return;
}
if (Owner) {
- if (vsystem("cd %s && %s -R %s %s", cd_to, CHOWN, Owner, arg))
+ if (vsystem("cd %s && %s -R %s %s", cd_to, CHOWN_CMD, Owner, arg))
warnx("couldn't change owner of '%s' to '%s'", arg, Owner);
return;
} else if (Group)
- if (vsystem("cd %s && %s -R %s %s", cd_to, CHGRP, Group, arg))
+ if (vsystem("cd %s && %s -R %s %s", cd_to, CHGRP_CMD, Group, arg))
warnx("couldn't change group of '%s' to '%s'", arg, Group);
}
diff -r 0185ba8cf0df -r 052382f987bd usr.sbin/pkg_install/add/main.c
--- a/usr.sbin/pkg_install/add/main.c Mon Jul 22 16:47:33 2002 +0000
+++ b/usr.sbin/pkg_install/add/main.c Sun Jul 13 09:45:19 2003 +0000
@@ -1,11 +1,11 @@
-/* $NetBSD: main.c,v 1.25 2002/07/19 19:04:33 yamt Exp $ */
+/* $NetBSD: main.c,v 1.25.2.1 2003/07/13 09:45:20 jlam 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.25 2002/07/19 19:04:33 yamt Exp $");
+__RCSID("$NetBSD: main.c,v 1.25.2.1 2003/07/13 09:45:20 jlam Exp $");
#endif
#endif
@@ -32,11 +32,12 @@
#include <err.h>
#include <sys/param.h>
+#include <sys/resource.h>
#include "lib.h"
#include "add.h"
#include "verify.h"
-static char Options[] = "hVvIRfnp:SMs:t:u";
+static char Options[] = "IMRSVfhnp:s:t:uv";
char *Prefix = NULL;
Boolean NoInstall = FALSE;
@@ -49,7 +50,7 @@
char *Directory = NULL;
char FirstPen[FILENAME_MAX];
add_mode_t AddMode = NORMAL;
-int upgrade = 0;
+Boolean Replace = FALSE;
static void
usage(void)
@@ -65,7 +66,10 @@
{
int ch, error=0;
lpkg_head_t pkgs;
+ struct rlimit rlim;
+ int rc;
+ setprogname(argv[0]);
while ((ch = getopt(argc, argv, Options)) != -1) {
switch (ch) {
case 'v':
@@ -114,7 +118,7 @@
/* NOTREACHED */
case 'u':
- upgrade = 1;
+ Replace = 1;
break;
case 'h':
case '?':
@@ -141,13 +145,28 @@
TAILQ_INSERT_TAIL(&pkgs, lpp, lp_link);
}
- }
- /* If no packages, yelp */
- else if (!ch)
+ } else if (!ch)
+ /* If no packages, yelp */
warnx("missing package name(s)"), usage();
else if (ch > 1 && AddMode == MASTER)
Home |
Main Index |
Thread Index |
Old Index