[gnome-continuous] Put a stop to rampant version inflation



commit 52134afcfd9d874c8c5446684f5a68bcaa1d1361
Author: Colin Walters <walters verbum org>
Date:   Mon Nov 18 17:01:08 2013 -0500

    Put a stop to rampant version inflation
    
    versioneddir.js needs to be the sole entry point for manipulation of
    the build directories now, as it contains cached data.
    
    Add an API to do what autobuilder.js was doing.

 src/js/builtins/autobuilder.js |   10 ++++++----
 src/js/versioneddir.js         |    9 +++++++++
 2 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/js/builtins/autobuilder.js b/src/js/builtins/autobuilder.js
index dfa51a2..521a66e 100644
--- a/src/js/builtins/autobuilder.js
+++ b/src/js/builtins/autobuilder.js
@@ -98,11 +98,13 @@ const Autobuilder = new Lang.Class({
     _onTaskCompleted: function(taskmaster, task, success, error) {
         let cancellable = null;
 
-        if (!task.changed)
-            GSystem.shutil_rm_rf(task.buildPath, cancellable);
-
-       if (task.name == 'resolve')
+        if (task.name == 'resolve') {
+           if (!task.changed) {
+               print("Resolve is unchanged");
+               this._buildsDir.deleteCurrentVersion(null);
+           }
            this._runResolve();
+       }
 
         let resultsPath;
 
diff --git a/src/js/versioneddir.js b/src/js/versioneddir.js
index 3db6dc4..c02738b 100644
--- a/src/js/versioneddir.js
+++ b/src/js/versioneddir.js
@@ -146,5 +146,14 @@ const VersionedDir = new Lang.Class({
         GSystem.file_ensure_directory(path, true, cancellable);
        this._cachedResults.push(newVersion);
        return path;
+    },
+
+    deleteCurrentVersion: function(cancellable) {
+       let versions = this.loadVersions(cancellable);
+       if (versions.length == 0)
+           throw new Error();
+       let last = versions.pop();
+       let path = this.createPathForVersion(last);
+       GSystem.shutil_rm_rf(path, cancellable);
     }
 });


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