aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--NEWS14
-rwxr-xr-xiurt8
-rwxr-xr-xiurt_root_command4
-rwxr-xr-xlib/Iurt/Ulri.pm12
-rw-r--r--lib/Iurt/Urpmi.pm55
-rw-r--r--lib/Iurt/Util.pm17
7 files changed, 82 insertions, 31 deletions
diff --git a/Makefile b/Makefile
index 30858fd..ae7da29 100644
--- a/Makefile
+++ b/Makefile
@@ -15,8 +15,7 @@ install:
install -d $(bindir) $(sbindir) $(INSTALLVENDORLIB)/Iurt
install -m 644 lib/Iurt/*.pm $(INSTALLVENDORLIB)/Iurt
install -m755 iurt_root_command $(sbindir)/
- install -m755 iurt $(bindir)/iurt
- install -m755 emi ulri $(bindir)/
+ install -m755 cancel_build emi iurt ulri $(bindir)/
tar: dist
diff --git a/NEWS b/NEWS
index e1f03a9..8d76df4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+- iurt: Use ip instead of ifconfig to bring lo up
+
+0.9.4
+- iurt: Fix getting srpm name when parsing the spec causes some output on stdout
+
+0.9.3
+- ulri: Fix a crash on build failure. This caused to not send failure emails
+ and not cleanup packages for other architectures.
+
+0.9.2
+- iurt: Improve logging
+- iurt: recreate .src.rpm using --target <arch> to fix installing BRs using %{?_isa} macro on armv7hl
+
+0.9.1
- cancel_build: add an utility to cancel a build in the queue
0.9.0
diff --git a/iurt b/iurt
index 1e3270c..880bcbf 100755
--- a/iurt
+++ b/iurt
@@ -43,8 +43,8 @@ use Iurt::Chroot qw(add_local_user create_temp_chroot remove_chroot create_build
use Iurt::Process qw(perform_command kill_for_good sudo);
use Iurt::Mail qw(sendmail);
use Iurt::RPM qw(check_arch check_noarch);
-use Iurt::Util qw(plog_init plog);
-use File::NCopy qw(copy);
+use Iurt::Util qw(logdir plog_init plog);
+use File::Copy qw(copy);
use File::Path qw(mkpath);
use File::Spec::Functions qw(rel2abs);
use File::Basename qw(fileparse);
@@ -324,7 +324,7 @@ plog_init($program_name, $run{logfd} || $LOG, 7, 1); # For parsing command line
# Display version information
#
-my $version = '0.9.0';
+my $version = '0.9.4';
plog("MSG", "This is iurt version $version");
my $todo = parseCommandLine($program_name, \@ARGV, \@params);
@@ -775,7 +775,7 @@ retry:
return $srpm;
}
- (my $log_dirname = $srpm) =~ s/.*:(.*)\.src.rpm/$1/;
+ my $log_dirname = logdir($srpm);
my $log_dir = "$local_spool/log/$log_dirname/";
# only create the log dir for the new srpm
diff --git a/iurt_root_command b/iurt_root_command
index e64b1f7..5dbc4f5 100755
--- a/iurt_root_command
+++ b/iurt_root_command
@@ -24,7 +24,7 @@ use strict;
my $program_name = 'iurt_root_command';
use Mkcd::Commandline qw(parseCommandLine usage);
use MDK::Common qw(any if_);
-use File::NCopy qw(copy);
+use File::Copy qw(copy);
use Iurt::Util qw(plog_init plog);
use Cwd 'realpath';
use File::Path qw(make_path);
@@ -424,7 +424,7 @@ sub netns_create {
check_path_authorized($dest) or return;
my $nsname = basename($dest);
system("ip", "netns", "add", $nsname) and return;
- system("ip", "netns", "exec", $nsname, "ifconfig", "lo", "up");
+ system("ip", "netns", "exec", $nsname, "ip", "link", "set", "lo", "up");
# We don't configure a DNS server so make sure one is not excepted
system('sed', '-i', 's|^hosts:.*|hosts: files|', "$dest/etc/nsswitch.conf");
# Some packages want a default route
diff --git a/lib/Iurt/Ulri.pm b/lib/Iurt/Ulri.pm
index 09be6b0..8453c86 100755
--- a/lib/Iurt/Ulri.pm
+++ b/lib/Iurt/Ulri.pm
@@ -299,19 +299,19 @@ sub warn_about_failure {
$fpath =~ tr!/!!s; # Squash double slashes ...
$fpath =~ s!/!//!; # ... except for http://
- $text .= "\nFailure details available in $fpath/log\n";
+ $text .= "\nFailure details available in $fpath/\n";
$text .= "Reason:\n";
- $text .= read_file("$fail_dir/$prefix/log/status.log");
+ $text .= read_file("$fail_dir/$prefix/status.log");
$text .= "\nLog files generated:\n";
- opendir my $DP1, "$fail_dir/$prefix/log/";
+ opendir my $DP1, "$fail_dir/$prefix/";
foreach my $f1 (readdir($DP1)) {
- next if ! -d "$fail_dir/$prefix/log/$f1" || $f1 =~ m/^\./;
+ next if ! -d "$fail_dir/$prefix/$f1" || $f1 =~ m/^\./;
- opendir my $DP2, "$fail_dir/$prefix/log/$f1";
+ opendir my $DP2, "$fail_dir/$prefix/$f1";
foreach my $f2 (sort(readdir $DP2)) {
next if $f2 =~ m/^\./;
- $text .= "$fpath/log/$f1/$f2\n";
+ $text .= "$fpath/$f1/$f2\n";
}
closedir $DP2;
}
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm
index 53d0756..a5162ce 100644
--- a/lib/Iurt/Urpmi.pm
+++ b/lib/Iurt/Urpmi.pm
@@ -3,13 +3,13 @@ package Iurt::Urpmi;
use strict;
use RPM4::Header;
use File::Basename;
-use File::NCopy qw(copy);
+use File::Copy qw(copy move);
use MDV::Distribconf::Build;
use MDK::Common qw(cat_);
use Iurt::Chroot qw(add_local_user create_temp_chroot);
use Iurt::Process qw(perform_command clean_process sudo);
use Iurt::Config qw(get_package_prefix);
-use Iurt::Util qw(plog);
+use Iurt::Util qw(logdir plog);
use urpm;
sub new {
@@ -383,10 +383,8 @@ sub install_packages {
@to_install or return 1;
- (my $log_dirname = $title) =~ s/^[^:]*:?([^:]*)\.(buildreqs\.nosrc|src).rpm/$1/;
-
+ my $log_dirname = logdir($title);
my $log_spool = "$local_spool/log/$log_dirname/";
-
mkdir $log_spool;
my @rpm = grep { !/src\.rpm$/ } @to_install;
@@ -445,14 +443,32 @@ sub install_packages {
sub get_srpm_name {
my ($run, $config, $chroot_tmp, $srpm, $luser, $spec) = @_;
- if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpmspec -q --qf %{NVR}.src.rpm --srpm /home/$luser/rpmbuild/SPECS/$spec > /home/$luser/rpmbuild/SPECS/$spec.srpm_name"),
+ my $log_spool = "$run->{local_spool}/log/" . logdir($srpm);
+ my $log_spool_existed = 1;
+ if (! -d $log_spool) {
+ $log_spool_existed = 0;
+ mkdir $log_spool;
+ }
+ if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpmspec -q --qf %{NVR}.src.rpm --srpm /home/$luser/rpmbuild/SPECS/$spec | tail -n1 > /home/$luser/rpmbuild/SPECS/$spec.srpm_name"),
$run, $config,
use_iurt_root_command => 1,
- hash => "identify_$srpm")) {
+ log => $log_spool,
+ logname => 'identify_srpm',
+ hash => 'identify_srpm')) {
plog("ERROR: failed to get the name of the generated src.rpm");
return;
}
- return cat_("$chroot_tmp/home/$luser/rpmbuild/SPECS/$spec.srpm_name");
+ my $new_srpm = cat_("$chroot_tmp/home/$luser/rpmbuild/SPECS/$spec.srpm_name");
+ # Move the generated logs if needed
+ if ($srpm ne $new_srpm) {
+ my $logfile = "$log_spool/identify_srpm.$run->{my_arch}.$run->{run}.log";
+ mkdir "$run->{local_spool}/log/" . logdir($new_srpm);
+ move("$logfile", "$run->{local_spool}/log/" . logdir($new_srpm));
+ if (!$log_spool_existed) {
+ rmdir $log_spool;
+ }
+ }
+ return $new_srpm;
}
# return ("exit_code", srpm, spec)
@@ -518,29 +534,35 @@ sub recreate_srpm {
}
}
+ my $new_srpm = get_srpm_name($run, $config, $chroot_tmp, $srpm, $luser, $spec);
+ if (!$new_srpm) {
+ plog("ERROR: failed to get the name of the generated src.rpm");
+ return;
+ }
+
+ my $log_spool = "$run->{local_spool}/log/" . logdir($new_srpm);
+ mkdir $log_spool;
+
# Delete old src.rpm, we will create it again
sudo($config, '--rm', $oldsrpm) or die "$program_name: could not delete $oldsrpm ($!)";
# 20060515 This should not be necessairy any more if urpmi *.spec works, but it doesn't
#
- my $ret = perform_command(qq(chroot $chroot_tmp su $luser -c "rpmbuild --nodeps -bs $with_flags /home/$luser/rpmbuild/SPECS/$spec"),
+ my $ret = perform_command(qq(chroot $chroot_tmp su $luser -c "rpmbuild --target $run->{my_arch} --nodeps -bs $with_flags /home/$luser/rpmbuild/SPECS/$spec"),
$run, $config,
use_iurt_root_command => 1,
mail => $config->{admin},
error => "[REBUILD] cannot create $srpm in $chroot_tmp",
debug_mail => $run->{debug},
- hash => "create_$srpm"
+ hash => "create_$srpm",
+ log => $log_spool,
+ logname => 'recreate_srpm'
);
# Return if we can't regenerate srpm
#
return 0 unless $ret;
- my $new_srpm = get_srpm_name($run, $config, $chroot_tmp, $srpm, $luser, $spec);
- if (!$new_srpm) {
- plog("ERROR: failed to get the name of the generated src.rpm");
- return;
- }
my $file = "$chroot_tmp/home/$luser/rpmbuild/SRPMS/$new_srpm";
my $prefix = get_package_prefix($srpm);
my $newfile = "$chroot_tmp/home/$luser/rpmbuild/SRPMS/$prefix$new_srpm";
@@ -574,7 +596,6 @@ sub install_dynamic_buildrequires {
return;
}
my $nosrc = $new_srpm =~ s/src.rpm$/buildreqs.nosrc.rpm/r;
-
while (1) {
# There is no way with perform_command to get the actual error code.
# We can however tell it that error 11 (missing BuildRequires) is ok so
@@ -609,7 +630,7 @@ sub install_dynamic_buildrequires {
unlink("$chroot_tmp/home/$luser/rpmbuild/SRPMS/$nosrc");
} else {
# This was a failure for another reason, no point retrying
- plog('ERROR', "Failed to generate dynamic BuildRequires.");
+ plog('ERROR', "Failed to generate dynamic BuildRequires ($chroot_tmp/home/$luser/rpmbuild/SRPMS/$nosrc does not exist).");
$run->{status}{$srpm} = 'build_failure';
return 0;
}
diff --git a/lib/Iurt/Util.pm b/lib/Iurt/Util.pm
index bf726d0..439e146 100644
--- a/lib/Iurt/Util.pm
+++ b/lib/Iurt/Util.pm
@@ -5,6 +5,7 @@ use Fcntl qw(:flock SEEK_END);
use strict;
our @EXPORT = qw(
+ logdir
plog_init
plog
pdie
@@ -121,6 +122,22 @@ sub pdie {
die $@;
}
+=item logdir($srpm)
+
+Get the name of the log directory based on the src.rpm filename.
+
+=cut
+
+sub logdir {
+ my $srpm = shift;
+ (my $logdir = $srpm) =~ s/^(?:[^:]*:)?([^:]*)\.(buildreqs\.nosrc|src).rpm/$1/;
+ return $logdir;
+}
+
+=back
+
+=cut
+
=head2 SSH HELPERS
=over 8