aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Iurt/Chroot.pm
diff options
context:
space:
mode:
authorOlivier Blin <blino@mageia.org>2010-11-25 23:15:18 +0000
committerOlivier Blin <blino@mageia.org>2010-11-25 23:15:18 +0000
commit32e34ed2eed35cb379d25cf148ffe691f281ceb2 (patch)
treec4d43aaf9ce34568e991ffbcbd8947f8004f94f9 /lib/Iurt/Chroot.pm
parent53c883b7d7a670655a108515a99ae268d7bddcf0 (diff)
downloadiurt-32e34ed2eed35cb379d25cf148ffe691f281ceb2.tar
iurt-32e34ed2eed35cb379d25cf148ffe691f281ceb2.tar.gz
iurt-32e34ed2eed35cb379d25cf148ffe691f281ceb2.tar.bz2
iurt-32e34ed2eed35cb379d25cf148ffe691f281ceb2.tar.xz
iurt-32e34ed2eed35cb379d25cf148ffe691f281ceb2.zip
use urpmq --list to find available basesystem package versions,
instead of checking a path, since it likely requies to have an additional NFS available
Diffstat (limited to 'lib/Iurt/Chroot.pm')
-rw-r--r--lib/Iurt/Chroot.pm19
1 files changed, 9 insertions, 10 deletions
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index d8ca8ff..9bcea57 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -439,14 +439,15 @@ sub create_chroot {
plog('DEBUG', "decompressing /var/log/qa from $chroot_tar in $tmp_chroot");
sudo($run, $config, '--untar', $chroot_tar, $tmp_chroot, "./var/log/qa");
- my $qa;
- if (open $qa, "$tmp_chroot/var/log/qa") {
- my $ok;
- my $f;
- while (!$ok && ($f = <$qa>)) {
- chomp $f;
- if (!-f "$config->{basesystem_media_root}/media/$config->{basesystem_media}/$f") {
- plog('DEBUG', "$f has changed");
+ my $tmp_urpmi = mktemp("$chroot.tmp.XXXXXX");
+ my @installed_pkgs = chomp_(cat_("$tmp_chroot/var/log/qa"));
+ my @available_pkgs = chomp_(`urpmq --urpmi-root $tmp_urpmi --use-distrib $run->{urpmi}{distrib_url} --list -f 2>/dev/null`);
+ my @removed_pkgs = difference2(\@installed_pkgs, \@available_pkgs);
+ rm_rf($tmp_urpmi);
+
+ if (@installed_pkgs) {
+ if (@removed_pkgs) {
+ plog('DEBUG', "changed packages: @removed_pkgs");
plog('NOTIFY', "Rebuilding chroot tarball");
$rebuild = 1;
@@ -457,8 +458,6 @@ sub create_chroot {
$clean->();
return;
}
- $ok = 1;
- }
}
} else {
plog('DEBUG', "can't open $tmp_chroot/var/log/qa");