prt-auf: ensure that port_diff does not pass bogus data to sysup

This commit is contained in:
John McQuah 2023-03-20 08:35:15 -04:00
parent 9682dcde14
commit 47dae3092c

View File

@ -69,7 +69,7 @@ if ($action eq "path") { @results = find_port_by_name($query[0],1,1,0);
} elsif ($action =~ /^(depends|quickdep)$/) { @results=deporder($1,@query);
} elsif ($action =~ /^dep(endent|tree)$/) { @results=list_ports($action,@query);
} elsif ($action eq "sysup") { my @outdated = grep { s/ .+// } port_diff("quick");
@results = up_inst("sysup", @outdated);
shift @outdated; @results = up_inst("sysup", @outdated);
} elsif ($action =~ /^(install|update)$/) { @results = up_inst($action,@query);
} elsif ($action eq "depinst") { @results = up_inst("depinst",@query);
} elsif ($action eq "dup") { $ind=find_dups(@query);
@ -633,7 +633,7 @@ sub port_diff { # returns a list of all the ports with differences
if ($dtype !~ /^(current|isinst|utd)/) {
foreach my $p (sort(keys %V_INST)) {
push @outfile, "$p $V_INST{$p} $V_REPO{$p}" if (($V_REPO{$p}) and ($V_INST{$p} ne $V_REPO{$p}));
push @outfile, "$p $V_INST{$p} MISSING" if (! $V_REPO{$p});
push @outfile, "$p $V_INST{$p} MISSING" if ((! $V_REPO{$p}) and ($dtype ne "quick"));
}
} elsif ($dtype eq "utd") { my $q=shift(@argq);
if (! $V_INST{$q}) { $retval--;
@ -737,13 +737,12 @@ sub up_inst { # returns scalar references to five arrays
# respect the user-supplied list of ports unless 'depinst' or 'sysup',
# in which case put glibc{,-32} at the front of the queue
@targets=grep { ($V_REPO{$_}) } @requested;
if ($type =~ /^(depinst|sysup)$/) {
@requested = deporder("quick",@requested);
@targets=grep { !m/^glibc(|-32)$/ } @requested;
unshift @targets, grep { m/^glibc(|-32)$/ } @requested;
} else {
@targets=grep { ($V_REPO{$_}) } @requested;
}
}
# exempt any locked ports unless they were explicitly requested
%EXEMPT = map { $_ => 1 } @LOCKED;
@ -759,7 +758,8 @@ sub up_inst { # returns scalar references to five arrays
$opkg{$t} = $opkg{margs}; $pvars{'%n'}=$t;
$opkg{$t} =~ s/-f// unless (grep { $_ eq $t } @requested);
$pvars{'%p'} = find_port_by_name($t,1,1,0); $pdirs{$t} = $pvars{'%p'};
($pvars{'%v'}, $pvars{'%r'}) = (get_pkgfile_fields($pvars{'%p'}))[0,1];
$pvars{'%v'} = $1 if ( $V_REPO{$t} =~ m/(.+)-[0-9]+$/ );
$pvars{'%r'} = $1 if ( $V_REPO{$t} =~ m/-([0-9]+)$/ );
$builtpkg{$t} = ($PKG_DIR) ? "$PKG_DIR/$t#$pvars{'%v'}-$pvars{'%r'}.pkg.tar.$COMPRESSION" : "$pvars{'%p'}/$t#$pvars{'%v'}-$pvars{'%r'}.pkg.tar.$COMPRESSION";
$builtpkg{$t} =~ s/\$name/$t/g; $builtpkg{$t} =~ s/\$\{name\}/$t/g;
$mkcmd{$t} = "$PKGMK -d $opkg{$t}";