local version = string.format("%d\n", p.version)
local empty = ""
-files = {
+local files = {
{ filename = "version", content=version },
{ filename = "proj/.keep", content=empty },
{ filename = "git/.keep", content=empty },
local e2version = string.format("%s\n", p.e2version)
local syntax = string.format("%s\n", buildconfig.SYNTAX[1])
local empty = ""
-files = {
+local files = {
{ filename = ".e2/.keep", content=empty },
{ filename = "in/.keep", content=empty },
{ filename = "log/.keep", content=empty },
end
e2lib.rmtempdir()
-v = tonumber(line:match("[0-9]+"))
+local v = tonumber(line:match("[0-9]+"))
if not v or v < 1 or v > 2 then
e2lib.abort(e:append("unhandled project version"))
end
string.format("%d\n", v))
-- call e2-install-e2
-e2_install_e2 = string.format("%s %s/e2-install-e2",
-e2lib.shquote(buildconfig.LUA), e2lib.shquote(buildconfig.TOOLDIR))
+local e2_install_e2 = string.format("%s %s/e2-install-e2",
+ e2lib.shquote(buildconfig.LUA), e2lib.shquote(buildconfig.TOOLDIR))
rc, re = e2lib.callcmd_log(e2_install_e2)
if rc ~= 0 then
e2lib.abort(err.new("installing local e2 failed"))
e2lib.abort(e:cat(re))
end
-v = tonumber(line:match("[0-9]+"))
+local v = tonumber(line:match("[0-9]+"))
if not v or v < 1 or v > 2 then
e2lib.abort(e:append("unhandled project version"))
end
package.path = "@LIBDIR@/?.lua"
package.cpath = "@LIBDIR@/?.so"
-require("buildconfig")
local e2lib = require("e2lib")
local e2option = require("e2option")
+require("buildconfig")
require("e2util")
e2lib.init()
local root = e2lib.locate_project_root()
-e2call = {}
+local e2call = {}
e2call.basename = e2lib.basename(arg[0])
local function quoteargs(argstr) -- probably has to do escaping?
e2call.localtool = root .. "/.e2/bin/" .. e2call.toolname
end
+local env, cmd
if e2util.stat(e2call.globaltool) then
e2call.tool = e2call.globaltool
env = string.format("LUA_PATH='%s/?.lua' LUA_CPATH='%s/?.so'",
buildconfig.LIBDIR, buildconfig.LIBDIR)
- lua = buildconfig.LUA
- cmd = string.format("%s %s %s %s", env, lua, e2call.tool, e2call.arg_string)
+ cmd = string.format("%s %s %s %s", env, buildconfig.LUA, e2call.tool,
+ e2call.arg_string)
elseif not root then
e2lib.abort(e2call.toolname ..
" is not a global tool and we're not in a project environment")
e2lib.abort(e2call.toolname .. " is neither local nor global tool")
end
-function table_log(loglevel, t)
+local function table_log(loglevel, t)
e2lib.log(loglevel, tostring(t))
for k,v in pairs(t) do
e2lib.log(loglevel, k .. "\t->\t" .. v)
-- @param info the info table
-- @return bool
-- @return nil, an error string on error
-function cache_chroot(info)
+local function cache_chroot(info)
for _,c in ipairs(info.chroot.groups_sorted) do
for _,file in ipairs(info.chroot.groups_byname[c].files) do
local rc, e = info.cache:cache_file(file.server, file.location, {})
-- @param sel table of selected results
-- @return bool
-- @return nil, an error string on error
-function fetch_sources(info, opts, sel)
+local function fetch_sources(info, opts, sel)
local rc1 = true -- global return code
local nfail = 0 -- failure counter
local e = err.new() -- no message yet, append the summary later on
end
--------------------- results
-s1 = "|"
-s2 = " "
-s3 = " "
+local s1 = "|"
+local s2 = " "
+local s3 = " "
pempty(s1, s2, s3)
s2 = " "
p1(s1, s2, "res")
end
--------------------- licences
-s1 = "|"
-s2 = " "
-s3 = " "
+local s1 = "|"
+local s2 = " "
+local s3 = " "
pempty(s1, s2, s3)
s2 = "|"
p1(s1, s2, "licences")
-llen = #info.licences_sorted
+local llen = #info.licences_sorted
for _,l in pairs(info.licences_sorted) do
local lic = info.licences[l]
llen = llen - 1
-- @param filename string: the filename
-- @return a table with fields checksum and checksum_type ("sha1", "md5")
-- @return nil, or an error string on error
-function read_checksum(checksum_file, filename)
+local function read_checksum(checksum_file, filename)
e2lib.log(4, string.format("read_checksum(%s, %s)", checksum_file,
filename))
local f, e = io.open(checksum_file, "r")
-- @param checksum_file: checksum file name
-- @return bool
-- @return nil, an error string on error
-function write_checksum_file_sha1(source_file, checksum_file)
+local function write_checksum_file_sha1(source_file, checksum_file)
e2lib.log(4, string.format("write_checksum_file_sha1(%s, %s)",
source_file, checksum_file))
local cmd = string.format("sha1sum %s > %s",
return true, nil
end
-function download(f)
+local function download(f)
local name = e2lib.basename(f)
local cmd = string.format("curl --silent --fail %s > %s",
e2lib.shquote(f), e2lib.shquote(name))
return true, nil
end
-function mv(s, d)
+local function mv(s, d)
local cmd = string.format("mv %s %s", e2lib.shquote(s),
e2lib.shquote(d))
local rc = e2lib.callcmd_capture(cmd)
-- @param flags table: flags
-- @return bool
-- @return nil, an error string on error
-function new_files_source(c, server, location, source_file, checksum_file,
+local function new_files_source(c, server, location, source_file, checksum_file,
checksum_file_format, no_checksum)
local source_file_base = e2lib.basename(source_file)
local do_checksum = (not no_checksum)
e2option.usage(1)
end
-r = arguments[1]
+local r = arguments[1]
-- apply the standard build mode to all results
for _,res in pairs(info.results) do
-- @return the server to store the result on
-- @return the location to store the result in
local results_server = "results"
-function storage_release(location, release_id)
+local function storage_release(location, release_id)
return results_server, string.format("%s/release/%s", location,
release_id)
end