diff --git a/man8/prt-auf.8 b/man8/prt-auf.8 index ea1d741..59a0957 100644 --- a/man8/prt-auf.8 +++ b/man8/prt-auf.8 @@ -1,5 +1,5 @@ .\" man page for prt-auf -.\" last edited March 2023 by John McQuah, jmcquah at disroot dot org +.\" last edited May 2023 by John McQuah, jmcquah at disroot dot org .\" .\" based on original work by Johannes Winkelmann, jw at tks6 dot net .\" @@ -200,7 +200,7 @@ built by an 'install' command). .TP .B depends [\-\-softdeps] [ ...] -print a sorted list of dependencies needed to install the packages passed +Print a sorted list of dependencies needed to install the packages passed as argument. Packages that need to be installed first are listed first. It shows a list of the dependencies that were found in the ports tree, followed by a list of the dependencies that could not be found. Pass the --softdeps flag if @@ -209,7 +209,7 @@ the output. .TP .B quickdep [\-\-softdeps] [ ...] -mostly the same output as depends, but stripped of the installation status +Mostly the same output as depends, but stripped of the installation status indicator, and separated by spaces rather than newlines. Also, ports that cannot be found in the ports tree are omitted from the results. This formatting is useful in command substitution, e.g. instead of running @@ -225,7 +225,7 @@ needed for successful builds. .TP .B deptree [\-\-softdeps] -print a tree of the dependencies of +Print a tree of the dependencies of .B . Pass the --softdeps flag if you want optional dependencies to appear in the @@ -241,20 +241,20 @@ occurred. .TP .B dependent [\-\-softdeps] [\-\-all] [\-\-recursive] [\-\-tree] -print a list of ports which have +Print a list of ports which have .B in their "Depends on:" line. To also search the "Optional:" lines, pass the --softdeps flag. By default, output is restricted to ports that are installed. -To see all hard dependencies, add the --all switch; use --recursive to get a +To see all the dependencies, add the --all switch; use --recursive to get a recursive list (without duplication), and --tree to get a nicely indented one. .TP .B ls [--path] -Prints out a listing of the port's directory +Print out a listing of the port's directory .TP .B cat [] -Prints out the file to stdout. If is not specified, 'Pkgfile' is used. +Print out the file to stdout. If is not specified, 'Pkgfile' is used. .TP .B edit [] @@ -336,27 +336,27 @@ are replaced like this: .TP \ \ \ \(bu -%P -> optional dependencies +%P \-> optional dependencies .TP \ \ \ \(bu -%M -> Maintainer +%M \-> Maintainer .TP \ \ \ \(bu -%R -> Readme ("yes"/"no") +%R \-> Readme ("yes"/"no") .TP \ \ \ \(bu -%E -> pre-install script ("yes"/"no") +%E \-> pre-install script ("yes"/"no") .TP \ \ \ \(bu -%O -> post-install script ("yes"/"no") +%O \-> post-install script ("yes"/"no") .TP \ \ \ \(bu -%l -> is locked ("yes"/"no") +%l \-> is locked ("yes"/"no") .TP \ \ \ \(bu @@ -584,7 +584,15 @@ looking for, without needing to clutter the code base by reimplementing shell wildcards. .TP -.B no "--ignore" switch. +.B no \-\-config\-prepend, \-\-config\-append, or \-\-config\-set switches. +Users of \fBprt\-get\fP might find it inconvenient not to have such a +mechanism for overriding the config file settings on a temporary basis. The +workaround is to create different variations of the config file, and use the +\fB\-\-config=\fP switch to select the appropriate file whenever a +non-default setting is desired. + +.TP +.B no \-\-ignore switch. This feature is easy enough to add at a later date, but a newcomer to CRUX will likely be confused at having such fine-grained control over the automatic dependency resolution. The two main reasons to use "--ignore" (an erroneous diff --git a/scripts/prt-auf b/scripts/prt-auf index e05fba9..9e11ec8 100755 --- a/scripts/prt-auf +++ b/scripts/prt-auf @@ -12,10 +12,10 @@ use strict; ################### Initialize global variables ####################### my $title="prt-auf"; my $version=0.51; my $cache_ver="V5.1"; -my $CONFDIR = "/var/lib/pkg"; my $prtalias="/etc/prt-get.aliases"; +my $CONFDIR="/var/lib/pkg"; my $prtalias="/etc/prt-get.aliases"; my $pkgdb="$CONFDIR/db"; my $prtlocker="$CONFDIR/prt-get.locker"; -my $prtcache="$CONFDIR/prt-get.cache"; my %LOCKED; my %ALIASES; my %DEPENDS; -my @allports; my %V_REPO; my %V_INST; my %DESC; my %SOFTDEPS; +my $prtcache="$CONFDIR/prt-get.cache"; my $altroot=""; my %LOCKED; my %ALIASES; +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 %osearch = ( cache=>0, regex=>0, path=>0, exact=>0, verbose=>0 ); my %odepends = ( inject=>1, soft=>0, tree=>0, recursive=>0, all=>0 ); @@ -47,7 +47,7 @@ if (($action !~ /^(fsearch|isinst|current)$/) and ($osearch{cache}==0)) { if ($osearch{cache}==1) { fill_hashes_from_cache(); } if ($action !~ /^(search|dsearch|fsearch|info|dup|ls|readme|cat)$/) { - open (DB, $pkgdb) or die "Could not open package database!\n"; + open (DB, "$altroot$pkgdb") or die "Could not open package database!\n"; local $/=""; while () { $V_INST{$1} = $2 if m/^(.*)\n(.*)\n/; } close (DB); @@ -147,11 +147,9 @@ if (($action =~ /^(listinst|listorphans|dependent)/) and "Readme", "PreInstall", "PostInstall"); for (my $i=0; $i<9; $i++) { printf $strf, $fields[$i], $results[$i] unless ($results[$i] =~ /^\s*$/); } } elsif ($action eq "remove") { - my %removed = %$ind; - my @successes = grep { $removed{$_}==1 } keys %removed; - my @failures = grep { $removed{$_}==0 } keys %removed; - print "Ports removed:\n" if (@successes); - foreach my $p (@successes) { print "$p\n"; } + my @removed = @$ind; + print "Ports removed:\n" if (@removed); + foreach my $p (@removed) { print "$p\n"; } } elsif ($action =~ /^(install|sysup)$/) { my @ok = @{$results[0]}; my %ok_pre = %{$results[1]}; my %ok_post = %{$results[2]}; my @ok_readme = @{$results[3]}; my @not_ok = @{$results[4]}; my $note; @@ -215,8 +213,11 @@ sub parse_args { } elsif ($arg eq "-fi") { $opkg{aargs} .= " -f"; } elsif ($arg =~ /^(-uf|-if|-us|-is|-ns|-kw)$/) { $opkg{margs} .= " $1"; } elsif ($arg =~ /^--margs=(.+)/) { $opkg{margs} .= $1; - } elsif ($arg =~ /^--aargs=(-r|--root)=(.+)/) { $opkg{aargs} .= "$1 $2"; - } elsif ($arg =~ /^--rargs=(-r|--root)=(.+)/) { $opkg{rargs} .= "$1 $2"; + } elsif (($arg =~ /^--install-root=(.+)$/) and (-d $1)) { $altroot=$1; + } elsif (($arg =~ /^--aargs=(-r|--root)=(.+)/) and (-d $2)) { $altroot=$2; + } elsif (($arg =~ /^--rargs=(-r|--root)=(.+)/) and (-d $2)) { $altroot=$2; + } elsif ($arg =~ /^--aargs=(.+)/) { $opkg{aargs} .= " $1"; + } elsif ($arg =~ /^--rargs=(.+)/) { $opkg{rargs} .= " $1"; } elsif ($arg =~ /^-/) { print "'$arg' is not a recognized option.\n"; } else { push (@query, $arg); } @@ -309,13 +310,13 @@ sub find_dups { } sub get_locked_and_aliased { - if (-f $prtalias) { - open (AL, $prtalias); + if (-f "$altroot$prtalias") { + open (AL, "$altroot$prtalias"); while () { $ALIASES{$1} = $2 if m/^\s*(.*)\s*:\s*(.*)/; } close (AL); } - if (-f $prtlocker) { - open (LK, $prtlocker); + if (-f "$altroot$prtlocker") { + open (LK, "$altroot$prtlocker"); while () { chomp; $LOCKED{$_}=1 unless /^\s*$/; } close (LK); } @@ -491,12 +492,16 @@ sub uninstall { my @rubbish = grep { ! defined $V_INST{$_} } @_; foreach my $r (@rubbish) { print "$r not installed; ignoring.\n"; } my %removed = map { $_ => 0 } @targets; + if (($altroot ne "") and ($opkg{rargs} !~ m/(-r|--root)/)) { + $opkg{rargs} .= " -r $altroot"; + } foreach my $t (@targets) { ($opkg{test} eq "no") ? system($PKGRM,$opkg{rargs},$t) : print "$PKGRM $opkg{rargs} $t\n"; $removed{$t}=1 if ($?>>8 == 0); if (($LOCKED{$t}) and ($opkg{test} eq "no")) { port_unlock($t); } } - return \%removed; + my @successes = grep { $removed{$_} == 1 } keys %removed; + return @successes; } sub port_lock { @@ -764,7 +769,10 @@ sub up_inst { # returns scalar references to five arrays $builtpkg{$t} =~ s/uuiVer/$pvars{'%v'}/g; $builtpkg{$t} =~ s/uuiRel/$pvars{'%r'}/g; $mkcmd{$t} = "$PKGMK -d $opkg{$t}"; - $addcmd{$t} = "$PKGADD -u $builtpkg{$t}"; + if (($altroot ne "") and ($opkg{aargs} !~ m/(-r|--root)/)) { + $opkg{aargs} .= " -r $altroot"; + } + $addcmd{$t} = "$PKGADD -u $opkg{aargs} $builtpkg{$t}"; if ($olog{write} eq "enabled") { $logfile{$t} = $olog{file}; $logfile{$t} =~ s/(%n|%v|%r|%p)/$pvars{$1}/g; @@ -788,8 +796,12 @@ sub up_inst { # returns scalar references to five arrays next BUILDLOG; } if ($mkcmd{$t} ne "") { - if ((-f "$pdirs{$t}/pre-install") and ($opkg{runscripts} eq "yes")) { - system("sh","$pdirs{$t}/pre-install"); + if (($opkg{runscripts} eq "yes") and (-f "$pdirs{$t}/pre-install")) { + if ($altroot ne "") { + system("chroot",$altroot,"sh","$pdirs{$t}/pre-install"); + } else { + system("sh","$pdirs{$t}/pre-install"); + } ( $?>>8 == 0 ) ? $ok_pre{$t} = 1 : delete $ok_pre{$t}; } chdir $pdirs{$t}; system("$mkcmd{$t}"); $status=( $?>>8 == 0 ); @@ -811,9 +823,13 @@ sub up_inst { # returns scalar references to five arrays } elsif ( ($not_ok{$t}) and (-f "$builtpkg{$t}") ) { system("mv $builtpkg{$t} $builtpkg{$t}.CHECKME"); } - if (($ok{$t}) and (-f "$pdirs{$t}/post-install") - and ($opkg{runscripts} eq "yes")) { - system("sh","$pdirs{$t}/post-install"); + if (($ok{$t}) and ($opkg{runscripts} eq "yes") + and (-f "$pdirs{$t}/post-install")) { + if ($altroot ne "") { + system("chroot",$altroot,"sh","$pdirs{$t}/post-install"); + } else { + system("sh","$pdirs{$t}/post-install"); + } ( $?>>8 == 0 ) ? $ok_post{$t}=1 : delete $ok_post{$t}; } }