summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorerh <erh@pkgsrc.org>2004-11-02 00:10:15 +0000
committererh <erh@pkgsrc.org>2004-11-02 00:10:15 +0000
commitf9fcee4b60a66f400a001744730ac3866ee48d95 (patch)
treee384ac20bebc2850622fc4005a67c5ccae82ad8c /pkgtools
parent26f3159c846fb5987331259a76d8530970f1e6e1 (diff)
downloadpkgsrc-f9fcee4b60a66f400a001744730ac3866ee48d95.tar.gz
Add a -N option to pkg_delete to delete registration information for a package
but not its files. Override PKG_DELETE when building this package so -N can be used to upgrade an existing install. Bump version to 20041101.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/pkg_install/Makefile5
-rw-r--r--pkgtools/pkg_install/files/add/perform.c6
-rw-r--r--pkgtools/pkg_install/files/delete/delete.h3
-rw-r--r--pkgtools/pkg_install/files/delete/main.c12
-rw-r--r--pkgtools/pkg_install/files/delete/perform.c10
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.16
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.cat18
-rw-r--r--pkgtools/pkg_install/files/lib/lib.h4
-rw-r--r--pkgtools/pkg_install/files/lib/plist.c21
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
10 files changed, 53 insertions, 26 deletions
diff --git a/pkgtools/pkg_install/Makefile b/pkgtools/pkg_install/Makefile
index 9b31300308b..a45c20d564a 100644
--- a/pkgtools/pkg_install/Makefile
+++ b/pkgtools/pkg_install/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.104 2004/10/05 21:08:32 erh Exp $
+# $NetBSD: Makefile,v 1.105 2004/11/02 00:10:15 erh Exp $
# Notes to package maintainers:
#
@@ -36,9 +36,12 @@ PKG_PRESERVE= # defined
# compiler to avoid problems with depending on pkgsrc GCC for building
# pkg_install. We also avoid building digest as that would involve
# using the newer pkg_install tools.
+# We also use the newly built pkg_delete since upgrading from
+# an older pkg_install might required features of the new program.
#
USE_NATIVE_GCC= yes
USE_DIGEST= no
+PKG_DELETE= ${WRKSRC}/delete/pkg_delete
PLIST_SUBST+= MANDIR=${MANDIR}
PLIST_SUBST+= PKG_TOOLS_BIN=${PKG_TOOLS_BIN}
diff --git a/pkgtools/pkg_install/files/add/perform.c b/pkgtools/pkg_install/files/add/perform.c
index f48e5d2c4e1..8fb095aee29 100644
--- a/pkgtools/pkg_install/files/add/perform.c
+++ b/pkgtools/pkg_install/files/add/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.24 2004/08/06 16:57:03 jlam Exp $ */
+/* $NetBSD: perform.c,v 1.25 2004/11/02 00:10:15 erh 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.44 1997/10/13 15:03:46 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.24 2004/08/06 16:57:03 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.25 2004/11/02 00:10:15 erh Exp $");
#endif
#endif
@@ -966,7 +966,7 @@ bomb:
fail:
/* Nuke the whole (installed) show, XXX but don't clean directories */
if (!Fake)
- delete_package(FALSE, FALSE, &Plist);
+ delete_package(FALSE, FALSE, &Plist, FALSE);
success:
/* delete the packing list contents */
diff --git a/pkgtools/pkg_install/files/delete/delete.h b/pkgtools/pkg_install/files/delete/delete.h
index 1d27f6782f2..03092c20ea8 100644
--- a/pkgtools/pkg_install/files/delete/delete.h
+++ b/pkgtools/pkg_install/files/delete/delete.h
@@ -1,4 +1,4 @@
-/* $NetBSD: delete.h,v 1.3 2003/09/23 07:13:50 grant Exp $ */
+/* $NetBSD: delete.h,v 1.4 2004/11/02 00:10:15 erh Exp $ */
/* from FreeBSD Id: delete.h,v 1.4 1997/02/22 16:09:35 peter Exp */
@@ -27,6 +27,7 @@
extern char *Prefix;
extern char *ProgramPath;
+extern Boolean NoDeleteFiles;
extern Boolean NoDeInstall;
extern Boolean CleanDirs;
extern Boolean Force;
diff --git a/pkgtools/pkg_install/files/delete/main.c b/pkgtools/pkg_install/files/delete/main.c
index c0cfeb2054d..92689cdaf7c 100644
--- a/pkgtools/pkg_install/files/delete/main.c
+++ b/pkgtools/pkg_install/files/delete/main.c
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.13 2004/03/29 20:28:05 tv Exp $ */
+/* $NetBSD: main.c,v 1.14 2004/11/02 00:10:15 erh Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static char *rcsid = "from FreeBSD Id: main.c,v 1.11 1997/10/08 07:46:48 charnier Exp";
#else
-__RCSID("$NetBSD: main.c,v 1.13 2004/03/29 20:28:05 tv Exp $");
+__RCSID("$NetBSD: main.c,v 1.14 2004/11/02 00:10:15 erh Exp $");
#endif
#endif
@@ -42,10 +42,11 @@ __RCSID("$NetBSD: main.c,v 1.13 2004/03/29 20:28:05 tv Exp $");
#include "lib.h"
#include "delete.h"
-static char Options[] = "DFK:ORVdfhnp:rv";
+static char Options[] = "DFK:NORVdfhnp:rv";
char *Prefix = NULL;
char *ProgramPath = NULL;
+Boolean NoDeleteFiles = FALSE;
Boolean NoDeInstall = FALSE;
Boolean CleanDirs = FALSE;
Boolean File2Pkg = FALSE;
@@ -99,6 +100,11 @@ main(int argc, char **argv)
Verbose = TRUE;
break;
+ case 'N':
+ NoDeleteFiles = TRUE;
+ NoDeInstall = TRUE;
+ break;
+
case 'O':
OnlyDeleteFromPkgDB = TRUE;
break;
diff --git a/pkgtools/pkg_install/files/delete/perform.c b/pkgtools/pkg_install/files/delete/perform.c
index 4efa9381b75..3d7be264bc8 100644
--- a/pkgtools/pkg_install/files/delete/perform.c
+++ b/pkgtools/pkg_install/files/delete/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.11 2004/02/07 10:37:52 grant Exp $ */
+/* $NetBSD: perform.c,v 1.12 2004/11/02 00:10:15 erh 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.11 2004/02/07 10:37:52 grant Exp $");
+__RCSID("$NetBSD: perform.c,v 1.12 2004/11/02 00:10:15 erh Exp $");
#endif
#endif
@@ -327,6 +327,7 @@ require_delete(char *home, int tryall)
Verbose ? "-v" : "",
(Force > 1) ? "-f -f" : (Force == 1) ? "-f" : "",
NoDeInstall ? "-D" : "",
+ NoDeleteFiles ? "-N" : "",
CleanDirs ? "-d" : "",
Fake ? "-n" : "",
rm_installed ? installed : lpp->lp_name, NULL);
@@ -671,9 +672,10 @@ pkg_do(char *pkg)
}
if (fexists(PRESERVE_FNAME)) {
printf("Package `%s' is marked as not for deletion\n", pkg);
- if (Force <= 1) {
+ if (Force <= (NoDeleteFiles ? 0 : 1)) {
return 1;
}
+ printf("Deleting anyway\n");
}
if (!isemptyfile(REQUIRED_BY_FNAME)) {
/* This package is required by others. Either nuke
@@ -778,7 +780,7 @@ pkg_do(char *pkg)
}
if (!Fake) {
/* Some packages aren't packed right, so we need to just ignore delete_package()'s status. Ugh! :-( */
- if (delete_package(FALSE, CleanDirs, &Plist) == FAIL)
+ if (delete_package(FALSE, CleanDirs, &Plist, NoDeleteFiles) == FAIL)
warnx(
"couldn't entirely delete package `%s'\n"
"(perhaps the packing list is incorrectly specified?)", pkg);
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.1 b/pkgtools/pkg_install/files/delete/pkg_delete.1
index 04fbd7d3ee8..2919439c5c2 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.1
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_delete.1,v 1.6 2004/02/07 10:37:52 grant Exp $
+.\" $NetBSD: pkg_delete.1,v 1.7 2004/11/02 00:10:15 erh Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -114,6 +114,10 @@ if it's set, otherwise it defaults to
.It Fl n
Don't actually deinstall a package, just report the steps that
would be taken if it were.
+.It Fl N
+Remove the package's registration and its entries from the package database,
+but leave the files installed. Don't run any deinstall scripts or @unexec lines
+either.
.It Fl O
Only delete the package's entries from the package database, do not
touch the package or its files itself.
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.cat1 b/pkgtools/pkg_install/files/delete/pkg_delete.cat1
index 4e80f5f039e..f74c39aa136 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.cat1
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.cat1
@@ -1,8 +1,8 @@
PKG_DELETE(1) NetBSD General Commands Manual PKG_DELETE(1)
NNAAMMEE
- ppkkgg__ddeelleettee - a utility for deleting previously installed software package
- distributions
+ ppkkgg__ddeelleettee -- a utility for deleting previously installed software pack-
+ age distributions
SSYYNNOOPPSSIISS
ppkkgg__ddeelleettee [--DDddFFffnnOORRrrVVvv] [--KK _p_k_g___d_b_d_i_r] [--pp _p_r_e_f_i_x] _p_k_g_-_n_a_m_e _._._.
@@ -63,6 +63,10 @@ OOPPTTIIOONNSS
--nn Don't actually deinstall a package, just report the steps that
would be taken if it were.
+ --NN Remove the package's registration and its entries from the pack-
+ age database, but leave the files installed. Don't run any dein-
+ stall scripts or @unexec lines either.
+
--OO Only delete the package's entries from the package database, do
not touch the package or its files itself.
diff --git a/pkgtools/pkg_install/files/lib/lib.h b/pkgtools/pkg_install/files/lib/lib.h
index 24e21cf157c..37f29d853a9 100644
--- a/pkgtools/pkg_install/files/lib/lib.h
+++ b/pkgtools/pkg_install/files/lib/lib.h
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.11 2004/04/11 06:56:11 rh Exp $ */
+/* $NetBSD: lib.h,v 1.12 2004/11/02 00:10:15 erh Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -326,7 +326,7 @@ void delete_plist(package_t *, Boolean, pl_ent_t, char *);
void write_plist(package_t *, FILE *, char *);
void read_plist(package_t *, FILE *);
int plist_cmd(char *, char **);
-int delete_package(Boolean, Boolean, package_t *);
+int delete_package(Boolean, Boolean, package_t *, Boolean);
/* Package Database */
int pkgdb_open(int);
diff --git a/pkgtools/pkg_install/files/lib/plist.c b/pkgtools/pkg_install/files/lib/plist.c
index 3f5a534c542..31a7ad5ffbc 100644
--- a/pkgtools/pkg_install/files/lib/plist.c
+++ b/pkgtools/pkg_install/files/lib/plist.c
@@ -1,4 +1,4 @@
-/* $NetBSD: plist.c,v 1.10 2004/08/06 16:57:03 jlam Exp $ */
+/* $NetBSD: plist.c,v 1.11 2004/11/02 00:10:15 erh Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: plist.c,v 1.24 1997/10/08 07:48:15 charnier Exp";
#else
-__RCSID("$NetBSD: plist.c,v 1.10 2004/08/06 16:57:03 jlam Exp $");
+__RCSID("$NetBSD: plist.c,v 1.11 2004/11/02 00:10:15 erh Exp $");
#endif
#endif
@@ -335,7 +335,7 @@ write_plist(package_t *pkg, FILE * fp, char *realprefix)
* run it too in cases of failure.
*/
int
-delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
+delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg, Boolean NoDeleteFiles)
{
plist_t *p;
char *Where = ".", *last_file = "";
@@ -365,6 +365,8 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
break;
case PLIST_UNEXEC:
+ if (NoDeleteFiles)
+ break;
format_cmd(tmp, sizeof(tmp), p->name, Where, last_file);
if (Verbose)
printf("Execute `%s'\n", tmp);
@@ -381,6 +383,8 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
warnx("attempting to delete directory `%s' as a file\n"
"this packing list is incorrect - ignoring delete request", tmp);
} else {
+ int restored = 0; /* restored from preserve? */
+
if (p->next && p->next->type == PLIST_COMMENT) {
if (strncmp(p->next->name, CHECKSUM_HEADER, ChecksumHeaderLen) == 0) {
char *cp, buf[LegibleChecksumLen];
@@ -430,11 +434,9 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
}
}
}
- if (Verbose)
+ if (Verbose && !NoDeleteFiles)
printf("Delete file %s\n", tmp);
- if (!Fake) {
- int restored = 0; /* restored from preserve? */
-
+ if (!Fake && !NoDeleteFiles) {
if (delete_hierarchy(tmp, ign_err, nukedirs))
fail = FAIL;
if (preserve && name) {
@@ -450,7 +452,9 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
}
}
}
+ }
+ if (!Fake) {
if (!restored) {
#ifdef PKGDB_DEBUG
printf("pkgdb_remove(\"%s\")\n", tmp); /* HF */
@@ -471,6 +475,9 @@ delete_package(Boolean ign_err, Boolean nukedirs, package_t *pkg)
break;
case PLIST_DIR_RM:
+ if (NoDeleteFiles)
+ break;
+
(void) snprintf(tmp, sizeof(tmp), "%s/%s", Where, p->name);
if (fexists(tmp)) {
if (!isdir(tmp)) {
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index cfd61b3d1eb..0f47404ea1a 100644
--- a/pkgtools/pkg_install/files/lib/version.h
+++ b/pkgtools/pkg_install/files/lib/version.h
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.34 2004/10/31 02:48:12 grant Exp $ */
+/* $NetBSD: version.h,v 1.35 2004/11/02 00:10:15 erh 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 "20041031"
+#define PKGTOOLS_VERSION "20041101"
#endif /* _INST_LIB_VERSION_H_ */