[gnome-ostree] build: Only keep one cached buildroot around, not two



commit 3af20128ebbda52e88884e40a7c8f031adb95041
Author: Colin Walters <walters verbum org>
Date:   Sat Dec 22 14:40:36 2012 -0500

    build: Only keep one cached buildroot around, not two
    
    These take up a substantial amount of space for some reason, even
    though all the regular files are hardlinked.
    
    We don't really need two.

 src/ostbuild/js/build.js |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/src/ostbuild/js/build.js b/src/ostbuild/js/build.js
index 2c1a81d..8871d25 100644
--- a/src/ostbuild/js/build.js
+++ b/src/ostbuild/js/build.js
@@ -52,19 +52,13 @@ const Build = new Lang.Class({
     _cleanStaleBuildroots: function(buildrootCachedir, keepRoot, cancellable) {
 	let direnum = buildrootCachedir.enumerate_children("standard::*,unix::mtime",
 							   Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, cancellable);
-        let rootMtimes = [];
 	let finfo;
 	while ((finfo = direnum.next_file(cancellable)) != null) {
-	    rootMtimes.push([buildrootCachedir.get_child(finfo.get_name()), finfo.get_attribute_uint32('unix::mtime')]);
-	}
-        rootMtimes.sort(function (a,b) { let ma = a[1]; let mb = b[1]; if (ma == mb) return 0; else if (ma < mb) return -1; return 1;});
-        for (let i = 0; i < rootMtimes.length - 2; i++) {
-	    let path = rootMtimes[i][0];
-            if (path.equal(keepRoot)) {
-                continue;
-	    }
-            print("Removing old cached buildroot " + path.get_path());
-            GSystem.shutil_rm_rf(path, cancellable);
+	    let child = buildrootCachedir.get_child(finfo.get_name());
+	    if (child.equal(keepRoot))
+		continue;
+            print("Removing old cached buildroot " + child.get_path());
+            GSystem.shutil_rm_rf(child, cancellable);
 	}
     },
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]