From 589f5f2c51f527e81ddfcc7c2989c532300bd358 Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Wed, 6 Dec 2006 14:09:44 +0000 Subject: force to have a repository either in the config file or the command line --- iurt2 | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/iurt2 b/iurt2 index 02b0222..c399e5c 100755 --- a/iurt2 +++ b/iurt2 @@ -70,6 +70,7 @@ $run{todo} = []; [--copy-srpm] [--debug] [--distro] [--no-rsync] [--clean user1 user2 user3] [--clean-all] [--shell] [--stop {p|c|i|l|b|a|s}] [--use-system-distrib] [--dir] [--help foo?] [--log filename] [--group] [--unionfs] [--upload [--markrelease] [--source]] [--dir] [--help foo?] [--log filename] [--unionfs] [--status] [--ignore-failure] + [--repository ] {--config_help | --dkms {--media } --chroot --arch {i586|x86_64|ppc} --distro {cooker|2006.0|community/2006.0|...} } | --rebuild {cooker|2006.0|community/2006.0|...} {i586|x86_64|ppc|...} {filename1.src.rpm} {filename2.src.rpm} ... {filenamen.src.rpm} }", @@ -242,6 +243,12 @@ $run{todo} = []; ($run{stop}) = @_; 1; }, "Setting rpm build option" ], + [ "", "repository", 1, "", + "Set a repository path if one is not created in the configuration file", + sub { + ($run{repository}) = @_; + 1; + } , "Setting the repository" ], [ "", "status", 1, "", "Send a status mail to the provided mail address", sub { @@ -289,6 +296,16 @@ if (-f $configfile) { } else { $config = {}; } + +if ($run{repository}) { + plog('DEBUG', "overriding configuration repository by the one given in the command line"); + $config->{repository} = $run{repository} +} + +if (!$config->{repository}) { + die "FATAL $program_name: no repository have been defined (use --repository to specify one on the command line" +} + my $urpmi = Iurt::Urpmi->new(run => \%run, config => $config, urpmi_options => "-v --no-verify-rpm --nolock --auto --ignoresize"); $run{urpmi} = $urpmi; @@ -344,7 +361,7 @@ my %config_usage = ( }, iurt_root_command => { desc => 'Program to run sudo command', - default => '/usr/local/bin/iurt_root_command' + default => '/usr/sbin/iurt_root_command' }, distribution => { desc => 'Name of the packages distribution', @@ -400,7 +417,7 @@ my %config_usage = ( }, repository => { desc => 'Prefix of the repositories', - default => '/mnt/BIG/dis/' + default => '' }, rsync_to => { desc => 'Server where the result of the builds should be rsynced (name@server:path format)', @@ -456,6 +473,7 @@ $run{lock} = $lock; # cache file name is needed early to remove the manual lock file if the # lock mechanism does not work +mkpath $config->{cache_home}; my $cachefile = "$config->{cache_home}/iurt.$run{distro_tag}.$run{my_arch}.$lock.cache"; $run{cachefile} = $cachefile; if (!$run{debug} && $run{media} || $run{chroot}) { @@ -637,7 +655,9 @@ if ($run{shell}) { } } -# perform some cleaning before running to have some more space, rsync to the server too in case previous iurt crashed +# perform some cleaning before running to have some more space, rsync to +# the server too in case previous iurt crashed + if ($config->{rsync_to} && !$run{no_rsync}) { # remove some old and very big log files not to saturate the server system(qq(find $local_spool/log/ -name "*.log" \\( -size +$config->{log_size_limit} -or -mtime +$config->{log_size_date} \\) -exec rm -f {} \\;)); @@ -764,11 +784,6 @@ retry: next; } - # CM: Hack to allow resolution of localhost inside the chroot (for - # e.g. libneon). This will be properly done elsewhere later - # - system(qq($sudo sh -c "echo 127.0.0.1 localhost > $chroot_tmp/etc/hosts")); - # try to workarround the rpm -qa db4 error(2) from dbcursor->c_get: # No such file or directory # system("sudo chroot $chroot_tmp rm -rf /var/lib/rpm/__db* &> /dev/null"); -- cgit v1.2.1