[gnome-ostree] build: Add "shell" builtin



commit 2da9ac706f93ae7724974f0e0882b3d9635cae21
Author: Colin Walters <walters verbum org>
Date:   Tue Jan 15 23:05:09 2013 -0500

    build: Add "shell" builtin
    
    Mainly for debugging; e.g. you can use imports.gi.GSystem here.

 Makefile-ostbuild.am              |    1 +
 src/ostbuild/js/builtins/shell.js |   55 +++++++++++++++++++++++++++++++++++++
 src/ostbuild/js/main.js           |    1 +
 3 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am
index 3965096..b14f59f 100644
--- a/Makefile-ostbuild.am
+++ b/Makefile-ostbuild.am
@@ -66,6 +66,7 @@ jsostbuiltins_DATA= \
 	src/ostbuild/js/builtins/qa_smoketest.js \
 	src/ostbuild/js/builtins/prefix.js \
 	src/ostbuild/js/builtins/resolve.js \
+	src/ostbuild/js/builtins/shell.js \
 	$(NULL)
 
 endif
diff --git a/src/ostbuild/js/builtins/shell.js b/src/ostbuild/js/builtins/shell.js
new file mode 100644
index 0000000..9377933
--- /dev/null
+++ b/src/ostbuild/js/builtins/shell.js
@@ -0,0 +1,55 @@
+// Copyright (C) 2012,2013 Colin Walters <walters verbum org>
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the
+// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+const GLib = imports.gi.GLib;
+const Gio = imports.gi.Gio;
+const Lang = imports.lang;
+const Format = imports.format;
+
+const GSystem = imports.gi.GSystem;
+
+const Task = imports.task;
+const JsonDB = imports.jsondb;
+const ProcUtil = imports.procutil;
+const JsonUtil = imports.jsonutil;
+const Snapshot = imports.snapshot;
+const Config = imports.config;
+const BuildUtil = imports.buildutil;
+const Vcs = imports.vcs;
+const ArgParse = imports.argparse;
+
+var loop = GLib.MainLoop.new(null, true);
+
+const Shell = new Lang.Class({
+    Name: 'Shell',
+
+    _init: function() {
+    },
+
+    execute: function(argv) {
+	    imports.console.interact();
+    }
+});
+
+function main(argv) {
+    let ecode = 1;
+    var app = new Shell();
+    GLib.idle_add(GLib.PRIORITY_DEFAULT,
+		  function() { try { app.execute(argv); ecode = 0; } finally { loop.quit(); }; return false; });
+    loop.run();
+    return ecode;
+}
diff --git a/src/ostbuild/js/main.js b/src/ostbuild/js/main.js
index 6acda4a..9026900 100755
--- a/src/ostbuild/js/main.js
+++ b/src/ostbuild/js/main.js
@@ -23,6 +23,7 @@ const BUILTINS = {'autobuilder': "Run resolve and build",
                   'git-mirror': "Update internal git mirror for one or more components",
                   'resolve': "Expand git revisions in source to exact targets",
                   'build': "Build multiple components and generate trees",
+                  'shell': "Interactive JavaScript shell",
                   'qa-make-disk': "Generate a bare disk image",
 		  'qa-pull-deploy': "Copy OSTree repo into virtual disk and deploy it",
 		  'qa-smoketest': "Basic smoke testing via parsing serial console"};



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