From: Gordon Hecker Date: Thu, 13 Aug 2009 12:17:40 +0000 (+0200) Subject: bugfix: collect_project did not work for git repositories with working-copy X-Git-Tag: e2factory-2.3.2rc1~48 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=53183d030127937d41a5bf211b22255cd4991eec;p=e2factory.git bugfix: collect_project did not work for git repositories with working-copy and mmm sourceset Signed-off-by: Gordon Hecker --- diff --git a/local/git.lua b/local/git.lua index 4c220c3..dc47390 100644 --- a/local/git.lua +++ b/local/git.lua @@ -692,12 +692,24 @@ function git.toresult(info, sourcename, sourceset, directory) local sourcedir = string.format("%s/%s", directory, source) e2lib.mkdir(sourcedir, "-p") local archive = string.format("%s.tar.gz", src.name) - local ref = generic_git.sourceset2ref(sourceset, src.branch, src.tag) - -- git archive --format=tar | gzip > - local cmd = string.format( - "cd %s/%s && git archive --format=tar --prefix=\"%s/\" %s | ".. - "gzip > %s/%s", - info.root, src.working, sourcename, ref, sourcedir, archive) + local cmd = nil + if sourceset == "tag" or sourceset == "branch" then + local ref = generic_git.sourceset2ref(sourceset, src.branch, src.tag) + -- git archive --format=tar | gzip > + cmd = string.format( + "cd %s/%s && git archive --format=tar --prefix=\"%s/\" %s | ".. + "gzip > %s/%s", + info.root, src.working, sourcename, ref, sourcedir, archive) + elseif sourceset == "working-copy" or sourceset == "mmm" then + cmd = string.format("tar -C '%s/%s' ".. + "--transform='s,^./,./%s/,' ".. + "--exclude=.git ".. + "-czf '%s/%s' .", + info.root, src.working, sourcename, sourcedir, archive) + else + return false, e:append("sourceset not supported: %s", + sourceset) + end local rc, re = e2lib.callcmd_log(cmd) if rc ~= 0 then return false, e:cat(re)