Compare commits

..

No commits in common. "bb58beecdada9e15c6f270029981d857256532dd" and "c23eb319d3c26a0c70d2762c3bd17b147092cd86" have entirely different histories.

2 changed files with 22 additions and 33 deletions

View File

@ -435,7 +435,7 @@ check_footprint() {
else else
warning "footprint not found, creating new."; cat_footprint > "$TRUTH" warning "footprint not found, creating new."; cat_footprint > "$TRUTH"
fi fi
(( diffs == 0 )) || { cleanup_work; exit $E_FOOTPRINT; } (( diffs == 0 )) || exit $E_FOOTPRINT
} }
parse_signify_output() { # chomps the output of check_signature() parse_signify_output() { # chomps the output of check_signature()

View File

@ -24,7 +24,7 @@ my %opkg = ( margs=>"", aargs=>"", rargs=>"", run_scripts=>"no",
removecommand=>"/usr/bin/pkgrm", addcommand=>"/usr/bin/pkgadd", removecommand=>"/usr/bin/pkgrm", addcommand=>"/usr/bin/pkgadd",
makecommand=>"/usr/bin/pkgmk", nolock=>0, test=>"no", group=>"no" ); 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",
rm_on_uninst => "no", file => "/var/log/pkgbuild/%n.log" ); file => "/var/log/pkgbuild/%n.log" );
my $prtconf = "/etc/prt-get.conf"; my $prtconf = "/etc/prt-get.conf";
################### Process the given command ######################### ################### Process the given command #########################
@ -289,7 +289,6 @@ while (<PORTS>) { chomp;
$olog{write} = $1 if /^writelog\s+(enabled|disabled)/; $olog{write} = $1 if /^writelog\s+(enabled|disabled)/;
$olog{mode} = $1 if /^logmode\s+(append|overwrite)/; $olog{mode} = $1 if /^logmode\s+(append|overwrite)/;
$olog{rm_on_success} = $1 if /^rmlog_on_success\s+(no|yes)/; $olog{rm_on_success} = $1 if /^rmlog_on_success\s+(no|yes)/;
$olog{rm_on_uninst} = $1 if /^rmlog_on_uninst\s+(no|yes)/;
$olog{file} = $1 if /^logfile\s+(.*)\s*(#|$)/; $olog{file} = $1 if /^logfile\s+(.*)\s*(#|$)/;
$prtcache = $1 if /^cachefile\s+(.*)\s*(#|$)/; $prtcache = $1 if /^cachefile\s+(.*)\s*(#|$)/;
} }
@ -381,7 +380,7 @@ sub printf_ports {
$p = (split /\//, $pp)[-1]; $p = (split /\//, $pp)[-1];
@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] = ($V_INST{$p}) ? "yes" : "no"; $pstats[13] = (grep /^$p$/, keys %V_INST) ? "yes" : "no";
($pstats[13] eq "no") or ($V_INST{$p} eq $V_REPO{$p}) or $pstats[13] = "diff"; ($pstats[13] eq "no") or ($V_INST{$p} eq $V_REPO{$p}) or $pstats[13] = "diff";
printf STDOUT $outputf, @pstats[@pos]; printf STDOUT $outputf, @pstats[@pos];
} }
@ -508,25 +507,17 @@ sub uninstall {
my @targets = grep { defined $V_INST{$_} } @_; my @targets = grep { defined $V_INST{$_} } @_;
my @rubbish = grep { ! defined $V_INST{$_} } @_; my @rubbish = grep { ! defined $V_INST{$_} } @_;
foreach my $r (@rubbish) { print "$r not installed; ignoring.\n"; } foreach my $r (@rubbish) { print "$r not installed; ignoring.\n"; }
my @removed; my %removed = map { $_ => 0 } @targets;
if (($altroot ne "") and ($opkg{rargs} !~ m/(-r|--root)/)) { if (($altroot ne "") and ($opkg{rargs} !~ m/(-r|--root)/)) {
$opkg{rargs} .= " -r $altroot"; $opkg{rargs} .= " -r $altroot";
} }
foreach my $t (@targets) { foreach my $t (@targets) {
($opkg{test} eq "no") ? system($PKGRM,$opkg{rargs},$t) : print "$PKGRM $opkg{rargs} $t\n"; ($opkg{test} eq "no") ? system($PKGRM,$opkg{rargs},$t) : print "$PKGRM $opkg{rargs} $t\n";
next if ($?>>8 != 0); $removed{$t}=1 if ($?>>8 == 0);
push @removed, $t;
if (($LOCKED{$t}) and ($opkg{test} eq "no")) { port_unlock($t); } if (($LOCKED{$t}) and ($opkg{test} eq "no")) { port_unlock($t); }
if ($olog{rm_on_uninst} eq "yes") {
my $log_t = $olog{file};
my $rt = $1 if ($V_INST{$t} =~ m/.*-([0-9]+)$/);
my $vt = $V_INST{$t}; $vt =~ s/-$rt//;
my %pvars = ( '%n' => $t, '%v' => $vt, '%r' => $rt );
$log_t =~ s/(%n|%v|%r)/$pvars{$1}/g;
(! -f $log_t) or unlink $log_t or print "failed to delete $log_t\n";
}
} }
return \@removed; my @successes = grep { $removed{$_} == 1 } keys %removed;
return \@successes;
} }
sub port_lock { sub port_lock {
@ -589,7 +580,7 @@ sub list_ports {
map { $not_orphans{$_} = 1 } split(/[ ,]+/, $SOFTDEPS{$port}); map { $not_orphans{$_} = 1 } split(/[ ,]+/, $SOFTDEPS{$port});
} }
} }
@found = grep { $not_orphans{$_} == 0 } keys %V_INST; @found = grep { $not_orphans{$_} eq 0 } keys %V_INST;
} elsif (($subset eq "dependent") and ($odepends{recursive}==0)) { } elsif (($subset eq "dependent") and ($odepends{recursive}==0)) {
@found = grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace; @found = grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace;
if ($odepends{soft}==1) { if ($odepends{soft}==1) {
@ -611,11 +602,11 @@ sub list_ports {
our $ind; our %seen; our @lineage; my @fosters=(); my @children=(); our $ind; our %seen; our @lineage; my @fosters=(); my @children=();
$ind = ($V_INST{$seed}) ? "[i]" : "[ ]"; $ind = ($V_INST{$seed}) ? "[i]" : "[ ]";
print "$ind $seed\n" if ($odepends{tree}==1); print "$ind $seed\n" if ($odepends{tree}==1);
$seen{$sseed} = 1; $seen{$seed} = 1;
if ($direction eq "rev") { if ($direction eq "rev") {
@children = grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace; @children = grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace;
} elsif ($DEPENDS{$seed}) { } elsif ($DEPENDS{$sseed}) {
@children = split /[ ,]+/, $DEPENDS{$seed}; @children = split /[ ,]+/, $DEPENDS{$sseed};
} }
if (($odepends{soft}==1) and ($direction eq "rev")) { if (($odepends{soft}==1) and ($direction eq "rev")) {
@ -693,7 +684,7 @@ sub port_diff { # find differences between the pkgdb and the repo
if ( (! $V_INST{$q}) and (! who_aliased_to($q)) ) { if ( (! $V_INST{$q}) and (! who_aliased_to($q)) ) {
push @outfile, "$q: not installed"; $retval++; push @outfile, "$q: not installed"; $retval++;
} elsif ($V_INST{$q}) { } elsif ($V_INST{$q}) {
push @outfile, "$V_INST{$q}" if ($dtype eq "current"); push @outfile, "$q: version $V_INST{$q}" if ($dtype eq "current");
push @outfile, "$q is installed." if ($dtype eq "isinst"); push @outfile, "$q is installed." if ($dtype eq "isinst");
} else { } else {
push @outfile, "$q is provided by package ".who_aliased_to($q) push @outfile, "$q is provided by package ".who_aliased_to($q)
@ -767,7 +758,7 @@ sub up_inst { # returns scalar references to six arrays
my @requested=@_; my @sortedList; my @targets; my %pdirs; my %builtpkg; my @requested=@_; my @sortedList; my @targets; my %pdirs; my %builtpkg;
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 @missing; my %not_ok; my %ok_pre; my %ok_post; my @ok_readme=(); my %ok; my @missing; my %not_ok; my %ok_pre; my %ok_post; my @ok_readme=();
my $ord=0; my $PKGMK=$opkg{makecommand}; my $PKGADD=$opkg{addcommand}; my $PKGMK=$opkg{makecommand}; my $PKGADD=$opkg{addcommand};
my $SH=$opkg{scriptcommand}; my $SH=$opkg{scriptcommand};
# resolve dependencies unless --nodeps was given, # resolve dependencies unless --nodeps was given,
@ -820,7 +811,7 @@ sub up_inst { # returns scalar references to six arrays
if ($opkg{test} eq "yes") { print("*** prt-auf: test mode\n\n"); if ($opkg{test} eq "yes") { print("*** prt-auf: test mode\n\n");
print "-- Packages changed\n"; } print "-- Packages changed\n"; }
# build each package # build each package, unless already installed
BUILDLOG: foreach my $t (@targets) { BUILDLOG: foreach my $t (@targets) {
if ( (-f $builtpkg{$t}) and ($opkg{$t} !~ /-f/) and if ( (-f $builtpkg{$t}) and ($opkg{$t} !~ /-f/) and
((-M $builtpkg{$t}) > (-M "$pdirs{$t}/Pkgfile")) ) { ((-M $builtpkg{$t}) > (-M "$pdirs{$t}/Pkgfile")) ) {
@ -835,29 +826,28 @@ sub up_inst { # returns scalar references to six arrays
(! -f "$pdirs{$t}/post-install") or print(" (+post)"); (! -f "$pdirs{$t}/post-install") or print(" (+post)");
print("\n"); print("\n");
next BUILDLOG; next BUILDLOG;
} else {
$ord += 1;
} }
if (("$opkg{run_scripts} $opkg{pre_install}" =~ /yes/) and (-f "$altroot$pdirs{$t}/pre-install")) { if (("$opkg{run_scripts} $opkg{pre_install}" =~ /yes/) and (-f "$altroot$pdirs{$t}/pre-install")) {
$rs_cmd="$SH $pdirs{$t}/pre-install"; $rs_cmd="$SH $pdirs{$t}/pre-install";
($altroot eq "") or $rs_cmd = "chroot $altroot $rs_cmd"; ($altroot eq "") or $rs_cmd = "chroot $altroot $rs_cmd";
(system("$rs_cmd")==0) ? $ok_pre{$t} = $ord : delete $ok_pre{$t}; (system("$rs_cmd")==0) ? $ok_pre{$t} = 1 : delete $ok_pre{$t};
} }
chdir("$pdirs{$t}") or $not_ok{$t} = $ord; chdir("$pdirs{$t}") or $not_ok{$t} = 1;
if ($not_ok{$t}) { next BUILDLOG; } if ($not_ok{$t}) { next BUILDLOG; }
$status = (system("$mkcmd{$t}")==0); $status = (system("$mkcmd{$t}")==0);
if ($logfile{$t}) { if ($logfile{$t}) {
( ($mkcmd{$t} =~ /skipped build/) or ! log_failure($logfile{$t}) ) ? ( ($mkcmd{$t} =~ /skipped build/) or ! log_failure($logfile{$t}) ) ?
$ok{$t} = $ord : $not_ok{$t} = $ord; $ok{$t} = 1 : $not_ok{$t} = 1;
} else { } else {
($status) ? $ok{$t} = $ord : $not_ok{$t} = $ord; ($status) ? $ok{$t} = 1 : $not_ok{$t} = 1;
} }
if ($ok{$t}) { if ($ok{$t}) {
$addcmd{$t} =~ s/ -u / / if (! $V_INST{$t}); $addcmd{$t} =~ s/ -u / / if (! $V_INST{$t});
if (system("$addcmd{$t}")==0) { if (system("$addcmd{$t}")==0) {
$ok{$t} = 1;
push (@ok_readme, $t) if (-f "README"); push (@ok_readme, $t) if (-f "README");
} else { } else {
$not_ok{$t} = $ord; delete $ok{$t}; $not_ok{$t} = 1; delete $ok{$t};
} }
unlink($logfile{$t}) unlink($logfile{$t})
if ( ($logfile{$t}) and ($olog{rm_on_success} eq "yes") ); if ( ($logfile{$t}) and ($olog{rm_on_success} eq "yes") );
@ -867,7 +857,7 @@ sub up_inst { # returns scalar references to six arrays
if (($ok{$t}) and ("$opkg{run_scripts} $opkg{post_install}" =~ /yes/) and (-f "$altroot$pdirs{$t}/post-install")) { if (($ok{$t}) and ("$opkg{run_scripts} $opkg{post_install}" =~ /yes/) and (-f "$altroot$pdirs{$t}/post-install")) {
$rs_cmd="$SH post-install"; $rs_cmd="$SH post-install";
($altroot eq "") or $rs_cmd="chroot $altroot $rs_cmd"; ($altroot eq "") or $rs_cmd="chroot $altroot $rs_cmd";
(system("$rs_cmd")==0) ? $ok_post{$t}=$ord : 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}));
} }
@ -879,8 +869,7 @@ sub up_inst { # returns scalar references to six arrays
close(FH); return $failed; close(FH); return $failed;
} }
my @ok = sort { return ($ok{$a} < $ok{$b}) ? -1 : 1; } keys %ok; my @ok = keys %ok; my @not_ok = keys %not_ok;
my @not_ok = sort { return ($not_ok{$a} < $not_ok{$b}) ? -1 : 1; } keys %not_ok;
return \@ok, \%ok_pre, \%ok_post, \@ok_readme, \@not_ok, \@missing; return \@ok, \%ok_pre, \%ok_post, \@ok_readme, \@not_ok, \@missing;
} }