From 70a659c8151e952205b397be62218be90aab8c9b Mon Sep 17 00:00:00 2001 From: Anne Nicolas Date: Wed, 25 Jan 2012 08:25:59 +0000 Subject: fix media.cfg rewritting for Mageia --- BCD/Common.pm | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) (limited to 'BCD/Common.pm') diff --git a/BCD/Common.pm b/BCD/Common.pm index ac91081..9804eed 100644 --- a/BCD/Common.pm +++ b/BCD/Common.pm @@ -7,21 +7,21 @@ use MDK::Common; use Term::ANSIColor; use File::Copy::Recursive qw(dircopy pathrm); use File::Glob ':glob'; -use File::basename use BCD::Bcd qw(:DEFAULT); our @ISA = qw(Exporter); -our @EXPORT = qw(create_needed_dir check_dir clean_all print_color); +our @EXPORT = qw(create_needed_dir check_dir clean_all print_color check_based_on); # export all needed var -our @EXPORT_OK = qw($isoconf $wd $name $arch $file $based_on $version $repo $isodir $builddir $distrib_path $error_color $DISTRIB $THEME $tmp_rpmsrate $NB_FORK $dir_deps @list_of_removed $rpmrc $pwd_file $conf_file $date $urpmqlogs $support); +our @EXPORT_OK = qw($isoconf $wd $name $arch $file $based_on $version $repo $isodir $builddir $distrib_path $error_color $DISTRIB $THEME $tmp_rpmsrate $NB_FORK $dir_deps @list_of_removed $rpmrc $pwd_file $conf_file $date $urpmqlogs $rpmcheck_list_pkg $file_rpmcheck_log $smartcheck_list_pkg $smartcheck_dir $file_smartcheck_log $chroot_path $support); my $LOG="COMMON -"; my $color = "red"; + our @list_of_removed; -my ($sec,$min,$hour,$mday,$mon,$year,undef,undef,undef)= localtime(time); +my ($sec, $min, $hour, $mday, $mon, $year, undef, undef, undef) = localtime(time()); $year = $year + 1900; $mon = $mon + 1; our $date = $year . '_' . $mon . '_' . $mday . '-' . $hour . 'h' . $min . '-' . $sec; @@ -38,11 +38,11 @@ if (!$ARGV[0]) { } our $conf_file = $ARGV[0]; -our $isoconf = undef; +our $isoconf; if ($conf_file =~ /\.xml$/i) { $isoconf = XMLin($conf_file, keyattr => ['']); -} elsif ($file =~ /\.yaml$/i) { +} elsif ($conf_file =~ /\.yaml$/i) { $isoconf = YAML::LoadFile($conf_file); } else { print_color("You must provide an XML or YAML config file", $color) and exit 1; @@ -57,7 +57,6 @@ our $arch = $isoconf->{arch}; our $version = $isoconf->{mediainfo}{version}; our $repo = $isoconf->{repo}{path}; our $based_on = $isoconf->{based_on}; -our $support = $isoconf->{support}; $DISTRIB or print_color("You must define the tag",$color) and exit 1; $THEME or print_color("You must define the tag",$color) and exit 1; @@ -71,6 +70,22 @@ $based_on or print_color("You must define the tag",$color) and exit 1 $isoconf->{chroot_media} or print_color("Now you must define in the conf.xml file",$color) and exit 1; $isoconf->{chroot_media_exclude} or print_color("Now you must define in the conf.xml file",$color) and exit 1; +our $chroot_path = "/tmp/$isoconf->{nameid}-$version-$isoconf->{arch}"; + +our $rpmcheck_list_pkg = "/tmp/rpmcheck_list_pkg_to_add_$isoconf->{nameid}-$version-$isoconf->{arch}"; +our $file_rpmcheck_log = "/tmp/rpmcheck_failure_$isoconf->{nameid}-$version-$isoconf->{arch}"; +our $smartcheck_list_pkg = "/tmp/smartcheck_list_pkg_to_add_$isoconf->{nameid}-$version-$isoconf->{arch}"; +our $file_smartcheck_log = "/tmp/smartcheck_failure_$isoconf->{nameid}-$version-$isoconf->{arch}"; +our $smartcheck_dir = "/tmp/smartcheck_dir_$isoconf->{nameid}-$version-$isoconf->{arch}"; + +if (!defined($isoconf->{media}{first_media})) { + print_color("$LOG Please in the media list inform about the first_media name (Main)", $color); + whereisthedoc; +} +if (!defined($isoconf->{media}{update_prefix})) { + print_color("$LOG Please in the media list inform about the prefix use to define a media as an update, ie: 'Updates' (Updates)", $color); + whereisthedoc; +} # password file #"/home/plop/.signature.gpg"; @@ -117,6 +132,20 @@ sub check_dir { create_needed_dir("/tmp/$isoconf->{nameid}-$version-$isoconf->{arch}"); } +sub check_based_on { + if ($isoconf->{based_on} eq "1" || $isoconf->{based_on} =~ "gauldron") { + # dedicated line for MGA + print_color("Mageia distribution", $color); + return 1; + } elsif ($isoconf->{based_on} gt "2009.1" || $isoconf->{based_on} ne "mes5") { + print_color("distribution > 2009.1 or not a MES5", $color); + return 1; + } else { + print_color("distribution < 2009.1 or MES5", $color); + return 0; + } +} + sub clean_all { my @l = glob("/tmp/$isoconf->{nameid}-$version-$isoconf->{arch}/$distrib_path/*"); foreach (@l) { -- cgit v1.2.1