]> git.e2factory.org Git - e2factory.git/commitdiff
Mark global symbols 'local'
authorTobias Ulmer <tu@emlix.com>
Fri, 31 Aug 2012 12:57:55 +0000 (14:57 +0200)
committerTobias Ulmer <tu@emlix.com>
Tue, 26 Feb 2013 18:07:09 +0000 (19:07 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
global/e2-create-project.lua
global/e2-fetch-project.lua
global/e2-install-e2.lua
global/e2.lua.in
local/e2-fetch-sources.lua
local/e2-ls-project.lua
local/e2-new-source.lua
local/e2-playground.lua
local/policy.lua

index f8b7ad4a8e6c53806a0ee3bdbefc0faf75864fd8..115e2b7424105ae98c3ee9c465f38f41c1c8f9b6 100644 (file)
@@ -101,7 +101,7 @@ e2lib.chdir(tmpdir)
 
 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 },
@@ -178,7 +178,7 @@ local version = string.format("%s\n", p.version)
 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 },
index b3788130dd8809e39482b9ae259abcf46c18fe90..6cdf25f83c33fceccded821f13c8fb33ed8cb7de 100644 (file)
@@ -115,7 +115,7 @@ if not line then
 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
@@ -179,8 +179,8 @@ local rc, re = e2lib.write_file(e2lib.globals.global_interface_version_file,
 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"))
index 9b4f3ec2e6f8a1bf6a35945d95689960c34f7c29..ffd1f4a16864ac3955af1d5ee3aa67579d556bda 100644 (file)
@@ -89,7 +89,7 @@ if not line then
     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
index ea9dd3d9267046846b32a035f784315d36c60c30..bcb98704ad5f4b316a07561afea04555ad82d28e 100644 (file)
@@ -28,9 +28,9 @@
 package.path  = "@LIBDIR@/?.lua"
 package.cpath = "@LIBDIR@/?.so"
 
-require("buildconfig")
 local e2lib = require("e2lib")
 local e2option = require("e2option")
+require("buildconfig")
 require("e2util")
 
 e2lib.init()
@@ -52,7 +52,7 @@ end)
 
 local root = e2lib.locate_project_root()
 
-e2call = {}
+local e2call = {}
 e2call.basename = e2lib.basename(arg[0])
 
 local function quoteargs(argstr) -- probably has to do escaping?
@@ -80,12 +80,13 @@ if root then
     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")
@@ -102,7 +103,7 @@ else
     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)
index df5d3d64761e5164811459beea62eb5d7bae9b37..962d5ee3dbb734c80203d5e45857e86a00b681ff 100644 (file)
@@ -121,7 +121,7 @@ end
 -- @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, {})
@@ -139,7 +139,7 @@ end
 -- @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
index d890179ec32acca023a2b5455463130e696f8521..69a099e07a477ddb4fee75b46cb7b7b6a0918c28 100644 (file)
@@ -251,9 +251,9 @@ for _, s in pairs(sources) do
 end
 
 --------------------- results
-s1 = "|"
-s2 = " "
-s3 = " "
+local s1 = "|"
+local s2 = " "
+local s3 = " "
 pempty(s1, s2, s3)
 s2 = " "
 p1(s1, s2, "res")
@@ -277,13 +277,13 @@ for _, r in pairs(results) do
 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
index ea6be5f6b2f5834914be2de49a071f714ef8ecd1..22abca3cdda315f1467b735fe681ff1d362e0eab 100644 (file)
@@ -73,7 +73,7 @@ local opts, arguments = e2option.parse(arg)
 -- @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")
@@ -120,7 +120,7 @@ end
 -- @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",
@@ -132,7 +132,7 @@ function write_checksum_file_sha1(source_file, checksum_file)
     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))
@@ -143,7 +143,7 @@ function download(f)
     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)
@@ -160,7 +160,7 @@ end
 -- @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)
index 644b72da3ee1675750133c051a973e1dd473d433..1ed062e517b7d51fd6b8cae3c4187b2f2cbc0ac5 100644 (file)
@@ -71,7 +71,7 @@ if #arguments ~= 1 then
     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
index 367a7d15b0c1069cfd53f4fd6288d7ea7757cee6..dd4cba36d65030663f665d88212225a9d8d7e87a 100644 (file)
@@ -59,7 +59,7 @@ end
 -- @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