diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2014-01-24 12:31:44 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2014-01-24 12:40:37 +0000 |
commit | d4b019ea2d172d9e419b2041efaf62ea6fc5bafe (patch) | |
tree | c77c9989e850247827b6656ebc3bc54dadf4ba71 /buildrepo.lua | |
parent | 5b0f11467505706d4f2300ed6f4a02965318a70e (diff) | |
download | lua-aports-d4b019ea2d172d9e419b2041efaf62ea6fc5bafe.tar.bz2 lua-aports-d4b019ea2d172d9e419b2041efaf62ea6fc5bafe.tar.xz |
buildrepo: do redirection to logfile in shell
Diffstat (limited to 'buildrepo.lua')
-rwxr-xr-x | buildrepo.lua | 19 |
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 |