]> git.e2factory.org Git - e2factory.git/commitdiff
bugfix: collect_project did not work for git repositories with working-copy
authorGordon Hecker <gh@emlix.com>
Thu, 13 Aug 2009 12:17:40 +0000 (14:17 +0200)
committerGordon Hecker <gh@emlix.com>
Fri, 2 Oct 2009 12:11:38 +0000 (14:11 +0200)
and mmm sourceset

Signed-off-by: Gordon Hecker <gh@emlix.com>
local/git.lua

index 4c220c3dc5a5b72be1327726997fc010041d4eed..dc4739066cbea36c2854ca465b43e9c1905debaa 100644 (file)
@@ -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 <ref> | gzip > <tarball>
-       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 <ref> | gzip > <tarball>
+               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)