Synchronize pkg_install with HEAD (20080530)

r179352,179366: don't regenerate packages
    r179433: add long options
This commit is contained in:
flz 2008-06-10 09:56:11 +00:00
parent b48e5c9549
commit dc58ca5a99
15 changed files with 244 additions and 101 deletions

View File

@ -21,14 +21,14 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <err.h>
#include <sys/param.h>
#include <sys/utsname.h>
#include <err.h>
#include <getopt.h>
#include "lib.h"
#include "add.h"
static char Options[] = "hviIRfFnrp:P:SMt:C:K";
char *Prefix = NULL;
Boolean PrefixRecursive = FALSE;
char *Chroot = NULL;
@ -95,6 +95,25 @@ int getosreldate(void);
static void usage(void);
static char opts[] = "hviIRfFnrp:P:SMt:C:K";
static struct option longopts[] = {
{ "chroot", required_argument, NULL, 'C' },
{ "dry-run", no_argument, NULL, 'n' },
{ "force", no_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ "keep", no_argument, NULL, 'K' },
{ "master", no_argument, NULL, 'M' },
{ "no-deps", no_argument, NULL, 'i' },
{ "no-record", no_argument, NULL, 'R' },
{ "no-script", no_argument, NULL, 'I' },
{ "prefix", required_argument, NULL, 'p' },
{ "remote", no_argument, NULL, 'r' },
{ "template", required_argument, NULL, 't' },
{ "slave", no_argument, NULL, 'S' },
{ "verbose", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
int
main(int argc, char **argv)
{
@ -110,7 +129,7 @@ main(int argc, char **argv)
PkgAddCmd = argv[0];
start = argv;
while ((ch = getopt(argc, argv, Options)) != -1) {
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch(ch) {
case 'v':
Verbose++;
@ -170,12 +189,12 @@ main(int argc, char **argv)
case 'C':
Chroot = optarg;
break;
case 'i':
IgnoreDeps = TRUE;
break;
case 'h':
case '?':
default:
usage();
break;

View File

@ -15,7 +15,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 29, 2007
.Dd May 30, 2008
.Dt PKG_ADD 1
.Os
.Sh NAME
@ -81,31 +81,31 @@ working directory,
.Nm
will search them in each directory named by
.Ev PKG_PATH .
.It Fl v
.It Fl v , -verbose
Turn on verbose output.
.It Fl K
.It Fl K , -keep
Keep any downloaded package in
.Ev PKGDIR
if it is defined or in current directory by default.
.It Fl i
.It Fl i , -no-deps
Install the package without fetching and installing
dependencies.
.It Fl I
.It Fl I , -no-scripts
If any installation scripts (pre-install or post-install) exist for a given
package, do not execute them.
.It Fl n
.It Fl n , -dry-run
Do not actually install a package, just report the steps that
would be taken if it was.
.It Fl R
.It Fl R , -no-record
Do not record the installation of a package.
This means
that you cannot deinstall it later, so only use this option if
you know what you are doing!
.It Fl r
.It Fl r , -remote
Use the remote fetching feature.
This will determine the appropriate
objformat and release and then fetch and install the package.
.It Fl f
.It Fl f , -force
Force installation to proceed even if prerequisite packages are not
installed or the requirements script fails.
Although
@ -114,7 +114,7 @@ will still try to find and auto-install missing prerequisite packages,
a failure to find one will not be fatal.
.It Fl F
Already installed packages are not an error.
.It Fl p Ar prefix
.It Fl p , -prefix Ar prefix
Set
.Ar prefix
as the directory in which to extract files from a package.
@ -162,7 +162,7 @@ flag on the command line, it overrides its effect, causing
to use the given
.Ar prefix
recursively.
.It Fl t Ar template
.It Fl t , -template Ar template
Use
.Ar template
as the input to
@ -185,7 +185,7 @@ You can get a performance boost by setting the staging area
to reside on the same disk partition as target directories for package
file installation; often this is
.Pa /usr .
.It Fl M
.It Fl M , -master
Run in
.Cm MASTER
mode.
@ -207,7 +207,7 @@ When used in conjunction with
.Cm SLAVE
mode, it allows you to make radical changes to the package structure
before acting on its contents.
.It Fl S
.It Fl S , -slave
Run in
.Cm SLAVE
mode.
@ -223,7 +223,7 @@ in the staging area, the location of which is read as a string
from stdin.
The complete packing list is also read from stdin,
and the contents then acted on as normal.
.It Fl C Ar chrootdir
.It Fl C , -chroot Ar chrootdir
Before doing any operations,
.Xr chroot 2
to the

View File

@ -46,6 +46,7 @@ extern char PlayPen[];
extern int Dereference;
extern int PlistOnly;
extern int Recursive;
extern int Regenerate;
enum zipper {NONE, GZIP, BZIP, BZIP2 };
extern enum zipper Zipper;

View File

@ -12,12 +12,12 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <getopt.h>
#include <err.h>
#include "lib.h"
#include "create.h"
static char Options[] = "EGYNORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
match_t MatchType = MATCH_GLOB;
char *Prefix = NULL;
char *Comment = NULL;
@ -41,6 +41,8 @@ char PlayPen[FILENAME_MAX];
int Dereference = FALSE;
int PlistOnly = FALSE;
int Recursive = FALSE;
int Regenerate = TRUE;
int Help = FALSE;
#if defined(__FreeBSD_version) && __FreeBSD_version >= 500039
enum zipper Zipper = BZIP2;
#else
@ -50,6 +52,24 @@ enum zipper Zipper = GZIP;
static void usage(void);
static char opts[] = "EGYNnORhjvxyzf:p:P:C:c:d:i:I:k:K:r:t:X:D:m:s:S:o:b:";
static struct option longopts[] = {
{ "backup", required_argument, NULL, 'b' },
{ "extended", no_argument, NULL, 'E' },
{ "help", no_argument, &Help, TRUE },
{ "no", no_argument, NULL, 'N' },
{ "no-glob", no_argument, NULL, 'G' },
{ "origin", required_argument, NULL, 'o' },
{ "plist-only", no_argument, NULL, 'O' },
{ "prefix", required_argument, NULL, 'p' },
{ "recursive", no_argument, NULL, 'R' },
{ "regex", no_argument, NULL, 'x' },
{ "template", required_argument, NULL, 't' },
{ "verbose", no_argument, NULL, 'v' },
{ "yes", no_argument, NULL, 'Y' },
{ NULL, 0, NULL, 0 },
};
int
main(int argc, char **argv)
{
@ -57,7 +77,7 @@ main(int argc, char **argv)
char **pkgs, **start, *tmp;
pkgs = start = argv;
while ((ch = getopt(argc, argv, Options)) != -1)
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
switch(ch) {
case 'v':
Verbose++;
@ -192,7 +212,11 @@ main(int argc, char **argv)
Recursive = TRUE;
break;
case '?':
case 0:
if (Help)
usage();
break;
default:
usage();
break;
@ -228,12 +252,12 @@ static void
usage()
{
fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n%s\n%s\n",
"usage: pkg_create [-YNOhjvyz] [-C conflicts] [-P pkgs] [-p prefix]",
"usage: pkg_create [-YNOhjnvyz] [-C conflicts] [-P pkgs] [-p prefix]",
" [-i iscript] [-I piscript] [-k dscript] [-K pdscript]",
" [-r rscript] [-s srcdir] [-S basedir]",
" [-t template] [-X excludefile]",
" [-D displayfile] [-m mtreefile] [-o originpath]",
" -c comment -d description -f packlist pkg-filename",
" pkg_create [-EGYNRhvxy] -b pkg-name [pkg-filename]");
" pkg_create [-EGYNRhnvxy] -b pkg-name [pkg-filename]");
exit(1);
}

View File

@ -28,6 +28,8 @@ __FBSDID("$FreeBSD$");
#include <libgen.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/syslimits.h>
#include <sys/wait.h>
#include <unistd.h>
@ -336,6 +338,7 @@ pkg_perform(char **pkgs)
static void
make_dist(const char *homedir, const char *pkg, const char *suff, Package *plist)
{
struct stat sb;
char tball[FILENAME_MAX];
PackingList p;
int ret;
@ -355,6 +358,16 @@ make_dist(const char *homedir, const char *pkg, const char *suff, Package *plist
else
snprintf(tball, FILENAME_MAX, "%s/%s.%s", homedir, pkg, suff);
/*
* If the package tarball exists already, and we are running in `no
* clobber' mode, skip this package.
*/
if (stat(tball, &sb) == 0 && Regenerate == FALSE) {
if (Verbose)
printf("Skipping package '%s'. It already exists.\n", tball);
return;
}
args[nargs++] = "-c";
args[nargs++] = "-f";
args[nargs++] = tball;

View File

@ -23,7 +23,7 @@
.\" [jkh] Took John's changes back and made some additional extensions for
.\" better integration with FreeBSD's new ports collection.
.\"
.Dd November 8, 2005
.Dd May 30, 2008
.Dt PKG_CREATE 1
.Os
.Sh NAME
@ -31,7 +31,7 @@
.Nd a utility for creating software package distributions
.Sh SYNOPSIS
.Nm
.Op Fl YNOhjvyz
.Op Fl YNOhjnvyz
.Op Fl C Ar conflicts
.Op Fl P Ar pkgs
.Op Fl p Ar prefix
@ -52,7 +52,7 @@
.Fl f Ar packlist
.Ar pkg-filename
.Nm
.Op Fl EGYNRhvxy
.Op Fl EGYNRhnvxy
.Fl b Ar pkg-name
.Op Ar pkg-filename
.Sh DESCRIPTION
@ -103,11 +103,11 @@ Fetch long description for package from file
or, if preceded by
.Cm - ,
the argument itself.
.It Fl Y
.It Fl Y , -yes
Assume a default answer of `Yes' for any questions asked.
.It Fl N
.It Fl N , -no
Assume a default answer of `No' for any questions asked.
.It Fl O
.It Fl O , -plist-only
Go into a `packing list Only' mode.
This is a custom hack for the
.Fx
@ -115,7 +115,7 @@ This is a custom hack for the
and is used to do `fake pkg_add' operations when a port is installed.
In such cases, it is necessary to know what the final, adjusted packing
list will look like.
.It Fl v
.It Fl v , -verbose
Turn on verbose output.
.It Fl h
Force tar to follow symbolic links, so that the files they point to
@ -179,7 +179,7 @@ recorded into the packing list along with the
using
.Cm @comment
directive.
.It Fl p Ar prefix
.It Fl p , -prefix Ar prefix
Set
.Ar prefix
as the initial directory
@ -243,7 +243,7 @@ during package creation.
will be prefixed to all
.Cm @cwd
during package creation.
.It Fl t Ar template
.It Fl t , -template Ar template
Use
.Ar template
as the input to
@ -296,7 +296,7 @@ where
is the name of the first directory named by a
.Cm @cwd
directive.
.It Fl o Ar originpath
.It Fl o , -origin Ar originpath
Record an
.Ar originpath ,
as location of the port from which package has been created in the
@ -325,7 +325,7 @@ Compatibility synonym for
Use
.Xr gzip 1
utility to compress package tarball.
.It Fl b Ar pkg-name
.It Fl b , -backup Ar pkg-name
Create package file from a locally installed package named
.Ar pkg-name .
If the
@ -334,22 +334,40 @@ is not specified, then resulting archive will be created in the
current directory and named
.Ar pkg-name
with an appropriate extraction suffix applied.
.It Fl R
.It Fl R , -recursive
When creating package file from a locally installed package
also create package files for all packages required by
.Ar pkg-name .
Resulting archive(s) will be created in the current directory
and named using name of the respective package with appropriate
extraction suffix applied.
.It Fl x
.It Fl x , -regex
Use basic regular expressions for
.Ar pkg-name .
.It Fl E
.It Fl E , -extended
Use extended (modern) regular expressions for
.Ar pkg-name .
.It Fl G
.It Fl G , -no-glob
Use exact matching for
.Ar pkg-name .
.It Fl n
Run in
.Dq no clobber
mode.
If a package tarball exists, the
.Nm
utility will not overwrite it.
This is useful, for example, when multiple packages are saved with
several consecutive runs of
.Nm
with the
.Fl Rb
options.
Saving common dependencies multiple times would do a lot of duplicate
work in this case.
The
.Fl n
option avoids repackaging common dependencies multiple times.
.El
.Sh PACKING LIST DETAILS
The

View File

@ -24,12 +24,12 @@ __FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/stat.h>
#include <getopt.h>
#include <err.h>
#include "lib.h"
#include "delete.h"
static char Options[] = "adDfGhinp:rvxX";
char *Prefix = NULL;
Boolean CleanDirs = FALSE;
Boolean Interactive = FALSE;
@ -39,6 +39,25 @@ match_t MatchType = MATCH_GLOB;
static void usage(void);
static char opts[] = "adDfGhinp:rvxX";
static struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
{ "clean-dirs", no_argument, NULL, 'd' },
{ "dry-run", no_argument, NULL, 'n' },
{ "extended", no_argument, NULL, 'X' },
{ "force", no_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ "interactive",no_argument, NULL, 'i' },
{ "prefix", required_argument, NULL, 'p' },
{ "recursive", no_argument, NULL, 'r' },
{ "regex", no_argument, NULL, 'x' },
{ "no-glob", no_argument, NULL, 'G' },
{ "no-script", no_argument, NULL, 'D' },
{ "no-scripts", no_argument, NULL, 'D' },
{ "verbose", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 },
};
int
main(int argc, char **argv)
{
@ -49,7 +68,7 @@ main(int argc, char **argv)
struct stat stat_s;
pkgs = start = argv;
while ((ch = getopt(argc, argv, Options)) != -1)
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1)
switch(ch) {
case 'v':
Verbose++;
@ -101,7 +120,6 @@ main(int argc, char **argv)
break;
case 'h':
case '?':
default:
usage();
break;

View File

@ -17,7 +17,7 @@
.\" @(#)pkg_delete.1
.\" $FreeBSD$
.\"
.Dd June 29, 2004
.Dd May 30, 2008
.Dt PKG_DELETE 1
.Os
.Sh NAME
@ -72,20 +72,20 @@ The following command line options are supported:
.Bl -tag -width indent
.It Ar pkg-name ...
The named packages are deinstalled.
.It Fl a
.It Fl a , -all
Unconditionally delete all currently installed packages.
.It Fl i
.It Fl i , -interactive
Request confirmation before attempting to delete each package,
regardless whether or not the standard input device is a
terminal.
.It Fl v
.It Fl v , -verbose
Turn on verbose output.
.It Fl D
.It Fl D , -no-script , -no-scripts
If a deinstallation script exists for a given package, do not execute it.
.It Fl n
.It Fl n , -dry-run
Do not actually deinstall a package, just report the steps that
would be taken if it were.
.It Fl p Ar prefix
.It Fl p , -prefix Ar prefix
Set
.Ar prefix
as the directory in which to delete files from any installed packages
@ -93,7 +93,7 @@ which do not explicitly set theirs.
For most packages, the prefix will
be set automatically to the installed location by
.Xr pkg_add 1 .
.It Fl d
.It Fl d , -clean-dirs
Remove empty directories created by file cleanup.
By default, only
files/directories explicitly listed in a package's contents (either as
@ -104,17 +104,17 @@ This option tells
.Nm
to also remove any directories that were emptied as a result of removing
the package.
.It Fl f
.It Fl f , -force
Force removal of the package, even if a dependency is recorded or the
deinstall or require script fails.
.It Fl G
.It Fl G , -no-glob
Do not try to expand shell glob patterns in the
.Ar pkg-name
when selecting packages to be deleted (by default
.Nm
automatically expands shell glob patterns in the
.Ar pkg-name ) .
.It Fl x
.It Fl x , -regex
Treat the
.Ar pkg-name
as a regular expression and delete all packages whose names match
@ -124,13 +124,13 @@ provided, in that case
.Nm
deletes all packages that match at least one
regular expression from the list.
.It Fl X
.It Fl X , -extended
Like
.Fl x ,
but treats the
.Ar pkg-name
as an extended regular expression.
.It Fl r
.It Fl r , -recursive
Recursive removal.
In addition to specified packages, delete all
packages that depend on those packages as well.

View File

@ -22,11 +22,11 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "lib.h"
#include "info.h"
#include <getopt.h>
#include <err.h>
static char Options[] = "abcdDe:EfgGhiIjkKl:LmoO:pPqQrRst:vVW:xX";
#include "lib.h"
#include "info.h"
int Flags = 0;
match_t MatchType = MATCH_GLOB;
@ -41,6 +41,25 @@ struct which_head *whead;
static void usage(void);
static char opts[] = "abcdDe:EfgGhiIjkKl:LmoO:pPqQrRst:vVW:xX";
static struct option longopts[] = {
{ "all", no_argument, NULL, 'a' },
{ "blocksize", no_argument, NULL, 'b' },
{ "exist", required_argument, NULL, 'X' },
{ "exists", required_argument, NULL, 'X' },
{ "extended", no_argument, NULL, 'e' },
{ "help", no_argument, NULL, 'h' },
{ "keep", no_argument, NULL, 'K' },
{ "no-glob", no_argument, NULL, 'G' },
{ "origin", required_argument, NULL, 'O' },
{ "quiet", no_argument, NULL, 'q' },
{ "regex", no_argument, NULL, 'x' },
{ "template", required_argument, NULL, 't' },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'P' },
{ "which", required_argument, NULL, 'W' },
};
int
main(int argc, char **argv)
{
@ -58,7 +77,7 @@ main(int argc, char **argv)
MatchType = MATCH_ALL;
Flags = SHOW_INDEX;
}
else while ((ch = getopt(argc, argv, Options)) != -1) {
else while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch(ch) {
case 'a':
MatchType = MATCH_ALL;
@ -209,7 +228,6 @@ main(int argc, char **argv)
break;
case 'h':
case '?':
default:
usage();
break;

View File

@ -17,7 +17,7 @@
.\" @(#)pkg_info.1
.\" $FreeBSD$
.\"
.Dd January 9, 2006
.Dd May 30, 2008
.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 bcdDEfgGiIjkKLmopPqQrRsvVxX
.Op Fl bcdDEfghGiIjkKLmopPqQrRsvVxX
.Op Fl e Ar package
.Op Fl l Ar prefix
.Op Fl t Ar template
@ -67,9 +67,9 @@ For example,
will match versions 20030723 and later of the
.Pa portupgrade
package.
.It Fl a
.It Fl a , -all
Show all currently installed packages.
.It Fl b
.It Fl b , -blocksize
Use the
.Ev BLOCKSIZE
environment variable for output even when the
@ -77,11 +77,13 @@ environment variable for output even when the
or
.Fl Q
flag is present.
.It Fl v
.It Fl h , -help
Print help message.
.It Fl v , -verbose
Turn on verbose output.
.It Fl p
Show the installation prefix for each package.
.It Fl q
.It Fl q , -quiet
Be
.Dq quiet
in emitting report headers and such, just dump the
@ -110,7 +112,7 @@ precedence over all other package formatting options.
Show the requirements script (if any) for each package.
.It Fl k
Show the de-install script (if any) for each package.
.It Fl K
.It Fl K , -keep
Keep any downloaded package in
.Ev PKGDIR
if it is defined or in current directory by default.
@ -139,14 +141,14 @@ This path is the directory name in the
.Fx
.Em "Ports Collection"
of the underlying port from which the package was generated.
.It Fl G
.It Fl G , -no-glob
Do not try to expand shell glob patterns in the
.Ar pkg-name
when selecting packages to be displayed (by default
.Nm
automatically expands shell glob patterns in the
.Ar pkg-name ) .
.It Fl W Ar filename
.It Fl W , -which Ar filename
For the specified
.Ar filename
argument show which package it belongs to.
@ -156,10 +158,10 @@ directories specified in the environment variable
.Ev PATH
are searched using
.Xr which 1 .
.It Fl O Ar origin
.It Fl O , -origin Ar origin
List all packages having the specified
.Ar origin .
.It Fl x
.It Fl x , -regex
Treat the
.Ar pkg-name
as a regular expression and display information only for packages
@ -169,13 +171,13 @@ expressions could be provided, in that case
.Nm
displays information about all packages that match at least one
regular expression from the list.
.It Fl X
.It Fl X , -extended
Like
.Fl x ,
but treats the
.Ar pkg-name
as an extended regular expression.
.It Fl e Ar package
.It Fl e , -exists Ar package
If the package identified by
.Ar package
is currently installed, return 0, otherwise return 1.
@ -198,7 +200,7 @@ necessarily want the output intermingled in such a way that they cannot
organize it.
This lets you add a special token to the start of
each field.
.It Fl t Ar template
.It Fl t , -template Ar template
Use
.Ar template
as the argument to
@ -226,7 +228,7 @@ indeed to overflow it.
.Ed
.It Fl V
Show revision number of the packing list format.
.It Fl P
.It Fl P , -version
Show revision number of package tools.
.El
.Sh TECHNICAL DETAILS

View File

@ -105,7 +105,7 @@
* Version of the package tools - increase only when some
* functionality used by bsd.port.mk is changed, added or removed
*/
#define PKG_INSTALL_VERSION 20040629
#define PKG_INSTALL_VERSION 20080530
#define PKG_WRAPCONF_FNAME "/var/db/pkg_install.conf"
#define main(argc, argv) real_main(argc, argv)

View File

@ -13,6 +13,7 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <limits.h>
#include <sysexits.h>
#include <getopt.h>
#include "lib.h"
#include "pathnames.h"
@ -24,6 +25,14 @@ typedef struct installedport {
int usage(void);
static char opts[] = "d:f:h";
static struct option longopts[] = {
{ "date", required_argument, NULL, 'd' },
{ "file", required_argument, NULL, 'f' },
{ "help", no_argument, NULL, 'h' },
{ NULL, 0, NULL, 0 },
};
/*
* Parse /usr/port/UPDATING for corresponding entries. If no argument is
* passed to pkg_updating all entries for all installed ports are displayed.
@ -74,7 +83,7 @@ main(int argc, char *argv[])
DIR *dir;
FILE *fd;
while ((ch = getopt(argc, argv, "f:d:")) != -1) {
while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch (ch) {
case 'd':
dflag = 1;
@ -83,7 +92,7 @@ main(int argc, char *argv[])
case 'f':
updatingfile = optarg;
break;
case '?':
case 'h':
default:
usage();
}
@ -247,7 +256,7 @@ int
usage(void)
{
fprintf(stderr,
"usage: pkg_updating [-d YYYYMMDD] [-f file] [portname ...]\n");
"usage: pkg_updating [-h] [-d YYYYMMDD] [-f file] [portname ...]\n");
exit(EX_USAGE);
}

View File

@ -10,7 +10,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd November 2, 2007
.Dd May 30, 2008
.Dt PKG_UPDATING 1
.Os
.Sh NAME
@ -18,6 +18,7 @@
.Nd a utility for displaying UPDATING entries of software packages
.Sh SYNOPSIS
.Nm
.Op Fl h
.Op Fl d Ar date
.Op Fl f Ar file
.Op Ar pkg-name ...
@ -32,10 +33,15 @@ The following command line options are supported:
.Bl -tag -width indent
.It Ar pkg-name ...
UPDATING entries for the named packages are displayed.
.It Fl d Ar date
Only entries newer than this date are shown. Use a YYYYMMDD date format.
.It Fl f Ar UPDATING file
Defines a alternative location of the UPDATING file.
.It Fl d , -date Ar date
Only entries newer than
.Ar date
are shown. Use a YYYYMMDD date format.
.It Fl f , -file Ar file
Defines a alternative location of the UPDATING
.Ar file .
.It Fl h , -help
Print help message.
.El
.Sh EXAMPLES
.Bl -tag -width indent

View File

@ -21,11 +21,12 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include "lib.h"
#include "version.h"
#include <getopt.h>
#include <err.h>
static char Options[] = "dIhl:L:qs:XtTO:ov";
#include "lib.h"
#include "version.h"
char *LimitChars = NULL;
char *PreventChars = NULL;
@ -37,6 +38,21 @@ Boolean ShowOrigin = FALSE;
static void usage(void);
static char opts[] = "dIhl:L:qs:XtTO:ov";
static struct option longopts[] = {
{ "extended", no_argument, NULL, 'X' },
{ "help", no_argument, NULL, 'h' },
{ "match", required_argument, NULL, 's' },
{ "no-status", required_argument, NULL, 'L' },
{ "origin", required_argument, NULL, 'O' },
{ "quiet", no_argument, NULL, 'q' },
{ "show-origin",no_argument, NULL, 'o' },
{ "status", required_argument, NULL, 'l' },
{ "index-only", no_argument, NULL, 'I' },
{ "verbose", no_argument, NULL, 'v' },
{ NULL, 0, NULL, 0 }
};
int
main(int argc, char **argv)
{
@ -51,7 +67,7 @@ main(int argc, char **argv)
cmp = version_match(argv[3], argv[2]);
exit(cmp == 1 ? 0 : 1);
}
else while ((ch = getopt(argc, argv, Options)) != -1) {
else while ((ch = getopt_long(argc, argv, opts, longopts, NULL)) != -1) {
switch(ch) {
case 'v':
Verbose++;
@ -98,7 +114,6 @@ main(int argc, char **argv)
break;
case 'h':
case '?':
default:
usage();
break;

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd July 27, 2005
.Dd May 30, 2008
.Dt PKG_VERSION 1
.Os
.Sh NAME
@ -118,14 +118,14 @@ The
.Nm
utility supports several command-line arguments:
.Bl -tag -width indent
.It Fl h
.It Fl h , -help
Print help message.
.It Fl I
.It Fl I , -index-only
Use only the index file for determining if a package is out of date.
This is much faster than using the version number from a port's
Makefile, at the expense of potentially giving an incorrect result if
the index file is out of date.
.It Fl l
.It Fl l , -status Ar limchar
Limit the output to those packages whose status flag matches the
character(s) in
.Ar limchar .
@ -135,7 +135,7 @@ Note that because some of the status flag characters are also special
to the shell, it is best to quote
.Ar limchar
with single quotes.
.It Fl L
.It Fl L , -no-status Ar limchar
Limit the output to those packages whose status flag does not match
.Ar limchar .
You may specify more than one character to match in
@ -144,13 +144,13 @@ Note that because some of the status flag characters are also special
to the shell, it is best to quote
.Ar limchar
with single quotes.
.It Fl o
.It Fl o , -show-origin
Show the origin recorded on package generation instead of the package
name.
.It Fl O
.It Fl O , -origin Ar origin
Only list packages whose registered origin is
.Ar origin .
.It Fl q
.It Fl q , -quiet
Enable quiet output.
Quiet output precludes printing the
.Ar limchar
@ -160,10 +160,10 @@ or
.Fl L .
This is useful when used as the input to
.Xr portupgrade 8 .
.It Fl s
.It Fl s , -match Ar string
Limit the output to those packages whose names match a given
.Ar string .
.It Fl X
.It Fl X , -extended
Interpret
.Ar string
as a extended regular expression.