Revision: 147357 https://trac.macports.org/changeset/147357 Author: raimue@macports.org Date: 2016-04-02 04:22:11 -0700 (Sat, 02 Apr 2016) Log Message: ----------- Include git submodules recursively in tarball Modified Paths: -------------- branches/vcs-fetch/base/src/port1.0/portfetch.tcl Modified: branches/vcs-fetch/base/src/port1.0/portfetch.tcl =================================================================== --- branches/vcs-fetch/base/src/port1.0/portfetch.tcl 2016-04-02 11:00:07 UTC (rev 147356) +++ branches/vcs-fetch/base/src/port1.0/portfetch.tcl 2016-04-02 11:22:11 UTC (rev 147357) @@ -497,10 +497,10 @@ } } - # XXX: this does not support multiple recursive levels of submodules + # fetch all submodules if {[file isfile "$tmppath/.gitmodules"] && [tbool git.fetch_submodules]} { ui_info "$UI_PREFIX Cloning git submodules" - set cmdstring "${git.cmd} submodule -q update --init 2>&1" + set cmdstring "${git.cmd} submodule -q update --init --recursive 2>&1" if {[catch {system -W $tmppath $cmdstring} result]} { delete ${tmppath} return -code error [msgcat::mc "Git submodule init failed"] @@ -528,9 +528,13 @@ # TODO: add dependency on libarchive, if /usr/bin/tar is not bsdtar set tar [findBinary bsdtar tar] set tartmp [join [list [mktemp "/tmp/macports.portfetch.${name}.XXXXXXXX"] ".tar"] ""] + # determine tmppath again in shell, as the real path might be different + # due to symlinks (/tmp vs. /private/tmp), pass it as MPTOPDIR in + # environment set cmdstring [join [list \ - "${git.cmd} submodule -q foreach '" \ - "${git.cmd} archive --format=tar --prefix=\"${git.file_prefix}/\$path/\" \$sha1 " \ + "MPTOPDIR=\$PWD " \ + "${git.cmd} submodule -q foreach --recursive '" \ + "${git.cmd} archive --format=tar --prefix=\"${git.file_prefix}/\${PWD#\$MPTOPDIR/}/\" \$sha1 " \ "| tar -cf ${tartmp} @- @${tardst} " \ "&& mv ${tartmp} ${tardst}" \ "' 2>&1"] ""]
participants (1)
-
raimue@macports.org