summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-04-14 09:14:46 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-04-14 09:14:46 +0000
commit2a5a80d9c3ace1fce642c1bbee6efe98d6bf7215 (patch)
treec703d258d12443f4105101b4504228c25ea363ac
parentfb3acf5dadb1db1729700ab6d6d2a6ca87196570 (diff)
downloadlua-aports-2a5a80d9c3ace1fce642c1bbee6efe98d6bf7215.tar.bz2
lua-aports-2a5a80d9c3ace1fce642c1bbee6efe98d6bf7215.tar.xz
buildrepo: make sure we flush stdout on info output
We introduce a printf-like function 'info'
-rwxr-xr-xbuildrepo.lua30
1 files changed, 19 insertions, 11 deletions
diff --git a/buildrepo.lua b/buildrepo.lua
index 7093141..005b548 100755
--- a/buildrepo.lua
+++ b/buildrepo.lua
@@ -6,10 +6,12 @@ local lfs = require("lfs")
local function warn(formatstr, ...)
io.stderr:write(("WARNING: %s\n"):format(formatstr:format(...)))
+ io.stderr:flush()
end
local function err(formatstr, ...)
io.stderr:write(("ERROR: %s\n"):format(formatstr:format(...)))
+ io.stderr:flush()
end
local function fatal(exitcode, formatstr, ...)
@@ -17,6 +19,11 @@ local function fatal(exitcode, formatstr, ...)
os.exit(exitcode)
end
+local function info(formatstr, ...)
+ io.stdout:write(("%s\n"):format(formatstr:format(...)))
+ io.stdout:flush()
+end
+
local function parse_opts(opthelp, raw_args)
local valid_opts = {}
local opts = {}
@@ -179,10 +186,12 @@ for _,repo in pairs(args) do
if not db:known_deps_exists(aport) then
warn("%s: Skipped due to missing dependencies", aport.pkgname)
elseif not (opts.s and skip_aport(aport)) then
- io.write(("%d/%d %d/%d %s/%s %s\n"):format(tried, #pkgs,
+ info("%d/%d %d/%d %s/%s %s-r%s",
+ tried, #pkgs,
totally_built,
stats[repo].relevant_aports,
- repo, aport.pkgname, aport.pkgver))
+ repo, aport.pkgname,
+ aport.pkgver, aport.pkgrel)
if build_aport(aport, repodest, logdir) then
built = built + 1
else
@@ -203,7 +212,7 @@ for _,repo in pairs(args) do
local apkrepodir = ("%s/%s/%s"):format(repodest, repo, abuild.arch)
for file in lfs.dir(apkrepodir) do
if file:match("%.apk$") and not keep[file] then
- print("Deleting ", file)
+ info("Deleting %s", file)
if not opts.n then
os.remove(("%s/%s"):format(apkrepodir, file))
deleted = deleted + 1
@@ -214,7 +223,7 @@ for _,repo in pairs(args) do
-- generate new apkindex
if not opts.n then
- print("Updating apk index")
+ info("Updating apk index")
apkrepo.update_index(("%s/%s"):format(repodest, repo),
abuild.arch, db:git_describe())
end
@@ -225,11 +234,10 @@ for _,repo in pairs(args) do
end
for repo,stat in pairs(stats) do
- print(repo.." built:", stat.built)
- print(repo.." tried:", stat.tried)
- print(repo.." deleted:", stat.deleted)
- print(repo.." time:", stat.time)
- print(repo.." total built:", stat.relevant_aports - stat.tried + stat.built)
- print(repo.." total relevant aports:", stat.relevant_aports)
- print(repo.." total aports:", stat.total_aports)
+ info("%s built:\t%d", repo, stat.built)
+ info("%s tried:\t%d", repo, stat.tried)
+ info("%s deleted:\t%d", repo, stat.deleted)
+ info("%s total built:\t%d", repo, stat.relevant_aports - stat.tried + stat.built)
+ info("%s total relevant aports:\t%d", repo, stat.relevant_aports)
+ info("%s total aports:\t%d", repo, stat.total_aports)
end