Source-Changes-HG archive

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

[src/pkgviews]: src/usr.sbin/pkg_install Teach pkg_info(1) a new option '-N' ...



details:   https://anonhg.NetBSD.org/src/rev/3c091a1cf26f
branches:  pkgviews
changeset: 534250:3c091a1cf26f
user:      jlam <jlam%NetBSD.org@localhost>
date:      Fri Aug 08 10:19:01 2003 +0000

description:
Teach pkg_info(1) a new option '-N' that lists the exact dependencies for
a particular package (the @blddep lines of the +CONTENTS metadata file).
Bump the version to 20030808.

This could potentially be used by the pkgviews build infrastructure to
build new packages against older versions of dependencies.

diffstat:

 usr.sbin/pkg_install/info/info.h     |   4 ++-
 usr.sbin/pkg_install/info/main.c     |  14 +++++++----
 usr.sbin/pkg_install/info/perform.c  |   7 ++++-
 usr.sbin/pkg_install/info/pkg_info.1 |   6 +++-
 usr.sbin/pkg_install/info/show.c     |  42 ++++++++++++++++++++++++++++++++++-
 usr.sbin/pkg_install/lib/version.h   |   4 +-
 6 files changed, 63 insertions(+), 14 deletions(-)

diffs (210 lines):

diff -r 92c56221de02 -r 3c091a1cf26f usr.sbin/pkg_install/info/info.h
--- a/usr.sbin/pkg_install/info/info.h  Thu Jul 31 19:17:36 2003 +0000
+++ b/usr.sbin/pkg_install/info/info.h  Fri Aug 08 10:19:01 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: info.h,v 1.13 2002/06/09 13:23:45 yamt Exp $ */
+/* $NetBSD: info.h,v 1.13.2.1 2003/08/08 10:19:01 jlam Exp $ */
 
 /* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */
 
@@ -50,6 +50,7 @@
 #define SHOW_DEPENDS           0x04000
 #define SHOW_PKG_SIZE          0x08000
 #define SHOW_ALL_SIZE          0x10000
+#define SHOW_BLD_DEPENDS       0x20000
 
 extern int Flags;
 extern Boolean AllInstalled;
@@ -66,6 +67,7 @@
 extern void show_plist(char *, package_t *, pl_ent_t);
 extern void show_files(char *, package_t *);
 extern void show_depends(char *, package_t *);
+extern void show_bld_depends(char *, package_t *);
 extern void show_index(char *, char *);
 
 #endif                         /* _INST_INFO_H_INCLUDE */
diff -r 92c56221de02 -r 3c091a1cf26f usr.sbin/pkg_install/info/main.c
--- a/usr.sbin/pkg_install/info/main.c  Thu Jul 31 19:17:36 2003 +0000
+++ b/usr.sbin/pkg_install/info/main.c  Fri Aug 08 10:19:01 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: main.c,v 1.30.2.1 2003/07/13 09:45:25 jlam Exp $       */
+/*     $NetBSD: main.c,v 1.30.2.2 2003/08/08 10:19:01 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char *rcsid = "from FreeBSD Id: main.c,v 1.14 1997/10/08 07:47:26 charnier Exp";
 #else
-__RCSID("$NetBSD: main.c,v 1.30.2.1 2003/07/13 09:45:25 jlam Exp $");
+__RCSID("$NetBSD: main.c,v 1.30.2.2 2003/08/08 10:19:01 jlam Exp $");
 #endif
 #endif
 
@@ -38,7 +38,7 @@
 #include "lib.h"
 #include "info.h"
 
-static const char Options[] = "aBbcDde:fFhIikLl:mnpqRrsSvV";
+static const char Options[] = "aBbcDde:fFhIikLl:mNnpqRrsSvV";
 
 int     Flags = 0;
 Boolean AllInstalled = FALSE;
@@ -55,7 +55,7 @@
 usage(void)
 {
        fprintf(stderr, "%s\n%s\n%s\n",
-           "usage: pkg_info [-BbcDdFfIikLmnpqRrSsVvh] [-e package] [-l prefix]",
+           "usage: pkg_info [-BbcDdFfIikLmNnpqRrSsVvh] [-e package] [-l prefix]",
            "                pkg-name [pkg-name ...]",
            "       pkg_info -a [flags]");
        exit(1);
@@ -131,6 +131,10 @@
                        Flags |= SHOW_MTREE;
                        break;
 
+               case 'N':
+                       Flags |= SHOW_BLD_DEPENDS;
+                       break;
+
                case 'n':
                        Flags |= SHOW_DEPENDS;
                        break;
@@ -164,7 +168,7 @@
                        /* Reasonable definition of 'everything' */
                        Flags = SHOW_COMMENT | SHOW_DESC | SHOW_PLIST | SHOW_INSTALL |
                            SHOW_DEINSTALL | SHOW_REQUIRE | SHOW_DISPLAY | SHOW_MTREE |
-                           SHOW_REQBY | SHOW_DEPENDS | SHOW_PKG_SIZE | SHOW_ALL_SIZE;
+                           SHOW_REQBY | SHOW_BLD_DEPENDS | SHOW_DEPENDS | SHOW_PKG_SIZE | SHOW_ALL_SIZE;
                        break;
 
                case 'V':
diff -r 92c56221de02 -r 3c091a1cf26f usr.sbin/pkg_install/info/perform.c
--- a/usr.sbin/pkg_install/info/perform.c       Thu Jul 31 19:17:36 2003 +0000
+++ b/usr.sbin/pkg_install/info/perform.c       Fri Aug 08 10:19:01 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: perform.c,v 1.40.2.2 2003/07/23 20:48:01 jlam Exp $    */
+/*     $NetBSD: perform.c,v 1.40.2.3 2003/08/08 10:19:01 jlam Exp $    */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: perform.c,v 1.23 1997/10/13 15:03:53 jkh Exp";
 #else
-__RCSID("$NetBSD: perform.c,v 1.40.2.2 2003/07/23 20:48:01 jlam Exp $");
+__RCSID("$NetBSD: perform.c,v 1.40.2.3 2003/08/08 10:19:01 jlam Exp $");
 #endif
 #endif
 
@@ -185,6 +185,9 @@
                if (Flags & SHOW_DEPENDS) {
                        show_depends("Requires:\n", &plist);
                }
+               if (Flags & SHOW_BLD_DEPENDS) {
+                       show_bld_depends("Built using:\n", &plist);
+               }
                if ((Flags & SHOW_REQBY) && !isemptyfile(REQUIRED_BY_FNAME)) {
                        show_file("Required by:\n", REQUIRED_BY_FNAME);
                }
diff -r 92c56221de02 -r 3c091a1cf26f usr.sbin/pkg_install/info/pkg_info.1
--- a/usr.sbin/pkg_install/info/pkg_info.1      Thu Jul 31 19:17:36 2003 +0000
+++ b/usr.sbin/pkg_install/info/pkg_info.1      Fri Aug 08 10:19:01 2003 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_info.1,v 1.29.2.1 2003/07/13 09:45:25 jlam Exp $
+.\" $NetBSD: pkg_info.1,v 1.29.2.2 2003/08/08 10:19:01 jlam Exp $
 .\"
 .\" FreeBSD install - a package for the installation and maintenance
 .\" of non-core utilities.
@@ -25,7 +25,7 @@
 .Nd a utility for displaying information on software packages
 .Sh SYNOPSIS
 .Nm
-.Op Fl BbcDdFfhIikLmnpqRrSsVv
+.Op Fl BbcDdFfhIikLmNnpqRrSsVv
 .Bk -words
 .Op Fl e Ar package
 .Ek
@@ -170,6 +170,8 @@
 This lets you add a special token to the start of each field.
 .It Fl m
 Show the mtree file (if any) for each package.
+.It Fl N
+Show which packages each package was built with (exact dependencies), if any.
 .It Fl n
 Show which packages each package needs (depends upon), if any.
 .It Fl p
diff -r 92c56221de02 -r 3c091a1cf26f usr.sbin/pkg_install/info/show.c
--- a/usr.sbin/pkg_install/info/show.c  Thu Jul 31 19:17:36 2003 +0000
+++ b/usr.sbin/pkg_install/info/show.c  Fri Aug 08 10:19:01 2003 +0000
@@ -1,11 +1,11 @@
-/*     $NetBSD: show.c,v 1.25.2.1 2003/07/13 09:45:25 jlam Exp $       */
+/*     $NetBSD: show.c,v 1.25.2.2 2003/08/08 10:19:02 jlam Exp $       */
 
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static const char *rcsid = "from FreeBSD Id: show.c,v 1.11 1997/10/08 07:47:38 charnier Exp";
 #else
-__RCSID("$NetBSD: show.c,v 1.25.2.1 2003/07/13 09:45:25 jlam Exp $");
+__RCSID("$NetBSD: show.c,v 1.25.2.2 2003/08/08 10:19:02 jlam Exp $");
 #endif
 #endif
 
@@ -282,3 +282,41 @@
 
        printf("\n");
 }
+
+/*
+ * Show exact dependencies (packages this pkg was built with)
+ */
+void
+show_bld_depends(char *title, package_t *plist)
+{
+       plist_t *p;
+       int     nodepends;
+
+       nodepends = 1;
+       for (p = plist->head; p && nodepends; p = p->next) {
+               switch (p->type) {
+               case PLIST_BLDDEP:
+                       nodepends = 0;
+                       break;
+               default:
+                       break;
+               }
+       }
+       if (nodepends)
+               return;
+
+       if (!Quiet) {
+               printf("%s%s", InfoPrefix, title);
+       }
+       for (p = plist->head; p; p = p->next) {
+               switch (p->type) {
+               case PLIST_BLDDEP:
+                       printf("%s\n", p->name);
+                       break;
+               default:
+                       break;
+               }
+       }
+
+       printf("\n");
+}
diff -r 92c56221de02 -r 3c091a1cf26f usr.sbin/pkg_install/lib/version.h
--- a/usr.sbin/pkg_install/lib/version.h        Thu Jul 31 19:17:36 2003 +0000
+++ b/usr.sbin/pkg_install/lib/version.h        Fri Aug 08 10:19:01 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: version.h,v 1.13.4.7 2003/07/30 11:04:34 jlam Exp $    */
+/*     $NetBSD: version.h,v 1.13.4.8 2003/08/08 10:19:02 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 "20030730"
+#define PKGTOOLS_VERSION "20030808"
 
 #endif /* _INST_LIB_VERSION_H_ */



Home | Main Index | Thread Index | Old Index