[146635] branches/vcs-fetch/base/src/port1.0/portfetch.tcl
raimue at macports.org
raimue at macports.org
Mon Mar 14 09:45:23 PDT 2016
Revision: 146635
https://trac.macports.org/changeset/146635
Author: raimue at macports.org
Date: 2016-03-14 09:45:23 -0700 (Mon, 14 Mar 2016)
Log Message:
-----------
Initial tarball generation for fetch.type git
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-03-14 16:45:05 UTC (rev 146634)
+++ branches/vcs-fetch/base/src/port1.0/portfetch.tcl 2016-03-14 16:45:23 UTC (rev 146635)
@@ -427,29 +427,44 @@
# Perform a git fetch
proc portfetch::gitfetch {args} {
- global worksrcpath patchfiles \
- git.url git.branch git.cmd
+ global distpath workpath worksrcpath patchfiles \
+ git.url git.branch git.cmd \
+ name fetch.type
+ set generatedtar "${distpath}/${name}-${git.branch}.${fetch.type}.tar"
+ set generatedfile "${generatedtar}.xz"
+
+ if {${git.branch} ne "" && [file isfile "${generatedfile}"]} {
+ return 0
+ }
+
set options "-q"
if {${git.branch} eq ""} {
# if we're just using HEAD, we can make a shallow repo
set options "$options --depth=1"
}
- set cmdstring "${git.cmd} clone $options ${git.url} ${worksrcpath} 2>&1"
+
+ set generatedpath "${workpath}/${fetch.type}"
+ set cmdstring "${git.cmd} clone $options ${git.url} ${generatedpath} 2>&1"
ui_debug "Executing: $cmdstring"
if {[catch {system $cmdstring} result]} {
return -code error [msgcat::mc "Git clone failed"]
}
- if {${git.branch} ne ""} {
- set env "GIT_DIR=${worksrcpath}/.git GIT_WORK_TREE=${worksrcpath}"
- set cmdstring "$env ${git.cmd} checkout -q ${git.branch} 2>&1"
- ui_debug "Executing $cmdstring"
- if {[catch {system $cmdstring} result]} {
- return -code error [msgcat::mc "Git checkout failed"]
- }
+ if {${git.branch} eq ""} {
+ file rename ${generatedpath} ${worksrcpath}
+ return 0
}
+ # generate tarball
+ set xz [findBinary xz ${portutil::autoconf::xz_path}]
+ set cmdstring "${git.cmd} -c \"tar.tar.xz.command=xz -c\" archive --format=tar.xz --output=${generatedfile}.TMP ${git.branch} 2>&1"
+ ui_debug "Executing $cmdstring"
+ if {[catch {system -W ${generatedpath} $cmdstring} result]} {
+ return -code error [msgcat::mc "Git archive creation failed"]
+ }
+ file rename -force "${generatedfile}.TMP" "${generatedfile}"
+
if {[info exists patchfiles]} {
return [portfetch::fetchfiles]
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20160314/6168eb4c/attachment.html>
More information about the macports-changes
mailing list