aboutsummaryrefslogtreecommitdiffstats
path: root/iurt2
diff options
context:
space:
mode:
Diffstat (limited to 'iurt2')
-rwxr-xr-xiurt2241
1 files changed, 151 insertions, 90 deletions
diff --git a/iurt2 b/iurt2
index eb54322..1dd97ab 100755
--- a/iurt2
+++ b/iurt2
@@ -45,6 +45,14 @@ my $program_name = 'iurt2';
# sessing parameters
my $arg = @ARGV;
my (@params, %run);
+my %arch_comp = (
+ 'i586' => { 'i386' => 1, 'i486' => 1, 'i586' => 1 },
+ 'i686' => { 'i386' => 1, 'i486' => 1, 'i586' => 1, 'i686' => 1 },
+ 'x86_64' => { 'x86_64' => 1 },
+ 'ppc' => { 'ppc' => 1 },
+ 'ppc64' => { 'ppc' => 1, 'ppc64' => 1 },
+);
+
$run{todo} = [ ];
@params = (
# [ "one letter option", "long name option", "number of args (-X means ´at least X´)", "help text", "function to call", "log info"]
@@ -54,7 +62,7 @@ $run{todo} = [ ];
[ "", "$program_name", 0, "[--cache] [--chrooted-urpmi <media prefix>] [--concurrent-run] [--config foo value] [--warn] [--verbose integer]
[--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]
+ [--upload [--markrelease] [--source]] [--dir] [--help foo?] [--log filename] [--unionfs] [--status] [--ignore-failure]
{--config_help |
--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} }",
@@ -107,7 +115,10 @@ $run{todo} = [ ];
sub { $run{debug} = 1 }, "Activating debug mode" ],
[ "g", "group", 0, "",
"Activate group mode, packages will be compiled as a global set, not as individual packages",
- sub { $run{group} = 1 }, "Activating group mode to compile packages as a set" ],
+ sub { $run{group} = 1 }, "Activating the group mode" ],
+ [ "", "ignore-failure", 0, "",
+ "Do not take into account the failure cache, try to recompile all the packages not synchronized",
+ sub { $run{ignore_failure} = 1 }, "Activating the mode ignoring previous failure" ],
[ "u", "unionfs", 0, "",
"Activate unionfs mode",
sub { $run{unionfs} = 1 }, "Activating unionfs mode" ],
@@ -215,14 +226,6 @@ $run{distro_tag} =~ s,/,-,g;
my $real_arch = `uname -m`;
chomp $real_arch;
-my %arch_comp = (
- 'i586' => { 'i386' => 1, 'i486' => 1, 'i586' => 1 },
- 'i686' => { 'i386' => 1, 'i486' => 1, 'i586' => 1, 'i686' => 1 },
- 'x86_64' => { 'i386' => 1, 'i486' => 1, 'i586' => 1, 'i686' => 1, 'x86_64' => 1 },
- 'ppc' => { 'ppc' => 1 },
- 'ppc64' => { 'ppc' => 1, 'ppc64' => 1 },
-);
-
my $HOME = $ENV{HOME};
my $configfile = "$HOME/.iurt.$run{distro_tag}.conf";
print {$run{LOG}} "iurt: loading config file $configfile\n" if $run{verbose} > 1;
@@ -253,9 +256,9 @@ if (!$run{chrooted_urpmi} && $run{group}) {
my %config_usage = (
admin => { desc => 'Mail of the administrator of packages builds', default => '' },
- all_media => { desc => 'List of known media', default => [ 'main', 'contrib' ] },
+ all_media => { desc => 'List of known media', default => { 'main' => [ '' ], 'contrib' => [ '' ] } },
basesystem_media_root => { desc => 'Name of the media holding basesystem packages', default => sub { my ($config, $run) = @_; "$config->{repository}/$run{distro}/$run{my_arch}/" } },
- basesystem_media => { desc => 'Where to find basesystem packages', default => 'main' },
+ basesystem_media => { desc => 'Where to find basesystem packages', default => 'main/release' },
cache_home => { desc => 'Where to store the cache files', default => "$HOME/.bugs" },
cache_min_size => { desc => 'Minimal size to consider a cache file valid', default => 1000000 },
distribution => { desc => 'Name of the packages distribution', default => 'Mandriva Linux' },
@@ -319,7 +322,7 @@ my $chroot = "$config->{local_home}/$chroot_name";
$run{chroot_path} = $chroot;
my $chroot_tar = "$chroot.$run{my_arch}.tar.gz";
$run{chroot_tar} = $chroot_tar;
-if ($run{chroot}) {
+if ($run{chroot} || !-d "$chroot/dev") {
check_chroot($chroot, $chroot_tar, \%run) or die "FATAL iurt: could not prepare initial chroot"
}
@@ -361,7 +364,8 @@ print {$run{LOG}} "iurt: will try to compile $to_compile packages\n" if $run{ver
my ($fulldate, $daydate) = get_date();
if ($run{use_cache}) {
$run{run} = $cache->{run};
- $cache->{run}++
+ $run{run} ||= 1;
+ $cache->{run} = $run{run} + 1
} else {
$run{run} = "0.$fulldate"
}
@@ -455,7 +459,7 @@ if ($config->{rsync_to} && !$run{no_rsync}) {
print {$run{LOG}} "iurt: try to dump rpm macros to $chroot/home/builder/.rpmmacros\n" if $run{verbose} > 3;
if (!dump_rpmmacros("$chroot/home/builder/.rpmmacros")) {
- print "ERROR iurt: could not dump rpm macros to $chroot/home/builder/.rpmmacros, trying to rebuild the chroot";
+ print {$run{LOG}} "ERROR iurt: could not dump rpm macros to $chroot/home/builder/.rpmmacros, trying to rebuild the chroot\n";
check_chroot($chroot, $chroot_tar, \%run) or die "FATAL iurt: could not prepare initial chroot";
dump_rpmmacros("$chroot/home/builder/.rpmmacros") or die "FATAL iurt: could not dump rpm macros to $chroot/home/builder/.rpmmacros"
}
@@ -479,7 +483,7 @@ my $local_media;
my $rebuild;
if ($run{group}) {
$rebuild = 1;
- order_packages(\%run) or die "FATAL iurt: could not order packages";
+ order_packages(\%run, $config, $union_id) or die "FATAL iurt: could not order packages";
$local_media = "$local_spool/$run{run}/"
}
do {
@@ -508,7 +512,8 @@ do {
die "FATAL iurt: Could not have urpmi working !"
}
}
- ($union_id, my $unionfs_tmp, my $chroot_tmp) = create_temp_chroot(\%run, $cache, $unionfs_tmp, $unionfs_dir, $union_id, $srpm) or next;
+ my ($u_id, $unionfs_tmp, $chroot_tmp) = create_temp_chroot(\%run, $cache, $unionfs_tmp, $unionfs_dir, $union_id, $srpm) or next;
+ $union_id = $u_id;
if ($run{chrooted_urpmi}) {
$run{urpmi_command} = "urpmi $urpmi_options --root $chroot_tmp ";
@@ -571,15 +576,20 @@ do {
#
# on x86_64 the rpm database is getting corrupted and sometimes rpm do not found anymore
# installed packages, retrying several time to be sure something is really broken
- if (!perform_command("sudo $run{urpmi_command} $path_srpm/$srpm",
+ my $ok;
+ foreach my $try ([ '', 'Trying basic uprmi command' ], [ '', 'Rebuilding the rpm db and trying againg', '_retry' ], [ ' --allow-nodeps', 'trying harder with --allow-nodeps' , '_nodeps'], [ ' --no-install', 'try the hard way, with rpm', '_rpm']) {
+ my ($opt, $msg, $suf) = @$try;
+ print {$run{LOG}} "iurt: $msg\n" if $run{verbose};
+ my $unsatisfied;
+ if (!perform_command("sudo $run{urpmi_command} $opt $path_srpm/$srpm",
\%run, $config,
error => "[REBUILD] install of build dependencies of $srpm failed on $run{my_arch}",
- hash => "install_deps_$srpm",
- timeout => 900,
+ hash => "install_deps_$srpm$suf",
+ timeout => 600,
srpm => $srpm,
freq => 1,
#cc => $cc,
- retry => 2,
+ retry => 3,
debug_mail => $run{debug},
error_regexp => 'cannot be installed',
wait_regexp => {
@@ -587,7 +597,6 @@ do {
'is needed by' => sub {
print {$run{LOG}} "WARNING iurt: rpm database seems corrupted, retrying\n";
system("sudo chroot $chroot_tmp rm -rf /var/lib/rpm/__db* &> /dev/null");
- foreach (1 .. 3) { system("sudo chroot $chroot_tmp rpm -qa &> /dev/null") }
1
},
},
@@ -600,6 +609,7 @@ do {
my @missing_deps = $output =~ /([^ \n]+) \(due to unsatisfied ([^[ \n]*)(?: ([^\n]*)|\[([^\n]*)\])?\)/g;
# as it seems that rpm db corruption is making urpmi returning false problem on deps installation, try to compile anyway
@missing_deps or return 1;
+ $unsatisfied = 1;
while (my $missing_package = shift @missing_deps) {
my $missing_deps = shift @missing_deps;
my $version = shift @missing_deps;
@@ -636,13 +646,36 @@ do {
0
},
)) {
- $run{status}{$srpm} = 'install_deps_failure';
- next;
+ if (!clean_process("$run{urpmi_command} $opt $path_srpm/$srpm", $run{verbose})) {
+ dump_cache(\%run);
+ die "FATAL iurt: Could not have urpmi working !"
+ }
+ $unsatisfied and last
+ } else {
+ $ok = 1;
+ }
+ if (!$ok && (system("sudo chroot $chroot_tmp rm -rf /var/lib/rpm/__db*") || system("sudo chroot $chroot_tmp rpm --rebuilddb"))) {
+ print {$run{LOG}} "ERROR iurt: rebuilding rpm db failed, aborting ($!)\n";
+ last
+ }
+ if ($suf eq '_rpm') {
+ print {$run{LOG}} "iurt: trying to install all the rpms in $chroot_tmp/var/cache/urpmi/rpms/ manually\n" if $run{verbose};
+ if (!system("sudo chroot $chroot_tmp rpm -Uvh --force --nodeps /var/cache/urpmi/rpms/*.rpm")) {
+ $ok = 1;
+ last
+ } else {
+ $ok = 0
+ }
}
+ last if $ok == 1
+ }
+ if (!$ok) {
+ $run{status}{$srpm} = 'install_deps_failure';
+ next;
+ }
# try to workarround the rpm -qa db4 error(2) from dbcursor->c_get: No such file or directory
# running rpm -qa several time seems to fix the problem
system("sudo chroot $chroot_tmp rm -rf /var/lib/rpm/__db* &> /dev/null");
- foreach (1 .. 3) { system("sudo chroot $chroot_tmp rpm -qa &> /dev/null") }
perform_command("sudo chroot $chroot_tmp rpm -qa",
\%run, $config,
hash => "rpm_qa_$srpm",
@@ -684,7 +717,7 @@ do {
print {$run{LOG}} "ERROR iurt: seems like building $srpm needs to access /proc/self/exe, which is broken with unionfs, will try to recompile it in non unionfs mode\n";
$cache->{no_unionfs}{$srpm} = 1;
return 1
- } elsif ($output =~ /configure.*error.* -l([^\s]+)/) {
+ } elsif ($output =~ /bin\/ld: cannot find -l(\S*)|configure.*error.* (?:-l([^\s]+)|([^\s]+) includes)/) {
my $missing = $1;
my @rpm = find_provides(\%run, \%pack_provide, $missing);
print {$run{LOG}} "iurt: likely @rpm ($missing-devel) needed to rebuilt $srpm is not in build_requires\n" if $run{verbose} > 4;
@@ -773,7 +806,7 @@ do {
dump_cache(\%run) if $run{concurrent_run};
}
if ($run{group}) {
- $rebuild = 1 if order_packages(\%run)
+ $rebuild = 1 if order_packages(\%run, $config, $union_id)
}
} while ($rebuild);
@@ -834,7 +867,7 @@ sub clean_all_unionfs {
return
}
foreach (readdir $dir) {
- /unionfs\.((?:0\.)?\d+)\.(\d+)$/ or next;
+ /unionfs\.((?:0\.)?\d+)\.(\d*)$/ or next;
clean_unionfs($unionfs_dir, \%run, $1, $2);
}
closedir $dir
@@ -859,6 +892,7 @@ sub clean_chroot {
my ($chroot, $run, $only_clean) = @_;
if (-d $chroot) {
system("sudo umount $chroot/proc &> /dev/null");
+ system("sudo umount $chroot/dev/pts &> /dev/null");
perform_command("sudo rm -rf $chroot",
$run, $config,
mail => $config->{admin},
@@ -879,6 +913,7 @@ sub clean_chroot {
dump_rpmmacros("$chroot/home/builder/.rpmmacros") or return;
system("sudo mount none -t proc $chroot/proc &>/dev/null") and return;
+ system("sudo mount none -t devpts $chroot/dev/pts &>/dev/null") and return;
1
}
@@ -913,14 +948,17 @@ sub clean_unionfs {
-d "$unionfs_dir/unionfs.$r.$union_id" or return $union_id;
print {$run->{LOG}} "Cleaning $unionfs_dir/unionfs.$r.$union_id\n" if $run->{verbose} > 1;
my $nok = 1;
- my $proc = "$unionfs_dir/unionfs.$r.$union_id/proc";
+ my $path = "$unionfs_dir/unionfs.$r.$union_id";
while ($nok) {
$nok = 0;
- if (-d $proc && check_mounted($proc, 'proc')) {
- print {$run->{LOG}} "iurt iurt: umounting $proc\n" if $run->{verbose} > 2;
- if (system("sudo umount $proc &>/dev/null")) {
- print {$run->{LOG}} "ERROR iurt: could not umount $proc\n";
- return $union_id + 1
+ foreach my $fs ([ 'proc', 'proc'],[ 'dev/pts', 'devpts']) {
+ my ($dir, $type) = @$fs;
+ if (-d "$path/$dir" && check_mounted("$path/$dir", $type)) {
+ print {$run->{LOG}} "iurt iurt: umounting $path/$dir\n" if $run->{verbose} > 2;
+ if (system("sudo umount $path/$dir &>/dev/null")) {
+ print {$run->{LOG}} "ERROR iurt: could not umount $path/$dir\n";
+ return $union_id + 1
+ }
}
}
foreach my $t ("unionfs",'tmpfs') {
@@ -941,7 +979,7 @@ sub clean_unionfs {
foreach my $t ("unionfs",'tmpfs') {
my $d = "$unionfs_dir/$t.$r.$union_id";
print {$run->{LOG}} "iurt: removing $d\n" if $run->{verbose} > 1;
- if (system(qq{sudo rmdir $d})) {
+ if (system(qq{sudo rm -rf $d})) {
print {$run->{LOG}} "ERROR iurt: removing $d failed ($!)\n";
return $union_id + 1
}
@@ -952,8 +990,10 @@ sub clean_unionfs {
sub clean_chroot_tmp {
my ($chroot_dir, $dir) = @_;
my $d = "$chroot_dir/$dir";
- if (system("sudo umount $d/proc &>/dev/null") && $run{verbose} > 1) {
- print {$run{LOG}} "ERROR iurt: could not umount /proc in $d/\n"
+ foreach my $m ( 'proc', 'dev/pts') {
+ if (system("sudo umount $d/$m &>/dev/null") && $run{verbose} > 1) {
+ print {$run{LOG}} "ERROR iurt: could not umount /$m in $d/\n"
+ }
}
print {$run{LOG}} "iurt: cleaning $d\n" if $run{verbose};
system("sudo /sbin/fuser -k $d &> /dev/null");
@@ -1056,7 +1096,7 @@ sub update_srpm {
if (!$srpm) {
my $hdr = RPM4::Header->new("$dir/$rpm");
$hdr or return 0;
- $srpm = $hdr->queryformat("%{SOURCERPM}");
+ $srpm = $hdr->queryformat('%{SOURCERPM}');
$cache->{rpm_srpm}{$rpm} = $srpm
}
$srpm = fix_srpm_name($srpm, $rpm, $wrong_rpm);
@@ -1130,7 +1170,7 @@ sub sendmail {
sub check_arch {
my ($hdr) = @_;
my (@exclusive_arch) = $hdr->queryformat('%{EXCLUSIVEARCH}');
- return if ! grep { $_ eq $run{my_arch} || $_ eq '(none)' } @exclusive_arch;
+ return if ! grep { $arch_comp{$run{my_arch}}{$_} || $_ eq '(none)' } @exclusive_arch;
my (@exclude_arch) = $hdr->queryformat('%{EXCLUDEARCH}');
return if grep { $_ eq $run{my_arch} } @exclude_arch;
1
@@ -1275,7 +1315,7 @@ sub perform_command {
if (!$call_ret || $kill || $err || $opt{error_regexp} && $fulloutput =~ /$opt{error_regexp}/) {
print {$run->{LOG}} "ERROR iurt: call_ret $call_ret kill $kill err $err ($opt{error_regexp})\n" if $run->{verbose} > 4;;
if ($opt{log} && $config->{log_url}) {
- $comment = qq|See $config->{log_url}/$run{distro_tag}/$run{my_arch}/log/$opt{srpm}/\n\n$comment|
+ $comment = qq|See $config->{log_url}/$run->{distro_tag}/$run->{my_arch}/$run->{media}/log/$opt{srpm}/\n\n$comment|
}
my $out;
if (length $fulloutput < 10000) {
@@ -1454,50 +1494,59 @@ sub check_pid {
sub check_media {
my ($run, $cache, $config, $srpm_version, $wrong_rpm, $provides, $pack_provide, $maint) = @_;
# We could rely on only parsing the synthesis, hoping that they are correct, however this scan is very fast, so...
- my $rpms_dir = "$config->{repository}/$run->{distro}/$run->{my_arch}/media/$run->{media}/";
- print {$run->{LOG}} "iurt: checking current packages in $rpms_dir\n";
- opendir my $rpmdir, $rpms_dir or die "Could not open $rpms_dir: $!";
- foreach my $rpm (readdir $rpmdir) {
- my ($rarch, $srpm) = update_srpm($rpms_dir, $rpm, $wrong_rpm);
- $rarch or next;
- $cache->{queue}{$srpm} = 1;
- $run{status}{$srpm} = 'ok';
- check_version($srpm, $srpm_version)
+ foreach my $subdir (@{$config->{all_media}{$run->{media}}}) {
+ my $rpms_dir = "$config->{repository}/$run->{distro}/$run->{my_arch}/media/$run->{media}/$subdir/";
+ print {$run->{LOG}} "iurt: checking current packages in $rpms_dir\n";
+ opendir my $rpmdir, $rpms_dir or die "Could not open $rpms_dir: $!";
+ foreach my $rpm (readdir $rpmdir) {
+ my ($rarch, $srpm) = update_srpm($rpms_dir, $rpm, $wrong_rpm);
+ $rarch or next;
+ $cache->{queue}{$srpm} = 1;
+ $run{status}{$srpm} = 'ok';
+ check_version($srpm, $srpm_version)
+ }
+ closedir $rpmdir;
}
- closedir $rpmdir;
- foreach my $m (@{$config->{all_media}}) {
- my $synthesis_file = "$config->{repository}/$run->{distro}/$run->{my_arch}/media/$m/media_info/synthesis.hdlist.cz";
- if (-f $synthesis_file) {
- print {$run->{LOG}} "Parsing $synthesis_file\n";
- if (open my $syn, "zcat $synthesis_file |") {
- my @prov;
- my $nb;
- while (<$syn>) {
- if (/^\@provides@(.*)/) {
- foreach my $p (split '@', $1) {
- $p =~ /([^[]+)(?:\[(.*)\])?/g;
- push @prov, $1;
- $provides->{$1} = $2 || 1
- }
- } elsif (/\@info\@([^@]+)@/) {
- $nb++;
- my $p = $1;
- my ($name) = $p =~ /(.*)-[^-]+-[^-]+\..*$/;
- $provides->{$p} = 1;
- foreach (@prov) {
- $pack_provide->{$_} = $name
+ foreach my $m (keys %{$config->{all_media}}) {
+ foreach my $subdir (@{$config->{all_media}{$m}}) {
+ my $synthesis_file = "$config->{repository}/$run->{distro}/$run->{my_arch}/media/$m/$subdir/media_info/synthesis.hdlist.cz";
+ if (-f $synthesis_file) {
+ print {$run->{LOG}} "Parsing $synthesis_file\n";
+ if (open my $syn, "zcat $synthesis_file |") {
+ my @prov;
+ my $nb;
+ while (<$syn>) {
+ if (/^\@provides@(.*)/) {
+ foreach my $p (split '@', $1) {
+ $p =~ /([^[]+)(?:\[(.*)\])?/g;
+ push @prov, $1;
+ $provides->{$1} = $2 || 1
+ }
+ } elsif (/\@info\@([^@]+)@/) {
+ $nb++;
+ my $p = $1;
+ my ($name) = $p =~ /(.*)-[^-]+-[^-]+\..*$/;
+ $provides->{$p} = 1;
+ foreach (@prov) {
+ $pack_provide->{$_} = $name
+ }
+ @prov = ()
}
- @prov = ()
}
+ $nb < $config->{minimum_package_number} and die "FATAL iurt: synthesis files seems corrupted, only $nb packages found."
+ } else {
+ die "FATAL iurt: Could not open $synthesis_file\n";
}
- $nb < $config->{minimum_package_number} and die "FATAL iurt: synthesis files seems corrupted, only $nb packages found."
- } else {
- die "FATAL iurt: Could not open $synthesis_file\n";
}
}
}
- search_packages(0, $cache, $provides, $run, $maint, $srpm_version, "$config->{repository}/$run->{distro}/SRPMS/$run->{media}/")
+ #"
+ my $nb;
+ foreach my $subdir (@{$config->{all_media}{$run->{media}}}) {
+ $nb += search_packages(0, $cache, $provides, $run, $maint, $srpm_version, "$config->{repository}/$run->{distro}/SRPMS/$run->{media}/$subdir/")
+ }
+ $nb
}
sub search_packages {
@@ -1519,7 +1568,7 @@ sub search_packages {
if ($config->{unwanted_packages} && $srpm =~ /$config->{unwanted_packages}/) { next }
my $ok = 1;
if (check_version($srpm, $srpm_version)) {
- if (defined $cache->{failure}{$srpm}) {
+ if (!$run->{ignore_failure} && defined $cache->{failure}{$srpm}) {
$run->{status}{$srpm} = 'build_failure';
next
}
@@ -1600,13 +1649,13 @@ sub create_temp_chroot {
$chroot_tmp = "$unionfs_dir/unionfs.$run->{run}.$union_id";
if (!-d $tmpfs) {
if (!mkdir $tmpfs) {
- print "ERROR iurt: Could not create $tmpfs ($!)";
+ print {$run->{LOG}} "ERROR iurt: Could not create $tmpfs ($!)";
return
}
}
if (! -d $chroot_tmp) {
if (!mkdir $chroot_tmp) {
- print "ERROR iurt: Could not create $chroot_tmp ($!)";
+ print {$run->{LOG}} "ERROR iurt: Could not create $chroot_tmp ($!)";
return
}
}
@@ -1618,17 +1667,27 @@ sub create_temp_chroot {
clean_chroot($chroot_tmp, $run) if !$unionfs_tmp;
$unionfs_tmp = 1;
if (system(qq{sudo mount -t tmpfs none $tmpfs &>/dev/null})) {
- print "ERROR iurt: could not mount $tmpfs ($!)";
+ print {$run->{LOG}} "ERROR iurt: could not mount $tmpfs ($!)\n";
return
}
if (system(qq|sudo mount -o dirs=$tmpfs=rw:$home/chroot_$run->{distro_tag}$debug_tag=ro -t unionfs none $chroot_tmp &>/dev/null|)) {
- print "ERROR iurt: could not mount $tmpfs and $home/chroot_$run->{distro_tag}$debug_tag with unionfs ($!)";
+ print {$run->{LOG}} "ERROR iurt: could not mount $tmpfs and $home/chroot_$run->{distro_tag}$debug_tag with unionfs ($!)\n";
return
}
if (system("sudo mount -t proc none $chroot_tmp/proc &>/dev/null")) {
- print "ERROR iurt: could not mount /proc in the chroot $chroot_tmp.";
+ print {$run->{LOG}} "ERROR iurt: could not mount /proc in the chroot $chroot_tmp ($!).\n";
return
}
+ if (!-d "$chroot_tmp/dev/pts") {
+ if (system("sudo mkdir $chroot_tmp/dev/pts")) {
+ print {$run->{LOG}} "ERROR iurt: could not create /dev/pts in the chroot $chroot_tmp ($!).\n";
+ return
+ }
+ if (system("sudo mount -t devpts none $chroot_tmp/dev/pts &>/dev/null")) {
+ print {$run->{LOG}} "ERROR iurt: could not mount /dev/pts in the chroot $chroot_tmp ($!).\n";
+ return
+ }
+ }
}
} else {
print {$run->{LOG}} "iurt: installing a new chroot in $chroot_tmp\n" if $run->{verbose} > 1;
@@ -1651,7 +1710,6 @@ sub add_packages {
'is needed by' => sub {
print {$run{LOG}} "WARNING iurt: rpm database seems corrupted, retrying\n";
system("sudo chroot $chroot rm -rf /var/lib/rpm/__db* &> /dev/null");
- foreach (1 .. 3) { system("sudo chroot $chroot rpm -qa &> /dev/null") }
1
},
'database locked' => sub {
@@ -1690,10 +1748,12 @@ $user ALL=(ALL) NOPASSWD:RPM
sub remove_chroot {
my ($run, $dir, $func, $prefix) = @_;
+ print {$run->{LOG}} "iurt remove_chroot: dir $dir all $run->{clean_all} prefix $prefix\n";
if ($run->{clean_all}) {
opendir my $chroot_dir, $dir;
foreach (readdir $chroot_dir) {
- next if !-d || /\.{1,2}/;
+ next if !-d "$dir/$_" || /\.{1,2}/;
+ print {$run->{LOG}} "iurt: cleaning old chroot for $_ in $dir\n";
$func->("$dir/$_", $prefix)
}
} else {
@@ -1793,9 +1853,10 @@ sub recreate_srpm {
}
sub get_build_requires {
- my ($run, $config) = @_;
+ my ($run, $config, $union_id) = @_;
$run{todo_requires} = {};
- my ($union_id, $unionfs_tmp, $chroot_tmp) = create_temp_chroot(\%run, $cache, $unionfs_tmp, $unionfs_dir, $union_id) or return;
+ my ($u_id, $unionfs_tmp, $chroot_tmp) = create_temp_chroot(\%run, $cache, $unionfs_tmp, $unionfs_dir, $union_id) or return;
+ $union_id = $u_id;
my $urpm = new URPM;
foreach my $p (@{$run->{todo}}) {
@@ -1812,12 +1873,12 @@ sub get_build_requires {
}
sub order_packages {
- my ($run, $config, $provides, $local_media) = @_;
+ my ($run, $config, $union_id, $provides, $local_media) = @_;
my @packages = @{$run{todo}};
my $move;
get_local_provides($run, $local_media) or return;
if (!$run{todo_requires}) {
- get_build_requires($run, $config) or return
+ get_build_requires($run, $config, $union_id) or return
}
my %visit;
my %status;
@@ -1940,7 +2001,7 @@ sub send_status_mail {
foreach my $maint (keys %{$output{build}}) {
$text .= "\n$maint\n";
foreach my $rpm (@{$output{build}{$maint}}) {
- $text .= " $rpm (see $config->{log_url}/$run{distro_tag}/$run{my_arch}/log/$rpm/)\n"
+ $text .= " $rpm (see $config->{log_url}/$run{distro_tag}/$run{my_arch}/$run->{media}/log/$rpm/)\n"
}
}
print "$text\n";
@@ -1954,7 +2015,7 @@ sub get_maint {
if ($run{maint}{$srpm}) {
return $run{maint}{$srpm}, $srpm_name
}
- my $maint = `rpmmon -s -p $srpm_name`;
+ my $maint = `rpmmon -s -p "$srpm_name"`;
chomp $maint;
$run{maint}{$srpm} = $maint;
$maint, $srpm_name