[MacPorts] #16373: base should maintain a persistent working copy for all supported VCS fetches
MacPorts
noreply at macports.org
Fri Oct 30 03:08:46 PDT 2015
#16373: base should maintain a persistent working copy for all supported VCS
fetches
---------------------------+-------------------------------
Reporter: ryandesign@… | Owner: larryv@…
Type: enhancement | Status: assigned
Priority: Normal | Milestone: MacPorts Future
Component: base | Version: 1.7.0
Resolution: | Keywords: performance fetch
Port: |
---------------------------+-------------------------------
Comment (by mojca@…):
Can you please take a look at the attached `Portfile` for `xchm`? (Never
mind the fact that it leads to a build error later on.)
I copy-pasted some code from `portutil.tcl` and `portfetch.tcl`. This is
the relevant part:
{{{
checksums rmd160 ... \
sha256 ...
use_xz yes
pre-fetch {
if {![file exists ${distpath}/${distname}${extract.suffix}]} {
set git_dir ${workpath}/git
# clone the git repository
set options "-q"
set cmdstring "${git.cmd} clone $options ${git.url} ${git_dir}
2>&1"
ui_debug "Executing: $cmdstring"
if {[catch {system $cmdstring} result]} {
return -code error [msgcat::mc "Git clone failed"]
}
# create a tarball
set xz [findBinary xz ${portutil::autoconf::xz_path}]
set cmdstring "${git.cmd} archive ${git.branch}
--prefix=${distname}/ | ${xz} > ${distpath}/${distname}${extract.suffix}"
ui_debug "Executing: $cmdstring"
if {[catch {system -W ${git_dir} ${cmdstring}} result]} {
return -code error [msgcat::mc "Git archive failed"]
}
}
}
}}}
It works like explained months ago:
* In case the sources are missing, it will clone the repository and make
a tarball out of it and store it to `${distpath}`.
* (In extract phase the sources are extracted from the tarball, they are
not taken from the git repository.)
* Next time when the sources are needed, it will simply extract
everything from the tarball, no need for a new clone and for consumption
of a precious bandwidth.
* I assume that the buildbots / other servers would then also
automatically keep a mirror of these tarballs, so it would no longer be a
problem if the git repository goes offline.
However, this code should go to a portgroup (or possibly to core,
depending on where the other code resides) and I'm not too comfortable
writing the code for that yet.
Can someone please provide some feedback about this approach and in case
that the approach sounds reasonable, possibly help me rewrite the code?
--
Ticket URL: <https://trac.macports.org/ticket/16373#comment:32>
MacPorts <https://www.macports.org/>
Ports system for OS X
More information about the macports-tickets
mailing list