Compare commits

...

2 Commits

Author SHA1 Message Date
Ettore Di Giacinto 62548482d5 Merge pull request #11 from optiz0r/feature_optional_prune_virtuals
Allow virtual dependency pruning to be controlled by env var
2016-03-28 14:40:15 +02:00
Ben Roberts cc406e3924 Allow virtual dependency pruning to be controlled by env var
Defaults to off, while the stability of virtual pruning is checked
2016-03-28 13:22:00 +01:00
2 changed files with 17 additions and 12 deletions
+16 -12
View File
@@ -24,6 +24,7 @@ my $skip_portage_sync = $ENV{SKIP_PORTAGE_SYNC} // 0;
my $emerge_split_install = $ENV{EMERGE_SPLIT_INSTALL} // 0; my $emerge_split_install = $ENV{EMERGE_SPLIT_INSTALL} // 0;
my $webrsync = $ENV{WEBRSYNC} // 0; my $webrsync = $ENV{WEBRSYNC} // 0;
my $enman_repositories = $ENV{ENMAN_REPOSITORIES}; my $enman_repositories = $ENV{ENMAN_REPOSITORIES};
my $prune_virtuals = $ENV{PRUNE_VIRTUALS} // 0;
my $make_conf = $ENV{MAKE_CONF}; my $make_conf = $ENV{MAKE_CONF};
@@ -87,24 +88,27 @@ sub available_packages {
sub calculate_missing { sub calculate_missing {
my $package = shift; my $package = shift;
my $depth = shift; my $depth = shift;
my @Installed_Packages = @{+shift}; my @Installed_Packages = @{+shift};
my @Available_Packages = @{+shift}; my @Available_Packages = @{+shift};
my $prune_virtuals = shift;
# Getting the package dependencies and the installed packages # Getting the package dependencies and the installed packages
my @dependencies = package_deps( $package, $depth, 1 ); my @dependencies = package_deps( $package, $depth, 1 );
my %install_dependencies = map { $_ => 1 } @dependencies; if ($prune_virtuals) {
# Look for any virtuals and remove its immediate dependencies to avoid say "[$package] Pruning dependencies of virtual packages";
# installing multiple conflicting packages one by one my %install_dependencies = map { $_ => 1 } @dependencies;
my @virtual_deps; # Look for any virtuals and remove its immediate dependencies to avoid
for my $dep (@dependencies) { # installing multiple conflicting packages one by one
push(@virtual_deps, package_deps( $dep, 1, 1 )) if ( $dep =~ /^virtual\// ); my @virtual_deps;
for my $dep (@dependencies) {
push(@virtual_deps, package_deps( $dep, 1, 1 )) if ( $dep =~ /^virtual\// );
}
for my $dep (@virtual_deps) {
$install_dependencies{$dep} = 0 if ( $dep !~ /^virtual\// );
}
@dependencies = grep { $install_dependencies{$_} } @dependencies;
} }
for my $dep (@virtual_deps) {
$install_dependencies{$dep} = 0 if ( $dep !~ /^virtual\// );
}
@dependencies = grep { $install_dependencies{$_} } @dependencies;
#taking only the 4th column of output as key of the hashmap #taking only the 4th column of output as key of the hashmap
my %installed_packs = my %installed_packs =
@@ -250,7 +254,7 @@ if ($use_equo) {
foreach my $p (@packages) { foreach my $p (@packages) {
say "[$p] Getting the package dependencies which aren't already installed on the system.. "; say "[$p] Getting the package dependencies which aren't already installed on the system.. ";
push( @packages_deps, calculate_missing( $p , $dep_scan_depth,\@Installed_Packages,\@Available_Packages) ) push( @packages_deps, calculate_missing( $p , $dep_scan_depth,\@Installed_Packages,\@Available_Packages, $prune_virtuals) )
if $equo_install_atoms; if $equo_install_atoms;
push( @packages_deps, package_deps( $p, $dep_scan_depth, 0 ) ) push( @packages_deps, package_deps( $p, $dep_scan_depth, 0 ) )
if $equo_install_version; if $equo_install_version;
+1
View File
@@ -43,6 +43,7 @@ docker_volumes=( -v "$OUTPUT_DIR:/usr/portage/packages" )
[ -z "$DISTFILES" ] || docker_volumes+=(-v "$DISTFILES:/usr/portage/distfiles") [ -z "$DISTFILES" ] || docker_volumes+=(-v "$DISTFILES:/usr/portage/distfiles")
[ -z "$ENTROPY_DOWNLOADED_PACKAGES" ] || docker_volumes+=(-v "$ENTROPY_DOWNLOADED_PACKAGES:/var/lib/entropy/client/packages") [ -z "$ENTROPY_DOWNLOADED_PACKAGES" ] || docker_volumes+=(-v "$ENTROPY_DOWNLOADED_PACKAGES:/var/lib/entropy/client/packages")
[ -z "$DISTCC_HOSTS" ] || docker_env+=(-e "DISTCC_HOSTS=$DISTCC_HOSTS") [ -z "$DISTCC_HOSTS" ] || docker_env+=(-e "DISTCC_HOSTS=$DISTCC_HOSTS")
[ -z "${PRUNE_VIRTUALS}" ] || docker_env+=(-e "PRUNE_VIRTUALS=$PRUNE_VIRTUALS")
if [ -n "$REMOTE_OVERLAY" ]; then if [ -n "$REMOTE_OVERLAY" ]; then
git clone "$REMOTE_OVERLAY" "$TEMPDIR" git clone "$REMOTE_OVERLAY" "$TEMPDIR"