[Mageia-sysadm] [148] use urpmq --list to find available basesystem package versions,

root at mageia.org root at mageia.org
Fri Nov 26 00:15:18 CET 2010


Revision: 148
Author:   blino
Date:     2010-11-26 00:15:18 +0100 (Fri, 26 Nov 2010)
Log Message:
-----------
use urpmq --list to find available basesystem package versions,
instead of checking a path, since it likely requies to have an additional NFS available

Modified Paths:
--------------
    build_system/iurt/trunk/lib/Iurt/Chroot.pm

Modified: build_system/iurt/trunk/lib/Iurt/Chroot.pm
===================================================================
--- build_system/iurt/trunk/lib/Iurt/Chroot.pm	2010-11-25 18:07:24 UTC (rev 147)
+++ build_system/iurt/trunk/lib/Iurt/Chroot.pm	2010-11-25 23:15:18 UTC (rev 148)
@@ -439,14 +439,15 @@
 	    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 @@
 			    $clean->();
 			    return;
 			}
-			$ok = 1;
-		    }
 		}
 	    } else {
 		plog('DEBUG', "can't open $tmp_chroot/var/log/qa");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101126/f7892e47/attachment.html>


More information about the Mageia-sysadm mailing list