aboutsummaryrefslogtreecommitdiff
path: root/SBO-Lib/lib
diff options
context:
space:
mode:
authorAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-08-31 00:23:31 +0200
committerAndreas Guldstrand <andreas.guldstrand@gmail.com>2016-08-31 00:23:31 +0200
commit3fca4ebe361e06994fd5fd9a5b858980aa3a3465 (patch)
tree5e4fcb73a1d16ecd099980169582c3d9476b2539 /SBO-Lib/lib
parent7296b173cb1c7c53172b67c79832bb6b0fe6a67b (diff)
downloadsbotools-3fca4ebe361e06994fd5fd9a5b858980aa3a3465.tar.xz
sboinstall: report full package name for something already installed.
See #44.
Diffstat (limited to 'SBO-Lib/lib')
-rw-r--r--SBO-Lib/lib/SBO/Lib/Pkgs.pm9
1 files changed, 5 insertions, 4 deletions
diff --git a/SBO-Lib/lib/SBO/Lib/Pkgs.pm b/SBO-Lib/lib/SBO/Lib/Pkgs.pm
index 7918240..71941a5 100644
--- a/SBO-Lib/lib/SBO/Lib/Pkgs.pm
+++ b/SBO-Lib/lib/SBO/Lib/Pkgs.pm
@@ -138,14 +138,15 @@ sub get_installed_packages {
# Valid types: STD, SBO
my (@pkgs, %types);
foreach my $pkg (glob("$pkg_db/*")) {
- my ($name, $version, $build) = $pkg =~ m#/([^/]+)-([^-]+)-[^-]+-([^-]+)$#
+ $pkg =~ s!^\Q$pkg_db/\E!!;
+ my ($name, $version, $build) = $pkg =~ m#^([^/]+)-([^-]+)-[^-]+-([^-]+)$#
or next;
- push @pkgs, { name => $name, version => $version, build => $build };
+ push @pkgs, { name => $name, version => $version, build => $build, pkg => $pkg };
$types{$name} = 'STD';
}
# If we want all packages, let's just return them all
- return [ map { +{ name => $_->{name}, version => $_->{version} } } @pkgs ]
+ return [ map { +{ name => $_->{name}, version => $_->{version}, pkg => $_->{pkg} } } @pkgs ]
if $filter eq 'ALL';
# Otherwise, mark the SBO ones and filter
@@ -156,7 +157,7 @@ sub get_installed_packages {
foreach my $sbo (@sbos) { $types{$sbo} = 'SBO'
if $locations{ $sbo =~ s/-compat32//gr }; }
}
- return [ map { +{ name => $_->{name}, version => $_->{version} } }
+ return [ map { +{ name => $_->{name}, version => $_->{version}, pkg => $_->{pkg} } }
grep { $types{$_->{name}} eq $filter } @pkgs ];
}