<pre style='margin:0'>
Rainer Müller (raimue) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/db328146677c5eac40ca50929f16ab652cac82e3">https://github.com/macports/macports-base/commit/db328146677c5eac40ca50929f16ab652cac82e3</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit db328146677c5eac40ca50929f16ab652cac82e3
</span>Author: Rainer Müller <raimue@macports.org>
AuthorDate: Fri Apr 27 16:34:52 2018 +0200
<span style='display:block; white-space:pre;color:#404040;'> mportsync: Ignore top-level directory in snapshots
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> The name of the top-level directory in a snapshot tarball had to be the
</span><span style='display:block; white-space:pre;color:#404040;'> same as the root name of the tarball, which means the file name without
</span><span style='display:block; white-space:pre;color:#404040;'> extension.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> However, tarballs generated by GitHub do not follow this rule, as it
</span><span style='display:block; white-space:pre;color:#404040;'> uses a top-level directory name like "repository-branch/". Therefore,
</span><span style='display:block; white-space:pre;color:#404040;'> this will ignore the top-level directory in the tarball and always use
</span><span style='display:block; white-space:pre;color:#404040;'> the root name as directory name for extraction. This is fully compatible
</span><span style='display:block; white-space:pre;color:#404040;'> with existing snapshot tarballs as the tarball root name and top-level
</span><span style='display:block; white-space:pre;color:#404040;'> directory name matched anyway.
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> This change allows to to sync the ports tree directly from GitHub as
</span><span style='display:block; white-space:pre;color:#404040;'> a tarball updated after every commit by using this line in sources.conf:
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> https://github.com/macports/macports-ports/archive/master/ports.tar.gz [default]
</span>---
src/macports1.0/macports.tcl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/macports.tcl b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 650bb02..85bcd01 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/macports.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2793,8 +2793,13 @@ proc mportsync {{optionslist {}}} {
</span> }
}
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Ignore the top-level directory, which allows to use tarballs
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # generated by GitHub, as they use "repository-branch/"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # as top-level directory name.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set striparg "--strip-components=1"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> set tar [macports::findBinary tar $macports::autoconf::tar_path]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[catch {system -W "${destdir}/.." "$tar $verboseflag $extflag -xf $filename"} error]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[catch {system -W "${destdir}" "$tar $verboseflag $striparg $extflag -xf $tarpath"} error]} {
</span> ui_error "Extracting $source failed ($error)"
incr numfailed
continue
</pre><pre style='margin:0'>
</pre>