diff options
-rwxr-xr-x | iurt2 | 28 |
1 files changed, 20 insertions, 8 deletions
@@ -235,30 +235,38 @@ open(my $LOG, ">&STDERR"); $run{LOG} = $LOG; print "$program_name version $VERSION\n"; -plog_init($program_name, $LOG, $run{verbose}); - my $todo = parseCommandLine($program_name, \@ARGV, \@params); @ARGV and usage($program_name, \@params, "@ARGV, too many arguments"); + +plog_init($program_name, $LOG, $run{verbose}); + foreach my $t (@$todo) { plog(6, "$t->[2]"); - &{$t->[0]}(@{$t->[1]}) or print {$run{LOG}} "ERROR: $t->[2]\n"; + &{$t->[0]}(@{$t->[1]}) or plog("ERROR: $t->[2]"); } + $run{distro_tag} = $run{distro}; $run{distro_tag} =~ s,/,-,g; -my $real_arch = `uname -m`; -chomp $real_arch; +chomp(my $real_arch = `uname -m`); my $HOME = $ENV{HOME}; my $configfile = "$HOME/.iurt.$run{distro_tag}.conf"; + plog(2, "loading config file $configfile"); my $config; if (-f $configfile) { - $config = do $configfile or die "FATAL $program_name: syntax error in $configfile"; + $config = do $configfile or + die "FATAL $program_name: syntax error in $configfile"; } else { $config = {} } -my $urpmi = Iurt::Urpmi->new(run => \%run, config => $config, urpmi_options => "-v --no-verify-rpm --nolock --auto --ignoresize"); + +my $urpmi = Iurt::Urpmi->new( + run => \%run, + config => $config, + urpmi_options => "-v --no-verify-rpm --nolock --auto --ignoresize" +); $run{urpmi} = $urpmi; if (!$run{chrooted_urpmi} && $run{group}) { @@ -294,12 +302,16 @@ my %config_usage = ( supported_arch => { desc => 'Table of supported architecture', default => ['i586', 'x86_64'] }, upload => { desc => 'Where to copy build packages', default => "$HOME/uploads/" }, vendor => { desc => 'Name of the packages vendor', default => 'Mandriva' }, - ); +); + config_usage() if $run{config_usage}; + $run{my_arch} or usage($program_name, \@params, "no architecture given (media $run{media}, run{my_arch} $run{my_arch}, todo @{$run{todo}})"); + if (!$arch_comp{$real_arch}{$run{my_arch}}) { die "FATAL $program_name: could not compile $run{my_arch} binaries on a $real_arch" } + config_init(\%config_usage, $config, \%run); $config->{upload} .= $run{distro}; |