mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 08:52:07 +01:00
Add "-o" option to pkg_create(1) and pkg_info(1). This option intended to record
a path of the port from which package has been created within FreeBSD Ports Collection and will be used to improve pkg_version(1) and similar tools. Reviewed by: ports@FreeBSD.org, jkh Approved by: jkh
This commit is contained in:
parent
2159c8905f
commit
dd2b039a87
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=67454
@ -37,6 +37,7 @@ extern char *SrcDir;
|
||||
extern char *ExcludeFrom;
|
||||
extern char *Mtree;
|
||||
extern char *Pkgdeps;
|
||||
extern char *Origin;
|
||||
extern char PlayPen[];
|
||||
extern int Dereference;
|
||||
extern int PlistOnly;
|
||||
|
@ -18,7 +18,7 @@ static const char rcsid[] =
|
||||
#include "lib.h"
|
||||
#include "create.h"
|
||||
|
||||
static char Options[] = "YNOhvf:p:P:c:d:i:I:k:K:r:t:X:D:m:s:";
|
||||
static char Options[] = "YNOhvf:p:P:c:d:i:I:k:K:r:t:X:D:m:s:o:";
|
||||
|
||||
char *Prefix = NULL;
|
||||
char *Comment = NULL;
|
||||
@ -34,6 +34,7 @@ char *Require = NULL;
|
||||
char *ExcludeFrom = NULL;
|
||||
char *Mtree = NULL;
|
||||
char *Pkgdeps = NULL;
|
||||
char *Origin = NULL;
|
||||
char PlayPen[FILENAME_MAX];
|
||||
int Dereference = 0;
|
||||
int PlistOnly = 0;
|
||||
@ -129,6 +130,10 @@ main(int argc, char **argv)
|
||||
Pkgdeps = optarg;
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
Origin = optarg;
|
||||
break;
|
||||
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
@ -165,7 +170,7 @@ usage()
|
||||
"usage: pkg_create [-YNOhv] [-P pkgs] [-p prefix] [-f contents] [-i iscript]",
|
||||
" [-I piscript] [-k dscript] [-K pdscript] [-r rscript] ",
|
||||
" [-t template] [-X excludefile] [-D displayfile] ",
|
||||
" [-m mtreefile] -c comment -d description -f packlist ",
|
||||
" pkg-name");
|
||||
" [-m mtreefile] [-o origin] -c comment -d description ",
|
||||
" -f packlist pkg-name");
|
||||
exit(1);
|
||||
}
|
||||
|
@ -85,6 +85,10 @@ pkg_perform(char **pkgs)
|
||||
else
|
||||
suf = "tar";
|
||||
|
||||
/* Add the origin if asked, at the top */
|
||||
if (Origin)
|
||||
add_plist(&plist, PLIST_COMMENT, strconcat("ORIGIN:", Origin));
|
||||
|
||||
/* Stick the dependencies, if any, at the top */
|
||||
if (Pkgdeps) {
|
||||
if (Verbose && !PlistOnly)
|
||||
@ -92,7 +96,7 @@ pkg_perform(char **pkgs)
|
||||
while (Pkgdeps) {
|
||||
cp = strsep(&Pkgdeps, " \t\n");
|
||||
if (*cp) {
|
||||
add_plist(&plist, PLIST_PKGDEP, cp);
|
||||
add_plist_top(&plist, PLIST_PKGDEP, cp);
|
||||
if (Verbose && !PlistOnly)
|
||||
printf(" %s", cp);
|
||||
}
|
||||
|
@ -45,6 +45,7 @@
|
||||
.Op Fl X Ar excludefile
|
||||
.Op Fl D Ar displayfile
|
||||
.Op Fl m Ar mtreefile
|
||||
.Op Fl o Ar originpath
|
||||
.Fl c Ar comment
|
||||
.Fl d Ar description
|
||||
.Fl f Ar packlist
|
||||
@ -243,6 +244,13 @@ where
|
||||
is the name of the first directory named by a
|
||||
.Cm @cwd
|
||||
directive.
|
||||
.It Fl o Ar originpath
|
||||
Record an
|
||||
.Ar originpath ,
|
||||
as location of the port from which package has been created in the
|
||||
.Em "FreeBSD Ports Collection" .
|
||||
It should be in the form
|
||||
.Pa MASTERCATEGORY/PORTDIR .
|
||||
.El
|
||||
.Pp
|
||||
.Sh PACKING LIST DETAILS
|
||||
|
@ -44,6 +44,7 @@
|
||||
#define SHOW_REQBY 0x0400
|
||||
#define SHOW_MTREE 0x0800
|
||||
#define SHOW_SIZE 0x1000
|
||||
#define SHOW_ORIGIN 0x2000
|
||||
|
||||
extern int Flags;
|
||||
extern Boolean AllInstalled;
|
||||
@ -57,5 +58,6 @@ extern void show_plist(char *, Package *, plist_t);
|
||||
extern void show_files(char *, Package *);
|
||||
extern void show_index(char *, char *);
|
||||
extern void show_size(char *, Package *);
|
||||
extern void show_origin(char *, Package *);
|
||||
|
||||
#endif /* _INST_INFO_H_INCLUDE */
|
||||
|
@ -28,7 +28,7 @@ static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif
|
||||
|
||||
static char Options[] = "acdDe:fhiIkl:LmpqrRst:v";
|
||||
static char Options[] = "acdDe:fhiIkl:LmopqrRst:v";
|
||||
|
||||
int Flags = 0;
|
||||
Boolean AllInstalled = FALSE;
|
||||
@ -116,6 +116,10 @@ main(int argc, char **argv)
|
||||
Flags |= SHOW_SIZE;
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
Flags |= SHOW_ORIGIN;
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
InfoPrefix = optarg;
|
||||
break;
|
||||
@ -175,7 +179,7 @@ static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n%s\n",
|
||||
"usage: pkg_info [-cdDfikrRpLqImv] [-e package] [-l prefix]",
|
||||
"usage: pkg_info [-cdDfikorRpLqImv] [-e package] [-l prefix]",
|
||||
" [-t template] [pkg-name ...]",
|
||||
" pkg_info -a [flags]");
|
||||
exit(1);
|
||||
|
@ -205,6 +205,8 @@ pkg_do(char *pkg)
|
||||
show_files("Files:\n", &plist);
|
||||
if ((Flags & SHOW_SIZE) && installed)
|
||||
show_size("Package Size:\n", &plist);
|
||||
if (Flags & SHOW_ORIGIN)
|
||||
show_origin("Origin:\n", &plist);
|
||||
if (!Quiet)
|
||||
puts(InfoPrefix);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@
|
||||
.Nd a utility for displaying information on software packages
|
||||
.Sh SYNOPSIS
|
||||
.Nm pkg_info
|
||||
.Op Fl cdDfikrRpLsqImv
|
||||
.Op Fl cdDfikorRpLsqImv
|
||||
.Op Fl e Ar package
|
||||
.Op Fl l Ar prefix
|
||||
.Op Fl t Ar template
|
||||
@ -88,6 +88,13 @@ viewing the packing list, since full pathnames for everything
|
||||
are generated.
|
||||
.It Fl s
|
||||
Show the total size occupied by files installed within each package.
|
||||
.It Fl o
|
||||
Show the
|
||||
.Dq origin
|
||||
path recorded on package generation. This path
|
||||
intended to give an idea as to where the underlying port, from which
|
||||
package was generated, is located in the
|
||||
.Em "FreeBSD Ports Collection" .
|
||||
.It Fl e Ar pkg-name
|
||||
If the package identified by
|
||||
.Ar pkg-name
|
||||
|
@ -256,3 +256,18 @@ show_size(char *title, Package *plist)
|
||||
else
|
||||
printf("%lu\n", size);
|
||||
}
|
||||
|
||||
/* Show an "origin" path (usually category/portname) */
|
||||
void
|
||||
show_origin(char *title, Package *plist)
|
||||
{
|
||||
PackingList p;
|
||||
|
||||
if (!Quiet)
|
||||
printf("%s%s", InfoPrefix, title);
|
||||
for (p = plist->head; p != NULL; p = p->next)
|
||||
if (p->type == PLIST_COMMENT && !strncmp(p->name, "ORIGIN:", 7)) {
|
||||
printf("%s\n", p->name + 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user