prt-auf: more robust handling of whitespace in the dependency line

This commit is contained in:
John McQuah 2023-08-19 16:42:37 -04:00
parent 6bce0f06f5
commit a9fb36fff0

View File

@ -448,8 +448,8 @@ sub get_pkgfile_fields {
close(ECHO);
}
$Dependencies =~ s/, / /g; $Dependencies =~ s/,/ /g;
$SoftDeps =~ s/, / /g; $SoftDeps =~ s/,/ /g;
$Dependencies =~ s/,(| )/ /g;
$SoftDeps =~ s/,(| )/ /g;
if (shift) {
return $Name, $portpath, $Version, $Release, $descrip, $Dependencies,
$url, $SoftDeps, $maintainer, $readme, $preInstall, $postInstall;
@ -571,9 +571,9 @@ sub list_ports {
if ($subset eq "orphans") {
my %not_orphans = map { $_ => 0 } @searchspace;
foreach my $port (@searchspace) {
map { $not_orphans{$_} = 1 } split(/[ ,]/, $DEPENDS{$port});
map { $not_orphans{$_} = 1 } split(/[ ,]+/, $DEPENDS{$port});
if ($odepends{soft} == 1) {
map { $not_orphans{$_} = 1 } split(/[ ,]/, $SOFTDEPS{$port});
map { $not_orphans{$_} = 1 } split(/[ ,]+/, $SOFTDEPS{$port});
}
}
@found = grep { $not_orphans{$_} eq 0 } keys %V_INST;
@ -599,11 +599,11 @@ sub list_ports {
$ind = ($V_INST{$seed}) ? "[i]" : "[ ]";
print "$ind $seed\n" if ($odepends{tree}==1);
$seen{$seed} = 1;
my @children = ($direction eq "fwd") ? split /[ ,]/, $DEPENDS{$sseed}:
my @children = ($direction eq "fwd") ? split /[ ,]+/, $DEPENDS{$sseed}:
grep { " $DEPENDS{$_} " =~ / $sseed / } @searchspace;
if ($odepends{soft}==1) {
@fosters = ($direction eq "fwd") ?
grep { ($V_INST{$_}) } split /[ ,]/, $SOFTDEPS{$sseed}:
grep { ($V_INST{$_}) } split /[ ,]+/, $SOFTDEPS{$sseed}:
grep { " $SOFTDEPS{$_} " =~ / $sseed / } @searchspace;
}
@ -619,11 +619,11 @@ sub list_ports {
return if (($seen{$s}) and ($odepends{all} !=1));
$seen{$s} = 1;
my %curdeps = ($direction eq "fwd") ?
map {$_ => 0} split /[ ,]/, $DEPENDS{$s} :
map {$_ => 0} split /[ ,]+/, $DEPENDS{$s} :
map {$_ => 0} grep { " $DEPENDS{$_} " =~ / $s / } @searchspace;
if ($odepends{soft} == 1) {
my @optionals = ($direction eq "fwd") ?
grep { ($V_INST{$_}) } split /[ ,]/, $SOFTDEPS{$s} :
grep { ($V_INST{$_}) } split /[ ,]+/, $SOFTDEPS{$s} :
grep { " $SOFTDEPS{$_} " =~ / $s / } @searchspace;
map {$curdeps{$_} = 1} @optionals;
}
@ -717,13 +717,13 @@ sub deporder { # returns a sorted list of packages required.
push(@treewalk, $s); $imark{$s}=1;
# assemble the list of dependencies that must be visited next
%curdeps = map { $_ => $greedy } split /[ ,]/, $DEPENDS{$s};
%curdeps = map { $_ => $greedy } split /[ ,]+/, $DEPENDS{$s};
# if the user toggles --softdeps, consider the optional dependencies
# that are already installed or are given on the command line
if ($odepends{soft} == 1) {
foreach (grep { ($V_INST{$_}) or ($given{$_}) }
split /[ ,]/, $SOFTDEPS{$s}) { $curdeps{$_} = 1; }
split /[ ,]+/, $SOFTDEPS{$s}) { $curdeps{$_} = 1; }
}
foreach my $sd (keys %curdeps) {