[gnome-continuous] task-build: Write version number for build with commits



commit 7e6258827887aed5352d8773e3a782dbe8ee685d
Author: Colin Walters <walters verbum org>
Date:   Sat Nov 8 15:23:46 2014 -0500

    task-build: Write version number for build with commits
    
    This will now show up in "ostree admin status".

 src/js/tasks/task-build.js |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/js/tasks/task-build.js b/src/js/tasks/task-build.js
index 79f81ed..f20a6aa 100644
--- a/src/js/tasks/task-build.js
+++ b/src/js/tasks/task-build.js
@@ -541,7 +541,8 @@ const TaskBuild = new Lang.Class({
     },
 
     _commit: function(branch, subject, file, cancellable, params) {
-       params = Params.parse(params, { withParent: true });
+       params = Params.parse(params, { withParent: true,
+                                       version: null });
         let [, parentRev] = this.ostreeRepo.resolve_rev(branch, true);
        let changed;
        if (parentRev) {
@@ -551,8 +552,13 @@ const TaskBuild = new Lang.Class({
            changed = true;
        }
 
+       let metadata = null;
+       if (params.version != null) {
+           metadata = GLib.Variant.new('a{sv}', {'version': GLib.Variant.new("s", params.version)});
+       }
         if (changed) {
-            let [, rev] = this.ostreeRepo.write_commit(params.withParent ? parentRev : null, subject, "", 
null, file, cancellable);
+            let [, rev] = this.ostreeRepo.write_commit(params.withParent ? parentRev : null, subject, "", 
+                                                      metadata, file, cancellable);
             this.ostreeRepo.transaction_set_ref(null, branch, rev);
             return rev;
         } else {
@@ -975,7 +981,7 @@ const TaskBuild = new Lang.Class({
             this.ostreeRepo.prepare_transaction(cancellable);
             this.ostreeRepo.scan_hardlinks(cancellable);
             let file = this._writeMtreeFromDirectory(composeRootdir, [], cancellable);
-            rev = this._commit(treename, "Compose", file, cancellable);
+            rev = this._commit(treename, "Compose", file, cancellable, { version: this._buildName });
             this.ostreeRepo.commit_transaction(cancellable);
            this.ostreeRepo.set_disable_fsync(true);
        }));


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