aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--SBO-Lib/lib/SBO/Lib/Pkgs.pm9
-rwxr-xr-xsboinstall8
-rwxr-xr-xt/04-install.t2
3 files changed, 10 insertions, 9 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 ];
}
diff --git a/sboinstall b/sboinstall
index ad0b208..724b9a4 100755
--- a/sboinstall
+++ b/sboinstall
@@ -13,7 +13,7 @@
use 5.16.0;
use strict;
use warnings FATAL => 'all';
-use SBO::Lib qw/ usage_error slackbuilds_or_fetch get_build_queue merge_queues get_sbo_locations get_installed_packages get_inst_names get_installed_cpans get_sbo_location user_prompt process_sbos print_failures %config get_arch show_version /;
+use SBO::Lib qw/ usage_error slackbuilds_or_fetch get_build_queue merge_queues get_sbo_locations get_installed_packages get_installed_cpans get_sbo_location user_prompt process_sbos print_failures %config get_arch show_version /;
use Getopt::Long qw(:config bundling);
use File::Basename;
@@ -96,11 +96,11 @@ if ($no_reqs or $non_int) {
}
# get lists of installed packages and perl modules from CPAN
-my $inst_names = get_inst_names(get_installed_packages 'ALL');
+my $inst_pkgs = get_installed_packages('ALL');
my $pms = get_installed_cpans();
s/::/-/g for @$pms;
my %inst_names;
-$inst_names{$_} = 1 for @$inst_names;
+$inst_names{$_->{name}} = $_ for @$inst_pkgs;
# populate %locations and sanity check
%locations = get_sbo_locations($build_queue);
@@ -122,7 +122,7 @@ FIRST: for my $sbo (@$build_queue) {
my $name = $compat32 ? "$sbo-compat32" : $sbo;
if ($inst_names{$name}) {
- say "$name already installed.";
+ say sprintf "%s (%s) is already installed.", $name, $inst_names{$name}{pkg};
next FIRST;
} else {
if ($sbo =~ /^perl-/) {
diff --git a/t/04-install.t b/t/04-install.t
index 3302909..93c0460 100755
--- a/t/04-install.t
+++ b/t/04-install.t
@@ -74,7 +74,7 @@ sboinstall 'nonexistentslackbuild4', { input => "y\ny", expected => qr/nonexiste
sboremove 'nonexistentslackbuild4', 'nonexistentslackbuild5', { input => "y\ny\ny", test => 0 };
# 10: sboinstall nonexistentslackbuild6
-sboinstall 'nonexistentslackbuild6', { input => "y\ny", expected => qr/aaa_base already installed.*nonexistentslackbuild6 added to install queue.*Install queue: nonexistentslackbuild6/s };
+sboinstall 'nonexistentslackbuild6', { input => "y\ny", expected => qr/aaa_base \(aaa_base-[^)]+\) is already installed.*nonexistentslackbuild6 added to install queue.*Install queue: nonexistentslackbuild6/s };
# 11-12: sboinstall -i nonexistentslackbuild
sboinstall qw/ -i nonexistentslackbuild /, { input => "y\ny", expected => qr/nonexistentslackbuild added to install queue/ };