[gnome-ostree] autobuilder: queueResolve works from src urls



commit 9904e3862a0b1782ef28d42573e45bfd78ed4781
Author: Colin Walters <walters verbum org>
Date:   Wed Jan 23 17:42:51 2013 -0500

    autobuilder: queueResolve works from src urls
    
    This avoids us constantly erroring out when we get push notification
    from gnome git of something that's not in the moduleset.

 src/ostbuild/js/builtins/autobuilder.js |   22 +++++++++++++++++-----
 src/ostbuild/js/snapshot.js             |   11 +++++++++++
 2 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/src/ostbuild/js/builtins/autobuilder.js b/src/ostbuild/js/builtins/autobuilder.js
index 73ddcec..747413e 100644
--- a/src/ostbuild/js/builtins/autobuilder.js
+++ b/src/ostbuild/js/builtins/autobuilder.js
@@ -113,11 +113,23 @@ const Autobuilder = new Lang.Class({
 	return this._status;
     },
 
-    queueResolve: function(components) {
-	this._queued_force_resolve.push.apply(this._queued_force_resolve, components);
-	print("queued resolves: " + this._queued_force_resolve);
-	if (!this._resolve_taskset.isRunning())
-	    this._fetch();
+    queueResolve: function(srcUrls) {
+	let matchingComponents = [];
+	let snapshotData = this._src_db.loadFromPath(this._source_snapshot_path, null);
+	let snapshot = new Snapshot.Snapshot(snapshotData, this._source_snapshot_path);
+	for (let i = 0; i < srcUrls.length; i++) {
+	    let matches = snapshot.getMatchingSrc(srcUrls[i]);
+	    for (let j = 0; j < matches.length; j++)
+		matchingComponents.push(matches[j]['name']);
+	}
+	if (matchingComponents.length > 0) {
+	    this._queued_force_resolve.push.apply(this._queued_force_resolve, matchingComponents);
+	    print("queued resolves: " + matchingComponents.join(' '));
+	    if (!this._resolve_taskset.isRunning())
+		this._fetch();
+	} else {
+	    print("Ignored fetch requests for unknown URLs: " + srcUrls.join(','));
+	}
     },
     
     _fetchAll: function() {
diff --git a/src/ostbuild/js/snapshot.js b/src/ostbuild/js/snapshot.js
index 024ae16..51dca5f 100644
--- a/src/ostbuild/js/snapshot.js
+++ b/src/ostbuild/js/snapshot.js
@@ -105,6 +105,17 @@ const Snapshot = new Lang.Class({
 	return r;
     },
 
+    getMatchingSrc: function(src, allowNone) {
+	let result = [];
+	for (let i = 0; i < this._componentNames.length; i++) {
+	    let name = this._componentNames[i];
+	    let component = this.getComponent(name, false);
+	    if (component['src'] == src)
+		result.push(component);
+	}
+	return result;
+    },
+
     getExpanded: function(name) {
 	return this._expandComponent(this.getComponent(name));
     }



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