Skip to content

Commit

Permalink
Add experimental expandflags:preinstallexpand support
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Aug 10, 2015
1 parent b3e125a commit 20b1457
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions Build.pm
Original file line number Diff line number Diff line change
Expand Up @@ -463,10 +463,40 @@ my %subst_defaults = (
],
);

# expand the preinstalls/vminstalls
sub expandpreinstalls {
my ($config) = @_;
return if !$config->{'expandflags:preinstallexpand'} || $config->{'preinstallisexpanded'};
my (@pre, @vm);
if (@{$config->{'preinstall'} || []}) {
@pre = expand($config, @{$config->{'preinstall'} || []});
return "preinstalls: $pre[0]" unless shift @pre;
@pre = sort(@pre);
}
if (@{$config->{'vminstall'} || []}) {
my %pre = map {$_ => 1} @pre;
my %vmx = map {+"-$_" => 1} @{$config->{'vminstall'} || []};
my @pren = grep {/^-/ && !$vmx{$_}} @{$config->{'preinstall'} || []};
@vm = expand($config, @pre, @pren, @{$config->{'vminstall'} || []});
return "vminstalls: $vm[0]" unless shift @vm;
@vm = sort(grep {!$pre{$_}} @vm);
}
$config->{'preinstall'} = \@pre;
$config->{'vminstall'} = \@vm;
#print STDERR "pre: @pre\n";
#print STDERR "vm: @vm\n";
$config->{'preinstallisexpanded'} = 1;
return '';
}

# Delivers all packages which get used for building
sub get_build {
my ($config, $subpacks, @deps) = @_;

if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
my $err = expandpreinstalls($config);
return (undef, $err) if $err;
}
if ($config->{'type'} eq 'livebuild') {
push @deps, @{$config->{'substitute'}->{'build-packages:livebuild'}
|| $subst_defaults{'build-packages:livebuild'} || []};
Expand Down Expand Up @@ -543,6 +573,10 @@ sub get_sysbuild {
@sysdeps = @{$subst_defaults{'system-packages:deltarpm'} || []} unless @sysdeps;
}
return () unless @sysdeps;
if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
my $err = expandpreinstalls($config);
return (undef, $err) if $err;
}
my @ndeps = grep {/^-/} @sysdeps;
my %ndeps = map {$_ => 1} @ndeps;
@sysdeps = grep {!$ndeps{$_}} @sysdeps;
Expand All @@ -561,6 +595,10 @@ sub get_sysbuild {
# Delivers all packages which shall have an influence to other package builds (get_build reduced by support packages)
sub get_deps {
my ($config, $subpacks, @deps) = @_;
if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
my $err = expandpreinstalls($config);
return (undef, $err) if $err;
}
my @ndeps = grep {/^-/} @deps;
my @extra = @{$config->{'required'}};
if (@{$config->{'keep'} || []}) {
Expand Down Expand Up @@ -592,11 +630,19 @@ sub get_deps {

sub get_preinstalls {
my ($config) = @_;
if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
my $err = expandpreinstalls($config);
return ('expandpreinstalls_error') if $err;
}
return @{$config->{'preinstall'}};
}

sub get_vminstalls {
my ($config) = @_;
if ($config->{'expandflags:preinstallexpand'} && !$config->{'preinstallisexpanded'}) {
my $err = expandpreinstalls($config);
return ('expandpreinstalls_error') if $err;
}
return @{$config->{'vminstall'}};
}

Expand Down

0 comments on commit 20b1457

Please sign in to comment.