[gnome-continuous/gnome-3-14: 3/19] task-build: Write version number for build with commits



commit 38583fcc3140a3f43cc998b5ea398aaad859daea
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 a5ca125..28fc794 100644
--- a/src/js/tasks/task-build.js
+++ b/src/js/tasks/task-build.js
@@ -539,7 +539,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) {
@@ -549,8 +550,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 {
@@ -970,7 +976,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);
        }));
         print("Compose of " + targetName + " is " + rev);


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