rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
rc, re = e2lib.init2()
if not rc then
- return false, re
+ error(re)
end
e = err.new("creating project failed")
local config, re = e2lib.get_global_config()
if not config then
- return false, e:cat(re)
+ error(e:cat(re))
end
local scache, re = e2lib.setup_cache()
if not scache then
- return false, e:cat(re)
+ error(e:cat(re))
end
if #arguments ~= 1 then
local sl, re = e2lib.parse_server_location(arguments[1],
e2lib.globals.default_projects_server)
if not sl then
- return false, e:cat(re)
+ error(e:cat(re))
end
local p = {}
-- create the server side structure
local tmpdir, re = e2lib.mktempdir()
if not tmpdir then
- return false, re
+ error(re)
end
local version = string.format("%d\n", p.version)
rc, re = e2lib.mkdir_recursive(e2lib.dirname(sourcefile))
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
rc, re = eio.file_write(sourcefile, f.content)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
flocation = e2lib.join(p.location, f.filename)
rc, re = cache.push_file(scache, sourcefile, p.server, flocation, {})
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
end
e2lib.rmtempdir(tmpdir)
tmpdir, re = e2lib.mktempdir()
if not tmpdir then
- return false, re
+ error(re)
end
-- create the initial repository on server side
local rlocation = string.format("%s/proj/%s.git", p.location, p.name)
rc, re = generic_git.git_init_db(scache, p.server, rlocation)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
-- works up to this point
tmp_repo_url, re = url.parse(string.format("file://%s/.git", tmpdir))
if not tmp_repo_url then
- return false, e:cat(re)
+ error(e:cat(re))
end
tmp_repo_path, re = url.to_file_path(tmp_repo_url)
if not tmp_repo_path then
- return false, e:cat(re)
+ error(e:cat(re))
end
rc, re = generic_git.git_init_db1(tmp_repo_url.url, false)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
local gitignore, re = read_template("gitignore")
if not gitignore then
- return false, re
+ error(re)
end
local chroot, re = read_template("proj/chroot")
if not chroot then
- return false, re
+ error(re)
end
local licences, re = read_template("proj/licences")
if not licences then
- return false, re
+ error(re)
end
local env, re = read_template("proj/env")
if not env then
- return false, re
+ error(re)
end
local pconfig, re = read_template("proj/config")
if not pconfig then
- return false, re
+ error(re)
end
pconfig = pconfig:gsub("<<release_id>>", p.name)
pconfig = pconfig:gsub("<<name>>", p.name)
sourcefile = e2lib.join(tmpdir, f.filename)
rc, re = e2lib.mkdir_recursive(e2lib.dirname(sourcefile))
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
rc, re = eio.file_write(sourcefile, f.content)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
rc, re = generic_git.git_add(tmp_repo_path, { f.filename })
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
end
local ec = e2lib.join(tmpdir, e2lib.globals.extension_config)
rc, re = write_extension_config(ec, config.site.default_extensions)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
rc, re = generic_git.git_add(tmp_repo_path,
{ e2lib.globals.extension_config })
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
rc, re = generic_git.git_commit(tmp_repo_path, { "-m", "project setup" })
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
local refspec = "master:refs/heads/master"
rc, re = generic_git.git_push(scache, tmp_repo_path, p.server,
rlocation, refspec)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
e2lib.rmtempdir(tmpdir)
-
- return true
end
-local rc, re = e2_create_project(arg)
-if not rc then
+local pc, re = pcall(e2_create_project, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_fetch_project(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local e = err.new("fetching project failed")
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
rc, re = e2lib.init2()
if not rc then
- return false, re
+ error(re)
end
-- setup cache
local scache, re = e2lib.setup_cache()
if not scache then
- return false, e:cat(re)
+ error(e:cat(re))
end
-- standard global tool setup finished
if #arguments < 1 then
- return false, err.new("specify path to a project to fetch")
+ error(err.new("specify path to a project to fetch"))
end
if #arguments > 2 then
- return false, err.new("too many arguments")
+ error(err.new("too many arguments"))
end
local sl, re = e2lib.parse_server_location(arguments[1],
e2lib.globals.default_projects_server)
if not sl then
- return false, e:cat(re)
+ error(e:cat(re))
end
local p = {}
if string.sub(p.destdir, 1, 1) ~= "/" then
rc, re = e2lib.cwd()
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
p.destdir = e2lib.join(rc, p.destdir)
-- fetch project descriptor file
local tmpdir, re = e2lib.mktempdir()
if not tmpdir then
- return false, re
+ error(re)
end
local location = string.format("%s/version", p.location)
local rc, re = cache.fetch_file(scache, p.server, location, tmpdir, nil,
{ cache = false })
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
-- read the version from the first line
local version_file = string.format("%s/version", tmpdir)
local line, re = eio.file_read_line(version_file)
if not line then
- return false, e:cat(re)
+ error(e:cat(re))
end
e2lib.rmtempdir()
local v = tonumber(line:match("[0-9]+"))
if not v or v < 1 or v > 2 then
- return false, e:append("unhandled project version")
+ error(e:append("unhandled project version"))
end
-- version is 1 or 2
local rc, re = generic_git.git_clone_from_server(scache, p.server, location,
p.destdir, skip_checkout)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
-- checkout the desired branch, if a branch was given
rc, re, id = generic_git.lookup_id(e2lib.join(p.destdir, ".git"),
false, "refs/heads/" .. p.branch)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
if not id then
rc, re = generic_git.git_branch_new1(p.destdir, true, p.branch,
"origin/" .. p.branch)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
rc, re = generic_git.git_checkout1(p.destdir,
"refs/heads/" .. p.branch)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
end
end
rc, re = generic_git.git_checkout1(p.destdir, "refs/tags/" .. p.tag)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
end
local data = string.format("%s\n", p.location)
rc, re = eio.file_write(plf, data)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
-- write version file
local givf = e2lib.join(p.destdir, e2lib.globals.global_interface_version_file)
rc, re = eio.file_write(givf, string.format("%d\n", v))
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
local e2_install_e2 =
rc, re = e2lib.callcmd_log(e2_install_e2, p.destdir)
if not rc or rc ~= 0 then
local e = err.new("installing local e2 failed")
- return false, e:cat(re)
+ error(e:cat(re))
end
-
- return true
end
-local rc, re = e2_fetch_project(arg)
-if not rc then
+local pc, re = pcall(e2_fetch_project, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_install_e2(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
-- When called from e2-fetch-project, we inherit its arg vector.
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
local root = e2lib.locate_project_root()
if not root then
- return false, err.new("can't locate project root.")
+ error(err.new("can't locate project root."))
end
rc, re = e2lib.init2()
if not rc then
- return false, re
+ error(re)
end
local e = err.new("e2-install-e2 failed")
local config, re = e2lib.get_global_config()
if not config then
- return false, re
+ error(re)
end
local servers = config.servers
if not servers then
- return false, err.new("no servers configured in global config")
+ error(err.new("no servers configured in global config"))
end
local scache, re = e2lib.setup_cache()
if not scache then
- return false, e:cat(re)
+ error(e:cat(re))
end
-- standard global tool setup finished
local givf = e2lib.join(root, e2lib.globals.global_interface_version_file)
local line, re = eio.file_read_line(givf)
if not line then
- return false, e:cat(re)
+ error(e:cat(re))
end
local v = tonumber(line:match("[0-9]+"))
if not v or v < 1 or v > 2 then
- return false, e:append("unhandled project version")
+ error(e:append("unhandled project version"))
end
-- version is 1 or 2
if e2lib.exists(dir) then
rc, re = e2lib.unlink_recursive(dir)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
end
end
local extensions, re = e2lib.read_extension_config(root)
if not extensions then
- return false, e:cat(re)
+ error(e:cat(re))
end
local ef = e2lib.join(root, e2lib.globals.e2version_file)
local e2version, re = e2lib.parse_e2versionfile(ef)
if not e2version then
- return false, e:cat(re)
+ error(e:cat(re))
end
local ref
rc, re = generic_git.git_clone_from_server(scache, server, location,
destdir, false)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
-- change to requested branch or tag
rc, re = generic_git.git_checkout1(destdir, ref)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
for _,ex in ipairs(extensions) do
if e2lib.exists(destdir) then
rc, re = e2lib.unlink_recursive(destdir)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
end
rc, re = generic_git.git_clone_from_server(scache, server, location,
destdir, false)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
rc, re = generic_git.git_checkout1(destdir, ref)
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
end
rc, re = e2lib.callcmd_log(cmd, e2lib.join(root, ".e2/e2"))
if not rc or rc ~= 0 then
- return false, e:cat(re)
+ error(e:cat(re))
end
-
- return true
end
-local rc, re = e2_install_e2(arg)
-if not rc then
+local pc, re = pcall(e2_install_e2, arg)
+if not pc then
e2lib.abort(re)
end
local function e2(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
e2option.flag("prefix", "print installation prefix",
e2call.toolname = "e2"
local opts, re = e2option.parse(arg)
if not opts then
- return false, re
+ error(re)
end
if #opts == 0 then
e2option.usage(1)
end
- return 0
+ return nil, 0
else
e2call.toolname = e2call.basename
e2call.argindex = 1
root, root)
env.LUA_CPATH = string.format("%s/.e2/lib/e2/?.so", root)
elseif not root then
- return false,
- err.new("%s is not a global tool and we're not in a "..
- "project environment", e2call.toolname)
+ error(err.new("%s is not a global tool and we're not in a "..
+ "project environment", e2call.toolname))
else
- return false,
- err.new("%s is neither local nor global tool", e2call.toolname)
+ error(err.new("%s is neither local nor global tool", e2call.toolname))
end
table.insert(cmd, e2call.tool)
rc, re = e2lib.callcmd(cmd, {}, nil, env)
if not rc then
- return false, re
+ error(re)
end
- return rc
+ return nil, rc
end
-local rc, re = e2(arg)
-if not rc then
+local pc, re, rc = pcall(e2, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_build_numbers(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "build-numbers")
if not info then
- return false, re
+ error(re)
end
- return false, err.new("e2-build-numbers is deprecated and has been removed")
+ error(err.new("e2-build-numbers is deprecated and has been removed"))
end
-local rc, re = e2_build_numbers(arg)
-if not rc then
+local pc, re = pcall(e2_build_numbers, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_build(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "build")
if not info then
- return false, re
+ error(re)
end
e2option.flag("all", "build all results (default unless for working copy)")
rc, re = cache.set_writeback(info.cache, set.server, false)
if not rc then
local e = err.new(disable_msg, set.server)
- return false, e:cat(re)
+ error(e:cat(re))
end
elseif set.set == "enable" then
e2lib.logf(3, enable_msg, set.server)
rc, re = cache.set_writeback(info.cache, set.server, true)
if not rc then
local e = err.new(enable_msg, set.server)
- return false, e:cat(re)
+ error(e:cat(re))
end
end
end
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
-- get build mode from the command line
local build_mode, re = policy.handle_commandline_options(opts, true)
if not build_mode then
- return false, re
+ error(re)
end
info, re = e2tool.collect_project_info(info)
if not info then
- return false, re
+ error(re)
end
perform_writeback_settings(writeback)
local build_mode = nil
if opts["branch-mode"] and opts["wc-mode"] then
e = err.new("--branch-mode and --wc-mode are mutually exclusive")
- return false, e
+ error(e)
end
if opts["branch-mode"] then
-- selected results get a special build mode
local playground = opts["playground"]
if playground then
if opts.release then
- return false,
- err.new("--release and --playground are mutually exclusive")
+ error(err.new("--release and --playground are mutually exclusive"))
end
if opts.all then
- return false,
- err.new("--all and --playground are mutually exclusive")
+ error(err.new("--all and --playground are mutually exclusive"))
end
if #arguments ~= 1 then
- return false,
- err.new("please select one single result for the playground")
+ error(err.new("please select one single result for the playground"))
end
end
local force_rebuild = opts["force-rebuild"]
rc, re = e2tool.select_results(info, results, force_rebuild,
keep_chroot, build_mode, playground)
if not rc then
- return false, re
+ error(re)
end
-- a list of results to build, topologically sorted
local re
sel_res, re = e2tool.dlist_recursive(info, results)
if not sel_res then
- return false, re
+ error(re)
end
else
local re
sel_res, re = e2tool.dsort(info)
if not sel_res then
- return false, re
+ error(re)
end
end
rc, re = e2tool.print_selection(info, sel_res)
if not rc then
- return false, re
+ error(re)
end
if opts.release then
local version_table, re = e2lib.parse_e2versionfile(
e2lib.join(info.root, e2lib.globals.e2version_file))
if not version_table then
- return false, re
+ error(re)
end
if version_table.tag == "^" then
- return false,
- err.new("e2 is on a pseudo tag while building in release mode.")
+ error(
+ err.new("e2 is on a pseudo tag while building in release mode."))
end
end
for _,r in ipairs(sel_res) do
local bid, re = e2tool.buildid(info, r)
if not bid then
- return false, re
+ error(re)
end
end
for _,r in ipairs(sel_res) do
local bid, re = e2tool.buildid(info, r)
if not bid then
- return false, re
+ error(re)
end
console.infof("%-20s [%s]\n", r, bid)
end
-
- return true
- end
-
- -- build
- local rc, re = e2build.build_results(info, sel_res)
- if not rc then
- return false, re
+ else
+ -- build
+ local rc, re = e2build.build_results(info, sel_res)
+ if not rc then
+ error(re)
+ end
end
-
- return true
end
-local rc, re = e2_build(arg)
-if not rc then
+local pc, re = pcall(e2_build, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_cf(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "cf")
if not info then
- return false, re
+ error(re)
end
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
-- initialize some basics in the info structure without actually loading
-- the project configuration.
info, re = e2tool.collect_project_info(info, true)
if not info then
- return false, re
+ error(re)
end
local rc, re = e2lib.chdir(info.root)
if not rc then
- return false, re
+ error(re)
end
commands.editbuildscript = editbuildscript
end
if #match == 0 then
- return false, err.new("unknown command")
+ error(err.new("unknown command"))
elseif #match == 1 then
local a = {}
for _,o in ipairs(arguments) do
local f = commands[match[1]]
rc, re = f(info, a)
if not rc then
- return false, re
+ error(re)
end
else
- return false, err.new("Ambiguous command: \"%s\" matches: %s",
- cmd, table.concat(match, ', '))
+ error(err.new("Ambiguous command: \"%s\" matches: %s",
+ cmd, table.concat(match, ', ')))
end
-
- return true
end
-local rc, re = e2_cf(arg)
-if not rc then
+local pc, re = pcall(e2_cf, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_dlist(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "dlist")
if not info then
- return false, re
+ error(re)
end
e2option.flag("recursive", "show indirect dependencies, too")
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
if #arguments == 0 then
- return false,
- err.new("no result given - enter `e2-dlist --help' for usage information")
+ error(err.new(
+ "no result given - enter `e2-dlist --help' for usage information"))
elseif #arguments ~= 1 then e2option.usage(1) end
local result = arguments[1]
info, re = e2tool.collect_project_info(info)
if not info then
- return false, re
+ error(re)
end
if not info.results[ result ] then
- return false, err.new("no such result: %s", result)
+ error(err.new("no such result: %s", result))
end
local dep, re
dep, re = e2tool.dlist(info, result)
end
if not dep then
- return false, re
+ error(re)
end
for _,d in ipairs(dep) do
console.infonl(d)
end
-
- return true
end
-local rc, re = e2_dlist(arg)
-if not rc then
+local pc, re = pcall(e2_dlist, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_dsort(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "dsort")
if not info then
- return false, re
+ error(re)
end
local opts, re = e2option.parse(arg)
if not opts then
- return false, re
+ error(re)
end
info, re = e2tool.collect_project_info(info)
if not info then
- return false, re
+ error(re)
end
local d = e2tool.dsort(info)
console.infonl(dep)
end
end
-
- return true
end
-local rc, re = e2_dsort(arg)
-if not rc then
+local pc, re = pcall(e2_dsort, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_fetch_source(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "fetch-sources")
if not info then
- return false, re
+ error(re)
end
local e = err.new()
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
info, re = e2tool.collect_project_info(info)
if not info then
- return false, info
+ error(re)
end
if not (opts.fetch or opts.update) then
sel[s] = s
end
elseif opts.result then
- return false, err.new("is not a result: %s", x)
+ error(err.new("is not a result: %s", x))
else
- return false, err.new("is not a source: %s", x)
+ error(err.new("is not a source: %s", x))
end
end
elseif opts["all"] then
end
end
if e:getcount() > 0 then
- return false, e
+ error(e)
end
if opts.chroot then
end
if e:getcount() > 0 then
- return false, e
+ error(e)
end
-
- return true
end
-local rc, re = e2_fetch_source(arg)
-if not rc then
+local pc, re = pcall(e2_fetch_source, arg)
+if not pc then
e2lib.abort(re)
end
local rc, re, e
rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "help")
if not info then
- return false, re;
+ error(re)
end
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
info, re = e2tool.collect_project_info(info, true)
if not info then
- return false, re
+ error(re)
end
local documentation = {}
if #arguments == 0 then
rc, re = discover_documentation(documentation)
if not rc then
- return false, re
+ error(re)
end
rc, re = list_documentation(documentation)
if not rc then
- return false, re
+ error(re)
end
elseif #arguments == 1 then
rc, re = discover_documentation(documentation)
if not rc then
- return false, re
+ error(re)
end
rc, re = display_doc(documentation, arguments[1])
if not rc then
- return false, re
+ error(re)
end
else
- return false, err.new("Too many arguments")
+ error(err.new("Too many arguments"))
end
-
- return true
end
-local rc, re = e2_help(arg)
-if not rc then
+local pc, re = pcall(e2_help, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_ls_project(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "ls-project")
if not info then
- return false, re
+ error(re)
end
policy.register_commandline_options()
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
info, re = e2tool.collect_project_info(info)
if not info then
- return false, re
+ error(re)
end
local results = {}
if info.results[r] then
table.insert(results, r)
else
- return false, err.new("not a result: %s", r)
+ error(err.new("not a result: %s", r))
end
end
end
if #results > 0 then
results, re = e2tool.dlist_recursive(info, results)
if not results then
- return false, re
+ error(re)
end
else
results, re = e2tool.dsort(info)
if not results then
- return false, re
+ error(re)
end
end
table.sort(results)
return true
end
-local rc, re = e2_ls_project(arg)
-if not rc then
+local pc, re = pcall(e2_ls_project, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_new_source(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "new-source")
if not info then
- return false, re
+ error(re)
end
e2option.flag("git", "create a git repository")
e2option.flag("no-checksum", "do not verify checksum file")
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
info, re = e2tool.collect_project_info(info)
if not info then
- return false, re
+ error(re)
end
if opts.git then
if #arguments ~= 1 then
- return false, err.new("<name> argument required")
+ error(err.new("<name> argument required"))
end
-- remote
local rserver = info.default_repo_server
local rc, re = generic_git.new_repository(info.cache, lserver, llocation,
rserver, rlocation)
if not rc then
- return false, re
+ error(re)
end
e2lib.log(1, "Read e2-new-source(1) for the next step")
elseif opts.files then
local location = arguments[1]
local sl, re = e2lib.parse_server_location(location, info.default_files_server)
if not sl then
- return false, re
+ error(re)
end
local server = sl.server
local location = sl.location
local checksum_file = arguments[3]
local verify = not opts["no-checksum"]
if verify and not checksum_file then
- return false, err.new("checksum file argument missing")
+ error(err.new("checksum file argument missing"))
end
local rc, re = new_files_source(info.cache, server, location, source_file,
checksum_file, verify)
if not rc then
- return false, re
+ error(re)
end
else
- return false, err.new("Please specify either --files are --git")
+ error(err.new("Please specify either --files are --git"))
end
-
- return true
end
-local rc, re = e2_new_source(arg)
-if not rc then
+local pc, re = pcall(e2_new_source, arg)
+if not pc then
e2lib.abort(re)
end
local function e2_playground(arg)
local rc, re = e2lib.init()
if not rc then
- return false, re
+ error(re)
end
local info, re = e2tool.local_init(nil, "playground")
if not info then
- return false, re
+ error(re)
end
local e = err.new("entering playground failed")
local opts, arguments = e2option.parse(arg)
if not opts then
- return false, arguments
+ error(arguments)
end
-- get build mode from the command line
local build_mode, re = policy.handle_commandline_options(opts, true)
if not build_mode then
- return false, re
+ error(re)
end
info, re = e2tool.collect_project_info(info)
if not info then
- return false, re
+ error(re)
end
if #arguments ~= 1 then
end
rc, re = e2build.build_config(info, r, {})
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
if not e2build.chroot_exists(info, r) then
- return false, err.new("playground does not exist")
+ error(err.new("playground does not exist"))
end
if opts.showpath then
console.infonl(info.results[r].build_config.c)
end
rc, re = eio.file_write(profile, table.concat(out))
if not rc then
- return false, e:cat(re)
+ error(e:cat(re))
end
local command = nil
if opts.command then
end
rc, re = e2build.enter_playground(info, r, command)
if not rc then
- return false, re
+ error(re)
end
-
- return true
end
-local rc, re = e2_playground(arg)
-if not rc then
+local pc, re = pcall(e2_playground, arg)
+if not pc then
e2lib.abort(re)
end