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 pkg_install-20090302:
details: https://anonhg.NetBSD.org/pkgsrc/rev/c6a228f5d389
branches: trunk
changeset: 555460:c6a228f5d389
user: joerg <joerg%pkgsrc.org@localhost>
date: Mon Mar 02 17:13:49 2009 +0000
description:
pkg_install-20090302:
Add new option -r to pkg_info, which works like -R, but expands it
recursively.
diffstat:
pkgtools/pkg_install/files/info/info.h | 5 ++-
pkgtools/pkg_install/files/info/main.c | 12 ++++--
pkgtools/pkg_install/files/info/perform.c | 54 +++++++++++++++++++++++++-
pkgtools/pkg_install/files/info/pkg_info.1 | 9 +++-
pkgtools/pkg_install/files/info/pkg_info.cat1 | 6 ++-
pkgtools/pkg_install/files/info/show.c | 22 ++++++++++-
pkgtools/pkg_install/files/lib/version.h | 4 +-
7 files changed, 95 insertions(+), 17 deletions(-)
diffs (300 lines):
diff -r 76a6630f3979 -r c6a228f5d389 pkgtools/pkg_install/files/info/info.h
--- a/pkgtools/pkg_install/files/info/info.h Mon Mar 02 17:08:27 2009 +0000
+++ b/pkgtools/pkg_install/files/info/info.h Mon Mar 02 17:13:49 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: info.h,v 1.17 2008/02/02 16:21:45 joerg Exp $ */
+/* $NetBSD: info.h,v 1.18 2009/03/02 17:13:49 joerg Exp $ */
/* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */
@@ -70,6 +70,7 @@
char *meta_preserve;
char *meta_views;
char *meta_installed_info;
+ int is_installed;
};
#ifndef MAXINDEXSIZE
@@ -99,6 +100,7 @@
#define SHOW_BLD_DEPENDS 0x20000
#define SHOW_BI_VAR 0x40000
#define SHOW_SUMMARY 0x80000
+#define SHOW_FULL_REQBY 0x100000
enum which {
WHICH_ALL,
@@ -128,6 +130,7 @@
void show_bld_depends(const char *, package_t *);
void show_index(const char *, const char *);
void show_summary(struct pkg_meta *, package_t *, const char *);
+void show_list(lpkg_head_t *, const char *);
int pkg_perform(lpkg_head_t *);
diff -r 76a6630f3979 -r c6a228f5d389 pkgtools/pkg_install/files/info/main.c
--- a/pkgtools/pkg_install/files/info/main.c Mon Mar 02 17:08:27 2009 +0000
+++ b/pkgtools/pkg_install/files/info/main.c Mon Mar 02 17:13:49 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.24 2009/02/28 16:03:56 joerg Exp $ */
+/* $NetBSD: main.c,v 1.25 2009/03/02 17:13:49 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: main.c,v 1.24 2009/02/28 16:03:56 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.25 2009/03/02 17:13:49 joerg Exp $");
/*
*
@@ -44,7 +44,7 @@
#include "lib.h"
#include "info.h"
-static const char Options[] = ".aBbcDde:E:fFhIiK:kLl:mNnpQ:qRsSuvVX";
+static const char Options[] = ".aBbcDde:E:fFhIiK:kLl:mNnpQ:qrRsSuvVX";
int Flags = 0;
enum which Which = WHICH_LIST;
@@ -61,7 +61,7 @@
usage(void)
{
fprintf(stderr, "%s\n%s\n%s\n%s\n",
- "usage: pkg_info [-BbcDdFfhIikLmNnpqRSsVvX] [-e package] [-E package]",
+ "usage: pkg_info [-BbcDdFfhIikLmNnpqrRSsVvX] [-e package] [-E package]",
" [-K pkg_dbdir] [-l prefix] pkg-name ...",
" pkg_info [-a | -u] [flags]",
" pkg_info [-Q variable] pkg-name ...");
@@ -172,6 +172,10 @@
Quiet = TRUE;
break;
+ case 'r':
+ Flags |= SHOW_FULL_REQBY;
+ break;
+
case 'R':
Flags |= SHOW_REQBY;
break;
diff -r 76a6630f3979 -r c6a228f5d389 pkgtools/pkg_install/files/info/perform.c
--- a/pkgtools/pkg_install/files/info/perform.c Mon Mar 02 17:08:27 2009 +0000
+++ b/pkgtools/pkg_install/files/info/perform.c Mon Mar 02 17:13:49 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.52 2009/02/25 20:52:10 joerg Exp $ */
+/* $NetBSD: perform.c,v 1.53 2009/03/02 17:13:49 joerg Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -13,7 +13,7 @@
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
-__RCSID("$NetBSD: perform.c,v 1.52 2009/02/25 20:52:10 joerg Exp $");
+__RCSID("$NetBSD: perform.c,v 1.53 2009/03/02 17:13:49 joerg Exp $");
/*-
* Copyright (c) 2008 Joerg Sonnenberger <joerg%NetBSD.org@localhost>.
@@ -234,6 +234,7 @@
}
archive_read_finish(archive);
+ meta->is_installed = 0;
return meta;
}
@@ -279,9 +280,50 @@
close(fd);
}
+ meta->is_installed = 1;
+
return meta;
}
+static void
+build_full_reqby(lpkg_head_t *reqby, struct pkg_meta *meta)
+{
+ char *iter, *eol, *next;
+ lpkg_t *lpp;
+ struct pkg_meta *meta_dep;
+
+ if (meta->is_installed == 0 || meta->meta_required_by == NULL)
+ return;
+
+ for (iter = meta->meta_required_by; *iter != '\0'; iter = next) {
+ eol = iter + strcspn(iter, "\n");
+ if (*eol == '\n')
+ next = eol + 1;
+ else
+ next = eol;
+ if (iter == eol)
+ continue;
+ TAILQ_FOREACH(lpp, reqby, lp_link) {
+ if (strlen(lpp->lp_name) != eol - iter)
+ continue;
+ if (memcmp(lpp->lp_name, iter, eol - iter) == 0)
+ break;
+ }
+ if (lpp != NULL)
+ continue;
+ *eol = '\0';
+ lpp = alloc_lpkg(iter);
+ if (next != eol)
+ *eol = '\n';
+ TAILQ_INSERT_TAIL(reqby, lpp, lp_link);
+ meta_dep = read_meta_data_from_pkgdb(lpp->lp_name);
+ if (meta_dep == NULL)
+ continue;
+ build_full_reqby(reqby, meta_dep);
+ free_pkg_meta(meta_dep);
+ }
+}
+
static lfile_head_t files;
static int
@@ -396,6 +438,12 @@
if ((Flags & SHOW_REQBY) && meta->meta_required_by) {
show_file(meta->meta_required_by, "Required by:\n", TRUE);
}
+ if ((Flags & SHOW_FULL_REQBY) && meta->is_installed) {
+ lpkg_head_t reqby;
+ TAILQ_INIT(&reqby);
+ build_full_reqby(&reqby, meta);
+ show_list(&reqby, "Full required by list:\n");
+ }
if (Flags & SHOW_DESC) {
show_file(meta->meta_desc, "Description:\n", TRUE);
}
@@ -587,7 +635,7 @@
desired_meta_data |= LOAD_SIZE_ALL;
if (Flags & (SHOW_SUMMARY | SHOW_DESC))
desired_meta_data |= LOAD_DESC;
- if (Flags & SHOW_REQBY)
+ if (Flags & (SHOW_REQBY | SHOW_FULL_REQBY))
desired_meta_data |= LOAD_REQUIRED_BY;
if (Flags & SHOW_DISPLAY)
desired_meta_data |= LOAD_DISPLAY;
diff -r 76a6630f3979 -r c6a228f5d389 pkgtools/pkg_install/files/info/pkg_info.1
--- a/pkgtools/pkg_install/files/info/pkg_info.1 Mon Mar 02 17:08:27 2009 +0000
+++ b/pkgtools/pkg_install/files/info/pkg_info.1 Mon Mar 02 17:13:49 2009 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_info.1,v 1.23 2009/02/28 16:03:56 joerg Exp $
+.\" $NetBSD: pkg_info.1,v 1.24 2009/03/02 17:13:49 joerg Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" @(#)pkg_info.1
.\"
-.Dd February 27, 2009
+.Dd March 2, 2009
.Dt PKG_INFO 1
.Os
.Sh NAME
@@ -25,7 +25,7 @@
.Nd a utility for displaying information on software packages
.Sh SYNOPSIS
.Nm
-.Op Fl BbcDdFfhIikLmNnpqRSsVvX
+.Op Fl BbcDdFfhIikLmNnpqrRSsVvX
.Op Fl e Ar package
.Op Fl E Ar package
.Op Fl K Ar pkg_dbdir
@@ -176,6 +176,9 @@
raw info (basically, assume a non-human reading).
.It Fl R
For each package, show the packages that require it.
+.It Fl r
+For each package, show the packages that require it.
+Continue recursively to show all dependents.
.It Fl S
Show the size of this package and all the packages it requires,
in bytes.
diff -r 76a6630f3979 -r c6a228f5d389 pkgtools/pkg_install/files/info/pkg_info.cat1
--- a/pkgtools/pkg_install/files/info/pkg_info.cat1 Mon Mar 02 17:08:27 2009 +0000
+++ b/pkgtools/pkg_install/files/info/pkg_info.cat1 Mon Mar 02 17:13:49 2009 +0000
@@ -4,7 +4,7 @@
ppkkgg__iinnffoo -- a utility for displaying information on software packages
SSYYNNOOPPSSIISS
- ppkkgg__iinnffoo [--BBbbccDDddFFffhhIIiikkLLmmNNnnppqqRRSSssVVvvXX] [--ee _p_a_c_k_a_g_e] [--EE _p_a_c_k_a_g_e]
+ ppkkgg__iinnffoo [--BBbbccDDddFFffhhIIiikkLLmmNNnnppqqrrRRSSssVVvvXX] [--ee _p_a_c_k_a_g_e] [--EE _p_a_c_k_a_g_e]
[--KK _p_k_g___d_b_d_i_r] [--ll _p_r_e_f_i_x] _p_k_g_-_n_a_m_e _._._.
ppkkgg__iinnffoo [--aa | --uu] [flags]
ppkkgg__iinnffoo [--QQ _v_a_r_i_a_b_l_e] _p_k_g_-_n_a_m_e _._._.
@@ -107,6 +107,8 @@
--RR For each package, show the packages that require it.
+ --rr For each package, recursively show the packages that require it.
+
--SS Show the size of this package and all the packages it requires,
in bytes.
@@ -184,4 +186,4 @@
NetBSD wildcard dependency processing, pkgdb, depends displaying,
pkg size display etc.
-NetBSD 5.0 February 27, 2009 NetBSD 5.0
+NetBSD 5.0 March 2, 2009 NetBSD 5.0
diff -r 76a6630f3979 -r c6a228f5d389 pkgtools/pkg_install/files/info/show.c
--- a/pkgtools/pkg_install/files/info/show.c Mon Mar 02 17:08:27 2009 +0000
+++ b/pkgtools/pkg_install/files/info/show.c Mon Mar 02 17:13:49 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: show.c,v 1.24 2009/02/11 23:51:30 joerg Exp $ */
+/* $NetBSD: show.c,v 1.25 2009/03/02 17:13:49 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: show.c,v 1.24 2009/02/11 23:51:30 joerg Exp $");
+__RCSID("$NetBSD: show.c,v 1.25 2009/03/02 17:13:49 joerg Exp $");
/*
* FreeBSD install - a package for the installation and maintainance
@@ -405,3 +405,21 @@
return 0;
}
+
+void
+show_list(lpkg_head_t *pkghead, const char *title)
+{
+ lpkg_t *lpp;
+
+ if (!Quiet)
+ printf("%s%s", InfoPrefix, title);
+
+ while ((lpp = TAILQ_FIRST(pkghead)) != NULL) {
+ TAILQ_REMOVE(pkghead, lpp, lp_link);
+ puts(lpp->lp_name);
+ free_lpkg(lpp);
+ }
+
+ if (!Quiet)
+ printf("\n");
+}
diff -r 76a6630f3979 -r c6a228f5d389 pkgtools/pkg_install/files/lib/version.h
--- a/pkgtools/pkg_install/files/lib/version.h Mon Mar 02 17:08:27 2009 +0000
+++ b/pkgtools/pkg_install/files/lib/version.h Mon Mar 02 17:13:49 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: version.h,v 1.116 2009/03/02 14:59:14 joerg Exp $ */
+/* $NetBSD: version.h,v 1.117 2009/03/02 17:13:49 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 "20090301"
+#define PKGTOOLS_VERSION "20090302"
#endif /* _INST_LIB_VERSION_H_ */
Home |
Main Index |
Thread Index |
Old Index