From d32599e75599b20fdab9da40eed4ed4cb51e2616 Mon Sep 17 00:00:00 2001 From: joerg Date: Thu, 7 Feb 2008 23:42:16 +0000 Subject: [PATCH] Import pkg_install-20080208 --- dist/pkg_install/configure | 3 +-- dist/pkg_install/configure.ac | 2 +- dist/pkg_install/delete/perform.c | 31 ++++++++++++----------- dist/pkg_install/info/perform.c | 7 ++++-- dist/pkg_install/info/show.c | 7 ++++-- dist/pkg_install/lib/config.h.in | 3 --- dist/pkg_install/lib/pen.c | 41 ++----------------------------- dist/pkg_install/lib/version.h | 4 +-- 8 files changed, 33 insertions(+), 65 deletions(-) diff --git a/dist/pkg_install/configure b/dist/pkg_install/configure index 3ae0db43b66e..903c903899b7 100644 --- a/dist/pkg_install/configure +++ b/dist/pkg_install/configure @@ -4818,8 +4818,7 @@ done - -for ac_header in sys/cdefs.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h \ +for ac_header in sys/cdefs.h sys/file.h sys/ioctl.h sys/param.h \ sys/poll.h sys/queue.h sys/resource.h sys/signal.h sys/stat.h \ sys/statvfs.h sys/time.h sys/types.h sys/utsname.h sys/vfs.h \ sys/wait.h diff --git a/dist/pkg_install/configure.ac b/dist/pkg_install/configure.ac index 6dc7ec792e60..9dceb2014a00 100644 --- a/dist/pkg_install/configure.ac +++ b/dist/pkg_install/configure.ac @@ -78,7 +78,7 @@ AC_CHECK_HEADERS([assert.h ctype.h dirent.h err.h errno.h fnctl.h \ pwd.h regex.h signal.h stdarg.h stdio.h stdlib.h string.h \ termcap.h termios.h time.h unistd.h vis.h]) AC_CHECK_HEADERS([db1/db.h db_185.h db.h]) -AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/ioctl.h sys/mount.h sys/param.h \ +AC_CHECK_HEADERS([sys/cdefs.h sys/file.h sys/ioctl.h sys/param.h \ sys/poll.h sys/queue.h sys/resource.h sys/signal.h sys/stat.h \ sys/statvfs.h sys/time.h sys/types.h sys/utsname.h sys/vfs.h \ sys/wait.h]) diff --git a/dist/pkg_install/delete/perform.c b/dist/pkg_install/delete/perform.c index 24fdf8ce5a4b..6e6462abf927 100644 --- a/dist/pkg_install/delete/perform.c +++ b/dist/pkg_install/delete/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.1.1.5 2008/01/27 14:11:31 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.1.1.6 2008/02/07 23:42:16 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.1.1.5 2008/01/27 14:11:31 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.1.1.6 2008/02/07 23:42:16 joerg Exp $"); #endif #endif @@ -839,19 +839,22 @@ pkg_do(char *pkg) warnx("Oops - removed current working directory. Oh, well."); if (!Fake) { /* Finally nuke the +-files and the pkgdb-dir (/var/db/pkg/foo) */ - if (is_depoted_pkg) { - (void) remove_files(LogDir, "+*"); - if (isemptydir(LogDir)) - (void)rmdir(LogDir); - else - warnx("%s is not empty", LogDir); - return 0; - } else { - if (fexec(REMOVE_CMD, "-rf", LogDir, NULL)) { - warnx("couldn't remove log entry in %s, deinstall failed", LogDir); - if (!Force) - return 1; + (void) remove_files(LogDir, "+*"); + if (isemptydir(LogDir)) + (void)rmdir(LogDir); + else if (is_depoted_pkg) + warnx("%s is not empty", LogDir); + else if (Force) { + if (fexec(REMOVE_CMD, "-rf", LogDir, NULL) != 0) { + warnx("couldn't remove log entry in %s", LogDir); + return 1; + } else { + warnx("log entry forcefully removed in %s", LogDir); + return 0; } + } else { + warnx("couldn't remove log entry in %s", LogDir); + return 1; } } return 0; diff --git a/dist/pkg_install/info/perform.c b/dist/pkg_install/info/perform.c index e2f8d89b4a16..fc7259275df0 100644 --- a/dist/pkg_install/info/perform.c +++ b/dist/pkg_install/info/perform.c @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.1.1.4 2008/02/03 21:21:33 joerg Exp $ */ +/* $NetBSD: perform.c,v 1.1.1.5 2008/02/07 23:42:16 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -17,7 +17,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp"; #else -__RCSID("$NetBSD: perform.c,v 1.1.1.4 2008/02/03 21:21:33 joerg Exp $"); +__RCSID("$NetBSD: perform.c,v 1.1.1.5 2008/02/07 23:42:16 joerg Exp $"); #endif #endif @@ -90,6 +90,9 @@ __RCSID("$NetBSD: perform.c,v 1.1.1.4 2008/02/03 21:21:33 joerg Exp $"); #if HAVE_ERRNO_H #include #endif +#if HAVE_FCNTL_H +#include +#endif #if HAVE_SIGNAL_H #include #endif diff --git a/dist/pkg_install/info/show.c b/dist/pkg_install/info/show.c index 9e5a3de4ac42..eb577fc41f7b 100644 --- a/dist/pkg_install/info/show.c +++ b/dist/pkg_install/info/show.c @@ -1,4 +1,4 @@ -/* $NetBSD: show.c,v 1.1.1.5 2008/02/03 21:21:34 joerg Exp $ */ +/* $NetBSD: show.c,v 1.1.1.6 2008/02/07 23:42:17 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp"; #else -__RCSID("$NetBSD: show.c,v 1.1.1.5 2008/02/03 21:21:34 joerg Exp $"); +__RCSID("$NetBSD: show.c,v 1.1.1.6 2008/02/07 23:42:17 joerg Exp $"); #endif #endif @@ -138,6 +138,9 @@ show_var(const char *buf, const char *variable) { char *value; + if (buf == NULL) + return; + if ((value = var_get_memory(buf, variable)) != NULL) { (void) printf("%s\n", value); free(value); diff --git a/dist/pkg_install/lib/config.h.in b/dist/pkg_install/lib/config.h.in index e6d54d1af524..f662a6f19944 100644 --- a/dist/pkg_install/lib/config.h.in +++ b/dist/pkg_install/lib/config.h.in @@ -102,9 +102,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MOUNT_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H diff --git a/dist/pkg_install/lib/pen.c b/dist/pkg_install/lib/pen.c index 85072513f0e5..440ff4e42387 100644 --- a/dist/pkg_install/lib/pen.c +++ b/dist/pkg_install/lib/pen.c @@ -1,4 +1,4 @@ -/* $NetBSD: pen.c,v 1.1.1.2 2007/11/03 14:14:13 joerg Exp $ */ +/* $NetBSD: pen.c,v 1.1.1.3 2008/02/07 23:42:17 joerg Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp"; #else -__RCSID("$NetBSD: pen.c,v 1.1.1.2 2007/11/03 14:14:13 joerg Exp $"); +__RCSID("$NetBSD: pen.c,v 1.1.1.3 2008/02/07 23:42:17 joerg Exp $"); #endif #endif @@ -42,12 +42,6 @@ __RCSID("$NetBSD: pen.c,v 1.1.1.2 2007/11/03 14:14:13 joerg Exp $"); #if HAVE_SYS_SIGNAL_H #include #endif -#if HAVE_SYS_PARAM_H -#include -#endif -#if HAVE_SYS_MOUNT_H -#include -#endif /* For keeping track of where we are */ static char Current[MaxPathSize]; @@ -57,37 +51,6 @@ static int CurrentSet; /* rm -fr Current only if it's really set! */ * to prevent rm'ing of a partial string * when interrupted by ^C */ -#if 0 -/* - * Backup Current and Previous into temp. strings that are later - * restored & freed by restore_dirs - * This is to make nested calls to make_playpen/leave_playpen work - */ -void -save_dirs(char **c, char **p) -{ - *c = strdup(Current); /* XXX */ - *p = strdup(Previous); -} - -/* - * Restore Current and Previous from temp strings that were created - * by safe_dirs. - * This is to make nested calls to make_playpen/leave_playpen work - */ -void -restore_dirs(char *c, char *p) -{ - CurrentSet = 0; /* prevent from deleting */ - strlcpy(Current, c, sizeof(Current)); - CurrentSet = 1; /* rm -fr Current is safe now */ - free(c); - - strlcpy(Previous, p, sizeof(Previous)); - free(p); -} -#endif - char * where_playpen(void) { diff --git a/dist/pkg_install/lib/version.h b/dist/pkg_install/lib/version.h index bff216fe7d53..ac2ba2cef3da 100644 --- a/dist/pkg_install/lib/version.h +++ b/dist/pkg_install/lib/version.h @@ -1,4 +1,4 @@ -/* $NetBSD: version.h,v 1.1.1.9 2008/02/03 21:21:37 joerg Exp $ */ +/* $NetBSD: version.h,v 1.1.1.10 2008/02/07 23:42:17 joerg Exp $ */ /* * Copyright (c) 2001 Thomas Klausner. All rights reserved. @@ -33,6 +33,6 @@ #ifndef _INST_LIB_VERSION_H_ #define _INST_LIB_VERSION_H_ -#define PKGTOOLS_VERSION "20080202" +#define PKGTOOLS_VERSION "20080208" #endif /* _INST_LIB_VERSION_H_ */