aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2010-11-29 08:19:27 +0000
committerAntoine Ginies <aginies@mandriva.com>2010-11-29 08:19:27 +0000
commitdb9651a56a3dffdf17a303282f789e823cd90096 (patch)
treed6222edea8859073092849cbbe039cfd70745db1
parentb364785ea90e60806aaaec56d15bcc70a74daf6d (diff)
downloadbcd-db9651a56a3dffdf17a303282f789e823cd90096.tar
bcd-db9651a56a3dffdf17a303282f789e823cd90096.tar.gz
bcd-db9651a56a3dffdf17a303282f789e823cd90096.tar.bz2
bcd-db9651a56a3dffdf17a303282f789e823cd90096.tar.xz
bcd-db9651a56a3dffdf17a303282f789e823cd90096.zip
Fix urpmq queries for update, remove some print
-rw-r--r--BCD/Media.pm72
1 files changed, 45 insertions, 27 deletions
diff --git a/BCD/Media.pm b/BCD/Media.pm
index 9499d44..819979d 100644
--- a/BCD/Media.pm
+++ b/BCD/Media.pm
@@ -9,11 +9,12 @@ use Data::Dumper;
use MDK::Common;
use File::Glob ':glob';
use Parallel::ForkManager;
+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);
+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_OK = qw($rpmcheck_list_pkg $file_rpmcheck_log);
my $verbose;
@@ -99,11 +100,12 @@ sub use_gendistrib {
print_color("$LOG gendistrib --mediacfg $builddir/$isoconf->{iso}{mediacfg} $builddir", $color);
my $cmd = "gendistrib --mediacfg $builddir/$isoconf->{iso}{mediacfg} $builddir";
system($cmd) == 0 or die "$LOG system $cmd failed: $?\n";
- if ($isoconf->{based_on} lt "2009.1") {
+ if ($isoconf->{based_on} lt "2009.1" || $isoconf->{based_on} eq "mes5") {
foreach my $media (@{$isoconf->{media}{list}}) {
$media->{name} or next;
if ($destmedia eq $media->{destmedia}) { next }
$destmedia = $media->{destmedia};
+ 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/pubkey_$media->{name}");
@@ -123,14 +125,15 @@ sub copy_rpm {
sub create_mediacfg {
print_color("$LOG $builddir/$isoconf->{iso}{mediacfg}", $color);
- system("rm -rf $builddir/$isoconf->{mediainfo}{mediainfo_dir}");
+ system("rm -vrf $builddir/$isoconf->{mediainfo}{mediainfo_dir}");
create_needed_dir("$builddir/$isoconf->{mediainfo}{mediainfo_dir}");
my $media_cfg = "$builddir/$isoconf->{iso}{mediacfg}";
open my $MEDIACFG, ">$media_cfg";
print $MEDIACFG "\n";
print $MEDIACFG "[media_info]\n";
print $MEDIACFG "version=$version\n";
- if ($isoconf->{based_on} gt "2009.1") {
+ if ($isoconf->{based_on} gt "2009.1" or $isoconf->{based_on} ne "mes5") {
+ print_color("$LOG > 2009.1 or not a mes5 product", $color);
print $MEDIACFG "mediacfg_version=2\n";
}
print $MEDIACFG "branch=$isoconf->{iso}{branch}\n";
@@ -151,7 +154,8 @@ sub create_mediacfg {
$media->{name} or next;
if ($destmedia eq $media->{destmedia}) { next }
$destmedia = $media->{destmedia};
- if ($isoconf->{based_on} lt "2009.1") {
+ if ($isoconf->{based_on} =~ "mes5" || $isoconf->{based_on} lt "2009.1") {
+ print_color("$LOG < 2009.1 or mes5 detected", $color);
print $MEDIACFG "
[$media->{destmedia}]
@@ -473,15 +477,25 @@ sub do_fork {
# check an urpmq has been done before in an other media
foreach my $media (@{$isoconf->{media}{list}}) {
$media->{name} or next;
- if (-f "$dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}-$pkg") {
- $verbose and print_color("$LOG found the urpmq transaction for $pkg, i will use it $dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}-$pkg", $color);
+ # $dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}_update-$pkg"
+ my $previous_urqpm_querie;
+ if (-f "$dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}_update-$pkg") {
+ $previous_urqpm_querie = "$dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}_update-$pkg";
+ } elsif (-f "$dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}-$pkg") {
+ $previous_urqpm_querie = "$dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}-$pkg";
+ } else {
+ $previous_urqpm_querie = "EMPTY";
+ next;
+ }
+ 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);
system("touch $dir_deps/bypass-$pkg");
- system("cp -f $dir_deps/$isoconf->{tocopy_file}_todo_$media->{name}-$pkg $list-$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");
- last;
- } else {
- $verbose and print_color("$LOG can't found the urpmq transaction", $color);
}
+ last;
}
# check an urpmq has been done before in this media
if (-f "$dir_deps/bypass-$pkg") {
@@ -609,9 +623,12 @@ sub find_source_dest_media {
# find the dest media from source media
foreach my $media (@{$isoconf->{media}{list}}) {
# find a media or next one
- $media->{name} or next;
+ $media->{external}{name} or next;
+# print Dumper($media);
+# print "DEBUG todeal: $todeal DEBUG media->name: $media->{name} source_media: $source_media\n";
+# print "$todeal from $source_media | external-fullpath_mediadir: $media->{external}{fullpath_mediadir}/ media/$media->{destmedia}\n";
+# print "external-name $media->{external}{name}\n";
if ($source_media eq $media->{name}) {
- #print "DEBUG todeal: $todeal DEBUG media->name: $media->{name} source_media: $source_media\n";
# we have found the media so destmedia is $media->{destmedia}
# return the destmedia
return($media->{external}{fullpath_mediadir}, "media/$media->{destmedia}");
@@ -619,6 +636,8 @@ sub find_source_dest_media {
return("$media->{external}{fullpath_mediadir}/release", "media/$media->{destmedia}");
} elsif ($source_media eq "$media->{name}/updates") {
return("$media->{external}{fullpath_mediadir}/updates", "media/$media->{destmedia}");
+ } else {
+ print "dont know what to do ....\n";
}
next;
}
@@ -836,7 +855,7 @@ sub rpmcheck_launch {
sub remove_hdlist {
my $destmedia;
- if ($isoconf->{based_on} gt "2009.1") {
+ if ($isoconf->{based_on} gt "2009.1" or $isoconf->{based_on} != "mes5") {
print_color("$LOG remove hdlists*.cz from $builddir/media/media_info", $color);
system("rm -vf $builddir/media/media_info/hdlist*.cz");
foreach my $media (@{$isoconf->{media}{list}}) {
@@ -993,8 +1012,8 @@ sub solve_doble_issue {
my @list_to_filter; my @todeal;
my %already_seen; my @final_list;
my $keeped;
- # 50 should not cause any trouble... NB_FORK is too small...
- my $pm = new Parallel::ForkManager(50);
+ # 20 should not cause any trouble... NB_FORK is too small...
+ my $pm = new Parallel::ForkManager(20);
my @checked; my $already_done;
foreach my $media (@{$isoconf->{media}{list}}) {
$media->{name} or next;
@@ -1020,9 +1039,9 @@ sub solve_doble_issue {
$_ or next; my $found = 0;
my $pkg = basename($_);
foreach (cat_($isoconf->{mediainfo}{filter})) {
- if ($_ =~ /^$pkg_name/) { print "- skipping $_\n (from $isoconf->{mediainfo}{filter} file)" and $found = 1; }
+ if ($_ =~ /^$pkg_name/) { $found = 1; } #print "- skipping $_\n (from $isoconf->{mediainfo}{filter} file)" and $found = 1; }
}
- if ($_ =~ /kernel/) { print "- $pkg_name is a package relative to a kernel ! will be treated later\n"; }
+ #if ($_ =~ /kernel/) { print "- $pkg_name is a package relative to a kernel ! will be treated later\n"; }
$found eq "1" and next;
$pkg =~ /^$pkg_name\-\d.*/ or next;
# bypass special case like libwnck-1_22
@@ -1039,7 +1058,7 @@ sub solve_doble_issue {
} elsif ($r eq "1") {
system("rm -f $builddir/media/$media->{destmedia}/$keeped");
$keeped = $pkg;
- $verbose and print "i will keep $keeped and remove $builddir/media/$media->{destmedia}/$keeped\n";
+ $verbose and print "i will keep $pkg and remove $builddir/media/$media->{destmedia}/$keeped\n";
push @list_of_removed, "$builddir/media/$media->{destmedia}/$keeped";
};
}
@@ -1081,6 +1100,9 @@ sub process_list_link {
remove_all_excluded;
if ($option =~ /nodoble/) { print_color("$LOG skipping doble\n", $color); } else { solve_doble_issue; }
find_all_kernel;
+ copy_filedeps;
+ copy_rpmsrate;
+ copy_compssusers;
use_gendistrib;
## use_genhdlist2;
}
@@ -1098,17 +1120,13 @@ sub main_media {
if ($option =~ /verbose/) { $verbose = "1"; }
list_media;
create_media;
- copy_all_pubkey;
-
create_mediacfg;
-
- copy_filedeps;
- copy_rpmsrate;
- copy_compssusers;
+ copy_all_pubkey;
create_needed_dir($chroot_path);
print_color("$LOG erase previous bypasss file", $color);
system("rm -f $dir_deps/bypass-*");
+ copy_rpmsrate;
generate_list_of_rpm_2_copy;
process_list_link($option);
# target_size;
@@ -1116,10 +1134,10 @@ sub main_media {
rpmcheck_launch;
rpmcheck_list;
process_list_link($option);
- # second laucn of rpmcheck (should have fix a lot of missing deps)
+ # second launch of rpmcheck (should have fix a lot of missing deps)
rpmcheck_launch;
umount_all_mountloop;
- remove_hdlist;
+ #remove_hdlist;
show_size;
my $l = @list_of_removed;
if ($l ne "0") {