pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/pkg_install * When adding or checking a packa...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f32f03446f6b
branches:  trunk
changeset: 532693:f32f03446f6b
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Wed Aug 29 15:42:39 2007 +0000

description:
* 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:

 pkgtools/pkg_install/Makefile            |  11 +++++------
 pkgtools/pkg_install/files/admin/main.c  |  17 ++++++++++++-----
 pkgtools/pkg_install/files/lib/file.c    |  21 +++++++++++++++++++--
 pkgtools/pkg_install/files/lib/lib.h     |   3 ++-
 pkgtools/pkg_install/files/lib/version.h |   4 ++--
 5 files changed, 40 insertions(+), 16 deletions(-)

diffs (155 lines):

diff -r 8cd673e89ea2 -r f32f03446f6b pkgtools/pkg_install/Makefile
--- a/pkgtools/pkg_install/Makefile     Wed Aug 29 15:42:15 2007 +0000
+++ b/pkgtools/pkg_install/Makefile     Wed Aug 29 15:42:39 2007 +0000
@@ -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 @@
 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_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 -r 8cd673e89ea2 -r f32f03446f6b pkgtools/pkg_install/files/admin/main.c
--- a/pkgtools/pkg_install/files/admin/main.c   Wed Aug 29 15:42:15 2007 +0000
+++ b/pkgtools/pkg_install/files/admin/main.c   Wed Aug 29 15:42:39 2007 +0000
@@ -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 @@
                                }
                                
                                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 @@
                        }
                        (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 -r 8cd673e89ea2 -r f32f03446f6b pkgtools/pkg_install/files/lib/file.c
--- a/pkgtools/pkg_install/files/lib/file.c     Wed Aug 29 15:42:15 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/file.c     Wed Aug 29 15:42:39 2007 +0000
@@ -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 @@
 }
 
 /*
+ * 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 -r 8cd673e89ea2 -r f32f03446f6b pkgtools/pkg_install/files/lib/lib.h
--- a/pkgtools/pkg_install/files/lib/lib.h      Wed Aug 29 15:42:15 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/lib.h      Wed Aug 29 15:42:39 2007 +0000
@@ -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 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 -r 8cd673e89ea2 -r f32f03446f6b pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h  Wed Aug 29 15:42:15 2007 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h  Wed Aug 29 15:42:39 2007 +0000
@@ -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_ */



Home | Main Index | Thread Index | Old Index