From 1ebc1c246b6dbd53886bb1069e9b7a9a70d3c5ee Mon Sep 17 00:00:00 2001 From: Gordon Hecker Date: Fri, 12 Feb 2010 15:40:15 +0100 Subject: [PATCH] cleanup: remove code that logs tool invocations Signed-off-by: Gordon Hecker --- Changelog | 1 + generic/e2lib.lua | 65 --------------------------------- global/e2-create-project.lua.in | 2 - global/e2-fetch-project.lua.in | 2 - global/e2-install-e2.lua.in | 2 - local/build-numbers.lua | 2 - local/build.lua | 2 - local/dlist.lua | 2 - local/dsort.lua | 2 - local/fetch-sources.lua | 2 - local/ls-project.lua | 2 - local/new-source.lua | 2 - local/playground.lua | 2 - 13 files changed, 1 insertion(+), 87 deletions(-) diff --git a/Changelog b/Changelog index a600a33..1918ee3 100644 --- a/Changelog +++ b/Changelog @@ -21,6 +21,7 @@ NEXT: * code related to external tools was moved into the new tools module * a lot of effort was done to further modularize code * fix alignment of status messages for better readability + * tool invocations are no longer logged e2factory-2.3.3 * use sha1 module instead of calling the sha1sum tool diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 3faeb8f..d0ffd15 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -82,7 +82,6 @@ globals = { last_output = false, tmpdirs = {}, tmpfiles = {}, - enable_invocation_log = false, default_projects_server = "projects", default_project_version = "2", local_e2_branch = nil, @@ -462,65 +461,6 @@ local function append_to_file(file, line) return true, nil end ---- log tool invocations --- this function always succeeds or aborts --- @param info --- @param args --- @return nothing -function log_invocation(info, args) - local pname = "" - if info then - pname = info.name - end - local logstring = string.format( - "%s %s %s %s \"%s %s\"\n", - pname, os.date(), buildconfig.VERSIONSTRING, - globals.username, arg[0], table.concat(args, " ")) - - -- always log to the user logfile - local ulogdir = string.format("%s/.e2", globals.homedir) - local ulogfile = string.format("%s/run.log", ulogdir) - mkdir(ulogdir, "-p") - local rc, e = append_to_file(ulogfile, logstring) - if not rc then - abort(string.format("can't log to file %s: %s", ulogfile, e)) - end - - -- log to the project logfile - if info then - local plogdir = string.format("%s/.e2", info.root) - local plogfile = string.format("%s/run.log", plogdir) - mkdir(plogdir, "-p") - rc, e = append_to_file(plogfile, logstring) - if not rc then - abort(string.format("can't log to file %s: %s", plogfile, e)) - end - end - - -- send the queued logs from the user logfile to the server - local args = string.format( - "--silent --fail -0 -q -f " .. - "--header 'Content-type: text/plain' " .. - "--data-binary '@%s' --connect-timeout 1 " .. - "'http://e2data:6532/store-run-log.lua?project=%s&user=%s&host=%s' " .. - ">/dev/null", - ulogfile, pname, globals.username, globals.hostname) - local rc = true - local re = nil - if globals.enable_invocation_log == true then - -- really send logs only if enabled - rc, re = curl(args) - end - if not rc then - local ulogfile_backup = ulogfile .. ".backup" - local args = string.format("'%s' >>'%s'", ulogfile, ulogfile_backup) - cat(args) - rm(ulogfile, "-f") - else - log(3, "failed sending queued logs to the server") - end -end - --- exit from the tool, cleaning up temporary files and directories -- @param rc number: return code (optional, defaults to 0) -- @return This function does not return. @@ -853,11 +793,6 @@ function use_global_config() if not config then abort("global config not available") end - if config.log and config.log.enable ~= nil then - globals.enable_invocation_log = config.log.enable - log(3, string.format( - "globals.enable_invocation_log=%s", tostring(config.log.enable))) - end if config.log then assert_type(config.log, "config.log", "table") if config.log.logrotate then diff --git a/global/e2-create-project.lua.in b/global/e2-create-project.lua.in index bc77977..e955cb6 100755 --- a/global/e2-create-project.lua.in +++ b/global/e2-create-project.lua.in @@ -58,8 +58,6 @@ if not scache then e2lib.abort(e:cat(re)) end -e2lib.log_invocation(nil, arg) - -- standard global tool setup finished if e2lib.globals.osenv["E2_LOCAL_TAG"] and e2lib.globals.osenv["E2_LOCAL_BRANCH"] then diff --git a/global/e2-fetch-project.lua.in b/global/e2-fetch-project.lua.in index 4da21ef..91cde33 100755 --- a/global/e2-fetch-project.lua.in +++ b/global/e2-fetch-project.lua.in @@ -61,8 +61,6 @@ if not scache then e2lib.abort(e:cat(re)) end -e2lib.log_invocation(nil, arg) - -- standard global tool setup finished if #opts.arguments < 1 then diff --git a/global/e2-install-e2.lua.in b/global/e2-install-e2.lua.in index f533846..ddd113f 100755 --- a/global/e2-install-e2.lua.in +++ b/global/e2-install-e2.lua.in @@ -59,8 +59,6 @@ if not scache then e2lib.abort(e:cat(re)) end -e2lib.log_invocation(nil, arg) - -- standard global tool setup finished if #opts.arguments > 0 then diff --git a/local/build-numbers.lua b/local/build-numbers.lua index ed4c018..36b07cc 100755 --- a/local/build-numbers.lua +++ b/local/build-numbers.lua @@ -59,8 +59,6 @@ for _,res in pairs(info.results) do res.build_mode = build_mode end -e2lib.log_invocation(info, arg) - -- read build numbers, -- merge to results, -- flush buildids, diff --git a/local/build.lua b/local/build.lua index 83e54b6..6f41cc9 100755 --- a/local/build.lua +++ b/local/build.lua @@ -65,8 +65,6 @@ if not rc then e2lib.abort(re) end -e2lib.log_invocation(info, arg) - -- apply the standard build mode to all results for _,res in pairs(info.results) do res.build_mode = build_mode diff --git a/local/dlist.lua b/local/dlist.lua index f0376a1..431b064 100755 --- a/local/dlist.lua +++ b/local/dlist.lua @@ -51,8 +51,6 @@ if not info then e2lib.abort(re) end -e2lib.log_invocation(info, arg) - if not info.results[ result ] then e2lib.abort("no such result: ", result) end diff --git a/local/dsort.lua b/local/dsort.lua index d7991d1..4dc7eac 100755 --- a/local/dsort.lua +++ b/local/dsort.lua @@ -45,8 +45,6 @@ if not info then e2lib.abort(re) end -e2lib.log_invocation(info, arg) - local d = e2tool.dsort(info) if d then for i = 1, #d do print(d[i]) end diff --git a/local/fetch-sources.lua b/local/fetch-sources.lua index d9075ec..930be09 100755 --- a/local/fetch-sources.lua +++ b/local/fetch-sources.lua @@ -76,8 +76,6 @@ if not rc then e2lib.abort(e:cat(re)) end -e2lib.log_invocation(info, arg) - if not (opts.fetch or opts.update) then opts.fetch = true e2lib.warn("WOTHER", "Selecting fetch by default") diff --git a/local/ls-project.lua b/local/ls-project.lua index b27b2de..3e639c5 100755 --- a/local/ls-project.lua +++ b/local/ls-project.lua @@ -54,8 +54,6 @@ if not rc then e2lib.abort(re) end ---e2lib.log_invocation(info, arg) - local results = {} if opts.all then for r, _ in pairs(info.results) do diff --git a/local/new-source.lua b/local/new-source.lua index 2ef21ed..c962285 100644 --- a/local/new-source.lua +++ b/local/new-source.lua @@ -243,8 +243,6 @@ if not info then e2lib.abort(re) end -e2lib.log_invocation(info, arg) - if opts.git then if #opts.arguments ~= 1 then e2lib.abort(" argument required") diff --git a/local/playground.lua b/local/playground.lua index 9f965f3..96cef7a 100644 --- a/local/playground.lua +++ b/local/playground.lua @@ -59,8 +59,6 @@ if not rc then e2lib.abort(re) end -e2lib.log_invocation(info, arg) - if #opts.arguments ~= 1 then e2option.usage(1) end -- 2.39.5