summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_install
diff options
context:
space:
mode:
authorwiz <wiz>2005-05-30 13:23:31 +0000
committerwiz <wiz>2005-05-30 13:23:31 +0000
commit892b04ac5b6479e30ce7db24e2d36325654bceee (patch)
tree4e848109f940e6f3a88904baf01e789acb417cf9 /pkgtools/pkg_install
parent0194b54342bdcd9364750f4288d90c6fc616e36b (diff)
downloadpkgsrc-892b04ac5b6479e30ce7db24e2d36325654bceee.tar.gz
Update to 20050530:
Sync with base system: Ranges support and some other stuff that wasn't pulled over.
Diffstat (limited to 'pkgtools/pkg_install')
-rw-r--r--pkgtools/pkg_install/files/README6
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.16
-rw-r--r--pkgtools/pkg_install/files/admin/pkg_admin.cat16
-rw-r--r--pkgtools/pkg_install/files/delete/perform.c6
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.16
-rw-r--r--pkgtools/pkg_install/files/delete/pkg_delete.cat16
-rw-r--r--pkgtools/pkg_install/files/info/info.h6
-rw-r--r--pkgtools/pkg_install/files/info/perform.c30
-rw-r--r--pkgtools/pkg_install/files/info/pkg_info.146
-rw-r--r--pkgtools/pkg_install/files/info/pkg_info.cat138
-rw-r--r--pkgtools/pkg_install/files/info/show.c12
-rw-r--r--pkgtools/pkg_install/files/lib/ftpio.c7
-rw-r--r--pkgtools/pkg_install/files/lib/pen.c10
-rw-r--r--pkgtools/pkg_install/files/lib/str.c76
-rw-r--r--pkgtools/pkg_install/files/lib/version.h4
-rw-r--r--pkgtools/pkg_install/files/view/pkg_view.16
-rw-r--r--pkgtools/pkg_install/files/view/pkg_view.cat14
17 files changed, 167 insertions, 108 deletions
diff --git a/pkgtools/pkg_install/files/README b/pkgtools/pkg_install/files/README
index 42a8b0370cd..ef70fdf33f3 100644
--- a/pkgtools/pkg_install/files/README
+++ b/pkgtools/pkg_install/files/README
@@ -1,4 +1,4 @@
-# $NetBSD: README,v 1.6 2005/02/04 01:19:03 jlam Exp $
+# $NetBSD: README,v 1.7 2005/05/30 13:23:31 wiz Exp $
# Original from FreeBSD, no rcs id.
This is the pkg_install suite of tools for doing maintainance of
@@ -17,5 +17,5 @@ Christian E. Hopps, Thomas Klausner, Johnny Lam, and Matthias Scheler.
When making snapshots, please modify PKGTOOLS_VERSION in lib/version.h
to that day's date.
-This is the canonical location for these sources. Any changes should
-be made here first, then merged over to pkgsrc.
+src/usr.sbin/pkg_install is the canonical location for these sources.
+Any changes should be made here first, then merged over to pkgsrc.
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.1 b/pkgtools/pkg_install/files/admin/pkg_admin.1
index 9257522409f..20a78681910 100644
--- a/pkgtools/pkg_install/files/admin/pkg_admin.1
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_admin.1,v 1.9 2005/02/04 01:19:03 jlam Exp $
+.\" $NetBSD: pkg_admin.1,v 1.10 2005/05/30 13:23:31 wiz Exp $
.\"
.\" Copyright (c) 1999-2002 Hubert Feyrer. All rights reserved.
.\"
@@ -78,7 +78,9 @@ if it's set, otherwise it defaults to
Perform checks in a quiet manner.
In normal operation,
.Nm
-prints a '.' to standard output to indicate progress.
+prints a
+.Sq \&.
+to standard output to indicate progress.
This option suppresses this progress indicator.
.It Fl S
Set the shell glob pattern for package suffixes when matching package
diff --git a/pkgtools/pkg_install/files/admin/pkg_admin.cat1 b/pkgtools/pkg_install/files/admin/pkg_admin.cat1
index cf7fe2f6601..6e234121468 100644
--- a/pkgtools/pkg_install/files/admin/pkg_admin.cat1
+++ b/pkgtools/pkg_install/files/admin/pkg_admin.cat1
@@ -1,7 +1,7 @@
PKG_ADMIN(1) NetBSD General Commands Manual PKG_ADMIN(1)
NNAAMMEE
- ppkkgg__aaddmmiinn - perform various administrative tasks to the pkg system
+ ppkkgg__aaddmmiinn -- perform various administrative tasks to the pkg system
SSYYNNOOPPSSIISS
ppkkgg__aaddmmiinn [--bbqqSSVV] [--dd _l_s_d_i_r] [--KK _p_k_g___d_b_d_i_r] [--ss _s_f_x___p_a_t_t_e_r_n] _c_o_m_m_a_n_d
@@ -28,7 +28,7 @@ OOPPTTIIOONNSS
otherwise it defaults to _/_v_a_r_/_d_b_/_p_k_g.
--qq Perform checks in a quiet manner. In normal operation, ppkkgg__aaddmmiinn
- prints a '.' to standard output to indicate progress. This
+ prints a `.' to standard output to indicate progress. This
option suppresses this progress indicator.
--SS Set the shell glob pattern for package suffixes when matching
@@ -141,4 +141,4 @@ HHIISSTTOORRYY
AAUUTTHHOORRSS
The ppkkgg__aaddmmiinn command was written by Hubert Feyrer.
-NetBSD 2.0 August 13, 2004 NetBSD 2.0
+NetBSD 3.0 August 13, 2004 NetBSD 3.0
diff --git a/pkgtools/pkg_install/files/delete/perform.c b/pkgtools/pkg_install/files/delete/perform.c
index 01c9555718c..878217bd290 100644
--- a/pkgtools/pkg_install/files/delete/perform.c
+++ b/pkgtools/pkg_install/files/delete/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.15 2005/05/10 00:04:09 rillig Exp $ */
+/* $NetBSD: perform.c,v 1.16 2005/05/30 13:23:31 wiz Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: perform.c,v 1.15 1997/10/13 15:03:52 jkh Exp";
#else
-__RCSID("$NetBSD: perform.c,v 1.15 2005/05/10 00:04:09 rillig Exp $");
+__RCSID("$NetBSD: perform.c,v 1.16 2005/05/30 13:23:31 wiz Exp $");
#endif
#endif
@@ -845,7 +845,7 @@ pkg_do(char *pkg)
if (is_depoted_pkg) {
(void) remove_files(LogDir, "+*");
if (isemptydir(LogDir))
- (void) fexec(RMDIR_CMD, LogDir, NULL);
+ (void)rmdir(LogDir);
else
warnx("%s is not empty", LogDir);
return 0;
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.1 b/pkgtools/pkg_install/files/delete/pkg_delete.1
index dbb7f024450..e23f06113e8 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.1
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_delete.1,v 1.11 2005/02/05 00:28:58 jlam Exp $
+.\" $NetBSD: pkg_delete.1,v 1.12 2005/05/30 13:23:31 wiz Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -45,7 +45,9 @@ command.
Since the
.Nm
command may execute scripts or programs provided by a package file,
-your system may be susceptible to ``Trojan horses'' or other subtle
+your system may be susceptible to
+.Dq Trojan horses
+or other subtle
attacks from miscreants who create dangerous package files.
.Pp
You are advised to verify the competence and identity of those who
diff --git a/pkgtools/pkg_install/files/delete/pkg_delete.cat1 b/pkgtools/pkg_install/files/delete/pkg_delete.cat1
index 305e0cabdc5..34f7705cef4 100644
--- a/pkgtools/pkg_install/files/delete/pkg_delete.cat1
+++ b/pkgtools/pkg_install/files/delete/pkg_delete.cat1
@@ -1,8 +1,8 @@
PKG_DELETE(1) NetBSD General Commands Manual PKG_DELETE(1)
NNAAMMEE
- ppkkgg__ddeelleettee - a utility for deleting previously installed software package
- distributions
+ ppkkgg__ddeelleettee -- a utility for deleting previously installed software pack-
+ age distributions
SSYYNNOOPPSSIISS
ppkkgg__ddeelleettee [--DDddFFffNNnnOORRrrVVvv] [--KK _p_k_g___d_b_d_i_r] [--pp _p_r_e_f_i_x] _p_k_g_-_n_a_m_e _._._.
@@ -168,4 +168,4 @@ AAUUTTHHOORRSS
NetBSD wildcard dependency processing, pkgdb, recursive "down"
delete, etc.
-NetBSD 2.0 February 4, 2005 NetBSD 2.0
+NetBSD 3.0 February 4, 2005 NetBSD 3.0
diff --git a/pkgtools/pkg_install/files/info/info.h b/pkgtools/pkg_install/files/info/info.h
index 15a4d61fb07..fcd87cc4754 100644
--- a/pkgtools/pkg_install/files/info/info.h
+++ b/pkgtools/pkg_install/files/info/info.h
@@ -1,4 +1,4 @@
-/* $NetBSD: info.h,v 1.7 2005/02/10 23:51:18 grant Exp $ */
+/* $NetBSD: info.h,v 1.8 2005/05/30 13:23:32 wiz Exp $ */
/* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */
@@ -65,12 +65,12 @@ extern char *CheckPkg;
extern size_t termwidth;
extern lpkg_head_t pkgs;
-extern void show_file(char *, char *);
+extern void show_file(char *, char *, char *);
extern void show_var(const char *, const char *);
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 *);
+extern void show_index(char *, char *, char *);
#endif /* _INST_INFO_H_INCLUDE */
diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c
index 92c9e0e9116..80dab8bf518 100644
--- a/pkgtools/pkg_install/files/info/perform.c
+++ b/pkgtools/pkg_install/files/info/perform.c
@@ -1,4 +1,4 @@
-/* $NetBSD: perform.c,v 1.21 2005/02/21 01:21:39 grant Exp $ */
+/* $NetBSD: perform.c,v 1.22 2005/05/30 13:23:32 wiz Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#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.21 2005/02/21 01:21:39 grant Exp $");
+__RCSID("$NetBSD: perform.c,v 1.22 2005/05/30 13:23:32 wiz Exp $");
#endif
#endif
@@ -186,7 +186,7 @@ pkg_do(char *pkg)
char tmp[MaxPathSize];
(void) snprintf(tmp, sizeof(tmp), "%-19s ", pkg);
- show_index(tmp, COMMENT_FNAME);
+ show_index(pkg, tmp, COMMENT_FNAME);
} else if (Flags & SHOW_BI_VAR) {
show_var(BUILD_INFO_FNAME, BuildInfoVariable);
} else {
@@ -213,7 +213,7 @@ pkg_do(char *pkg)
}
}
if (Flags & SHOW_COMMENT) {
- show_file("Comment:\n", COMMENT_FNAME);
+ show_file(pkg, "Comment:\n", COMMENT_FNAME);
}
if (Flags & SHOW_DEPENDS) {
show_depends("Requires:\n", &plist);
@@ -222,28 +222,28 @@ pkg_do(char *pkg)
show_bld_depends("Built using:\n", &plist);
}
if ((Flags & SHOW_REQBY) && !isemptyfile(REQUIRED_BY_FNAME)) {
- show_file("Required by:\n", REQUIRED_BY_FNAME);
+ show_file(pkg, "Required by:\n", REQUIRED_BY_FNAME);
}
if (Flags & SHOW_DESC) {
- show_file("Description:\n", DESC_FNAME);
+ show_file(pkg, "Description:\n", DESC_FNAME);
}
if ((Flags & SHOW_DISPLAY) && fexists(DISPLAY_FNAME)) {
- show_file("Install notice:\n", DISPLAY_FNAME);
+ show_file(pkg, "Install notice:\n", DISPLAY_FNAME);
}
if (Flags & SHOW_PLIST) {
show_plist("Packing list:\n", &plist, PLIST_SHOW_ALL);
}
if ((Flags & SHOW_INSTALL) && fexists(INSTALL_FNAME)) {
- show_file("Install script:\n", INSTALL_FNAME);
+ show_file(pkg, "Install script:\n", INSTALL_FNAME);
}
if ((Flags & SHOW_DEINSTALL) && fexists(DEINSTALL_FNAME)) {
- show_file("De-Install script:\n", DEINSTALL_FNAME);
+ show_file(pkg, "De-Install script:\n", DEINSTALL_FNAME);
}
if ((Flags & SHOW_REQUIRE) && fexists(REQUIRE_FNAME)) {
- show_file("Require script:\n", REQUIRE_FNAME);
+ show_file(pkg, "Require script:\n", REQUIRE_FNAME);
}
if ((Flags & SHOW_MTREE) && fexists(MTREE_FNAME)) {
- show_file("mtree file:\n", MTREE_FNAME);
+ show_file(pkg, "mtree file:\n", MTREE_FNAME);
}
if (Flags & SHOW_PREFIX) {
show_plist("Prefix(s):\n", &plist, PLIST_CWD);
@@ -252,16 +252,16 @@ pkg_do(char *pkg)
show_files("Files:\n", &plist);
}
if ((Flags & SHOW_BUILD_VERSION) && fexists(BUILD_VERSION_FNAME)) {
- show_file("Build version:\n", BUILD_VERSION_FNAME);
+ show_file(pkg, "Build version:\n", BUILD_VERSION_FNAME);
}
if ((Flags & SHOW_BUILD_INFO) && fexists(BUILD_INFO_FNAME)) {
- show_file("Build information:\n", BUILD_INFO_FNAME);
+ show_file(pkg, "Build information:\n", BUILD_INFO_FNAME);
}
if ((Flags & SHOW_PKG_SIZE) && fexists(SIZE_PKG_FNAME)) {
- show_file("Size of this package in bytes: ", SIZE_PKG_FNAME);
+ show_file(pkg, "Size of this package in bytes: ", SIZE_PKG_FNAME);
}
if ((Flags & SHOW_ALL_SIZE) && fexists(SIZE_ALL_FNAME)) {
- show_file("Size in bytes including required pkgs: ", SIZE_ALL_FNAME);
+ show_file(pkg, "Size in bytes including required pkgs: ", SIZE_ALL_FNAME);
}
if (!Quiet) {
if (fexists(PRESERVE_FNAME)) {
diff --git a/pkgtools/pkg_install/files/info/pkg_info.1 b/pkgtools/pkg_install/files/info/pkg_info.1
index b57f15be500..5377f0590ea 100644
--- a/pkgtools/pkg_install/files/info/pkg_info.1
+++ b/pkgtools/pkg_install/files/info/pkg_info.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_info.1,v 1.15 2005/02/10 23:51:18 grant Exp $
+.\" $NetBSD: pkg_info.1,v 1.16 2005/05/30 13:23:32 wiz Exp $
.\"
.\" FreeBSD install - a package for the installation and maintenance
.\" of non-core utilities.
@@ -17,7 +17,7 @@
.\"
.\" @(#)pkg_info.1
.\"
-.Dd February 10, 2005
+.Dd May 30, 2005
.Dt PKG_INFO 1
.Os
.Sh NAME
@@ -127,6 +127,8 @@ Show the de-install script (if any) for each package.
Show the files within each package.
This is different from just viewing the packing list, since full pathnames
for everything are generated.
+Files that were created dynamically during installation of the package
+are not listed.
.It Fl l Ar str
Prefix each information category header (see
.Fl q )
@@ -152,7 +154,9 @@ from the build information for each package.
An empty string is returned if no such variable definition is found for
the package(s).
.It Fl q
-Be ``quiet'' in emitting report headers and such, just dump the
+Be
+.Dq quiet
+in emitting report headers and such, just dump the
raw info (basically, assume a non-human reading).
.It Fl R
For each package, show the packages that require it.
@@ -206,18 +210,38 @@ For example,
will match versions 1.3 and later of the
.Pa name
package.
+Additionally, ranges can be defined by giving a lower bound with
+\*[Gt] or \*[Ge] and an upper bound with \*[Lt] or \*[Le].
+The lower bound has to come first.
+For example,
+.Pa pkg_info -e 'name\*[Ge]1.3\*[Lt]2.0'
+will match versions 1.3 (inclusive) to 2.0 (exclusive)
+of package
+.Pa name .
+.Pp
The collating sequence of the various package version numbers is
unusual, but strives to be consistent.
-The magic string ``alpha'' equates to
+The magic string
+.Dq alpha
+equates to
.Pa alpha version
and sorts before a beta version.
-The magic string ``beta'' equates to
+The magic string
+.Dq beta
+equates to
.Pa beta version
and sorts before a release candidate.
-The magic string ``rc'' equates to
+The magic string
+.Dq rc
+equates to
.Pa release candidate
and sorts before a release.
-The magic string ``pre'', short for ``pre-release'', is a synonym for ``rc''.
+The magic string
+.Dq pre ,
+short for
+.Dq pre-release ,
+is a synonym for
+.Dq rc .
For example,
.Pa name-1.3rc3
will sort before
@@ -235,7 +259,9 @@ their numeric counterparts, so that
.Pa name-1.2e
has the same sorting value as
.Pa name-1.2.5
-The magic string ``pl'' equates to a
+The magic string
+.Dq pl
+equates to a
.Pa patch level
and has the same value as a dot in the dewey-decimal ordering schemes.
.Sh ENVIRONMENT
@@ -262,7 +288,9 @@ whereas searching in the current directory uses
literally.
.It Ev PKG_TMPDIR , Ev TMPDIR
These are tried in turn (if set) as candidate directories in which
-to create a ``staging area'' for any files extracted by
+to create a
+.Dq staging area
+for any files extracted by
.Nm
from package files.
If neither
diff --git a/pkgtools/pkg_install/files/info/pkg_info.cat1 b/pkgtools/pkg_install/files/info/pkg_info.cat1
index b04ac2e529e..c6e73baee83 100644
--- a/pkgtools/pkg_install/files/info/pkg_info.cat1
+++ b/pkgtools/pkg_install/files/info/pkg_info.cat1
@@ -1,7 +1,7 @@
PKG_INFO(1) NetBSD General Commands Manual PKG_INFO(1)
NNAAMMEE
- ppkkgg__iinnffoo - a utility for displaying information on software packages
+ ppkkgg__iinnffoo -- a utility for displaying information on software packages
SSYYNNOOPPSSIISS
ppkkgg__iinnffoo [--BBbbccDDddFFffhhIIiikkLLmmNNnnppqqRRrrSSssVVvv] [--ee _p_a_c_k_a_g_e] [--KK _p_k_g___d_b_d_i_r]
@@ -67,7 +67,8 @@ DDEESSCCRRIIPPTTIIOONN
--LL Show the files within each package. This is different from just
viewing the packing list, since full pathnames for everything are
- generated.
+ generated. Files that were created dynamically during installa-
+ tion of the package are not listed.
--ll _s_t_r Prefix each information category header (see --qq) shown with _s_t_r.
This is primarily of use to front-end programs that want to
@@ -127,19 +128,24 @@ PPAACCKKAAGGEE WWIILLDDCCAARRDDSS
nates have been implemented. Package version numbers can also be matched
in a relational manner using the _>_=, _<_=, _>, and _< operators. For exam-
ple, _p_k_g___i_n_f_o _-_e _'_n_a_m_e_>_=_1_._3_' will match versions 1.3 and later of the
- _n_a_m_e package. The collating sequence of the various package version num-
- bers is unusual, but strives to be consistent. The magic string
- ``alpha'' equates to _a_l_p_h_a _v_e_r_s_i_o_n and sorts before a beta version. The
- magic string ``beta'' equates to _b_e_t_a _v_e_r_s_i_o_n and sorts before a release
- candidate. The magic string ``rc'' equates to _r_e_l_e_a_s_e _c_a_n_d_i_d_a_t_e and
- sorts before a release. The magic string ``pre'', short for ``pre-
- release'', is a synonym for ``rc''. For example, _n_a_m_e_-_1_._3_r_c_3 will sort
- before _n_a_m_e_-_1_._3 and after _n_a_m_e_-_1_._2_._9. Similarly _n_a_m_e_-_1_._3_a_l_p_h_a_2 will sort
- before _n_a_m_e_-_1_._3_b_e_t_a_1 and they both sort before _n_a_m_e_-_1_._3_r_c_1. In addition,
- alphabetic characters sort in the same place as their numeric counter-
- parts, so that _n_a_m_e_-_1_._2_e has the same sorting value as _n_a_m_e_-_1_._2_._5 The
- magic string ``pl'' equates to a _p_a_t_c_h _l_e_v_e_l and has the same value as a
- dot in the dewey-decimal ordering schemes.
+ _n_a_m_e package. Additionally, ranges can be defined by giving a lower
+ bound with > or >= and an upper bound with < or <=. The lower bound has
+ to come first. For example, _p_k_g___i_n_f_o _-_e _'_n_a_m_e_>_=_1_._3_<_2_._0_' will match ver-
+ sions 1.3 (inclusive) to 2.0 (exclusive) of package _n_a_m_e.
+
+ The collating sequence of the various package version numbers is unusual,
+ but strives to be consistent. The magic string ``alpha'' equates to
+ _a_l_p_h_a _v_e_r_s_i_o_n and sorts before a beta version. The magic string ``beta''
+ equates to _b_e_t_a _v_e_r_s_i_o_n and sorts before a release candidate. The magic
+ string ``rc'' equates to _r_e_l_e_a_s_e _c_a_n_d_i_d_a_t_e and sorts before a release.
+ The magic string ``pre'', short for ``pre-release'', is a synonym for
+ ``rc''. For example, _n_a_m_e_-_1_._3_r_c_3 will sort before _n_a_m_e_-_1_._3 and after
+ _n_a_m_e_-_1_._2_._9. Similarly _n_a_m_e_-_1_._3_a_l_p_h_a_2 will sort before _n_a_m_e_-_1_._3_b_e_t_a_1 and
+ they both sort before _n_a_m_e_-_1_._3_r_c_1. In addition, alphabetic characters
+ sort in the same place as their numeric counterparts, so that _n_a_m_e_-_1_._2_e
+ has the same sorting value as _n_a_m_e_-_1_._2_._5 The magic string ``pl'' equates
+ to a _p_a_t_c_h _l_e_v_e_l and has the same value as a dot in the dewey-decimal
+ ordering schemes.
EENNVVIIRROONNMMEENNTT
PKG_DBDIR If the --KK flag isn't given, then PKG_DBDIR is the location of
@@ -178,4 +184,4 @@ AAUUTTHHOORRSS
NetBSD wildcard dependency processing, pkgdb, depends displaying,
pkg size display etc.
-BSD February 10, 2005 BSD
+NetBSD 3.0 May 30, 2005 NetBSD 3.0
diff --git a/pkgtools/pkg_install/files/info/show.c b/pkgtools/pkg_install/files/info/show.c
index 6f972290a60..8dc6ac36a2f 100644
--- a/pkgtools/pkg_install/files/info/show.c
+++ b/pkgtools/pkg_install/files/info/show.c
@@ -1,4 +1,4 @@
-/* $NetBSD: show.c,v 1.7 2004/08/06 16:57:03 jlam Exp $ */
+/* $NetBSD: show.c,v 1.8 2005/05/30 13:23:32 wiz Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#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.7 2004/08/06 16:57:03 jlam Exp $");
+__RCSID("$NetBSD: show.c,v 1.8 2005/05/30 13:23:32 wiz Exp $");
#endif
#endif
@@ -107,7 +107,7 @@ static const show_t showv[] = {
};
void
-show_file(char *title, char *fname)
+show_file(char *pkg, char *title, char *fname)
{
FILE *fp;
char line[1024];
@@ -117,7 +117,7 @@ show_file(char *title, char *fname)
printf("%s%s", InfoPrefix, title);
}
if ((fp = fopen(fname, "r")) == (FILE *) NULL) {
- printf("ERROR: show_file: Can't open '%s' for reading!\n", fname);
+ printf("ERROR: show_file: package \"%s\": can't open '%s' for reading\n", pkg, fname);
} else {
int append_nl = 0;
while ((n = fread(line, 1, sizeof(line), fp)) != 0) {
@@ -174,7 +174,7 @@ show_var(const char *fname, const char *variable)
}
void
-show_index(char *title, char *fname)
+show_index(char *pkg, char *title, char *fname)
{
FILE *fp;
char *line;
@@ -186,7 +186,7 @@ show_index(char *title, char *fname)
maxline -= MAX(MAXNAMESIZE, strlen(title));
}
if ((fp = fopen(fname, "r")) == (FILE *) NULL) {
- warnx("show_file: can't open '%s' for reading", fname);
+ warnx("show_index: package \"%s\": can't open '%s' for reading", pkg, fname);
return;
}
if ((line = fgetln(fp, &linelen))) {
diff --git a/pkgtools/pkg_install/files/lib/ftpio.c b/pkgtools/pkg_install/files/lib/ftpio.c
index 33e98c59c41..95ac9963009 100644
--- a/pkgtools/pkg_install/files/lib/ftpio.c
+++ b/pkgtools/pkg_install/files/lib/ftpio.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ftpio.c,v 1.15 2005/03/20 15:55:54 hubertf Exp $ */
+/* $NetBSD: ftpio.c,v 1.16 2005/05/30 13:23:32 wiz Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -8,7 +8,7 @@
#include <sys/cdefs.h>
#endif
#ifndef lint
-__RCSID("$NetBSD: ftpio.c,v 1.15 2005/03/20 15:55:54 hubertf Exp $");
+__RCSID("$NetBSD: ftpio.c,v 1.16 2005/05/30 13:23:32 wiz Exp $");
#endif
/*-
@@ -107,9 +107,6 @@ __RCSID("$NetBSD: ftpio.c,v 1.15 2005/03/20 15:55:54 hubertf Exp $");
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
-#if HAVE_NETDB_H
-#include <netdb.h>
-#endif
#if HAVE_REGEX_H
#include <regex.h>
#endif
diff --git a/pkgtools/pkg_install/files/lib/pen.c b/pkgtools/pkg_install/files/lib/pen.c
index a93df09b6e0..82fb8023882 100644
--- a/pkgtools/pkg_install/files/lib/pen.c
+++ b/pkgtools/pkg_install/files/lib/pen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pen.c,v 1.17 2005/02/20 09:17:25 grant Exp $ */
+/* $NetBSD: pen.c,v 1.18 2005/05/30 13:23:32 wiz Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "from FreeBSD Id: pen.c,v 1.25 1997/10/08 07:48:12 charnier Exp";
#else
-__RCSID("$NetBSD: pen.c,v 1.17 2005/02/20 09:17:25 grant Exp $");
+__RCSID("$NetBSD: pen.c,v 1.18 2005/05/30 13:23:32 wiz Exp $");
#endif
#endif
@@ -48,12 +48,6 @@ __RCSID("$NetBSD: pen.c,v 1.17 2005/02/20 09:17:25 grant Exp $");
#if HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
-#if HAVE_SYS_VFS_H
-#include <sys/vfs.h>
-#endif
-#if HAVE_SYS_STATVFS_H
-#include <sys/statvfs.h>
-#endif
/* For keeping track of where we are */
static char Current[MaxPathSize];
diff --git a/pkgtools/pkg_install/files/lib/str.c b/pkgtools/pkg_install/files/lib/str.c
index b221e316466..8a41181ec9c 100644
--- a/pkgtools/pkg_install/files/lib/str.c
+++ b/pkgtools/pkg_install/files/lib/str.c
@@ -1,4 +1,4 @@
-/* $NetBSD: str.c,v 1.11 2005/05/29 19:20:53 minskim Exp $ */
+/* $NetBSD: str.c,v 1.12 2005/05/30 13:23:32 wiz Exp $ */
#if HAVE_CONFIG_H
#include "config.h"
@@ -11,7 +11,7 @@
#if 0
static const char *rcsid = "Id: str.c,v 1.5 1997/10/08 07:48:21 charnier Exp";
#else
-__RCSID("$NetBSD: str.c,v 1.11 2005/05/29 19:20:53 minskim Exp $");
+__RCSID("$NetBSD: str.c,v 1.12 2005/05/30 13:23:32 wiz Exp $");
#endif
#endif
@@ -175,7 +175,7 @@ static const test_t modifiers[] = {
/* locate the test in the tests array */
static int
-mktest(int *op, char *test)
+mktest(int *op, const char *test)
{
const test_t *tp;
@@ -200,12 +200,12 @@ mktest(int *op, char *test)
* 'nb' encodes as 'netbsd version', which is used after all other tests
*/
static int
-mkcomponent(arr_t *ap, char *num)
+mkcomponent(arr_t *ap, const char *num)
{
static const char alphas[] = "abcdefghijklmnopqrstuvwxyz";
const test_t *modp;
int64_t n;
- char *cp;
+ const char *cp;
if (*num == 0) {
return 0;
@@ -244,7 +244,7 @@ mkcomponent(arr_t *ap, char *num)
/* make a version number string into an array of comparable 64bit ints */
static int
-mkversion(arr_t *ap, char *num)
+mkversion(arr_t *ap, const char *num)
{
(void) memset(ap, 0, sizeof(arr_t));
while (*num) {
@@ -298,7 +298,7 @@ vtest(arr_t *lhs, int tst, arr_t *rhs)
* Compare two dewey decimal numbers
*/
static int
-deweycmp(char *lhs, int op, char *rhs)
+deweycmp(const char *lhs, int op, const char *rhs)
{
arr_t right;
arr_t left;
@@ -371,31 +371,59 @@ alternate_match(const char *pattern, const char *pkg)
static int
dewey_match(const char *pattern, const char *pkg)
{
- char *cp;
- char *sep;
- char *ver;
- char name[MaxPathSize];
- int op;
- int n;
-
- if ((sep = strpbrk(pattern, "<>")) == NULL) {
- errx(EXIT_FAILURE, "dewey_match(): '<' or '>' expected in `%s'", pattern);
+ const char *version;
+ const char *sep, *sep2;
+ int op, op2;
+ int n;
+
+ /* compare names */
+ if ((version=strrchr(pkg, '-')) == NULL) {
+ warnx("Invalid package name `%s'", pkg);
+ return 0;
}
- (void) snprintf(name, sizeof(name), "%.*s", (int) (sep - pattern), pattern);
+ if ((sep = strpbrk(pattern, "<>")) == NULL)
+ errx(EXIT_FAILURE, "dewey_match: '<' or '>' expected in `%s'", pattern);
+ /* compare name lengths */
+ if ((sep-pattern != version-pkg) ||
+ strncmp(pkg, pattern, (size_t)(version-pkg)) != 0)
+ return 0;
+ version++;
+
+ /* extract comparison operator */
if ((n = mktest(&op, sep)) < 0) {
warnx("Bad comparison `%s'", sep);
return 0;
}
- ver = sep + n;
- n = (int) (sep - pattern);
- if ((cp = strrchr(pkg, '-')) != (char *) NULL) {
- if (strncmp(pkg, name, (size_t) (cp - pkg)) == 0 &&
- n == (int)(cp - pkg)) {
- if (deweycmp(cp + 1, op, ver)) {
- return 1;
+ /* skip operator */
+ sep += n;
+
+ /* if greater than, look for less than */
+ sep2 = NULL;
+ if (op == GT || op == GE) {
+ if ((sep2 = strchr(sep, '<')) != NULL) {
+ if ((n = mktest(&op2, sep2)) < 0) {
+ warnx("Bad comparison `%s'", sep2);
+ return 0;
}
+ /* compare upper limit */
+ if (!deweycmp(version, op2, sep2+n))
+ return 0;
}
}
+
+ /* compare only pattern / lower limit */
+ if (sep2) {
+ char ver[PKG_PATTERN_MAX];
+
+ strlcpy(ver, sep, MIN(sizeof(ver), sep2-sep+1));
+ if (deweycmp(version, op, ver))
+ return 1;
+ }
+ else {
+ if (deweycmp(version, op, sep))
+ return 1;
+ }
+
return 0;
}
diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h
index c14716ea1b7..0bc97cc741b 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.44 2005/05/29 19:20:53 minskim Exp $ */
+/* $NetBSD: version.h,v 1.45 2005/05/30 13:23:32 wiz 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 "20050529"
+#define PKGTOOLS_VERSION "20050530"
#endif /* _INST_LIB_VERSION_H_ */
diff --git a/pkgtools/pkg_install/files/view/pkg_view.1 b/pkgtools/pkg_install/files/view/pkg_view.1
index 5ca4e982fd3..7c6869a50ba 100644
--- a/pkgtools/pkg_install/files/view/pkg_view.1
+++ b/pkgtools/pkg_install/files/view/pkg_view.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: pkg_view.1,v 1.9 2005/02/04 01:19:04 jlam Exp $
+.\" $NetBSD: pkg_view.1,v 1.10 2005/05/30 13:23:32 wiz Exp $
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -62,7 +62,9 @@ directory.
Since the
.Nm
command may execute scripts or programs provided by a package file,
-your system may be susceptible to ``Trojan horses'' or other subtle
+your system may be susceptible to
+.Dq Trojan horses
+or other subtle
attacks from miscreants who create dangerous package files.
.Pp
You are advised to verify the competence and identity of those who
diff --git a/pkgtools/pkg_install/files/view/pkg_view.cat1 b/pkgtools/pkg_install/files/view/pkg_view.cat1
index c64f82ff97c..2a036988de1 100644
--- a/pkgtools/pkg_install/files/view/pkg_view.cat1
+++ b/pkgtools/pkg_install/files/view/pkg_view.cat1
@@ -1,7 +1,7 @@
PKG_VIEW(1) NetBSD General Commands Manual PKG_VIEW(1)
NNAAMMEE
- ppkkgg__vviieeww - add and delete instances of depoted packages in views
+ ppkkgg__vviieeww -- add and delete instances of depoted packages in views
SSYYNNOOPPSSIISS
ppkkgg__vviieeww [--nnVVvv] [--dd _s_t_o_w_d_i_r] [--ii _i_g_n_o_r_e] [--kk _p_k_g___d_b_d_i_r] [--WW _v_i_e_w_b_a_s_e]
@@ -141,4 +141,4 @@ SSEEEE AALLSSOO
AAUUTTHHOORRSS
The ppkkgg__vviieeww utility was written by Alistair G. Crooks <agc@NetBSD.org>.
-NetBSD 2.0 September 8, 2003 NetBSD 2.0
+NetBSD 3.0 September 8, 2003 NetBSD 3.0