diff options
author | Marcelo Leitner <mrl@mandriva.com> | 2007-06-08 19:38:00 +0000 |
---|---|---|
committer | Marcelo Leitner <mrl@mandriva.com> | 2007-06-08 19:38:00 +0000 |
commit | eddbbe3687116377bb5852eaa7c55d94cab80086 (patch) | |
tree | 69d5f2b0c312622a9a98009dc63e3e351e567a57 | |
parent | 7d4c5a5e499eb17191ddcbbada596df33831260b (diff) | |
download | iurt-eddbbe3687116377bb5852eaa7c55d94cab80086.tar iurt-eddbbe3687116377bb5852eaa7c55d94cab80086.tar.gz iurt-eddbbe3687116377bb5852eaa7c55d94cab80086.tar.bz2 iurt-eddbbe3687116377bb5852eaa7c55d94cab80086.tar.xz iurt-eddbbe3687116377bb5852eaa7c55d94cab80086.zip |
- Add support for icecream via option --icecream <procs>
- Add support for external and intentional medias via --additional_media option
- Fix local_spool hdlist detection while in group mode: hdlist.cz will never be
a directory.
- Fix TMP environment location at package building command. It must be inside
sudo, otherelse sudo will strip it.
-rwxr-xr-x | iurt2 | 26 | ||||
-rw-r--r-- | lib/Iurt/Chroot.pm | 32 | ||||
-rw-r--r-- | lib/Iurt/Urpmi.pm | 18 |
3 files changed, 74 insertions, 2 deletions
@@ -275,6 +275,17 @@ $run{todo} = []; ($run{with_flags}) = $run{with_flags} . " --without " . @_[0]; 1; }, "Adding specified extra --without parameter to rpm" ], + [ "", "additional-media", 1, "<path>", + "Includes an additional media", + sub { + $run{additional_media} ||= []; + push @{$run{additional_media}}, @_[0]; + }, "Adding an additional media" ], + [ "", "icecream", 1, "<procs>", + "Enables icecream usage by <procs> procs", + sub { + $run{icecream} = @_[0]; + }, "Enabling icecream usage" ], ); open(my $LOG, ">&STDERR"); @@ -363,6 +374,7 @@ my %config_usage = ( 'rpm-build', 'rpm-mandriva-setup-build', 'sudo', + 'icecream', 'urpmi', 'curl', ] @@ -469,6 +481,14 @@ my %config_usage = ( desc => 'Name of the packages vendor', default => 'Mandriva' }, + additional_media => { + desc => 'Additional medias to be used', + default => [] + }, + icecream => { + desc => 'Enabled icecream usage and uses N procs', + default => 0 + }, ); config_usage() if $run{config_usage}; @@ -850,8 +870,12 @@ retry: } my ($srpm_name) = $srpm =~ /(?:.*:)?(.*)-[^-]+-[^-]+\.src\.rpm$/; + my $icecream; + if ($run{icecream}) { + $icecream = "RPM_BUILD_NCPUS=$run{icecream}"; + } - if (!perform_command(qq(TMP=/home/$luser/tmp/ $sudo chroot $chroot_tmp /bin/su - $luser -c "$command"), + if (!perform_command(qq($sudo chroot $chroot_tmp /bin/su - $luser -c "TMP=/home/$luser/tmp/ $icecream $command"), \%run, $config, $cache, mail => $maintainer, error => "[REBUILD] $srpm from $run{distro_tag} does not build correctly on $run{my_arch}", diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index c4b2f15..526263a 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -45,6 +45,12 @@ sub clean_chroot { if (-d $chroot && !$o_only_tar) { system("$sudo umount $chroot/proc &> /dev/null"); system("$sudo umount $chroot/dev/pts &> /dev/null"); + if ($run->{icecream}) { + system("$sudo umount $chroot/var/cache/icecream &> /dev/null"); + } + if (-d "$chroot/urpmi_medias/") { + system ("$sudo umount $chroot/urpmi_medias/*"); + } sudo($run, $config, '--rm', '-r', $chroot); } @@ -64,6 +70,26 @@ sub clean_chroot { dump_rpmmacros($run, $config, "$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; + if ($run->{icecream}) { + system("$sudo mkdir -p $chroot/var/cache/icecream"); + system("$sudo mount -o bind /var/cache/icecream $chroot/var/cache/icecream &>/dev/null") and return; + } + + my $count = 0; + foreach my $m (@{$run->{additional_media}}) { + if (($m =~ m/^(http:|ftp:)/)) { + next; + } + my $mount_point = "$chroot/urpmi_medias/$count"; + my $bind; + my ($url) = $m =~ s!^(http://|ftp://|file://)!!; + if (($m =~ m/^(file:)/)) { + $bind = "-o bind"; + } + system("$sudo mkdir -p $mount_point"); + system("$sudo mount $bind $url $mount_point") and return; + $count++; + } 1; } @@ -469,6 +495,12 @@ sub build_chroot { sudo($run, $config, "--rm", "$tmp_chroot/var/lib/rpm/__db*"); system("$sudo umount $tmp_chroot/proc &> /dev/null"); system("$sudo umount $tmp_chroot/dev/pts &> /dev/null"); + if ($run->{icecream}) { + system("$sudo umount $tmp_chroot/var/cache/icecream &> /dev/null"); + } + if (-d "$tmp_chroot/urpmi_medias/") { + system ("$sudo umount $tmp_chroot/urpmi_medias/*"); + } return !system($sudo, 'tar', 'czf', $chroot_tar, '-C', $tmp_chroot, '.'); } } diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm index f4628ee..f774e48 100644 --- a/lib/Iurt/Urpmi.pm +++ b/lib/Iurt/Urpmi.pm @@ -110,7 +110,23 @@ sub urpmi_command { } } - if (-d "$local_media/hdlist.cz") { + my $count = 0; + foreach my $m (@{$run->{additional_media}}) { + my ($name) = $m =~ s![/:]!_!g; + my $url; + if (($m =~ m!^(http:|ftp:)!)) { + $url = $m; + } + else { + $url = "/urpmi_medias/$count"; + $count++; + } + if (!add_media($self, $chroot_tmp, $name, "$name $url")) { + plog("ERROR: Unable to add media $m"); + } + } + + if (-d "$local_media") { mkdir("$chroot_tmp/iurt_media/"); opendir my $dir, $local_media; my $next; |