From ab8f8f2ea135b48143c67dd5ae965c66fbd323df Mon Sep 17 00:00:00 2001 From: grant Date: Thu, 10 Feb 2005 23:51:18 +0000 Subject: pull in binary pkg handling changes from src: rework pkg_info(8) operating on binary packages, deprecating the `-.' argument as it is no longer required (but is retained as a no-op for backward compatibility). the behaviour is now what is expected and intended: - when the pkg argument is path (absolute or relative) to a binary pkg, pkg_info operates on it. - when no pkg argument is given, or the argument is not a binary pkg path, pkg_info operates on the installed packages. `pkg_info foo-1.0.tgz', `pkg_info /path/to/foo-1.0.tgz', etc. now work correctly when foo-1.0.tgz is in the cwd. bump PKGTOOLS_VERSION to 20050210. --- pkgtools/pkg_install/files/info/info.h | 3 +-- pkgtools/pkg_install/files/info/main.c | 10 ++++------ pkgtools/pkg_install/files/info/perform.c | 20 ++++---------------- pkgtools/pkg_install/files/info/pkg_info.1 | 8 +++----- pkgtools/pkg_install/files/lib/version.h | 4 ++-- 5 files changed, 14 insertions(+), 31 deletions(-) (limited to 'pkgtools') diff --git a/pkgtools/pkg_install/files/info/info.h b/pkgtools/pkg_install/files/info/info.h index 21baee0d985..15a4d61fb07 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.6 2004/08/20 20:09:53 jlam Exp $ */ +/* $NetBSD: info.h,v 1.7 2005/02/10 23:51:18 grant Exp $ */ /* from FreeBSD Id: info.h,v 1.10 1997/02/22 16:09:40 peter Exp */ @@ -64,7 +64,6 @@ extern size_t PlayPenSize; extern char *CheckPkg; extern size_t termwidth; extern lpkg_head_t pkgs; -extern int usedot; extern void show_file(char *, char *); extern void show_var(const char *, const char *); diff --git a/pkgtools/pkg_install/files/info/main.c b/pkgtools/pkg_install/files/info/main.c index 433bdb8b691..729b16dff01 100644 --- a/pkgtools/pkg_install/files/info/main.c +++ b/pkgtools/pkg_install/files/info/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.12 2004/12/29 12:16:56 agc Exp $ */ +/* $NetBSD: main.c,v 1.13 2005/02/10 23:51:18 grant Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -11,7 +11,7 @@ #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.12 2004/12/29 12:16:56 agc Exp $"); +__RCSID("$NetBSD: main.c,v 1.13 2005/02/10 23:51:18 grant Exp $"); #endif #endif @@ -63,13 +63,12 @@ size_t PlayPenSize = sizeof(PlayPen); char *CheckPkg = NULL; size_t termwidth = 0; lpkg_head_t pkgs; -int usedot; static void usage(void) { fprintf(stderr, "%s\n%s\n%s\n%s\n", - "usage: pkg_info [-.BbcDdFfhIikLmNnpqRrSsVv] [-e package] [-K pkg_dbdir] [-l prefix]", + "usage: pkg_info [-BbcDdFfhIikLmNnpqRrSsVv] [-e package] [-K pkg_dbdir] [-l prefix]", " pkg-name [pkg-name ...]", " pkg_info -a [flags]", " pkg_info -Q variable pkg-name [pkg-name ...]"); @@ -86,8 +85,7 @@ main(int argc, char **argv) setprogname(argv[0]); while ((ch = getopt(argc, argv, Options)) != -1) switch (ch) { - case '.': - usedot = 1; + case '.': /* for backward compatibility */ break; case 'a': diff --git a/pkgtools/pkg_install/files/info/perform.c b/pkgtools/pkg_install/files/info/perform.c index 34b3d40336a..b023a19e93b 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.19 2005/02/04 01:19:04 jlam Exp $ */ +/* $NetBSD: perform.c,v 1.20 2005/02/10 23:51:18 grant 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.19 2005/02/04 01:19:04 jlam Exp $"); +__RCSID("$NetBSD: perform.c,v 1.20 2005/02/10 23:51:18 grant Exp $"); #endif #endif @@ -76,7 +76,7 @@ pkg_do(char *pkg) strlcpy(fname, cp, sizeof(fname)); isTMP = TRUE; } - } else if (usedot && fexists(pkg) && isfile(pkg)) { + } else if (fexists(pkg) && isfile(pkg)) { int len; if (*pkg != '/') { @@ -90,10 +90,6 @@ pkg_do(char *pkg) strlcpy(fname, pkg, sizeof(fname)); } cp = fname; - } else if (usedot) { - if ((cp = fileFindByPath(pkg)) != NULL) { - strncpy(fname, cp, MaxPathSize); - } } if (cp) { @@ -113,13 +109,6 @@ pkg_do(char *pkg) } strcpy(PlayPen, cp2); } else { - if (!usedot) { - /* only recognise a local uninstalled package if usedot was given */ - warnx("can't find package file '%s'", fname); - code = 1; - goto bail; - } - /* * Apply a crude heuristic to see how much space the package will * take up once it's unpacked. I've noticed that most packages @@ -179,8 +168,7 @@ pkg_do(char *pkg) } /* No match */ - warnx("can't find package `%s' installed%s!", pkg, - usedot ? " or in a file" : ""); + warnx("can't find package `%s'", pkg); return 1; } if (chdir(log_dir) == FAIL) { diff --git a/pkgtools/pkg_install/files/info/pkg_info.1 b/pkgtools/pkg_install/files/info/pkg_info.1 index 73963af6700..b57f15be500 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.14 2004/11/10 17:50:10 agc Exp $ +.\" $NetBSD: pkg_info.1,v 1.15 2005/02/10 23:51:18 grant Exp $ .\" .\" FreeBSD install - a package for the installation and maintenance .\" of non-core utilities. @@ -17,7 +17,7 @@ .\" .\" @(#)pkg_info.1 .\" -.Dd November 10, 2004 +.Dd February 10, 2005 .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 .BbcDdFfhIikLmNnpqRrSsVv +.Op Fl BbcDdFfhIikLmNnpqRrSsVv .Bk -words .Op Fl e Ar package .Ek @@ -67,8 +67,6 @@ is also given), or a URL to an ftp-available package. .Pp The following command-line options are supported: .Bl -tag -width indent -.It Fl . -Recognise uninstalled binary packages in the current working directory. .It Fl a Show information for all currently installed packages. .It Fl B diff --git a/pkgtools/pkg_install/files/lib/version.h b/pkgtools/pkg_install/files/lib/version.h index 67bea6f9102..8be5702f0ea 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.40 2005/02/04 09:10:13 jlam Exp $ */ +/* $NetBSD: version.h,v 1.41 2005/02/10 23:51:18 grant 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 "20050204" +#define PKGTOOLS_VERSION "20050210" #endif /* _INST_LIB_VERSION_H_ */ -- cgit v1.2.3