diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-09-25 06:23:20 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-09-25 06:23:20 +0000 |
commit | 4034fc48132cf815bf72135e55d4186d5b842acf (patch) | |
tree | 37c42889a3194703d181a4d16e074d49c9ddfd89 | |
parent | 98db2579c1be08c1c32f8879e439de8bd54c6af5 (diff) | |
download | iurt-4034fc48132cf815bf72135e55d4186d5b842acf.tar iurt-4034fc48132cf815bf72135e55d4186d5b842acf.tar.gz iurt-4034fc48132cf815bf72135e55d4186d5b842acf.tar.bz2 iurt-4034fc48132cf815bf72135e55d4186d5b842acf.tar.xz iurt-4034fc48132cf815bf72135e55d4186d5b842acf.zip |
use rpmbuild/ rather than rpm/ like modern guidelines
(need invalidating chroots)
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | iurt | 24 | ||||
-rw-r--r-- | lib/Iurt/Chroot.pm | 6 | ||||
-rw-r--r-- | lib/Iurt/DKMS.pm | 2 | ||||
-rw-r--r-- | lib/Iurt/Urpmi.pm | 16 |
5 files changed, 26 insertions, 24 deletions
@@ -1,4 +1,6 @@ 0.6.13 (unreleased) +- use rpmbuild/ rather than rpm/ + (need invalidating chroots) 0.6.12 - mount /dev/shm as tmpfs using the helper, safer @@ -219,7 +219,7 @@ $run{todo} = []; "Use this username to build package", sub { ($run{user}) = @_ }, 'Setting build username' ], [ "r", "rebuild", -2, "<distro> <architecture> <srpm 1> <srpm 2> ... <srpm n>", - "Rebuild the packages, e.g. $program_name -r cooker x86_64 /home/foo/rpm/SRPMS/foo-2.3-12mdv2007.0.src.rpm", + "Rebuild the packages, e.g. $program_name -r cooker x86_64 /home/foo/rpmbuild/SRPMS/foo-2.3-12mdv2007.0.src.rpm", sub { $run{rebuild} = 1; $run{distro} = shift @_; @@ -902,7 +902,7 @@ retry: -d $log_dir or die "FATAL: could not create $log_dir (check permissions and group ownerships)"; plog('INFO', "Install build dependencies"); - my $path_srpm = "$chroot_tmp/home/$luser/rpm/SRPMS/"; + my $path_srpm = "$chroot_tmp/home/$luser/rpmbuild/SRPMS/"; # on x86_64 the rpm database is getting corrupted and sometimes # rpm do not found anymore installed packages, retrying several @@ -927,11 +927,11 @@ retry: debug_mail => $run{debug}, log => $log_dir); # or next; As this failed quite often, do not stop plog('NOTIFY', "Building $srpm"); - my $command = "rpmbuild --rebuild $run{with_flags} /home/$luser/rpm/SRPMS/$srpm"; + my $command = "rpmbuild --rebuild $run{with_flags} /home/$luser/rpmbuild/SRPMS/$srpm"; if ($run{stop}) { $urpmi->install_packages('chroot', $chroot_tmp, $local_spool, \%pack_provide, 'configure', "[ADMIN] installation of urpmi and sudo failed in the chroot $run{my_arch}", { check => 1, maintainer => $config->{admin} }, 'urpmi', 'sudo'); add_sudoers($chroot_tmp, $luser); - $command = "rpmbuild -b$run{stop} /home/$luser/rpm/SPECS/$spec"; + $command = "rpmbuild -b$run{stop} /home/$luser/rpmbuild/SPECS/$spec"; } my ($srpm_name) = $srpm =~ /(?:.*:)?(.*)-[^-]+-[^-]+\.src\.rpm$/; @@ -998,12 +998,12 @@ retry: delete $cache->{needed}{$srpm} if defined $cache->{needed}{$srpm}; delete $cache->{buildrequires}{$srpm} if defined $cache->{buildrequires}{$srpm}; # FIXME It seems the glob is not correctly expanded any more, so listing the directory content to do so - opendir my $binfh, "$chroot_tmp/home/$luser/rpm/RPMS/"; + opendir my $binfh, "$chroot_tmp/home/$luser/rpmbuild/RPMS/"; my @packages; foreach my $bindir (readdir $binfh) { - -d "$chroot_tmp/home/$luser/rpm/RPMS/$bindir" or next; - opendir my $rpmfh, "$chroot_tmp/home/$luser/rpm/RPMS/$bindir"; - push @packages, map { "$chroot_tmp/home/$luser/rpm/RPMS/$bindir/$_" } grep { !/src\.rpm$/ && /\.rpm$/ } readdir $rpmfh; + -d "$chroot_tmp/home/$luser/rpmbuild/RPMS/$bindir" or next; + opendir my $rpmfh, "$chroot_tmp/home/$luser/rpmbuild/RPMS/$bindir"; + push @packages, map { "$chroot_tmp/home/$luser/rpmbuild/RPMS/$bindir/$_" } grep { !/src\.rpm$/ && /\.rpm$/ } readdir $rpmfh; } # 20060810 warly We should fail here, but rpm is currently @@ -1034,14 +1034,14 @@ retry: } else { plog('OK', "build successful, copying packages to $local_spool."); - system("cp $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpm/RPMS/ to $local_spool ($!)"); + system("cp $chroot_tmp/home/$luser/rpmbuild/RPMS/*/*.rpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpmbuild/RPMS/ to $local_spool ($!)"); } if ($run{copy_srpm}) { # replace the old srpm unlink "$local_spool/$old_srpm"; - system("cp $chroot_tmp/home/$luser/rpm/SRPMS/$srpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy $srpm from $chroot_tmp/home/$luser/rpm/SRPMS/ to $local_spool ($!)"); + system("cp $chroot_tmp/home/$luser/rpmbuild/SRPMS/$srpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy $srpm from $chroot_tmp/home/$luser/rpmbuild/SRPMS/ to $local_spool ($!)"); } process_queue($config, \%run, \@wrong_rpm, 1); } @@ -1061,9 +1061,9 @@ retry: $rebuild = 0; if ($done == @{$run{todo}}) { plog('OK', "all packages succesfully compiled, copying packages to $local_spool."); - system("cp $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpm/RPMS/ to $local_spool ($!)"); + system("cp $chroot_tmp/home/$luser/rpmbuild/RPMS/*/*.rpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpmbuild/RPMS/ to $local_spool ($!)"); if ($run{copy_srpm}) { - system("cp $chroot_tmp/home/$luser/rpm/SRPMS/*.src.rpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy SRPMS from $chroot_tmp/home/$luser/rpm/SRPMS/ to $local_spool ($!)"); + system("cp $chroot_tmp/home/$luser/rpmbuild/SRPMS/*.src.rpm $local_spool &>/dev/null") and plog('ERROR', "ERROR: could not copy SRPMS from $chroot_tmp/home/$luser/rpmbuild/SRPMS/ to $local_spool ($!)"); } } else { plog('FAIL', "some packages could not be compiled."); diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm index 1e19860..3995d21 100644 --- a/lib/Iurt/Chroot.pm +++ b/lib/Iurt/Chroot.pm @@ -151,8 +151,8 @@ sub dump_rpmmacros { } my $packager = $run->{packager} || $config->{packager}; - print $f qq(\%_topdir \%(echo \$HOME)/rpm -\%_tmppath \%(echo \$HOME)/rpm/tmp/ + print $f qq(\%_topdir \%(echo \$HOME)/rpmbuild +\%_tmppath \%(echo \$HOME)/rpmbuild/tmp/ \%distribution $config->{distribution} \%vendor $config->{vendor} \%packager $packager @@ -451,7 +451,7 @@ sub build_chroot { sudo($config, "--cp", "$tmp_chroot/tmp/qa", "$tmp_chroot/var/log/qa"); unlink("$tmp_chroot/tmp/qa"); - sudo($config, "--mkdir", "$tmp_chroot/etc/skel/rpm/$_") + sudo($config, "--mkdir", "$tmp_chroot/etc/skel/rpmbuild/$_") foreach "", qw(RPMS BUILD SPECS SRPMS SOURCES tmp); # diff --git a/lib/Iurt/DKMS.pm b/lib/Iurt/DKMS.pm index 8fd8f57..d16fd55 100644 --- a/lib/Iurt/DKMS.pm +++ b/lib/Iurt/DKMS.pm @@ -275,7 +275,7 @@ sub dkms_compile { -d "$dkms_spool/$media" or mkdir_p "$dkms_spool/$media"; - my @dkms_rpm_dirs = ("/home/$luser/rpm/RPMS/*", "/usr/src/rpm/RPMS/*", "/var/lib/dkms/$realname/$realversion/rpm"); + my @dkms_rpm_dirs = ("/home/$luser/rpmbuild/RPMS/*", "/usr/src/rpm/RPMS/*", "/var/lib/dkms/$realname/$realversion/rpm"); my $copied; foreach (@dkms_rpm_dirs) { my $rpms = "$chroot_tmp$_/*.rpm"; diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm index 00a7e1a..96c9d96 100644 --- a/lib/Iurt/Urpmi.pm +++ b/lib/Iurt/Urpmi.pm @@ -64,8 +64,8 @@ sub add_to_local_media { my ($self, $chroot_tmp, $srpm, $luser) = @_; my $local_media = $self->{local_media}; - system("cp $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm $local_media &>/dev/null") and plog("ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpm/RPMS/ to $local_media ($!)"); - system("cp $chroot_tmp/home/$luser/rpm/SRPMS/$srpm $local_media &>/dev/null") and plog("ERROR: could not copy $srpm from $chroot_tmp/home/$luser/rpm/SRPMS/ to $local_media ($!)"); + system("cp $chroot_tmp/home/$luser/rpmbuild/RPMS/*/*.rpm $local_media &>/dev/null") and plog("ERROR: could not copy rpm files from $chroot_tmp/home/$luser/rpmbuild/RPMS/ to $local_media ($!)"); + system("cp $chroot_tmp/home/$luser/rpmbuild/SRPMS/$srpm $local_media &>/dev/null") and plog("ERROR: could not copy $srpm from $chroot_tmp/home/$luser/rpmbuild/SRPMS/ to $local_media ($!)"); } sub urpmi_command { @@ -610,7 +610,7 @@ sub recreate_srpm { perform_command([ sub { my ($s, $d) = @_; - sudo($config, '--cp', $s, $d) } , [ "$dir/$srpm", "$chroot_tmp/home/$luser/rpm/SRPMS/" ] ], + sudo($config, '--cp', $s, $d) } , [ "$dir/$srpm", "$chroot_tmp/home/$luser/rpmbuild/SRPMS/" ] ], $run, $config, $cache, type => 'perl', mail => $config->{admin}, @@ -638,7 +638,7 @@ sub recreate_srpm { 1; }); plog('DEBUG', "recreating src.rpm..."); - if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpm -i /home/$luser/rpm/SRPMS/$srpm"), + if (!perform_command(qq(chroot $chroot_tmp su $luser -c "rpm -i /home/$luser/rpmbuild/SRPMS/$srpm"), $run, $config, $cache, %opt)) { plog("ERROR: chrooting failed (retry $opt{retry}") if $run->{debug}; if ($opt{retry}) { @@ -648,7 +648,7 @@ sub recreate_srpm { } my $spec; - my $oldsrpm = "$chroot_tmp/home/$luser/rpm/SRPMS/$srpm"; + my $oldsrpm = "$chroot_tmp/home/$luser/rpmbuild/SRPMS/$srpm"; my $filelist = `rpm -qlp $oldsrpm`; my ($name) = $srpm =~ /(?:.*:)?(.*)-[^-]+-[^-]+\.src\.rpm$/; foreach my $file (split "\n", $filelist) { @@ -662,7 +662,7 @@ sub recreate_srpm { } # 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/rpm/SPECS/$spec"), + my $ret = perform_command(qq(chroot $chroot_tmp su $luser -c "rpmbuild --nodeps -bs $with_flags /home/$luser/rpmbuild/SPECS/$spec"), $run, $config, $cache, use_iurt_root_command => 1, mail => $config->{admin}, @@ -679,12 +679,12 @@ sub recreate_srpm { # we can not rely on build time (one of the src.rpm may have been built on a machine with wrong time) # let's say that if we have several one, we want the non original one my $file = $oldsrpm; - foreach my $f (glob "$chroot_tmp/home/$luser/rpm/SRPMS/$name-*.src.rpm") { + foreach my $f (glob "$chroot_tmp/home/$luser/rpmbuild/SRPMS/$name-*.src.rpm") { $file = $f if $f ne $oldsrpm; } my ($new_srpm) = basename($file); my $prefix = get_package_prefix($srpm); - my $newfile = "$chroot_tmp/home/$luser/rpm/SRPMS/$prefix$new_srpm"; + my $newfile = "$chroot_tmp/home/$luser/rpmbuild/SRPMS/$prefix$new_srpm"; if (-f $file && $newfile ne $file) { if (-f $newfile) { sudo($config, '--rm', $newfile) or die "$program_name: could not delete $newfile ($!)"; |