aboutsummaryrefslogtreecommitdiffstats
path: root/BCD/Genisoimage.pm
diff options
context:
space:
mode:
Diffstat (limited to 'BCD/Genisoimage.pm')
-rw-r--r--BCD/Genisoimage.pm35
1 files changed, 25 insertions, 10 deletions
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");
}