Compare commits
2 Commits
c23eb319d3
...
bb58beecda
Author | SHA1 | Date | |
---|---|---|---|
bb58beecda | |||
1ea7303305 |
@ -435,7 +435,7 @@ check_footprint() {
|
||||
else
|
||||
warning "footprint not found, creating new."; cat_footprint > "$TRUTH"
|
||||
fi
|
||||
(( diffs == 0 )) || exit $E_FOOTPRINT
|
||||
(( diffs == 0 )) || { cleanup_work; exit $E_FOOTPRINT; }
|
||||
}
|
||||
|
||||
parse_signify_output() { # chomps the output of check_signature()
|
||||
|
@ -24,7 +24,7 @@ my %opkg = ( margs=>"", aargs=>"", rargs=>"", run_scripts=>"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",
|
||||
file => "/var/log/pkgbuild/%n.log" );
|
||||
rm_on_uninst => "no", file => "/var/log/pkgbuild/%n.log" );
|
||||
my $prtconf = "/etc/prt-get.conf";
|
||||
|
||||
################### Process the given command #########################
|
||||
@ -289,6 +289,7 @@ while (<PORTS>) { chomp;
|
||||
$olog{write} = $1 if /^writelog\s+(enabled|disabled)/;
|
||||
$olog{mode} = $1 if /^logmode\s+(append|overwrite)/;
|
||||
$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*(#|$)/;
|
||||
$prtcache = $1 if /^cachefile\s+(.*)\s*(#|$)/;
|
||||
}
|
||||
@ -380,7 +381,7 @@ sub printf_ports {
|
||||
$p = (split /\//, $pp)[-1];
|
||||
@pstats = get_pkgfile_fields($pp,"all");
|
||||
$pstats[12] = ($LOCKED{$p}) ? "yes" : "no";
|
||||
$pstats[13] = (grep /^$p$/, keys %V_INST) ? "yes" : "no";
|
||||
$pstats[13] = ($V_INST{$p}) ? "yes" : "no";
|
||||
($pstats[13] eq "no") or ($V_INST{$p} eq $V_REPO{$p}) or $pstats[13] = "diff";
|
||||
printf STDOUT $outputf, @pstats[@pos];
|
||||
}
|
||||
@ -507,17 +508,25 @@ sub uninstall {
|
||||
my @targets = grep { defined $V_INST{$_} } @_;
|
||||
my @rubbish = grep { ! defined $V_INST{$_} } @_;
|
||||
foreach my $r (@rubbish) { print "$r not installed; ignoring.\n"; }
|
||||
my %removed = map { $_ => 0 } @targets;
|
||||
my @removed;
|
||||
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);
|
||||
next if ($?>>8 != 0);
|
||||
push @removed, $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";
|
||||
}
|
||||
}
|
||||
my @successes = grep { $removed{$_} == 1 } keys %removed;
|
||||
return \@successes;
|
||||
return \@removed;
|
||||
}
|
||||
|
||||
sub port_lock {
|
||||
@ -580,7 +589,7 @@ sub list_ports {
|
||||
map { $not_orphans{$_} = 1 } split(/[ ,]+/, $SOFTDEPS{$port});
|
||||
}
|
||||
}
|
||||
@found = grep { $not_orphans{$_} eq 0 } keys %V_INST;
|
||||
@found = grep { $not_orphans{$_} == 0 } keys %V_INST;
|
||||
} elsif (($subset eq "dependent") and ($odepends{recursive}==0)) {
|
||||
@found = grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace;
|
||||
if ($odepends{soft}==1) {
|
||||
@ -602,11 +611,11 @@ sub list_ports {
|
||||
our $ind; our %seen; our @lineage; my @fosters=(); my @children=();
|
||||
$ind = ($V_INST{$seed}) ? "[i]" : "[ ]";
|
||||
print "$ind $seed\n" if ($odepends{tree}==1);
|
||||
$seen{$seed} = 1;
|
||||
$seen{$sseed} = 1;
|
||||
if ($direction eq "rev") {
|
||||
@children = grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace;
|
||||
} elsif ($DEPENDS{$sseed}) {
|
||||
@children = split /[ ,]+/, $DEPENDS{$sseed};
|
||||
} elsif ($DEPENDS{$seed}) {
|
||||
@children = split /[ ,]+/, $DEPENDS{$seed};
|
||||
}
|
||||
|
||||
if (($odepends{soft}==1) and ($direction eq "rev")) {
|
||||
@ -684,7 +693,7 @@ sub port_diff { # find differences between the pkgdb and the repo
|
||||
if ( (! $V_INST{$q}) and (! who_aliased_to($q)) ) {
|
||||
push @outfile, "$q: not installed"; $retval++;
|
||||
} elsif ($V_INST{$q}) {
|
||||
push @outfile, "$q: version $V_INST{$q}" if ($dtype eq "current");
|
||||
push @outfile, "$V_INST{$q}" if ($dtype eq "current");
|
||||
push @outfile, "$q is installed." if ($dtype eq "isinst");
|
||||
} else {
|
||||
push @outfile, "$q is provided by package ".who_aliased_to($q)
|
||||
@ -758,7 +767,7 @@ sub up_inst { # returns scalar references to six arrays
|
||||
my @requested=@_; my @sortedList; my @targets; my %pdirs; my %builtpkg;
|
||||
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 $PKGMK=$opkg{makecommand}; my $PKGADD=$opkg{addcommand};
|
||||
my $ord=0; my $PKGMK=$opkg{makecommand}; my $PKGADD=$opkg{addcommand};
|
||||
my $SH=$opkg{scriptcommand};
|
||||
|
||||
# resolve dependencies unless --nodeps was given,
|
||||
@ -811,7 +820,7 @@ sub up_inst { # returns scalar references to six arrays
|
||||
if ($opkg{test} eq "yes") { print("*** prt-auf: test mode\n\n");
|
||||
print "-- Packages changed\n"; }
|
||||
|
||||
# build each package, unless already installed
|
||||
# build each package
|
||||
BUILDLOG: foreach my $t (@targets) {
|
||||
if ( (-f $builtpkg{$t}) and ($opkg{$t} !~ /-f/) and
|
||||
((-M $builtpkg{$t}) > (-M "$pdirs{$t}/Pkgfile")) ) {
|
||||
@ -826,28 +835,29 @@ sub up_inst { # returns scalar references to six arrays
|
||||
(! -f "$pdirs{$t}/post-install") or print(" (+post)");
|
||||
print("\n");
|
||||
next BUILDLOG;
|
||||
} else {
|
||||
$ord += 1;
|
||||
}
|
||||
if (("$opkg{run_scripts} $opkg{pre_install}" =~ /yes/) and (-f "$altroot$pdirs{$t}/pre-install")) {
|
||||
$rs_cmd="$SH $pdirs{$t}/pre-install";
|
||||
($altroot eq "") or $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} = $ord : delete $ok_pre{$t};
|
||||
}
|
||||
chdir("$pdirs{$t}") or $not_ok{$t} = 1;
|
||||
chdir("$pdirs{$t}") or $not_ok{$t} = $ord;
|
||||
if ($not_ok{$t}) { next BUILDLOG; }
|
||||
$status = (system("$mkcmd{$t}")==0);
|
||||
if ($logfile{$t}) {
|
||||
( ($mkcmd{$t} =~ /skipped build/) or ! log_failure($logfile{$t}) ) ?
|
||||
$ok{$t} = 1 : $not_ok{$t} = 1;
|
||||
$ok{$t} = $ord : $not_ok{$t} = $ord;
|
||||
} else {
|
||||
($status) ? $ok{$t} = 1 : $not_ok{$t} = 1;
|
||||
($status) ? $ok{$t} = $ord : $not_ok{$t} = $ord;
|
||||
}
|
||||
if ($ok{$t}) {
|
||||
$addcmd{$t} =~ s/ -u / / if (! $V_INST{$t});
|
||||
if (system("$addcmd{$t}")==0) {
|
||||
$ok{$t} = 1;
|
||||
push (@ok_readme, $t) if (-f "README");
|
||||
} else {
|
||||
$not_ok{$t} = 1; delete $ok{$t};
|
||||
$not_ok{$t} = $ord; delete $ok{$t};
|
||||
}
|
||||
unlink($logfile{$t})
|
||||
if ( ($logfile{$t}) and ($olog{rm_on_success} eq "yes") );
|
||||
@ -857,7 +867,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")) {
|
||||
$rs_cmd="$SH post-install";
|
||||
($altroot eq "") or $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}=$ord : delete $ok_post{$t};
|
||||
}
|
||||
last if (($opkg{group} eq "yes") and ($not_ok{$t}));
|
||||
}
|
||||
@ -869,7 +879,8 @@ sub up_inst { # returns scalar references to six arrays
|
||||
close(FH); return $failed;
|
||||
}
|
||||
|
||||
my @ok = keys %ok; my @not_ok = keys %not_ok;
|
||||
my @ok = sort { return ($ok{$a} < $ok{$b}) ? -1 : 1; } keys %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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user