summaryrefslogtreecommitdiffstats
path: root/lib/MGA
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MGA')
-rw-r--r--lib/MGA/DrakISO/BuildMedia.pm57
1 files changed, 35 insertions, 22 deletions
diff --git a/lib/MGA/DrakISO/BuildMedia.pm b/lib/MGA/DrakISO/BuildMedia.pm
index 9bf157f..497012a 100644
--- a/lib/MGA/DrakISO/BuildMedia.pm
+++ b/lib/MGA/DrakISO/BuildMedia.pm
@@ -45,8 +45,11 @@ my $urpm;
# The hash key is the package name and the hash value is a hash containing the
# following fields:
#
-# object the URPM::Package object for the newest version/release
-# of that package
+# base_pkg a reference to the URPM::Package object for the newest
+# version/release of that package in the base media
+#
+# best_pkg a reference to the URPM::Package object for the newest
+# version/release of that package in all media
#
# class undefined if the package is not selected
# set to 1 if the package was explicity selected
@@ -88,7 +91,9 @@ sub prepare_media {
update_dependencies($build);
build_installer_media($build);
- check_installer_media($build);
+
+ check_installer_media($build, ${$build->{repo}{classes}}[0]);
+ check_installer_media($build, '*');
my $arch = $build->{settings}{arch};
my $version = $build->{settings}{version};
@@ -172,11 +177,19 @@ sub get_available_packages {
urpm::media::configure($urpm);
+ my $base_class = ${$build->{repo}{classes}}[0];
+
$urpm->traverse(sub {
my ($pkg) = @_;
- my $name = $pkg->name();
- if (!defined $package{$name} || $pkg->compare_pkg($package{$name}{object}) > 0) {
- $package{$name}{object} = $pkg;
+ my $name = $pkg->name;
+ my @medium = grep { $pkg->id >= $_->{start} && $pkg->id <= $_->{end} } @{$urpm->{media}}
+ or die "ERROR: failed to identify the medium containing the $name package\n";
+ if (!defined $package{$name} || $pkg->compare_pkg($package{$name}{best_pkg}) > 0) {
+ $package{$name}{best_pkg} = $pkg;
+ }
+ return if $medium[0]->{name} !~ /^$base_class/;
+ if (!defined $package{$name}{base_pkg} || $pkg->compare_pkg($package{$name}{base_pkg}) > 0) {
+ $package{$name}{base_pkg} = $pkg;
}
});
}
@@ -371,7 +384,7 @@ sub update_dependencies {
my @search_list = grep { $package{$_}{class} == 1 } keys %package;
while (@search_list) {
foreach my $name (@search_list) {
- my $pkg = $package{$name}{object};
+ my $pkg = $package{$name}{best_pkg};
my $parent_name = $pkg->name();
my @requires = $pkg->requires_nosense();
$urpm->traverse_tag('whatprovides', \@requires, sub {
@@ -433,16 +446,16 @@ sub build_installer_media {
# single medium for each class, so we ignore the source media type.
my @packages = grep { defined $package{$_}{class} } keys %package;
foreach my $name (@packages) {
- my $pkg = $package{$name}{object};
- my $id = $pkg->id();
- my @medium = grep { $id >= $_->{start} && $id <= $_->{end} } @{$urpm->{media}}
- or die "ERROR: failed to identify the medium containing the $name package\n";
- my $src_path = $medium[0]->{url} . '/' . $pkg->filename();
- my @path_parts = split('/', $src_path);
- my $class = $path_parts[-3];
- my $name = $path_parts[-1];
- my $dst_path = $media_dir . $class . '/' . $name;
- copy_or_link($src_path, $dst_path);
+ foreach my $pkg (uniq($package{$name}{best_pkg}, $package{$name}{base_pkg})) {
+ defined $pkg or next;
+ my @medium = grep { $pkg->id >= $_->{start} && $pkg->id <= $_->{end} } @{$urpm->{media}};
+ my $src_path = $medium[0]->{url} . '/' . $pkg->filename();
+ my @path_parts = split('/', $src_path);
+ my $class = $path_parts[-3];
+ my $name = $path_parts[-1];
+ my $dst_path = $media_dir . $class . '/' . $name;
+ copy_or_link($src_path, $dst_path);
+ }
}
print " generating media info\n" if $::verbose > 1;
@@ -500,14 +513,14 @@ sub create_media_cfg {
}
sub check_installer_media {
- my ($build) = @_;
+ my ($build, $class) = @_;
- print "Checking installer media\n" if $::verbose;
+ print "Checking installer media [$class]\n" if $::verbose;
my $arch = $build->{settings}{arch};
- my $media_dir = $build->get_builddir('files/' . $arch . '/media/');
- my $log_file = $build->get_builddir('tmp') . '/rpmcheck.log';
- system("zcat -q $media_dir/*/media_info/hdlist.cz | rpmcheck -explain -failures > $log_file") == 0
+ my $media_dir = $build->get_builddir('files/' . $arch . '/media');
+ my $log_file = $build->get_builddir('tmp') . '/rpmcheck.log';
+ system("zcat -q $media_dir/$class/media_info/hdlist.cz | rpmcheck -explain -failures > $log_file") == 0
or die "ERROR: failed to run rpmcheck\n";
if (system("grep -q FAILED $log_file") == 0) {