[gnome-continuous] task-builddisks: allows restricting to particular specific targets



commit 67997103b8db742c486d9d692589c15a2a11e5ec
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Thu Jun 5 09:39:11 2014 -0400

    task-builddisks: allows restricting to particular specific targets
    
    Rebuilding disk images can be slow, even when they can be incrementally
    updated. Allow, e.g.:
    
     make -n builddisks targets='["x86_64-runtime"]'
    
    To rebuild only a subset of the disk images.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=732389

 src/js/tasks/task-builddisks.js |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/js/tasks/task-builddisks.js b/src/js/tasks/task-builddisks.js
index 94c4b0b..7c8f3c0 100644
--- a/src/js/tasks/task-builddisks.js
+++ b/src/js/tasks/task-builddisks.js
@@ -48,6 +48,8 @@ const TaskBuildDisks = new Lang.Class({
     _inheritPreviousDisk: true,
     _onlyTreeSuffixes: ['-runtime', '-devel-debug'],
 
+    DefaultParameters: {targets: null},
+
     execute: function(cancellable) {
         let isLocal = this._buildName == 'local';
              let baseImageDir = this.workdir.resolve_relative_path(this._imageSubdir);
@@ -74,14 +76,24 @@ const TaskBuildDisks = new Lang.Class({
         GSystem.file_linkcopy(buildDataPath, destPath, Gio.FileCopyFlags.ALL_METADATA, cancellable);
 
         let targets = buildData['targets'];
+        let targetsToBuild = Object.keys(targets);
+        if (this.parameters.targets != null)
+            targetsToBuild = targetsToBuild.filter(function(targetName) {
+                for (let i = 0; i < this.parameters.targets.length; i++) {
+                    if (JSUtil.stringEndswith(targetName, '/' + this.parameters.targets[i]))
+                        return true;
+                }
+                return false;
+            }.bind(this));
 
         let osname = buildData['snapshot']['osname'];
         let originRepoUrl = buildData['snapshot']['repo'];
 
-        for (let targetName in targets) {
+        for (let i = 0; i < targetsToBuild.length; i++) {
+            let targetName = targetsToBuild[i];
             let matched = false;
-            for (let i = 0; i < this._onlyTreeSuffixes.length; i++) {
-                if (JSUtil.stringEndswith(targetName, this._onlyTreeSuffixes[i])) {
+            for (let j = 0; j < this._onlyTreeSuffixes.length; j++) {
+                if (JSUtil.stringEndswith(targetName, this._onlyTreeSuffixes[j])) {
                     matched = true;
                     break;
                 }


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