summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2014-01-24 12:31:44 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-01-24 12:40:37 +0000
commitd4b019ea2d172d9e419b2041efaf62ea6fc5bafe (patch)
treec77c9989e850247827b6656ebc3bc54dadf4ba71
parent5b0f11467505706d4f2300ed6f4a02965318a70e (diff)
downloadlua-aports-d4b019ea2d172d9e419b2041efaf62ea6fc5bafe.tar.bz2
lua-aports-d4b019ea2d172d9e419b2041efaf62ea6fc5bafe.tar.xz
buildrepo: do redirection to logfile in shell
-rwxr-xr-xbuildrepo.lua19
1 files changed, 6 insertions, 13 deletions
diff --git a/buildrepo.lua b/buildrepo.lua
index 07af4e9..fc618b5 100755
--- a/buildrepo.lua
+++ b/buildrepo.lua
@@ -25,7 +25,7 @@ local function parse_opts(opthelp, raw_args)
for optc, separator in opthelp:gmatch("%s+%-(%a)(%s+)") do
valid_opts[optc] = { hasarg = (separator == " ") }
end
-
+
local i = 1
while i <= #raw_args do
local a = raw_args[i]
@@ -77,25 +77,18 @@ local function build_aport(aport, repodest, logdir, skip_failed)
if skip_failed and skip_aport(aport) then
return nil
end
- local log
+ local logredirect = ""
if logdir ~= nil then
local dir = ("%s/%s"):format(logdir, aport.pkgname)
if not lfs.attributes(dir) then
assert(lfs.mkdir(dir), dir)
end
local logfile = ("%s/%s-%s-r%s.log"):format(dir, aport.pkgname, aport.pkgver, aport.pkgrel)
- log = io.open(logfile, "w")
- else
- log = io.stdout
- end
- local pipe = io.popen(("REPODEST='%s' abuild -r -m 2>&1"):format(repodest))
- for line in pipe:lines() do
- log:write(("%s\n"):format(line))
- end
- if log ~= io.stdout then
- log:close()
+
+ logredirect = ("> '%s' 2>&1"):format(logfile)
end
- success = pipe:close()
+ local cmd = ("REPODEST='%s' abuild -r -m %s"):format(repodest, logredirect)
+ success = os.execute(cmd)
if not success then
err("%s: Failed to build", aport.pkgname)
end