aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnne Nicolas <ennael@mageia.org>2011-11-06 10:25:58 +0000
committerAnne Nicolas <ennael@mageia.org>2011-11-06 10:25:58 +0000
commit025060b12e8849745bf381eadb210204826377c6 (patch)
tree2bc61466735c2d6075effbf12249b988a5feb8b9
parent3e58c1ee79532469f4e7d1b0084f5f791a31c7ca (diff)
downloadbcd-025060b12e8849745bf381eadb210204826377c6.tar
bcd-025060b12e8849745bf381eadb210204826377c6.tar.gz
bcd-025060b12e8849745bf381eadb210204826377c6.tar.bz2
bcd-025060b12e8849745bf381eadb210204826377c6.tar.xz
bcd-025060b12e8849745bf381eadb210204826377c6.zip
sync with upstream:
- fix idx file generation - better support of release/updates in media supp
-rw-r--r--BCD/Bcd.pm1
-rw-r--r--BCD/Genisoimage.pm35
-rw-r--r--BCD/Media.pm11
3 files changed, 32 insertions, 15 deletions
diff --git a/BCD/Bcd.pm b/BCD/Bcd.pm
index ce0bffa..cc65737 100644
--- a/BCD/Bcd.pm
+++ b/BCD/Bcd.pm
@@ -53,6 +53,7 @@ sub main_bcd() {
'' => \&help_bcd,
info => \&print_info,
iso => \&main_iso,
+ idx => \&create_idx,
md5 => \&create_md5,
stagex => \&main_stagex,
isolinux => \&main_isolinux,
diff --git a/BCD/Genisoimage.pm b/BCD/Genisoimage.pm
index 4a5cc42..e5ecfe7 100644
--- a/BCD/Genisoimage.pm
+++ b/BCD/Genisoimage.pm
@@ -4,9 +4,10 @@ use strict;
use XML::Simple;
use BCD::Common qw(:DEFAULT $isoconf $wd $name $arch $version $builddir $isodir $error_color $repo $based_on);
use BCD::Media qw(:DEFAULT parse_synthesis);
+use URPM;
our @ISA = qw(Exporter);
-our @EXPORT = qw(main_iso);
+our @EXPORT = qw(main_iso create_idx);
our @EXPORT_OK = qw($isoname);
my $LOG="GENISOIMAGE -";
@@ -52,16 +53,30 @@ sub create_idx {
print_color("$LOG create the IDX file from $builddir/pkg-$version-$isoconf->{iso}{tag}.idx", $color);
# pkg-2009.1-pauillac.idx
my $idx = "$builddir/pkg-$version-$isoconf->{iso}{tag}.idx";
- my %hrpms = parse_synthesis("$builddir/$isoconf->{mediainfo}{mediainfo_dir}/");
- open my $idx_file, ">$idx";
- foreach (keys %hrpms) {
- $_ or next;
- print $_;
- my @table = @{ $hrpms{$_} };
-# print "$isoconf->{iso}{header}{volumeid} $_-$table[0]-$table[1]\n";
- print $idx_file "$isoconf->{iso}{header}{volumeid} $_-$table[0]-$table[1]\n";
+ system("cp -vf /dev/null $idx");
+ use Data::Dumper;
+ my $urpm = URPM->new;
+ my @hdlists = glob("$builddir/media/media_info/hdlist_*.cz");
+ my @tab;
+ foreach (@hdlists) {
+ print_color("$LOG parsing $_ hslist", $color);
+ $urpm->parse_hdlist($_);
+ $urpm->traverse( sub {
+ my $pkg = shift;
+ my $pkgname = $pkg->name;
+ my $version = $pkg->version;
+ my $arch = $pkg->arch;
+ push @tab, "$pkgname-$version ($arch)";
+ }
+ );
}
- close $idx;
+ my %hashtab = map { $_ => 1 } @tab;
+ my @orderedpkgs = sort keys %hashtab;
+ open my $FILE_IDX, ">>$idx";
+ foreach (@orderedpkgs) {
+ print $FILE_IDX "$isoconf->{iso}{header}{volumeid} $_\n";
+ }
+ close $FILE_IDX;
system("cp -v $builddir/pkg-$version-$isoconf->{iso}{tag}.idx $isodir/$isoname.idx");
}
diff --git a/BCD/Media.pm b/BCD/Media.pm
index ab9d309..9f9189c 100644
--- a/BCD/Media.pm
+++ b/BCD/Media.pm
@@ -197,7 +197,6 @@ sub parse_synthesis {
# based on a similar functions in pkgs.pm
sub get_list_from_CAT {
- #4 META_CLASS"desktop" mandriva-xfce-config-One
my ($file, $cat, $poids) = @_;
my (%rates, @need_to_copy);
my (@l);
@@ -294,13 +293,15 @@ sub add_media {
system("sudo chroot $chroot_path mkdir -p /tmp/$name");
system("sudo mount -o bind $path $chroot_path/tmp/$name -o ro");
# check if path contain sub direcroty or not (media/release media/updates etc...)
- if (-d "$path/release" and -d "$path/updates") {
- print_color("$LOG This supp media contains release and updates sub-directory", $color);
+ if (-d "$path/release") {
+ print_color("$LOG This supp media contains a release sub-directory", $color);
system("LC_ALL=C sudo chroot $chroot_path urpmi.addmedia $name-release /tmp/$name/release");
- if ($update =~ /yes/) {
+ if (-d "$path/updates" and $update =~ /yes/) {
+ print_color("$LOG This supp media contains an updates sub-directory and update is set to yes", $color);
system("LC_ALL=C sudo chroot $chroot_path urpmi.addmedia --update '$name $isoconf->{media}{update_prefix}' /tmp/$name/updates");
}
} else {
+ print_color("$LOG There is no subdirectory (updates/release)for this supp media", $color);
system("LC_ALL=C sudo chroot $chroot_path urpmi.addmedia $name /tmp/$name");
}
push @to_umount, "/tmp/$name";
@@ -476,7 +477,7 @@ sub create_list {
$_ or next;
$tested_exclude = $tested_exclude . " --skip $_"
};
- print_color("$LOG remove unwanted mandriva-release, use $DISTRIB", $color);
+ print_color("$LOG remove unwanted mageia-release, use $DISTRIB", $color);
# urpmq options (with option in the xml file)
my $urpmq_options = "--requires-recursive -c --sources $isoconf->{mediainfo}{urpmi_option}";
my $urpmq_extra_opt = "$opt_sug $opt_srpm $extra_media";