pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install/files/lib pkg_install-20090213:
details: https://anonhg.NetBSD.org/pkgsrc/rev/0e69c365e314
branches: trunk
changeset: 554345:0e69c365e314
user: joerg <joerg%pkgsrc.org@localhost>
date: Fri Feb 13 01:31:42 2009 +0000
description:
pkg_install-20090213:
Fix pkg_delete -d:
- ignore @dirrm commands, directories are removed already on demand
- use local copy of dir before changing it, the caller expects it
unmodified for the call to pkgdb_remove
diffstat:
pkgtools/pkg_install/files/lib/lib.h | 4 ++--
pkgtools/pkg_install/files/lib/plist.c | 30 +++++++++++++++++-------------
pkgtools/pkg_install/files/lib/version.h | 4 ++--
3 files changed, 21 insertions(+), 17 deletions(-)
diffs (110 lines):
diff -r 5c388bf93464 -r 0e69c365e314 pkgtools/pkg_install/files/lib/lib.h
--- a/pkgtools/pkg_install/files/lib/lib.h Fri Feb 13 01:29:59 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/lib.h Fri Feb 13 01:31:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lib.h,v 1.46 2009/02/02 12:35:01 joerg Exp $ */
+/* $NetBSD: lib.h,v 1.47 2009/02/13 01:31:42 joerg Exp $ */
/* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */
@@ -308,7 +308,7 @@
int URLlength(const char *);
Boolean make_preserve_name(char *, size_t, char *, char *);
void remove_files(const char *, const char *);
-int delete_hierarchy(char *, Boolean, Boolean);
+int delete_hierarchy(const char *, Boolean, Boolean);
int format_cmd(char *, size_t, const char *, const char *, const char *);
int recursive_remove(const char *, int);
diff -r 5c388bf93464 -r 0e69c365e314 pkgtools/pkg_install/files/lib/plist.c
--- a/pkgtools/pkg_install/files/lib/plist.c Fri Feb 13 01:29:59 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/plist.c Fri Feb 13 01:31:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plist.c,v 1.22 2009/02/02 12:35:01 joerg Exp $ */
+/* $NetBSD: plist.c,v 1.23 2009/02/13 01:31:42 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: plist.c,v 1.22 2009/02/02 12:35:01 joerg Exp $");
+__RCSID("$NetBSD: plist.c,v 1.23 2009/02/13 01:31:42 joerg Exp $");
/*
* FreeBSD install - a package for the installation and maintainance
@@ -638,7 +638,7 @@
break;
case PLIST_DIR_RM:
- if (NoDeleteFiles)
+ if (NoDeleteFiles || nukedirs)
break;
(void) snprintf(tmp, sizeof(tmp), "%s%s%s/%s",
@@ -675,11 +675,10 @@
* Returns 1 on error, 0 else.
*/
int
-delete_hierarchy(char *dir, Boolean ign_err, Boolean nukedirs)
+delete_hierarchy(const char *dir, Boolean ign_err, Boolean nukedirs)
{
- char *cp1, *cp2;
+ char *cp1, *cp2, *tmp_dir;
- cp1 = cp2 = dir;
if (!fexists(dir)) {
if (!ign_err)
warnx("%s `%s' doesn't really exist",
@@ -700,21 +699,26 @@
if (!nukedirs)
return 0;
+
+ cp1 = cp2 = tmp_dir = xstrdup(dir);;
+
while (cp2) {
if ((cp2 = strrchr(cp1, '/')) != NULL)
*cp2 = '\0';
- if (!isemptydir(dir))
- return 0;
- if (rmdir(dir) && !ign_err) {
- if (!fexists(dir))
- warnx("directory `%s' doesn't really exist", dir);
- else
+ if (!isemptydir(tmp_dir))
+ break;
+ if (rmdir(tmp_dir) && !ign_err) {
+ if (fexists(tmp_dir)) {
+ free(tmp_dir);
return 1;
+ }
+ warnx("directory `%s' doesn't really exist", tmp_dir);
}
/* back up the pathname one component */
if (cp2) {
- cp1 = dir;
+ cp1 = tmp_dir;
}
}
+ free(tmp_dir);
return 0;
}
diff -r 5c388bf93464 -r 0e69c365e314 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h Fri Feb 13 01:29:59 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h Fri Feb 13 01:31:42 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.110 2009/02/11 23:42:42 joerg Exp $ */
+/* $NetBSD: version.h,v 1.111 2009/02/13 01:31:42 joerg Exp $ */
/*
* Copyright (c) 2001 Thomas Klausner. All rights reserved.
@@ -27,6 +27,6 @@
#ifndef _INST_LIB_VERSION_H_
#define _INST_LIB_VERSION_H_
-#define PKGTOOLS_VERSION "20090212"
+#define PKGTOOLS_VERSION "20090213"
#endif /* _INST_LIB_VERSION_H_ */
Home |
Main Index |
Thread Index |
Old Index