[gnome-ostree/wip/no-config-use-builddir] Require tools to be run from build directory, drop ~/.config/ostbuild.cfg
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-ostree/wip/no-config-use-builddir] Require tools to be run from build directory, drop ~/.config/ostbuild.cfg
- Date: Wed, 20 Feb 2013 19:48:41 +0000 (UTC)
commit d8d76748b5fce9c6e262a21ffa2e0dfe6fb30e3d
Author: Colin Walters <walters verbum org>
Date: Wed Feb 20 12:57:36 2013 -0500
Require tools to be run from build directory, drop ~/.config/ostbuild.cfg
We want the ability to do multiple builds at once sanely; for example,
there should be a mainline autobuilder, but we should be able to
"clone" it to try a queued patch.
The "prefix" concept was kind of attempting to address this - the
vague idea was that mainline is say "gnomeos-3.8", and you'd create a
new prefix "gnomeos-3.8-bug697332" that had a patch from that bug.
But in reality things were messy because all the tools read the global
config file from ~/.config/ostbuild.cfg.
Let's approach this from another direction - a build directory is tied
to a given prefix, and if you want to do a separate build, you need to
make a separate build directory.
Then to make things efficient, later we'll add a tool to "clone" a
build directory, sharing all of the data.
For now though, it's best to just try to keep killing this idea of a
"prefix" that gets written all over the build directory. For the
cases where we do potentially have shared data (like the repo), the
manifest already has an 'osname' we can use.
Makefile-ostbuild.am | 2 -
src/ostbuild/js/buildutil.js | 11 +++++
src/ostbuild/js/builtin.js | 48 +++++++++++++-----------
src/ostbuild/js/builtins/autobuilder.js | 12 ++---
src/ostbuild/js/builtins/checkout.js | 8 +---
src/ostbuild/js/builtins/git_mirror.js | 7 ++-
src/ostbuild/js/builtins/make.js | 2 +-
src/ostbuild/js/builtins/prefix.js | 49 ------------------------
src/ostbuild/js/builtins/run_task.js | 1 -
src/ostbuild/js/builtins/shell.js | 1 -
src/ostbuild/js/config.js | 60 ------------------------------
src/ostbuild/js/main.js | 9 +---
src/ostbuild/js/task.js | 22 +++++++++--
src/ostbuild/js/tasks/task-bdiff.js | 9 +---
src/ostbuild/js/tasks/task-build.js | 18 ++++----
src/ostbuild/js/tasks/task-builddisks.js | 11 ++---
src/ostbuild/js/tasks/task-resolve.js | 12 ++---
src/ostbuild/js/tasks/task-smoketest.js | 10 ++---
src/ostbuild/js/vcs.js | 4 +-
19 files changed, 96 insertions(+), 200 deletions(-)
---
diff --git a/Makefile-ostbuild.am b/Makefile-ostbuild.am
index ed921e5..bd98a08 100644
--- a/Makefile-ostbuild.am
+++ b/Makefile-ostbuild.am
@@ -42,7 +42,6 @@ jsostbuild_DATA= \
src/ostbuild/js/argparse.js \
src/ostbuild/js/buildutil.js \
src/ostbuild/js/builtin.js \
- src/ostbuild/js/config.js \
src/ostbuild/js/fileutil.js \
src/ostbuild/js/task.js \
src/ostbuild/js/jsondb.js \
@@ -66,7 +65,6 @@ jsostbuiltins_DATA= \
src/ostbuild/js/builtins/make.js \
src/ostbuild/js/builtins/qa_make_disk.js \
src/ostbuild/js/builtins/qa_pull_deploy.js \
- src/ostbuild/js/builtins/prefix.js \
src/ostbuild/js/builtins/run_task.js \
src/ostbuild/js/builtins/shell.js \
$(NULL)
diff --git a/src/ostbuild/js/buildutil.js b/src/ostbuild/js/buildutil.js
index 5bcfcb4..5cf93f0 100644
--- a/src/ostbuild/js/buildutil.js
+++ b/src/ostbuild/js/buildutil.js
@@ -122,3 +122,14 @@ function atomicSymlinkSwap(linkPath, newTarget, cancellable) {
tmpLinkPath.make_symbolic_link(relpath, cancellable);
GSystem.file_rename(tmpLinkPath, linkPath, cancellable);
}
+
+function checkIsWorkDirectory(dir) {
+ let manifest = dir.get_child('manifest.json');
+ if (!manifest.query_exists(null)) {
+ throw new Error("No manifest.json found in " + dir.get_path());
+ }
+ let dotGit = dir.get_child('.git');
+ if (dotGit.query_exists(null)) {
+ throw new Error(".git found in " + dir.get_path() + "; are you in a gnome-ostree checkout?");
+ }
+}
diff --git a/src/ostbuild/js/builtin.js b/src/ostbuild/js/builtin.js
index 168c228..e37804e 100644
--- a/src/ostbuild/js/builtin.js
+++ b/src/ostbuild/js/builtin.js
@@ -22,12 +22,12 @@ const Format = imports.format;
const GSystem = imports.gi.GSystem;
-const Config = imports.config;
const Params = imports.params;
const JsonUtil = imports.jsonutil;
const ArgParse = imports.argparse;
const JsonDB = imports.jsondb;
const Snapshot = imports.snapshot;
+const BuildUtil = imports.buildutil;
const Builtin = new Lang.Class({
Name: 'Builtin',
@@ -36,38 +36,42 @@ const Builtin = new Lang.Class({
_init: function() {
this.parser = new ArgParse.ArgumentParser(this.DESCRIPTION);
-
- this.config = Config.get();
- this.workdir = Gio.File.parse_name(this.config.getGlobal('workdir'));
- this.mirrordir = Gio.File.parse_name(this.config.getGlobal('mirrordir'));
+ this._workdirInitialized = false;
+ },
+
+ _initWorkdir: function(workdir, cancellable) {
+ if (this._workdirInitialized)
+ return;
+ this._workdirInitialized = true;
+ if (workdir === null)
+ workdir = Gio.File.new_for_path('.');
+ else if (typeof(workdir) == 'string')
+ workdir = Gio.File.new_for_path(workdir);
+
+ BuildUtil.checkIsWorkDirectory(workdir);
+
+ this.workdir = workdir;
+ this.mirrordir = workdir.get_child('src');
+ GSystem.file_ensure_directory(this.mirrordir, true, cancellable);
this.patchdir = this.workdir.get_child('patches');
this.libdir = Gio.File.new_for_path(GLib.getenv('OSTBUILD_LIBDIR'));
this.repo = this.workdir.get_child('repo');
},
- _initPrefix: function(prefix) {
- if (!prefix)
- this.prefix = Config.get().getPrefix();
- else
- this.prefix = prefix;
- },
-
- _initSnapshot: function(prefix, snapshotPath, cancellable) {
+ _initSnapshot: function(workdir, snapshotPath, cancellable) {
+ this._initWorkdir(workdir, cancellable);
let snapshotDir = this.workdir.get_child('snapshots');
let path, data;
- if (!prefix && !snapshotPath)
- prefix = Config.get().getPrefix();
- if (prefix) {
- this.prefix = prefix;
- let db = new JsonDB.JsonDB(snapshotDir.get_child(prefix));
- path = db.getLatestPath();
- data = db.loadFromPath(path, cancellable);
- } else {
+ if (snapshotPath !== null) {
path = Gio.File.new_for_path(snapshotPath);
data = JsonUtil.loadJson(path, cancellable);
- this.prefix = data['prefix'];
+ } else {
+ let db = new JsonDB.JsonDB(snapshotDir);
+ path = db.getLatestPath();
+ data = db.loadFromPath(path, cancellable);
}
this._snapshot = new Snapshot.Snapshot(data, path);
+ this.prefix = this._snapshot.data['prefix'];
},
main: function(argv, loop, cancellable) {
diff --git a/src/ostbuild/js/builtins/autobuilder.js b/src/ostbuild/js/builtins/autobuilder.js
index 3ed89bf..bf479b4 100644
--- a/src/ostbuild/js/builtins/autobuilder.js
+++ b/src/ostbuild/js/builtins/autobuilder.js
@@ -28,7 +28,6 @@ const JsonDB = imports.jsondb;
const ProcUtil = imports.procutil;
const JsonUtil = imports.jsonutil;
const Snapshot = imports.snapshot;
-const Config = imports.config;
const loop = GLib.MainLoop.new(null, true);
@@ -48,7 +47,6 @@ const Autobuilder = new Lang.Class({
_init: function() {
this.parent();
- this.parser.addArgument('--prefix');
this.parser.addArgument('--autoupdate-self', { action: 'storeTrue' });
this.parser.addArgument('--stage');
@@ -63,7 +61,7 @@ const Autobuilder = new Lang.Class({
},
execute: function(args, loop, cancellable) {
- this._initSnapshot(args.prefix, null, cancellable);
+ this._initSnapshot(null, null, cancellable);
this._autoupdate_self = args.autoupdate_self;
if (!args.stage)
@@ -74,9 +72,9 @@ const Autobuilder = new Lang.Class({
this._do_builddisks = this._stageIndex >= this._stages.indexOf('builddisks');
this._do_smoke = this._stageIndex >= this._stages.indexOf('smoke');
- this._resolveTaskName = 'resolve/' + this.prefix;
- this._buildTaskName = 'build/' + this.prefix;
- this._bdiffTaskName = 'bdiff/' + this.prefix;
+ this._resolveTaskName = 'resolve'
+ this._buildTaskName = 'build'
+ this._bdiffTaskName = 'bdiff';
this._manifestPath = Gio.File.new_for_path('manifest.json');
@@ -87,7 +85,7 @@ const Autobuilder = new Lang.Class({
this._impl = Gio.DBusExportedObject.wrapJSObject(AutoBuilderIface, this);
this._impl.export(Gio.DBus.session, '/org/gnome/OSTreeBuild/AutoBuilder');
- this._snapshot_dir = this.workdir.get_child('snapshots').get_child(this.prefix);
+ this._snapshot_dir = this.workdir.get_child('snapshots');
this._src_db = new JsonDB.JsonDB(this._snapshot_dir);
this._taskmaster = new Task.TaskMaster(this.workdir.get_child('tasks'),
diff --git a/src/ostbuild/js/builtins/checkout.js b/src/ostbuild/js/builtins/checkout.js
index 0b3aaf4..0483534 100644
--- a/src/ostbuild/js/builtins/checkout.js
+++ b/src/ostbuild/js/builtins/checkout.js
@@ -27,7 +27,6 @@ const JsonDB = imports.jsondb;
const ProcUtil = imports.procutil;
const JsonUtil = imports.jsonutil;
const Snapshot = imports.snapshot;
-const Config = imports.config;
const Params = imports.params;
const BuildUtil = imports.buildutil;
const Vcs = imports.vcs;
@@ -107,9 +106,9 @@ const Checkout = new Lang.Class({
_init: function() {
this.parent();
this.parser.addArgument('--overwrite', {action:'storeTrue'});
- this.parser.addArgument('--prefix');
this.parser.addArgument('--patches-path');
this.parser.addArgument('--metadata-path');
+ this.parser.addArgument('--workdir');
this.parser.addArgument('--snapshot');
this.parser.addArgument('--checkoutdir');
this.parser.addArgument('--clean', {action: 'storeTrue'});
@@ -117,10 +116,7 @@ const Checkout = new Lang.Class({
},
execute: function(args, loop, cancellable) {
- this._initSnapshot(args.prefix, args.snapshot, cancellable);
-
- if (!this.mirrordir.query_exists(cancellable))
- throw new Error("Need mirrordir: "+ this.mirrordir.get_path());
+ this._initSnapshot(args.workdir, args.snapshot, cancellable);
let componentName = args.component;
diff --git a/src/ostbuild/js/builtins/git_mirror.js b/src/ostbuild/js/builtins/git_mirror.js
index d1c05cb..d31a984 100644
--- a/src/ostbuild/js/builtins/git_mirror.js
+++ b/src/ostbuild/js/builtins/git_mirror.js
@@ -22,7 +22,6 @@ const Format = imports.format;
const Builtin = imports.builtin;
const ProcUtil = imports.procutil;
-const Config = imports.config;
const Snapshot = imports.snapshot;
const BuildUtil = imports.buildutil;
const Vcs = imports.vcs;
@@ -38,7 +37,7 @@ const GitMirror = new Lang.Class({
_init: function() {
this.parent();
- this.parser.addArgument('--prefix');
+ this.parser.addArgument('--workdir');
this.parser.addArgument('--manifest');
this.parser.addArgument('--snapshot');
this.parser.addArgument('--timeout-sec', { help: "Cache fetch results for provided number of
seconds" });
@@ -50,6 +49,8 @@ const GitMirror = new Lang.Class({
},
execute: function(args, loop, cancellable) {
+ this._initWorkdir(args.workdir, cancellable);
+
let parser = new ArgParse.ArgumentParser();
if (!args.timeout_sec)
@@ -60,7 +61,7 @@ const GitMirror = new Lang.Class({
let manifestData = JsonUtil.loadJson(manifestPath, cancellable);
this._snapshot = new Snapshot.Snapshot(manifestData, manifestPath, { prepareResolve: true });
} else {
- this._initSnapshot(args.prefix, args.snapshot, cancellable);
+ this._initSnapshot(null, args.snapshot, cancellable);
}
let componentNames;
diff --git a/src/ostbuild/js/builtins/make.js b/src/ostbuild/js/builtins/make.js
index cab5084..9ee9901 100644
--- a/src/ostbuild/js/builtins/make.js
+++ b/src/ostbuild/js/builtins/make.js
@@ -28,7 +28,6 @@ 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;
@@ -46,6 +45,7 @@ const Make = new Lang.Class({
},
execute: function(args, loop, cancellable) {
+ this._initWorkdir(null, cancellable);
this._loop = loop;
this._failed = false;
let taskmaster = new Task.TaskMaster(this.workdir.get_child('tasks'),
diff --git a/src/ostbuild/js/builtins/run_task.js b/src/ostbuild/js/builtins/run_task.js
index 4a34c32..d76168f 100644
--- a/src/ostbuild/js/builtins/run_task.js
+++ b/src/ostbuild/js/builtins/run_task.js
@@ -28,7 +28,6 @@ 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;
diff --git a/src/ostbuild/js/builtins/shell.js b/src/ostbuild/js/builtins/shell.js
index 00250dc..31b42a4 100644
--- a/src/ostbuild/js/builtins/shell.js
+++ b/src/ostbuild/js/builtins/shell.js
@@ -27,7 +27,6 @@ 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;
diff --git a/src/ostbuild/js/main.js b/src/ostbuild/js/main.js
index 0f1e2e2..19035e5 100755
--- a/src/ostbuild/js/main.js
+++ b/src/ostbuild/js/main.js
@@ -21,17 +21,12 @@ const Format = imports.format;
const BUILTINS = ['autobuilder',
'checkout',
- 'prefix',
'git-mirror',
- 'resolve',
- 'build',
- 'build-disks',
'make',
- 'shell',
- 'run-task',
'qa-make-disk',
'qa-pull-deploy',
- 'qa-smoketest'];
+ 'run-task',
+ 'shell'];
function getModule(unixName) {
return imports.builtins[unixName.replace(/-/g, '_')];
diff --git a/src/ostbuild/js/task.js b/src/ostbuild/js/task.js
index 7288a08..4aa58c9 100644
--- a/src/ostbuild/js/task.js
+++ b/src/ostbuild/js/task.js
@@ -22,7 +22,6 @@ const Lang = imports.lang;
const Signals = imports.signals;
const GSystem = imports.gi.GSystem;
-const Config = imports.config;
const Params = imports.params;
const JsonUtil = imports.jsonutil;
const JsonDB = imports.jsondb;
@@ -210,10 +209,22 @@ const TaskDef = new Lang.Class({
this.vars = vars;
this.parameters = Params.parse(parameters, this.DefaultParameters);
- this.config = Config.get();
- this.workdir = Gio.File.parse_name(this.config.getGlobal('workdir'));
+ if (taskmaster !== null)
+ this.workdir = taskmaster.path.get_parent();
+ else
+ this.workdir = Gio.File.new_for_path(GLib.getenv('_OSTBUILD_WORKDIR'));
+
+ print("task workdir=" + this.workdir.get_path());
+
+ BuildUtil.checkIsWorkDirectory(this.workdir);
+
this.resultdir = this.workdir.get_child('results');
- this.mirrordir = Gio.File.parse_name(this.config.getGlobal('mirrordir'));
+ GSystem.file_ensure_directory(this.resultdir, true, null);
+ this.mirrordir = this.workdir.get_child('src');
+ GSystem.file_ensure_directory(this.mirrordir, true, null);
+ this.cachedir = this.workdir.resolve_relative_path('cache/raw');
+ GSystem.file_ensure_directory(this.cachedir, true, null);
+
this.libdir = Gio.File.new_for_path(GLib.getenv('OSTBUILD_LIBDIR'));
this.repo = this.workdir.get_child('repo');
},
@@ -321,6 +332,9 @@ const TaskDef = new Lang.Class({
let context = new GSystem.SubprocessContext({ argv: baseArgv });
context.set_cwd(this._workdir.get_path());
context.set_stdin_disposition(GSystem.SubprocessStreamDisposition.PIPE);
+ let childEnv = GLib.get_environ();
+ childEnv.push('_OSTBUILD_WORKDIR=' + this.workdir.get_path());
+ context.set_environment(childEnv);
if (this.PreserveStdout) {
let outPath = this._workdir.get_child('output.txt');
context.set_stdout_file_path(outPath.get_path());
diff --git a/src/ostbuild/js/tasks/task-bdiff.js b/src/ostbuild/js/tasks/task-bdiff.js
index 1d249f6..91993e3 100644
--- a/src/ostbuild/js/tasks/task-bdiff.js
+++ b/src/ostbuild/js/tasks/task-bdiff.js
@@ -29,7 +29,6 @@ const ProcUtil = imports.procutil;
const StreamUtil = imports.streamutil;
const JsonUtil = imports.jsonutil;
const Snapshot = imports.snapshot;
-const Config = imports.config;
const BuildUtil = imports.buildutil;
const Vcs = imports.vcs;
const ArgParse = imports.argparse;
@@ -38,7 +37,7 @@ const TaskBdiff = new Lang.Class({
Name: "TaskBdiff",
Extends: Task.TaskDef,
- TaskPattern: [/bdiff\/(.*?)$/, 'prefix'],
+ TaskPattern: [/bdiff$/],
TaskAfterPrefix: '/build/',
@@ -81,11 +80,9 @@ const TaskBdiff = new Lang.Class({
},
execute: function(cancellable) {
- let prefix = this.vars['prefix'];
-
this.subworkdir = Gio.File.new_for_path('.');
- let builddb = this._getResultDb('build/' + prefix);
+ let builddb = this._getResultDb('build');
let latestPath = builddb.getLatestPath();
if (!latestPath)
throw new Error("No builds!")
@@ -149,7 +146,7 @@ const TaskBdiff = new Lang.Class({
diffstat: diffstat });
}
- let bdiffdb = this._getResultDb('bdiff/' + prefix);
+ let bdiffdb = this._getResultDb('bdiff');
bdiffdb.store(result, cancellable);
}
});
diff --git a/src/ostbuild/js/tasks/task-build.js b/src/ostbuild/js/tasks/task-build.js
index 56aa5f2..b31a35c 100644
--- a/src/ostbuild/js/tasks/task-build.js
+++ b/src/ostbuild/js/tasks/task-build.js
@@ -30,7 +30,6 @@ const ProcUtil = imports.procutil;
const StreamUtil = imports.streamutil;
const JsonUtil = imports.jsonutil;
const Snapshot = imports.snapshot;
-const Config = imports.config;
const BuildUtil = imports.buildutil;
const Vcs = imports.vcs;
const ArgParse = imports.argparse;
@@ -47,7 +46,7 @@ const TaskBuild = new Lang.Class({
Name: "TaskBuild",
Extends: Task.TaskDef,
- TaskPattern: [/build\/(.*?)$/, 'prefix'],
+ TaskPattern: [/build$/],
TaskAfterPrefix: '/resolve/',
@@ -160,6 +159,7 @@ const TaskBuild = new Lang.Class({
GSystem.shutil_rm_rf(cachedRootTmp, cancellable);
ProcUtil.runSync(['ostree', '--repo=' + this.repo.get_path(),
'checkout', '--user-mode', '--union',
+ '--workdir=' + this.workdir.get_path(),
'--from-file=' + tmpPath.get_path(), cachedRootTmp.get_path()], cancellable);
GSystem.file_unlink(tmpPath, cancellable);
@@ -479,6 +479,7 @@ const TaskBuild = new Lang.Class({
let componentSrc = buildWorkdir.get_child(basename);
let childArgs = ['ostbuild', 'checkout', '--snapshot=' + this._snapshot.path.get_path(),
+ '--workdir=' + this.workdir.get_path(),
'--checkoutdir=' + componentSrc.get_path(),
'--metadata-path=' + tempMetadataPath.get_path(),
'--overwrite', basename];
@@ -734,27 +735,26 @@ const TaskBuild = new Lang.Class({
},
execute: function(cancellable) {
- let prefix = this.vars['prefix'];
-
this.subworkdir = Gio.File.new_for_path('.');
this.forceBuildComponents = {};
this.cachedPatchdirRevision = null;
- this.prefix = prefix;
- this.patchdir = this.workdir.get_child('patches');
let snapshotDir = this.workdir.get_child('snapshots');
- let srcdb = new JsonDB.JsonDB(snapshotDir.get_child(prefix));
+ let srcdb = new JsonDB.JsonDB(snapshotDir);
let snapshotPath = srcdb.getLatestPath();
let workingSnapshotPath = this.subworkdir.get_child(snapshotPath.get_basename());
GSystem.file_linkcopy(snapshotPath, workingSnapshotPath, Gio.FileCopyFlags.OVERWRITE,
cancellable);
let data = srcdb.loadFromPath(workingSnapshotPath, cancellable);
this._snapshot = new Snapshot.Snapshot(data, workingSnapshotPath);
+ this.prefix = this._snapshot.data['prefix'];
+
+ this.patchdir = this.workdir.get_child('patches');
let components = this._snapshot.data['components'];
- let builddb = this._getResultDb('build/' + this.prefix);
+ let builddb = this._getResultDb('build');
let targetSourceVersion = builddb.parseVersionStr(this._snapshot.path.get_basename());
@@ -832,7 +832,7 @@ const TaskBuild = new Lang.Class({
}
}
- this._componentBuildCachePath = this.workdir.get_child('component-builds.json');
+ this._componentBuildCachePath = this.cachedir.get_child('component-builds.json');
if (this._componentBuildCachePath.query_exists(cancellable)) {
this._componentBuildCache = JsonUtil.loadJson(this._componentBuildCachePath, cancellable);
} else {
diff --git a/src/ostbuild/js/tasks/task-builddisks.js b/src/ostbuild/js/tasks/task-builddisks.js
index c1bdf11..39e2330 100644
--- a/src/ostbuild/js/tasks/task-builddisks.js
+++ b/src/ostbuild/js/tasks/task-builddisks.js
@@ -30,7 +30,6 @@ const ProcUtil = imports.procutil;
const BuildUtil = imports.buildutil;
const LibQA = imports.libqa;
const JsonDB = imports.jsondb;
-const Config = imports.config;
const JsonUtil = imports.jsonutil;
const GuestFish = imports.guestfish;
@@ -40,7 +39,7 @@ const TaskBuildDisks = new Lang.Class({
Name: 'TaskBuildDisks',
Extends: Task.TaskDef,
- TaskPattern: [/builddisks\/(.*?)$/, 'prefix'],
+ TaskPattern: [/builddisks$/],
TaskAfterPrefix: '/build/',
@@ -48,16 +47,14 @@ const TaskBuildDisks = new Lang.Class({
_VERSION_RE: /^(\d+)\.(\d+)$/,
execute: function(cancellable) {
- let prefix = this.vars['prefix'];
-
let subworkdir = Gio.File.new_for_path('.');
- let baseImageDir = this.workdir.get_child('images').get_child(prefix);
+ let baseImageDir = this.workdir.get_child('images');
GSystem.file_ensure_directory(baseImageDir, true, cancellable);
let currentImageLink = baseImageDir.get_child('current');
let previousImageLink = baseImageDir.get_child('previous');
- let builddb = this._getResultDb('build/' + prefix);
+ let builddb = this._getResultDb('build');
let latestPath = builddb.getLatestPath();
let buildVersion = builddb.parseVersionStr(latestPath.get_basename());
@@ -80,7 +77,7 @@ const TaskBuildDisks = new Lang.Class({
for (let targetName in targets) {
let targetRevision = buildData['targets'][targetName];
let squashedName = targetName.replace(/\//g, '_');
- let diskName = prefix + '-' + squashedName + '-disk.qcow2';
+ let diskName = osname + '-' + squashedName + '-disk.qcow2';
let diskPath = workImageDir.get_child(diskName);
let prevPath = currentImageLink.get_child(diskName);
GSystem.shutil_rm_rf(diskPath, cancellable);
diff --git a/src/ostbuild/js/tasks/task-resolve.js b/src/ostbuild/js/tasks/task-resolve.js
index 1080b8a..7c06d69 100644
--- a/src/ostbuild/js/tasks/task-resolve.js
+++ b/src/ostbuild/js/tasks/task-resolve.js
@@ -28,7 +28,6 @@ const Task = imports.task;
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;
@@ -37,21 +36,20 @@ const TaskResolve = new Lang.Class({
Name: "TaskResolve",
Extends: Task.TaskDef,
- TaskPattern: [/resolve\/(.*?)$/, 'prefix'],
+ TaskPattern: [/resolve$/],
DefaultParameters: {fetchAll: false,
fetchComponents: [],
timeoutSec: 10},
execute: function(cancellable) {
- this.prefix = this.vars['prefix'];
- let manifest = this.config.getGlobal('manifest');
- let manifestPath = Gio.File.new_for_path(manifest);
+ let manifestPath = this.workdir.get_child('manifest.json');
let data = JsonUtil.loadJson(manifestPath, cancellable);
this._snapshot = new Snapshot.Snapshot(data, manifestPath, { prepareResolve: true });
let gitMirrorArgs = ['ostbuild', 'git-mirror', '--timeout-sec=' + this.parameters.timeoutSec,
- '--manifest=' + manifest];
+ '--workdir=' + this.workdir.get_path(),
+ '--manifest=' + manifestPath.get_path()];
if (this.parameters.fetchAll || this.parameters.fetchComponents.length > 0) {
gitMirrorArgs.push('--fetch');
gitMirrorArgs.push('-k');
@@ -73,7 +71,7 @@ const TaskResolve = new Lang.Class({
}
let snapshotdir = this.workdir.get_child('snapshots');
- this._src_db = new JsonDB.JsonDB(snapshotdir.get_child(this.prefix));
+ this._src_db = new JsonDB.JsonDB(snapshotdir);
let [path, modified] = this._src_db.store(this._snapshot.data, cancellable);
if (modified) {
print("New source snapshot: " + path.get_path());
diff --git a/src/ostbuild/js/tasks/task-smoketest.js b/src/ostbuild/js/tasks/task-smoketest.js
index 3722ad5..525178c 100644
--- a/src/ostbuild/js/tasks/task-smoketest.js
+++ b/src/ostbuild/js/tasks/task-smoketest.js
@@ -141,7 +141,7 @@ const SmoketestOne = new Lang.Class({
}
},
- execute: function(subworkdir, prefix, diskPath, cancellable) {
+ execute: function(subworkdir, diskPath, cancellable) {
print("Smoke testing disk " + diskPath.get_path());
this._loop = GLib.MainLoop.new(null, true);
this._done = false;
@@ -220,12 +220,10 @@ const TaskSmoketest = new Lang.Class({
Name: 'TaskSmoketest',
Extends: Task.TaskDef,
- TaskPattern: [/smoketest\/(.*?)$/, 'prefix'],
+ TaskPattern: [/smoketest$/],
execute: function(cancellable) {
- let prefix = this.vars['prefix'];
-
- let imageDir = this.workdir.get_child('images').get_child(prefix);
+ let imageDir = this.workdir.get_child('images');
let currentImages = imageDir.get_child('current');
let e = currentImages.enumerate_children('standard::*', Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS,
@@ -239,7 +237,7 @@ const TaskSmoketest = new Lang.Class({
let subworkdir = Gio.File.new_for_path(workdirName);
GSystem.file_ensure_directory(subworkdir, true, cancellable);
let smokeTest = new SmoketestOne();
- smokeTest.execute(subworkdir, prefix, currentImages.get_child(name), cancellable);
+ smokeTest.execute(subworkdir, currentImages.get_child(name), cancellable);
}
}
});
diff --git a/src/ostbuild/js/vcs.js b/src/ostbuild/js/vcs.js
index 3d324c2..f48f50c 100644
--- a/src/ostbuild/js/vcs.js
+++ b/src/ostbuild/js/vcs.js
@@ -38,8 +38,8 @@ function getMirrordir(mirrordir, keytype, uri, params) {
rest = uri;
}
let prefix = params.prefix ? params.prefix + '/' : '';
- return mirrordir.resolve_relative_path(prefix + keytype + '/' +
- scheme + '/' + rest);
+ let relpath = prefix + keytype + '/' + scheme + '/' + rest;
+ return mirrordir.resolve_relative_path(relpath);
}
function _fixupSubmoduleReferences(mirrordir, cwd, cancellable) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]