diff options
author | jlam <jlam@pkgsrc.org> | 2007-08-29 15:42:39 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2007-08-29 15:42:39 +0000 |
commit | ac7403794495f776cb1377a48d428e06b29bb067 (patch) | |
tree | 48e3bca62be8bfb480af26ad434e28b97044efc7 /pkgtools/pkg_install | |
parent | 7ff58b1c0370cc6e49627cf3dc07a0d5ec34c5ce (diff) | |
download | pkgsrc-ac7403794495f776cb1377a48d428e06b29bb067.tar.gz |
* When adding or checking a package using pkg_admin(1), give a more
meaningful warning if the file is a symlink whose target doesn't exist.
The message has now been changed from:
pkg_admin: netbsd32_compat30-extras: File `/usr/pkg/emul/netbsd32/usr/lib/libm387.so' is in +CONTENTS but not on filesystem!
to:
pkg_admin: Symlink `/usr/pkg/emul/netbsd32/usr/lib/libm387.so' exists and is in +CONTENTS but target does not exist!
* Pass values for --sysconfdir (and --prefix) to the configure script
instead of passing them through CPPFLAGS. Both SYSCONFDIR and PREFIX
are only used by audit-packages, and the audit-packages Makefile
already handles passing these values inherited from the configure
script. This avoids compiler warnings that, e.g. SYSCONFDIR has been
redefined on the command line.
* Fix quoting for arguments to the configure script -- :Q instead of
\"\".
Bump version to 20070828. Reviewed by <joerg>.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r-- | pkgtools/pkg_install/Makefile | 11 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/admin/main.c | 17 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/file.c | 21 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/lib.h | 3 | ||||
-rw-r--r-- | pkgtools/pkg_install/files/lib/version.h | 4 |
5 files changed, 40 insertions, 16 deletions
diff --git a/pkgtools/pkg_install/Makefile b/pkgtools/pkg_install/Makefile index da4dd56d986..1d269a57c57 100644 --- a/pkgtools/pkg_install/Makefile +++ b/pkgtools/pkg_install/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.140 2007/08/10 22:42:13 joerg Exp $ +# $NetBSD: Makefile,v 1.141 2007/08/29 15:42:39 jlam Exp $ # Notes to package maintainers: # @@ -20,10 +20,11 @@ PKG_DESTDIR_SUPPORT= user-destdir CONFLICTS+= audit-packages-[0-9]* GNU_CONFIGURE= yes +CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR:Q} CONFIGURE_ARGS+= --with-pkgdbdir=${PKG_DBDIR:Q} -CONFIGURE_ARGS+= --with-ftp="\"${FETCH_CMD}"\" -CONFIGURE_ARGS+= --with-pax="\"${PAX}"\" -CONFIGURE_ARGS+= --with-tar="\"${TAR}"\" +CONFIGURE_ARGS+= --with-ftp=${FETCH_CMD:Q} +CONFIGURE_ARGS+= --with-pax=${PAX:Q} +CONFIGURE_ARGS+= --with-tar=${TAR:Q} USE_TOOLS+= pax:run tar:run gzcat:run # The following tools are needed by pkg_view and linkfarm. @@ -52,8 +53,6 @@ CPPFLAGS+= -D_LARGEFILE_SOURCE -D_LARGE_FILES CPPFLAGS+= -D_FILE_OFFSET_BITS=64 CPPFLAGS+= -DDEF_UMASK=${DEF_UMASK} -CPPFLAGS+= -DPREFIX="\"${PREFIX}\"" -CPPFLAGS+= -DSYSCONFDIR="\"${PKG_SYSCONFDIR}\"" MAKE_ENV+= MACHINE_ARCH=${MACHINE_ARCH:Q} MAKE_ENV+= OPSYS=${OPSYS:Q} diff --git a/pkgtools/pkg_install/files/admin/main.c b/pkgtools/pkg_install/files/admin/main.c index ffc5cb897ae..3574d4e855a 100644 --- a/pkgtools/pkg_install/files/admin/main.c +++ b/pkgtools/pkg_install/files/admin/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.31 2007/08/15 02:08:40 joerg Exp $ */ +/* $NetBSD: main.c,v 1.32 2007/08/29 15:42:39 jlam Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -8,7 +8,7 @@ #include <sys/cdefs.h> #endif #ifndef lint -__RCSID("$NetBSD: main.c,v 1.31 2007/08/15 02:08:40 joerg Exp $"); +__RCSID("$NetBSD: main.c,v 1.32 2007/08/29 15:42:39 jlam Exp $"); #endif /* @@ -177,8 +177,10 @@ check1pkg(const char *pkgdir) } filecnt++; + } else if (isbrokenlink(file)) { + warnx("%s: Symlink `%s' exists and is in %s but target does not exist!", PkgName, file, CONTENTS_FNAME); } else { - warnx("%s: File %s is in %s but not on filesystem!", PkgName, file, CONTENTS_FNAME); + warnx("%s: File `%s' is in %s but not on filesystem!", PkgName, file, CONTENTS_FNAME); } break; case PLIST_CWD: @@ -261,8 +263,13 @@ add1pkg(const char *pkgdir) } (void) snprintf(file, sizeof(file), "%s/%s", dirp, p->name); if (!(isfile(file) || islinktodir(file))) { - warnx("%s: File `%s' is in %s but not on filesystem!", - PkgName, file, CONTENTS_FNAME); + if (isbrokenlink(file)) { + warnx("%s: Symlink `%s' exists and is in %s but target does not exist!", + PkgName, file, CONTENTS_FNAME); + } else { + warnx("%s: File `%s' is in %s but not on filesystem!", + PkgName, file, CONTENTS_FNAME); + } } else { pkgdb_store(file, PkgName); cnt++; diff --git a/pkgtools/pkg_install/files/lib/file.c b/pkgtools/pkg_install/files/lib/file.c index 099cb0c6895..b683c205e6a 100644 --- a/pkgtools/pkg_install/files/lib/file.c +++ b/pkgtools/pkg_install/files/lib/file.c @@ -1,4 +1,4 @@ -/* $NetBSD: file.c,v 1.22 2007/08/21 07:11:42 joerg Exp $ */ +/* $NetBSD: file.c,v 1.23 2007/08/29 15:42:39 jlam Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -17,7 +17,7 @@ #if 0 static const char *rcsid = "from FreeBSD Id: file.c,v 1.29 1997/10/08 07:47:54 charnier Exp"; #else -__RCSID("$NetBSD: file.c,v 1.22 2007/08/21 07:11:42 joerg Exp $"); +__RCSID("$NetBSD: file.c,v 1.23 2007/08/29 15:42:39 jlam Exp $"); #endif #endif @@ -114,6 +114,23 @@ islinktodir(const char *fname) } /* + * Check if something is a link that points to nonexistant target. + */ +Boolean +isbrokenlink(const char *fname) +{ + struct stat sb; + + if (lstat(fname, &sb) != FAIL && S_ISLNK(sb.st_mode)) { + if (stat(fname, &sb) != FAIL) + return FALSE; /* link target exists! */ + else + return TRUE; /* link target missing*/ + } else + return FALSE; /* non-link */ +} + +/* * Check to see if file is a dir, and is empty */ Boolean diff --git a/pkgtools/pkg_install/files/lib/lib.h b/pkgtools/pkg_install/files/lib/lib.h index c2f5c32319c..951a3976b7d 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.36 2007/08/15 02:08:40 joerg Exp $ */ +/* $NetBSD: lib.h,v 1.37 2007/08/29 15:42:39 jlam Exp $ */ /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ @@ -348,6 +348,7 @@ Boolean islinktodir(const char *); Boolean isemptydir(const char *); Boolean isemptyfile(const char *); Boolean isfile(const char *); +Boolean isbrokenlink(const char *); Boolean isempty(const char *); int URLlength(const char *); char *fileGetURL(const char *); diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 026b5cb1e9d..959cd68d779 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.79 2007/08/21 07:11:42 joerg Exp $ */ +/* $NetBSD: version.h,v 1.80 2007/08/29 15:42:39 jlam 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 "20070821" +#define PKGTOOLS_VERSION "20070828" #endif /* _INST_LIB_VERSION_H_ */ |