aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/DKMS.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-04-02 18:40:46 +0000
committerOlivier Blin <oblin@mandriva.com>2008-04-02 18:40:46 +0000
commit7fa6dfb5fa1e6b1aff7494bea373b4c88ce16b45 (patch)
tree239fb96a2e9dbc2d26ecde3faad984c5fc4afbd3 /lib/Iurt/DKMS.pm
parente853abede711eff32b901caae2c38c725fd68ca4 (diff)
downloadiurt-7fa6dfb5fa1e6b1aff7494bea373b4c88ce16b45.tar
iurt-7fa6dfb5fa1e6b1aff7494bea373b4c88ce16b45.tar.gz
iurt-7fa6dfb5fa1e6b1aff7494bea373b4c88ce16b45.tar.bz2
iurt-7fa6dfb5fa1e6b1aff7494bea373b4c88ce16b45.tar.xz
iurt-7fa6dfb5fa1e6b1aff7494bea373b4c88ce16b45.zip
factorize (for next commit)
Diffstat (limited to 'lib/Iurt/DKMS.pm')
-rw-r--r--lib/Iurt/DKMS.pm16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/Iurt/DKMS.pm b/lib/Iurt/DKMS.pm
index 637aeea..2acad93 100644
--- a/lib/Iurt/DKMS.pm
+++ b/lib/Iurt/DKMS.pm
@@ -283,8 +283,20 @@ sub dkms_compile {
-d "$dkms_spool/$media" or mkdir_p "$dkms_spool/$media";
- system("cp $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm $dkms_spool/$media/ &>/dev/null") && system("cp $chroot_tmp/usr/src/rpm/RPMS/*/*.rpm $dkms_spool/$media/ &>/dev/null") and $run->{LOG}->("ERROR: could not copy dkms packages from $chroot_tmp/usr/src/rpm/RPMS/*/*.rpm or $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm to $dkms_spool/$media ($!)\n");
- !sudo($run, $config, '--rm', "$chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm") || !sudo($run, $config, '--rm', "$chroot_tmp/usr/src/rpm/RPMS/*/*.rpm") and $run->{LOG}->("ERROR: could not delete dkms packages from $chroot_tmp/usr/src/rpm/RPMS/*/*.rpm or $chroot_tmp/home/$luser/rpm/RPMS/*/*.rpm ($!)\n");
+ my @dkms_rpm_dirs = ("/home/$luser/rpm/RPMS/*", "/usr/src/rpm/RPMS/*");
+ my $copied;
+ foreach (@dkms_rpm_dirs) {
+ my $rpms = "$chroot_tmp$_/*.rpm";
+ if (system("cp $rpms $dkms_spool/$media/ &>/dev/null") == 0) {
+ $copied = 1;
+ sudo($run, $config, '--rm', $rpms)
+ or $run->{LOG}->("ERROR: could not delete dkms packages from $rpms ($!)\n");
+ last;
+ }
+ }
+ $run->{LOG}->("ERROR: could not copy dkms packages from " .
+ join(" or ", map { "$chroot_tmp$_/*.rpm" } @dkms_rpm_dirs) .
+ " to $dkms_spool/$media ($!)\n") if !$copied;
if ($kerver ne $modulesdir) {
system("sudo rm -f $chroot_tmp/lib/modules/$kerver");