prt-auf: respect the --run-scripts flag

update the man-page
This commit is contained in:
John McQuah 2023-06-22 17:40:16 -04:00
parent 801587943d
commit 9d4f22e6d1
2 changed files with 169 additions and 123 deletions

View File

@ -81,38 +81,65 @@ non-option argument passed. This is very similar to
\fBsubcommand\fP can be one of the following: \fBsubcommand\fP can be one of the following:
.TP .TP
.B install [\-\-group] [\-fr] [\-\-margs=] [\-\-aargs=] <package1> [<package2> ...] .B install [\-\-group] [\-fr] [\-\-softdeps] [\-\-nodeps] [\-\-margs=] [\-\-aargs=] <package1> [<package2> ...]
install/update all packages in the order given, without resolving calculate the minimal set of packages needed to satisfy the dependencies of
dependencies. Pass the --group flag to abort the operation if any packages passed on the command line, and then proceed to install or
package fails. Pass the -fr flag to force a rebuild even if a package appears update each package in the (sorted) list. Pass the --group flag to abort the
up to date. operation if any package fails.
The --nodeps flag tells \fBprt\-auf\fP to leave the list of targets as-is,
without injecting or sorting by dependencies. The --softdeps flag tells
the sorting algorithm to also consider any optional dependency relationships
among the packages passed as argument (not injecting all possible optionals,
only the ones already installed or given on the command line). The default
behaviour is to inject (and sort by) hard dependencies only.
Pass the -fr flag to force a rebuild, even if a requested package appears
up to date. This flag will be inherited by all \fBpkgmk\fP processes. In
order not to tax your system resources unnecessarily, \fBprt\-auf\fP will
interpret the -fr flag to also imply --nodeps. You can pass --depsort
\fIafter\fP -fr, if you really want to force a rebuild of every package in
the dependency chain.
Normally \fBprt\-auf\fP will skip the compilation step and proceed straight
to \fBpkgadd(8)\fP if it finds an existing package (of the same version as
what's in the repository) in the expected location. This shortcut is taken
in case the user chose to run \fBpkgmk\fP manually, rather than as a child
process of \fBprt\-auf\fP. To avoid short-circuiting the rebuild on the next
run of \fBprt\-auf\fP (after a transaction that failed due to a footprint
mismatch), any built package with a mismatched footprint will be renamed with
the "CHECKME" suffix. You can inspect this built package using \fBpkginfo
-f\fP, and \fBpkgadd\fP it if the footprint mismatch is deemed
unproblematic.
.TP .TP
.B depinst [\-\-group] [\-fr] [\-\-softdeps] [\-\-margs=] [\-\-aargs=] <package1> [<package2> ...] .B depinst [\-\-group] [\-fr] [\-\-softdeps] [\-\-margs=] [\-\-aargs=] <package1> [<package2> ...]
calculate the minimal set of packages needed to satisfy the dependencies of essentially a synonym for \fBinstall\fP (without the --nodeps flag). Support
packages passed on the command line, and then run \fBinstall\fP on the for this subcommand is retained as a convenience for long-time prt-get
resulting list. Pass the --softdeps flag if you want optional dependencies to users, who might not be accustomed to the automatic dependency injection of
be considered when sorting the list of targets. The -fr flag (force rebuild) prt-auf. A helpful way to summarize this aspect of 'prt-auf install'
only applies to packages explicitly given on the command line; the --group is that prt-auf never "silently assumes the user didn't want a particular
flag applies to the entire set of targets calculated by the dependency dependency" [1]. The user has to actively turn off the dependency resolver
resolver. (using the --nodeps flag) in order to mimic the classic behaviour of prt-get.
[1] https://lists.crux.nu/pipermail/crux/2008-June/001784.html
.TP .TP
.B update [\-\-group] [\-fr] [\-\-margs=] [\-\-aargs=] <package1> [<package2> ...] .B update [\-\-group] [\-fr] [\-\-softdeps] [\-\-nodeps] [\-\-margs=] [\-\-aargs=] <package1> [<package2> ...]
essentially a synonym for \fBinstall\fP. Support for this subcommand is essentially a synonym for \fBinstall\fP. Support for this subcommand is
retained as a convenience for long-time prt-get users, who might not be retained as a convenience for long-time prt-get users, who might not be
accustomed to the mixed install/update mode of prt-auf. accustomed to the mixed install/update mode of prt-auf.
.TP .TP
.B remove [\-\-rargs=] <package1> [<package2> ...] .B remove [\-\-rargs=] <package1> [<package2> ...]
remove packages listed in this order. The only relevant option you might want remove packages listed in this order (and delete them from the lockfile, if
to pass to \fBpkgrm\fP(8) is --root (or -r), used when you're managing a CRUX locked). The only relevant option you might want to pass to \fBpkgrm\fP(8)
installation on a temporarily mounted filesystem. In order not to confuse the is --root (or -r), used when you're managing a CRUX installation on a
argument parser (which splits on whitespace), you should format such a request temporarily mounted filesystem. In order not to confuse the argument parser
as (which splits on whitespace), you should format such a request as
.B prt\-auf remove \-\-rargs=\-\-root=/path/to/mounted/crux <package1> [<package2> ...] .B prt\-auf remove \-\-rargs=\-\-root=/path/to/mounted/crux <package1> [<package2> ...]
and \fBprt\-auf\fP will clean up the -r switch so that \fBpkgrm\fP(8) does what and \fBprt\-auf\fP will clean up the -r switch so that \fBpkgrm\fP(8) does what
you want. you want. Even easier is to pass the --install-root option (see below).
.TP .TP
.B sysup [\-\-group] [\-\-softdeps] [\-\-test] .B sysup [\-\-group] [\-\-softdeps] [\-\-test]
@ -128,11 +155,11 @@ of targets.
.B lock <package1> [<package2>...] .B lock <package1> [<package2>...]
Exempt these packages from any subsequent Exempt these packages from any subsequent
.B sysup .B sysup
operation (i.e., keep them at their currently-installed version) operation (i.e., keep them at their currently-installed version).
.TP .TP
.B unlock <package1> [<package2>...] .B unlock <package1> [<package2>...]
Remove lock from these packages Remove lock from these packages.
.TP .TP
.B listlocked .B listlocked
@ -140,31 +167,37 @@ List names of packages which are locked.
.TP .TP
.B diff [\-\-all] .B diff [\-\-all]
Show differences between installed packages and ports in the ports Show differences between installed packages and versions available in the
tree. Locked packages are only displayed if you use the --all switch. active repositories.
Locked packages are only displayed if you use the --all switch.
.TP .TP
.B quickdiff .B quickdiff
Print a simple list of packages which have a different version in the Print a simple list of packages whose installed version differs from the
ports tree than what is installed. version available in the repositories.
.TP .TP
.B search [\-\-path] [\-\-regex] <expr> .B search [\-\-path] [\-\-regex] <expr>
Search the ports tree for Search the repositories for ports that contain
.B expr .B expr
in their name in their name.
.TP .TP
.B dsearch [\-\-path] [\-\-regex] <expr> .B dsearch [\-\-path] [\-\-regex] <expr>
Search the ports tree (both name and description) for the pattern Search the ports tree (both name and description) for the pattern
\fBexpr\fP. The search in the description is not case sensitive. Note that <expr>. The search in the description is not case sensitive. Note that
this requires prt\-auf to read every Pkgfile, which makes it rather slow; if this requires prt-auf to read every Pkgfile, which makes it rather slow; if
you like this, consider using the cache functionality, so you only have to you like searching by dependencies, consider using the cache functionality,
spend this time once after updating the ports tree has been updated. so you only have to recurse through the ports collections after each update
of the ports tree, not whenever you conduct a description search.
.TP .TP
.B fsearch [\-\-path] [\-\-regex] <pattern> .B fsearch [\-\-path] [\-\-regex] <pattern>
Search the ports tree for file names that match \fBpattern\fP. Search the repositories for ports whose footprints contain a match for
<pattern>. By default, the full path is tested against <pattern>, so if you
want to avoid spurious matches involving the parent directories, use --regex
with the end-of-line anchor ($) or the leading path separator (\e/)
delimiting the sought-after filename.
.SH "" .SH ""
@ -172,31 +205,28 @@ When using the --regex switch with 'search', 'dsearch', or 'fsearch',
\fIpattern\fP should be a Perl-compatible regular expression (e.g. prt-auf \fIpattern\fP should be a Perl-compatible regular expression (e.g. prt-auf
fsearch --regex 'liblz(o2|ma).*'). You can omit the --regex switch if your fsearch --regex 'liblz(o2|ma).*'). You can omit the --regex switch if your
search pattern contains no metacharacters (such as: +, *, ., / ). Shell search pattern contains no metacharacters (such as: +, *, ., / ). Shell
globbing (with the * and ? wildcards) is \fINOT\fP supported. The 'fsearch' globbing (with the * and ? wildcards) is \fINOT\fP supported.
action looks for matches against the full path, not just the filename, so if
you're looking for a filename that begins with 'liblz', you should use
'\\/liblz' rather than '^liblz'.
.TP .TP
.B info <port> .B info <port>
Print available info for a port Print available info for a port.
.TP .TP
.B path <port> .B path <port>
Print the path of a port Print the path of a port.
.TP .TP
.B readme <port> .B readme <port>
Print the port's README file if it exists Print the port's README file if it exists.
.SH "" .SH ""
The subcommands 'info', 'path', and 'readme' expect as their argument an exact The subcommands 'info', 'path', and 'readme' expect as their argument an exact
match for one of the ports in the active repositories. If you are not sure that match for one of the ports in the active repositories. If you are not sure that
a port by that name exists, you should first use 'search', 'dsearch', or 'fsearch' a port by that name exists, you should first use 'search', 'dsearch',
to generate a list of possible arguments. The info or readme will come from the or 'fsearch' to generate a list of possible arguments. The info or readme
highest-priority port in the active repositories (the same port that would be will come from the highest-priority port in the active repositories (the
built by an 'install' command). same port that would be built by an 'install' command).
.TP .TP
.B depends [\-\-softdeps] <package1> [<package2> ...] .B depends [\-\-softdeps] <package1> [<package2> ...]
@ -241,16 +271,16 @@ occurred.
.TP .TP
.B dependent [\-\-softdeps] [\-\-all] [\-\-recursive] [\-\-tree] <package> .B dependent [\-\-softdeps] [\-\-all] [\-\-recursive] [\-\-tree] <package>
Print a list of ports which have Print a list of ports whose "Depends on:" line contains
.B <package> .B <package>
in their "Depends on:" line. To also search the "Optional:" lines, pass the (or its dependents, if --recursive is given). To also search the "Optional:"
--softdeps flag. By default, output is restricted to ports that are installed. lines, pass the --softdeps flag. By default, output is restricted to ports
To see all the dependencies, add the --all switch; use --recursive to get a that are installed. To see all the dependencies, add the --all switch. Use
recursive list (without duplication), and --tree to get a nicely indented one. --tree to get a nicely indented list (similar to the 'deptree' subcommand).
.TP .TP
.B ls [--path] <port> .B ls [--path] <port>
Print out a listing of the port's directory Print out a listing of the port's directory.
.TP .TP
.B cat <port> [<file>] .B cat <port> [<file>]
@ -412,14 +442,16 @@ Show the current version of prt\-auf
.TP .TP
.B cache .B cache
Create a cache file from the ports tree, which will be used whenever \fBprt\-auf\fP Create a cache file from the ports tree, which will be used whenever
is invoked with the --cache option. Remember to run \fBprt\-auf cache\fP each time \fBprt\-auf\fP is invoked with the --cache option. Remember to run
you update the ports tree, or automate this step by appending a line to the \fBprt\-auf cache\fP each time you update the ports tree, or automate this
\fBports\fP(8) script. If you invoke \fBprt\-auf\fP from a symbolic link that ends step by appending a line to the \fBports\fP(8) script. If you invoke
in 'cache', \fBprt\-auf\fP will act as if it saw the --cache option on the command \fBprt\-auf\fP from a symbolic link that ends in 'cache', \fBprt\-auf\fP
line, so the symbolic link \fBprt\-cache\fP -> \fBprt\-auf\fP will save you the will act as if it saw the --cache option on the command line, so the
hassle of typing '--cache' each time. Cache files generated by \fBprt\-auf\fP are symbolic link \fBprt\-cache\fP -> \fBprt\-auf\fP will save you the hassle of
compatible with those generated by the equivalent version of \fBprt\-get\fP(8). typing '--cache' each time. Cache files generated by \fBprt\-auf\fP are
compatible with those generated by the equivalent version of
\fBprt\-get\fP(8).
.SH "OPTIONS" .SH "OPTIONS"
@ -433,7 +465,7 @@ be affected by the operation.
.TP .TP
.B \-fr .B \-fr
Force rebuild. Implies 'pkgmk -f'; same as --margs=-f Force rebuild. Implies 'pkgmk -f'; same as --margs=-f
.TP
In the most common uses of \fB\-fr\fP, it is not desired to rebuild all the In the most common uses of \fB\-fr\fP, it is not desired to rebuild all the
dependencies too, even the ones that are out of date. Hence the \fB\-fr\fP flag dependencies too, even the ones that are out of date. Hence the \fB\-fr\fP flag
will be interpreted to imply also \fB\-\-nodeps\fP. But you can override this will be interpreted to imply also \fB\-\-nodeps\fP. But you can override this
@ -474,58 +506,76 @@ Pass these additional arguments to pkgadd
.TP .TP
.B \-\-install\-root=<dir>, e.g. \-\-install\-root="/mnt" .B \-\-install\-root=<dir>, e.g. \-\-install\-root="/mnt"
Specify a mountpoint other than "/", where the built packages are to be Specify a mountpoint other than '/', where the built packages are to be
installed. This setting affects the package database that is subject to installed. This setting affects the package database that is subject to
read/write operations, but not the ports tree (which remains governed by read/write operations, but not the ports tree (which remains governed by
the prtdir directives in \fBprt-get.conf(5)\fP). the prtdir directives in \fBprt-get.conf(5)\fP).
Beware of combining \fB\-\-install\-root\fP with the Pre- and post-install scripts will not be executed if the requested
directive 'runscripts yes' in the configuration file. One side-effect of root directory lacks a copy of the ports tree. So if you're maintaining an
the naive attempt to reconcile this combination is that \fBprt\-auf\fP installation mounted somewhere different than '/', it's not enough to put
copies the pre- or post-install scripts into the ports tree under <dir>, the line 'runscripts yes' in your configuration file; you also have to
before running a \fBchroot(1)\fP command to launch the scripts. This ensure that the pre- and post-install scripts can be found in the same
workaround might inadvertently pollute <dir> with unwanted files, if the location relative to <dir>.
mountpoint did not already contain a copy of the ports tree. It is safer
to set 'runscripts no' in the configuration file, whenever you plan to
use an alternate root for installations.
.TP .TP
.B \-\-cache .B \-\-cache
Use cache file for this command Use cache file for this command
.TP
.B \-\-config=<file>
Read configuration directives from <file>, rather than \fI/etc/prt-get.conf\fP.
.TP
.B \-\-pre\-install, \-\-post\-install, \-\-run\-scripts
Execute pre-install, post-install, or both, if found in the port directory.
Each of these flags can be used as a one-time override of 'runscripts no' in
the configuration file. Basically equivalent to using --config=... with a
custom file that differs from your usual \fIprt-get.conf\fP only in
the 'runscripts' directive.
.SH "" .SH ""
The following options affect the output of non-install (information-seeking) transactions. The following options affect the output of non-install (information-seeking)
transactions.
.TP .TP
.B \-v, \-vv .B \-v, \-vv
(verbosity level) Show version of a port (\-v), or show both version (verbosity level) Show version of a port (-v), or show both version
and description (\-vv). Passing more than one of these options is equivalent to \-vv. and description (-vv). Passing more than one of these options is equivalent
to -vv.
.TP
.B \-\-filter=<pattern>
Restrict the output of a 'search' or 'list' command, showing only the ports
that match <pattern>. Basically a convenience for users who prefer not to
launch a separate process (awk or grep) to trim the search results.
.TP .TP
.B \-\-path .B \-\-path
Show path info for the ports found by a search or a dependency calculation Show path info for the ports found by a search or a dependency calculation.
.TP .TP
.B \-\-regex .B \-\-regex
Interpret filter and search pattern as regular expression Interpret filter and search pattern as regular expression.
.SH "CONFIGURATION" .SH "CONFIGURATION"
Most of the directives available in \fBprt\-get.conf(5)\fP are also recognized and Most of the directives available in \fBprt\-get.conf(5)\fP are also
respected by \fBprt\-auf\fP. Notably, you can specify the active port recognized and respected by \fBprt\-auf\fP. Notably, you can specify the
collections by ensuring that they appear on lines beginning with 'prtdir '. active port collections by ensuring that they appear on lines where 'prtdir'
You can also toggle the running of pre-/post-install scripts by editing the is the first non-whitespace string. You can also toggle the running of
line that contains 'runscripts'. You can specify alternatives to the pre-/post-install scripts by editing the line that contains 'runscripts'.
default pkgutils programs ( /usr/bin/pkgmk, /usr/bin/pkgadd, and You can specify alternatives to the default pkgutils programs (
/usr/bin/pkgrm ) by editing the lines for 'makecommand', 'addcommand', /usr/bin/pkgmk, /usr/bin/pkgadd, /usr/bin/pkgrm, /bin/sh ) by editing the lines
and 'removecommand', respectively. Lastly, you can control whether the pkgmk for 'makecommand', 'addcommand', 'removecommand', 'runscriptcommand',
output is saved in a log file, using the respectively. Lastly, you can control whether the pkgmk output is saved in a
directives 'writelog <enabled|disabled>', 'logmode <append|overwrite>', log file, using the directives 'writelog <enabled|disabled>', 'logmode
and 'logfile <path>'. The <path> in a 'logfile' directive can contain any of <append|overwrite>', and 'logfile <path>'. The <path> in a 'logfile'
the variables "%n", "%v", "%r", and "%p", which are automatically replaced by directive can contain any of the variables "%n", "%v", "%r", and "%p", which
the port's name, version, release, and full path in the ports tree, respectively. are automatically replaced by the port's name, version, release, and full
path in the ports tree, respectively.
.SH "TECHNICAL DETAILS" .SH "TECHNICAL DETAILS"
@ -548,7 +598,7 @@ variables are only initialized once the program knows the requested action.
After all the arguments are parsed (and screened for validity), the hash maps After all the arguments are parsed (and screened for validity), the hash maps
\fI%opkg\fP, \fI%odepends\fP, \fI%osearch\fP, and \fI%olog\fP will \fI%opkg\fP, \fI%odepends\fP, \fI%osearch\fP, and \fI%olog\fP will
retain in memory the user's desired settings. Then the relevant data structures retain in memory the user's desired settings. Then the relevant data structures
are populated from the files on disk (the cache, if \-\-cache was passed on the are populated from the files on disk (the cache, if --cache was passed on the
command line, the database of installed packages in /var/lib/pkg, the list of command line, the database of installed packages in /var/lib/pkg, the list of
locked ports, the list of aliases, or each \fBPkgfile\fP(5) found in the ports locked ports, the list of aliases, or each \fBPkgfile\fP(5) found in the ports
tree). tree).

View File

@ -19,9 +19,10 @@ my @allports; my %V_REPO; my %V_INST; my %DESC; my %DEPENDS; my %SOFTDEPS;
my @results; my $strf; my $ind; my $hh; my $portpath; my $built_pkg; my @results; my $strf; my $ind; my $hh; my $portpath; my $built_pkg;
my %osearch = ( cache=>0, regex=>0, path=>0, exact=>0, verbose=>0 ); my %osearch = ( cache=>0, regex=>0, path=>0, exact=>0, verbose=>0 );
my %odepends = ( inject=>1, soft=>0, tree=>0, recursive=>0, all=>0 ); my %odepends = ( inject=>1, soft=>0, tree=>0, recursive=>0, all=>0 );
my %opkg = ( margs=>"", aargs=>"", rargs=>"", runscripts=>"yes", nolock=>0, my %opkg = ( margs=>"", aargs=>"", rargs=>"", run_scripts=>"no",
makecommand=>"/usr/bin/pkgmk", addcommand=>"/usr/bin/pkgadd", pre_install=>"no", post_install=>"no", scriptcommand=>"/bin/sh",
removecommand=>"/usr/bin/pkgrm", test=>"no", group=>"no" ); removecommand=>"/usr/bin/pkgrm", addcommand=>"/usr/bin/pkgadd",
makecommand=>"/usr/bin/pkgmk", nolock=>0, test=>"no", group=>"no" );
my %olog = ( write => "disabled", mode => "overwrite", rm_on_success => "yes", my %olog = ( write => "disabled", mode => "overwrite", rm_on_success => "yes",
file => "/var/log/pkgbuild/%n.log" ); file => "/var/log/pkgbuild/%n.log" );
my $prtconf = "/etc/prt-get.conf"; my $prtconf = "/etc/prt-get.conf";
@ -100,7 +101,7 @@ if (($action =~ /^(listinst|listorphans|dependent)/)
} }
} elsif ($action =~ /^(fsearch)/) { } elsif ($action =~ /^(fsearch)/) {
my %hits = %{$hh}; $strf = "%20s %s\n"; my @fmatch; my %hits = %{$hh}; $strf = "%20s %s\n"; my @fmatch;
printf $strf, "Found in", "Matching File"; printf $strf, "Found in", "Matching File" if (%hits);
foreach my $fh (keys %hits) { foreach my $fh (keys %hits) {
chomp($hits{$fh}); chomp($hits{$fh});
@fmatch = split /\s/, $hits{$fh}; @fmatch = split /\s/, $hits{$fh};
@ -108,10 +109,11 @@ if (($action =~ /^(listinst|listorphans|dependent)/)
} }
} elsif ($action =~ /^(current|isinst|dup|diff|quickdiff)$/) { } elsif ($action =~ /^(current|isinst|dup|diff|quickdiff)$/) {
my $format = "%20s %15s %20s\n"; my $ind = shift(@results); my $format = "%20s %15s %20s\n"; my $ind = shift(@results);
if ($action eq "diff") { if (! @results) {
if ($#results > 0) { ($action !~ /diff$/) or print "No differences found\n";
printf $format, "Port", "Installed", "Available in Repo" exit 0;
} else { print "No differences found\n" } } elsif ($action eq "diff") {
printf $format, "Port", "Installed", "Available in Repo"
} }
foreach (@results) { foreach (@results) {
if ($action =~ /^(current|isinst)$/) { print "$_\n"; next; } if ($action =~ /^(current|isinst)$/) { print "$_\n"; next; }
@ -175,13 +177,11 @@ if (($action =~ /^(listinst|listorphans|dependent)/)
} }
if (@ok_readme) { if (@ok_readme) {
print "Ports with README files:\n"; print "Ports with README files:\n";
foreach (@ok_readme) { print " $_\n"; } print join("\n ", @ok_readme);
print "\n";
} }
if (@not_ok) { if (@not_ok) {
print "Ports with pkgmk/pkgadd failures:\n"; print "Ports with pkgmk/pkgadd failures:\n";
foreach (@not_ok) { print " $_\n"; } print join("\n ", @not_ok);
print "\n";
} }
} }
@ -217,6 +217,9 @@ while (my $arg = shift) {
} elsif ($arg eq "-vv") { $osearch{verbose} += 2; } elsif ($arg eq "-vv") { $osearch{verbose} += 2;
} elsif ($arg eq "--test") { $opkg{test} = "yes"; } elsif ($arg eq "--test") { $opkg{test} = "yes";
} elsif ($arg eq "--group") { $opkg{group} = "yes"; } elsif ($arg eq "--group") { $opkg{group} = "yes";
} elsif ($arg eq "--pre-install") { $opkg{pre_install} = "yes";
} elsif ($arg eq "--post-install") { $opkg{post_install} = "yes";
} elsif ($arg eq "--run-scripts") { $opkg{run_scripts} = "yes";
} elsif ($arg eq "-fr") { $opkg{margs} .= " -f"; $odepends{inject} = 0; } elsif ($arg eq "-fr") { $opkg{margs} .= " -f"; $odepends{inject} = 0;
} elsif ($arg eq "-fi") { $opkg{aargs} .= " -f"; } elsif ($arg eq "-fi") { $opkg{aargs} .= " -f";
} elsif ($arg =~ /^(-uf|-if|-us|-is|-ns|-kw)$/) { $opkg{margs} .= " $1"; } elsif ($arg =~ /^(-uf|-if|-us|-is|-ns|-kw)$/) { $opkg{margs} .= " $1";
@ -275,8 +278,9 @@ while (<PORTS>) { chomp;
} }
} }
} }
$opkg{runscripts} = $1 if /^runscripts\s+(yes|no)/; $opkg{run_scripts} = $1 if /^runscripts\s+(yes|no)/;
$opkg{makecommand} = $1 if /^makecommand\s+(.*)(#|$)/; $opkg{scriptcommand} = $1 if /^runscriptcommand\s+(.*)(#|$)/;
$opkg{makecommand} = $1 if /^makecommand\s+(.*)(#|$)/;
$opkg{addcommand} = $1 if /^addcommand\s+(.*)(#|$)/; $opkg{addcommand} = $1 if /^addcommand\s+(.*)(#|$)/;
$opkg{removecommand} = $1 if /^removecommand\s+(.*)(#|$)/; $opkg{removecommand} = $1 if /^removecommand\s+(.*)(#|$)/;
$olog{write} = $1 if /^writelog\s+(enabled|disabled)/; $olog{write} = $1 if /^writelog\s+(enabled|disabled)/;
@ -312,6 +316,8 @@ sub find_dups {
$dupstr = "$format\n"; $dupstr = "$format\n";
$dupstr =~ $dupstr =~
s/(%n|%p1|%v1|%u1|%M1|%p2|%v2|%u2|%M2)/$dupinfo[$subscripts{$1}]/g; s/(%n|%p1|%v1|%u1|%M1|%p2|%v2|%u2|%M2)/$dupinfo[$subscripts{$1}]/g;
$dupstr =~ s/\\n/\n/g;
$dupstr =~ s/\\t/\t/g;
print $dupstr; print $dupstr;
} }
} }
@ -372,8 +378,7 @@ sub printf_ports {
@pstats = get_pkgfile_fields($pp,"all"); @pstats = get_pkgfile_fields($pp,"all");
$pstats[12] = ($LOCKED{$p}) ? "yes" : "no"; $pstats[12] = ($LOCKED{$p}) ? "yes" : "no";
$pstats[13] = (grep /^$p$/, keys %V_INST) ? "yes" : "no"; $pstats[13] = (grep /^$p$/, keys %V_INST) ? "yes" : "no";
$pstats[13] = "diff" ($pstats[13] eq "no") or ($V_INST{$p} eq $V_REPO{$p}) or $pstats[13] = "diff";
if (($pstats[13] eq "yes") and ($V_INST{$p} ne $V_REPO{$p}));
printf STDOUT $outputf, @pstats[@pos]; printf STDOUT $outputf, @pstats[@pos];
} }
} }
@ -383,9 +388,7 @@ sub fill_hashes_from_cache {
open (my $cf,$prtcache) or die "cannot use $prtcache as a cache!\n"; open (my $cf,$prtcache) or die "cannot use $prtcache as a cache!\n";
my $p; my $parent; my $deps; my $softDeps; my $p; my $parent; my $deps; my $softDeps;
my $ignored=<$cf>; chomp($ignored); my $ignored=<$cf>; chomp($ignored);
if ($ignored ne "$cache_ver") { ($ignored eq "$cache_ver") or die "incompatible cache format; regenerate by running $0 cache";
die "incompatible cache format; regenerate by running $0 cache";
}
while (1) { while (1) {
$p = <$cf>; last unless defined $p; $p = <$cf>; last unless defined $p;
@ -585,12 +588,12 @@ sub list_ports {
} elsif ($subset =~ /^dep(endent|tree)/) { } elsif ($subset =~ /^dep(endent|tree)/) {
our $direction = ($subset eq "deptree") ? "fwd" : "rev"; our $direction = ($subset eq "deptree") ? "fwd" : "rev";
my $header = (($subset eq "deptree") and ($odepends{tree} == 1)) ? my $header = (($subset eq "deptree") and ($odepends{tree} == 1)) ?
"-- dependencies ([i] = installed, '-->' = already shown)\n": "-- dependencies ([i] = installed, '-->' = already shown)":
"-- reverse dependencies ('-->' = already shown)\n"; "-- reverse dependencies ('-->' = already shown)";
if (($direction eq "fwd") and ($odepends{soft} == 1)) { if (($direction eq "fwd") and ($odepends{soft} == 1)) {
$header =~ s/installed,/installed, [s] = installed softdep,/; $header =~ s/installed,/installed, [s] = installed softdep,/;
} }
print $header unless ($odepends{tree} == 0); ($odepends{tree} == 0) or print "$header\n";
our $indent=" "; our $height=0; our $indent=" "; our $height=0;
our $ind; our %seen; our @lineage; my @fosters=(); our $ind; our %seen; our @lineage; my @fosters=();
@ -743,6 +746,7 @@ sub up_inst { # returns scalar references to five arrays
my %mkcmd; my %addcmd; my $rs_cmd; my %logfile; my %pvars; my $status; my %mkcmd; my %addcmd; my $rs_cmd; my %logfile; my %pvars; my $status;
my %ok; my %not_ok; my %ok_pre; my %ok_post; my @ok_readme=(); my %ok; my %not_ok; my %ok_pre; my %ok_post; my @ok_readme=();
my $PKGMK=$opkg{makecommand}; my $PKGADD=$opkg{addcommand}; my $PKGMK=$opkg{makecommand}; my $PKGADD=$opkg{addcommand};
my $SH=$opkg{scriptcommand};
# resolve dependencies unless --nodeps was given, # resolve dependencies unless --nodeps was given,
# but put glibc{,-32} at the front of the queue # but put glibc{,-32} at the front of the queue
@ -804,13 +808,9 @@ sub up_inst { # returns scalar references to five arrays
$ok{$t}=1; $ok{$t}=1;
next BUILDLOG; next BUILDLOG;
} }
if (($opkg{runscripts} eq "yes") and (-f "$pdirs{$t}/pre-install")) { if (("$opkg{run_scripts} $opkg{pre_install}" =~ /yes/) and (-f "$altroot$pdirs{$t}/pre-install")) {
$rs_cmd="/bin/sh $pdirs{$t}/pre-install"; $rs_cmd="$SH $pdirs{$t}/pre-install";
if ($altroot ne "") { ($altroot eq "") or $rs_cmd = "chroot $altroot $rs_cmd";
(-f "$altroot/$pdirs{$t}/pre-install") or
system("install -D $pdirs{$t}/pre-install $altroot/$pdirs{$t}/pre-install");
$rs_cmd = "chroot $altroot $rs_cmd";
}
(system("$rs_cmd")==0) ? $ok_pre{$t} = 1 : delete $ok_pre{$t}; (system("$rs_cmd")==0) ? $ok_pre{$t} = 1 : delete $ok_pre{$t};
} }
chdir("$pdirs{$t}") or $not_ok{$t} = 1; chdir("$pdirs{$t}") or $not_ok{$t} = 1;
@ -835,13 +835,9 @@ sub up_inst { # returns scalar references to five arrays
} elsif ( ($not_ok{$t}) and (-f "$builtpkg{$t}") ) { } elsif ( ($not_ok{$t}) and (-f "$builtpkg{$t}") ) {
rename("$builtpkg{$t}","$builtpkg{$t}.CHECKME"); rename("$builtpkg{$t}","$builtpkg{$t}.CHECKME");
} }
if (($ok{$t}) and ($opkg{runscripts} eq "yes") and (-f "post-install")) { if (($ok{$t}) and ("$opkg{run_scripts} $opkg{post_install}" =~ /yes/) and (-f "$altroot$pdirs{$t}/post-install")) {
$rs_cmd="/bin/sh post-install"; $rs_cmd="$SH post-install";
if ($altroot ne "") { ($altroot eq "") or $rs_cmd="chroot $altroot $rs_cmd";
(-f "$altroot/$pdirs{$t}/post-install") or
system("install -D $pdirs{$t}/post-install $altroot/$pdirs{$t}/post-install");
$rs_cmd="chroot $altroot $rs_cmd";
}
(system("$rs_cmd")==0) ? $ok_post{$t}=1 : delete $ok_post{$t}; (system("$rs_cmd")==0) ? $ok_post{$t}=1 : delete $ok_post{$t};
} }
last if (($opkg{group} eq "yes") and ($not_ok{$t})); last if (($opkg{group} eq "yes") and ($not_ok{$t}));