From 025060b12e8849745bf381eadb210204826377c6 Mon Sep 17 00:00:00 2001 From: Anne Nicolas Date: Sun, 6 Nov 2011 10:25:58 +0000 Subject: sync with upstream: - fix idx file generation - better support of release/updates in media supp --- BCD/Genisoimage.pm | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'BCD/Genisoimage.pm') 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"); } -- cgit v1.2.1