From 9c5e795577be2e3dfbc72c331acf07039318c882 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Adrian=20Schr=C3=B6ter?= Date: Tue, 9 Mar 2010 16:23:23 +0100 Subject: [PATCH] * Collect exclusive arch from all possible needed architectures of kiwi file. * Drop packages with onlyarch="skipit" * Do not list packages with arch= $not_target_arch * join code for - repopackages - metapackages - packages (live image) --- Build/Kiwi.pm | 53 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/Build/Kiwi.pm b/Build/Kiwi.pm index e15689b..2627681 100644 --- a/Build/Kiwi.pm +++ b/Build/Kiwi.pm @@ -145,16 +145,6 @@ sub kiwiparse { die("bad instsource path: $kiwisource->{'path'}\n") unless $kiwisource->{'path'} =~ /^obs:\/\/\/?([^\/]+)\/([^\/]+)\/?$/; push @repos, "$1/$2"; } - for my $repopackages (@{$instsource->{'repopackages'} || []}) { - for my $repopackage (@{$repopackages->{'repopackage'} || []}) { - push @packages, $repopackage->{'name'}; - } - } - if ($instsource->{'metadata'}) { - for my $repopackage (@{$instsource->{'metadata'}->[0]->{'repopackage'} || []}) { - push @packages, $repopackage->{'name'}; - } - } if ($instsource->{'productoptions'}) { my $productoptions = $instsource->{'productoptions'}->[0] || {}; for my $po (@{$productoptions->{'productvar'} || []}) { @@ -184,18 +174,43 @@ sub kiwiparse { push @repos, "$1/$2"; } } - for my $packagegroup (@{$kiwi->{'packages'} || []}) { - for my $package (@{$packagegroup->{'package'} || []}) { - if ($package->{'arch'}) { - my $ma = $arch; - $ma =~ s/i[456]86/i386/; - my $pa = $package->{'arch'}; - $pa =~ s/i[456]86/i386/; - next if $ma ne $pa; + + # Find packages and possible additional required architectures + my @additionalarchs; + my @pkgs = unify(@{$instsource->{'metadata'}->[0]->{'repopackage'}}, @{$instsource->{'repopackages'}->[0]->{'repopackage'}}, + @{$kiwi->{'packages'}[0]->{'package'}}); + for my $package (@pkgs) { + # filter packages, which are not targeted for the wanted plattform + if ($package->{'arch'}) { + if (@requiredarch) { + # this is a product + next unless ( grep { $_ eq $package->{'arch'} } @requiredarch ); + }else{ + # live appliance + my $ma = $arch; + $ma =~ s/i[456]86/i386/; + my $pa = $package->{'arch'}; + $pa =~ s/i[456]86/i386/; + next if $ma ne $pa; } - push @packages, $package->{'name'}; + } + + # not nice, but optimise our build dependencies + next if defined($package->{'onlyarch'}) && $package->{'onlyarch'} eq "skipit"; + + # we need this package + push @packages, $package->{'name'}; + + # find the maximal superset of possible required architectures + my @add; + my @only; + @add = split(",",$package->{'addarch'}) if $package->{'addarch'}; + @only = split(",",$package->{'onlyarch'}) if $package->{'onlyarch'}; + for my $ra ( unify(@add, @only) ) { + push @additionalarchs, $ra } } + @requiredarch = unify( @requiredarch, @additionalarchs ); if (!$instsource) { my $packman = $preferences->{'packagemanager'}->[0]->{'_content'}; -- 2.7.4