[builder] Speed up Available/Installed Packages computation #3

This commit is contained in:
mudler
2016-03-06 13:13:55 +01:00
parent f37168a9e8
commit aebe2c8783
+7 -3
View File
@@ -62,17 +62,19 @@ sub calculate_missing {
my $package = shift;
my $depth = shift;
my @Installed_Packages = @{shift};
my @Available_Packages = @{shift};
# Getting the package dependencies and the installed packages
say "[$package] Getting the package dependencies and the installed packages";
my @Packages = package_deps( $package, $depth, 1 );
my @Installed_Packages = qx/equo q list installed --quiet/;
chomp(@Installed_Packages);
say "[$package] Getting the package dependencies and the installed packages";
#taking only the 4th column of output as key of the hashmap
my %installed_packs =
map { $_ => 1 } @Installed_Packages;
my %available_packs = map { $_ => 1 } available_packages();
my %available_packs = map { $_ => 1 } @Available_Packages;
# removing from packages the one that are already installed and keeping only the available in the entropy repositories
my @to_install = grep( defined $available_packs{$_},
@@ -189,9 +191,11 @@ my @packages = @ARGV;
if ($use_equo) {
my @packages_deps;
my @Installed_Packages = qx/equo q list installed --quiet/;
my @Available_Packages = available_packages();
foreach my $p (@packages) {
say "[$p] Getting the package dependencies which aren't already installed on the system.. ";
push( @packages_deps, calculate_missing( $p , $dep_scan_depth) )
push( @packages_deps, calculate_missing( $p , $dep_scan_depth,\@Installed_Packages,\@Available_Packages) )
if $equo_install_atoms;
push( @packages_deps, package_deps( $p, $dep_scan_depth, 0 ) )
if $equo_install_version;