aboutsummaryrefslogtreecommitdiffstats
path: root/BCD/Common.pm
diff options
context:
space:
mode:
Diffstat (limited to 'BCD/Common.pm')
-rw-r--r--BCD/Common.pm43
1 files changed, 36 insertions, 7 deletions
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 <theme><name> tag",$color) and exit 1;
$THEME or print_color("You must define the <theme><theme> tag",$color) and exit 1;
@@ -71,6 +70,22 @@ $based_on or print_color("You must define the <based_on> tag",$color) and exit 1
$isoconf->{chroot_media} or print_color("Now you must define <chroot_media> in the conf.xml file",$color) and exit 1;
$isoconf->{chroot_media_exclude} or print_color("Now you must define <chroot_media_exclude> 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 (<first_media>Main</first_media>)", $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' (<update_prefix>Updates</update_prefix>)", $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) {