summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorjlam <jlam>2003-09-02 01:37:04 +0000
committerjlam <jlam>2003-09-02 01:37:04 +0000
commite038f78af7fdb3c4b3292b5898fb3013c4643c84 (patch)
treef9a4f4e0af7b7bd0b123e02594c35c7ab743bea7 /pkgtools/pkg_install
parentdcd9ce6b4f998a4e5f95d9a4fe58b6f8475650f5 (diff)
downloadpkgsrc-e038f78af7fdb3c4b3292b5898fb3013c4643c84.tar.gz
Re-add the checks for HAVE_CHFLAGS and HAVE_DBOPEN so that this can build
on systems that don't have either function.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/add/extract.c8
-rw-r--r--pkgtools/pkg_install/files/lib/pkgdb.c19
2 files changed, 23 insertions, 4 deletions
diff --git a/pkgtools/pkg_install/files/add/extract.c b/pkgtools/pkg_install/files/add/extract.c
index 9ce0089c288..f8f4a7a8efe 100644
--- a/pkgtools/pkg_install/files/add/extract.c
+++ b/pkgtools/pkg_install/files/add/extract.c
@@ -1,4 +1,4 @@
-/* $NetBSD: extract.c,v 1.4 2003/09/01 16:27:11 jlam Exp $ */
+/* $NetBSD: extract.c,v 1.5 2003/09/02 01:37:04 jlam Exp $ */
#include <nbcompat.h>
#if HAVE_CONFIG_H
@@ -11,7 +11,7 @@
#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.4 2003/09/01 16:27:11 jlam Exp $");
+__RCSID("$NetBSD: extract.c,v 1.5 2003/09/02 01:37:04 jlam Exp $");
#endif
#endif
@@ -88,7 +88,9 @@ rollback(char *name, char *home, plist_t *start, plist_t *stop)
if (q->type == PLIST_FILE) {
(void) snprintf(try, sizeof(try), "%s/%s", dir, q->name);
if (make_preserve_name(bup, sizeof(bup), name, try) && fexists(bup)) {
+#if HAVE_CHFLAGS
(void) chflags(try, 0);
+#endif
(void) unlink(try);
if (rename(bup, try))
warnx("rollback: unable to rename %s back to %s", bup, try);
@@ -181,7 +183,9 @@ extract_plist(char *home, package_t *pkg)
/* first try to rename it into place */
(void) snprintf(try, sizeof(try), "%s/%s", Directory, p->name);
if (fexists(try)) {
+#if HAVE_CHFLAGS
(void) chflags(try, 0); /* XXX hack - if truly immutable, rename fails */
+#endif
if (preserve && PkgName) {
char pf[FILENAME_MAX];
diff --git a/pkgtools/pkg_install/files/lib/pkgdb.c b/pkgtools/pkg_install/files/lib/pkgdb.c
index 9ad24071880..07658a4b85b 100644
--- a/pkgtools/pkg_install/files/lib/pkgdb.c
+++ b/pkgtools/pkg_install/files/lib/pkgdb.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pkgdb.c,v 1.11 2003/09/01 16:27:15 jlam Exp $ */
+/* $NetBSD: pkgdb.c,v 1.12 2003/09/02 01:37:05 jlam Exp $ */
#include <nbcompat.h>
#if HAVE_CONFIG_H
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: pkgdb.c,v 1.11 2003/09/01 16:27:15 jlam Exp $");
+__RCSID("$NetBSD: pkgdb.c,v 1.12 2003/09/02 01:37:05 jlam Exp $");
#endif
/*
@@ -74,10 +74,13 @@ __RCSID("$NetBSD: pkgdb.c,v 1.11 2003/09/01 16:27:15 jlam Exp $");
/* just in case we change the environment variable name */
#define PKG_DBDIR "PKG_DBDIR"
+#if HAVE_DBOPEN
static DB *pkgdbp;
+#endif
static char *pkgdb_dir = NULL;
static char pkgdb_cache[FILENAME_MAX];
+#if HAVE_DBOPEN
/*
* Open the pkg-database
* Return value:
@@ -250,6 +253,18 @@ pkgdb_remove_pkg(const char *pkg)
return ret;
}
+#else /* if !HAVE_DBOPEN */
+
+int pkgdb_open(int mode) { return -1; }
+void pkgdb_close(void) {}
+int pkgdb_store(const char *key, const char *val) { return EXIT_SUCCESS; }
+char *pkgdb_retrieve(const char *key) { return NULL; }
+void pkgdb_dump(void) {}
+int pkgdb_remove(const char *key) { return EXIT_SUCCESS; }
+int pkgdb_remove_pkg(const char *pkg) { return EXIT_SUCCESS; }
+
+#endif /* HAVE_DBOPEN */
+
/*
* Return name of cache file in the buffer that was passed.
*/