[gnome-ostree] build: Write -buildresult.json file containing exact revisions



commit 5ab5097c0896bd123745496cd5362305434d1a72
Author: Colin Walters <walters verbum org>
Date:   Mon Jan 14 17:53:03 2013 -0500

    build: Write -buildresult.json file containing exact revisions
    
    This records the exact revisions resulting from a particular build; at
    present, the latest.

 src/ostbuild/js/builtins/build.js |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/ostbuild/js/builtins/build.js b/src/ostbuild/js/builtins/build.js
index 304c30c..6157c74 100644
--- a/src/ostbuild/js/builtins/build.js
+++ b/src/ostbuild/js/builtins/build.js
@@ -542,15 +542,16 @@ const Build = new Lang.Class({
 
         let treename = 'trees/' + target['name'];
         
-        ProcUtil.runSync(['ostree', '--repo=' + this.repo.get_path(),
-			 'commit', '-b', treename, '-s', 'Compose',
-			 '--owner-uid=0', '--owner-gid=0', '--no-xattrs', 
-			 '--related-objects-file=' + relatedTmpPath.get_path(),
-			 '--skip-if-unchanged'], cancellable,
-                          {cwd: composeRootdir.get_path(),
-                           logInitiation: true});
+        let ostreeRevision = ProcUtil.runSyncGetOutputUTF8Stripped(['ostree', '--repo=' + this.repo.get_path(),
+								    'commit', '-b', treename, '-s', 'Compose',
+								    '--owner-uid=0', '--owner-gid=0', '--no-xattrs', 
+								    '--related-objects-file=' + relatedTmpPath.get_path(),
+								    '--skip-if-unchanged'], cancellable,
+								   {cwd: composeRootdir.get_path(),
+								    logInitiation: true});
         GSystem.file_unlink(relatedTmpPath, cancellable);
         GSystem.shutil_rm_rf(composeRootdir, cancellable);
+	return [treename, ostreeRevision];
     },
 
     /* Build the Yocto base system. */
@@ -649,6 +650,7 @@ const Build = new Lang.Class({
 
 	this._srcDb = new JsonDB.JsonDB(this._snapshotDir, this.prefix + '-src-snapshot');
 	[this._snapshot, this._snapshotPath] = Snapshot.load(this._srcDb, this.prefix, args.snapshot, cancellable);
+	let snapshotName = this._snapshotPath.get_basename();
 	
         this.forceBuildComponents = {};
         this.cachedPatchdirRevision = null;
@@ -781,11 +783,17 @@ const Build = new Lang.Class({
 	    }
 	}
 
+	let buildDataPath = this.workdir.get_child(this.prefix + '-buildresult.json');
+	let targetRevisions = {};
+	let buildData = { snapshotName: snapshotName,
+			  targets: targetRevisions };
         for (let i = 0; i < targetsList.length; i++) {
 	    let target = targetsList[i];
             print(Format.vprintf("Composing %s from %d components", [target['name'], target['contents'].length]));
-            this._composeOneTarget(target, componentBuildRevs, cancellable);
+            let [treename, ostreeRev] = this._composeOneTarget(target, componentBuildRevs, cancellable);
+	    targetRevisions[treename] = ostreeRev;
 	}
+	JsonUtil.writeJsonFileAtomic(buildDataPath, buildData, cancellable);
     }
 });
 



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