From 6fb537bbc5d19236ec981e24e290f80d491baa64 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Mon, 13 Dec 2010 21:42:05 +0000 Subject: use perl-URPM to create idx --- BCD/Genisoimage.pm | 15 +++++++++++++-- BCD/Media.pm | 21 ++++++++++++++++++--- BCD/Web.pm | 2 +- 3 files changed, 32 insertions(+), 6 deletions(-) (limited to 'BCD') diff --git a/BCD/Genisoimage.pm b/BCD/Genisoimage.pm index 7dba9b1..96d5b6e 100644 --- a/BCD/Genisoimage.pm +++ b/BCD/Genisoimage.pm @@ -3,6 +3,7 @@ package BCD::Genisoimage; 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); our @ISA = qw(Exporter); our @EXPORT = qw(main_iso); @@ -48,11 +49,21 @@ sub create_productid { } sub create_idx { - print_color("$LOG create the IDX file from $builddir/pkg-$version-$isoconf->{iso}{tag}.idx", $color); + print_color("$LOG create the IDX file from $builddir/pkg-$version-$isoconf->{iso}{tag}.idx", $color); # pkg-2009.1-pauillac.idx - system("find $builddir -name \*.rpm | awk -F 'media/' {'print \"$isoconf->{iso}{header}{volumeid} \" \$2'} | sed -e 's/\.rpm\$//g' | sort > $builddir/pkg-$version-$isoconf->{iso}{tag}.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; + 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"; + } + close $idx; system("cp -v $builddir/pkg-$version-$isoconf->{iso}{tag}.idx $isodir/$isoname.idx"); } + sub create_iso { # build the ISO with all args diff --git a/BCD/Media.pm b/BCD/Media.pm index 3b5878a..aa50fad 100644 --- a/BCD/Media.pm +++ b/BCD/Media.pm @@ -14,7 +14,7 @@ use Data::Dumper; use BCD::Common qw(:DEFAULT $isoconf $wd $name $arch $version $based_on $repo $builddir $distrib_path $error_color $DISTRIB $THEME $tmp_rpmsrate $NB_FORK $dir_deps @list_of_removed); our @ISA = qw(Exporter); -our @EXPORT = qw(main_media list_media use_gendistrib list_medias_available check_repo_hdlist rpmcheck_launch solve_doble_issue clean_urpmq_log get_srpms_list find_all_kernel, create_mediacfg); +our @EXPORT = qw(main_media list_media use_gendistrib list_medias_available check_repo_hdlist rpmcheck_launch solve_doble_issue clean_urpmq_log get_srpms_list find_all_kernel, create_mediacfg parse_synthesis); our @EXPORT_OK = qw($rpmcheck_list_pkg $file_rpmcheck_log); my $verbose; @@ -108,6 +108,7 @@ sub use_gendistrib { print_color("$LOG < 2009.1 or mes5 detected", $color); print_color("$LOG move hdlists and synthesys from $builddir/media/$destmedia/media_info to $builddir/media/media_info/", $color); system("rm -vf $builddir/media/media_info/*_$media->{name}.cz"); + system("rm -vf $builddir/media/media_info/*_main.cz"); system("rm -vf $builddir/media/media_info/pubkey_$media->{name}"); system("cp -avf $builddir/media/$destmedia/media_info/hdlist.cz $builddir/media/media_info/hdlist_$media->{name}.cz"); system("cp -avf $builddir/media/$destmedia/media_info/pubkey $builddir/media/media_info/pubkey_$media->{name}"); @@ -177,6 +178,20 @@ name=$media->{desc} close $MEDIACFG; } +sub parse_synthesis { + my ($path) = @_; + my $urpm = new URPM; + my %hash_rpms; + foreach (<$path/*.cz>) { + $urpm->parse_synthesis($_, keep_all_tags => 0); + $urpm->traverse(sub { my ($p) = @_; + $hash_rpms{ $p->name } = [ $p->version, $p->release, ]; + } + ); + } + return %hash_rpms; +} + # based on a similar functions in pkgs.pm sub get_list_from_CAT { #4 META_CLASS"desktop" mandriva-xfce-config-One @@ -490,7 +505,7 @@ sub do_fork { if ($previous_urqpm_querie =~ /EMPTY/) { $verbose and print_color("$LOG can't found the urpmq transaction for $pkg", $color); } else { - $verbose and print_color("$LOG found the urpmq transaction for $pkg, i will use $previous_urqpm_querie", $color); + $verbose and print_color("$LOG found the urpmq transaction for $pkg, i will use $previous_urqpm_querie, and copy it to $list-$pkg", $color); system("touch $dir_deps/bypass-$pkg"); system("cp -f $previous_urqpm_querie $list-$pkg"); #system("cp -f $dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}-$pkg $dir_deps/$list_filename-$pkg"); @@ -548,7 +563,7 @@ sub concatenate_files { foreach my $totest (cat_($exclude->{file})) { chomp($totest); if (! $totest) { next }; - system("rm -vf $chroot_path/urpmq/$isoconf->{tocopy_file}_todo_*$totest"); + system("rm -vf $chroot_path/urpmq/$isoconf->{tocopy_file}_todo_*-$totest"); } } } diff --git a/BCD/Web.pm b/BCD/Web.pm index f5630f6..70cf501 100644 --- a/BCD/Web.pm +++ b/BCD/Web.pm @@ -31,7 +31,7 @@ sub main_html { show_rpmcheck(); rename_iso(); link_urpmq_log(); - clean_previous_iso(); + #clean_previous_iso(); link_iso(); open my $B, ">>$index"; print $B ""; -- cgit v1.2.1