<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[120144] trunk/dports/_resources/port1.0/group/github-1.0.tcl</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/120144">120144</a></dd>
<dt>Author</dt> <dd>ryandesign@macports.org</dd>
<dt>Date</dt> <dd>2014-05-16 16:49:58 -0700 (Fri, 16 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>github-1.0.tcl: support &quot;github.tarball_from releases&quot; (#42273); improve documentation</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkdports_resourcesport10groupgithub10tcl">trunk/dports/_resources/port1.0/group/github-1.0.tcl</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdports_resourcesport10groupgithub10tcl"></a>
<div class="modfile"><h4>Modified: trunk/dports/_resources/port1.0/group/github-1.0.tcl (120143 => 120144)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/_resources/port1.0/group/github-1.0.tcl        2014-05-16 23:48:41 UTC (rev 120143)
+++ trunk/dports/_resources/port1.0/group/github-1.0.tcl        2014-05-16 23:49:58 UTC (rev 120144)
</span><span class="lines">@@ -30,12 +30,83 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> #
</span><span class="cx"> #
</span><del>-# This PortGroup sets up default behaviors for projects hosted at github.
</del><ins>+# This PortGroup accommodates projects hosted at github.
</ins><span class="cx"> #
</span><span class="cx"> # Usage:
</span><span class="cx"> #
</span><del>-#   PortGroup               github 1.0
</del><ins>+# After the PortSystem 1.0 line, put:
+#
+#   PortGroup           github 1.0
+#
+# Then, replace the name and version lines with:
+#
</ins><span class="cx"> #   github.setup            author project version [tag_prefix]
</span><ins>+#
+# The port's name will be set to the github project name. If that's not correct,
+# override it by setting the port name as usual, for example:
+#
+#   github.setup        someone someproject 1.2.3
+#   name                myportname
+#
+# The tag_prefix is optional, and refers to any characters that may appear
+# before the actual version number when you view the list of tags for this
+# project on github. For example, if the tags are named like &quot;v1.2.3&quot; then
+# tag_prefix should be specified as &quot;v&quot;:
+#
+#   github.setup        someone someproject 1.2.3 v
+#
+# Some projects use github's &quot;releases&quot; service to offer distfiles:
+# 
+# https://github.com/blog/1547-release-your-software
+#
+# If the project offers a &quot;release&quot;, that's probably the best distfile to use
+# for the port. To do this, use:
+#
+#   github.tarball_from releases
+#
+# Github imposes no naming convention for &quot;release&quot; distfiles, so you may need
+# to set distname as you would for other ports.
+#
+# Older projects use the discontinued &quot;downloads&quot; service. New &quot;downloads&quot; can
+# no longer be created, but old ones are still available:
+#
+# https://github.com/blog/1302-goodbye-uploads
+#
+# If the project doesn't have &quot;releases&quot; but does have &quot;downloads&quot;, use them
+# this way (and set distname if needed):
+#
+#   github.tarball_from downloads
+#
+# If neither &quot;releases&quot; nor &quot;downloads&quot; are available, github can automatically
+# generate a distfile from a git tag or commit. This is the github portgroup's
+# default behavior; to use this, simply don't set github.tarball_from. The
+# distname is irrelevant when fetching from a tag or commit, so don't set it
+# either.
+#
+# If the project's developers do not tag their releases, encourage them to do
+# so. Until they do, or if you need to use a development version that's not
+# tagged, you can use a git commit hash and set the version field. If the
+# project does not assign version numbers (or for development versions) you can
+# invent one, typically in the YYYYMMDD format corresponding to the date of the
+# commit you picked. For example, if you want to use a commit with the hash
+# 0ff25277c3842598d919cd3c73d60768 that was committed on April 1, 2014, then
+# you would use:
+#
+#   github.setup        someone someproject 0ff25277c3842598d919cd3c73d60768
+#   version             20140401
+#
+# Some projects' tag- or commit-based distfiles will not contain all the
+# necessary files, if the project uses git submodules. If available, use a
+# distfile from &quot;releases&quot; or &quot;downloads&quot; instead, as described above. If the
+# project does not provide those, encourage the project's developers to provide
+# releases. Until they do, fetch from git instead of from a distfile, and add a
+# post-fetch block to fetch the submodules:
+#
+#   fetch.type          git
+#
+#   post-fetch {
+#       system -W ${worksrcpath} &quot;git submodule update --init&quot;
+#   }
</ins><span class="cx"> 
</span><span class="cx"> options github.author github.project github.version github.tag_prefix github.livecheck_type
</span><span class="cx"> options github.homepage github.raw github.master_sites github.tarball_from
</span><span class="lines">@@ -46,18 +117,27 @@
</span><span class="cx"> 
</span><span class="cx"> default master_sites {${github.master_sites}}
</span><span class="cx"> 
</span><del>-# The ability to host downloads on github is going away
-# https://github.com/blog/1302-goodbye-uploads
</del><span class="cx"> default github.tarball_from {tags}
</span><span class="cx"> option_proc github.tarball_from handle_tarball_from
</span><span class="cx"> proc handle_tarball_from {option action args} {
</span><del>-    global github.author github.project github.master_sites
</del><ins>+    global github.author github.project github.master_sites git.branch github.homepage
</ins><span class="cx"> 
</span><del>-    # keeping the default at tags like many portfiles already do
-    # the port writer can set github.tarball_from to &quot;downloads&quot; and have the URI path accordingly changed
-    if {${action} eq &quot;set&quot; &amp;&amp; $args eq &quot;downloads&quot;} {
</del><ins>+    if {${action} eq &quot;set&quot;} {
</ins><span class="cx">         github.tarball_from ${args}
</span><del>-        github.master_sites https://github.com/downloads/${github.author}/${github.project}
</del><ins>+        switch ${args} {
+            downloads {
+                github.master_sites https://github.com/downloads/${github.author}/${github.project}
+            }
+            releases {
+                github.master_sites ${github.homepage}/releases/download/${git.branch}
+            }
+            tags {
+                github.master_sites ${github.homepage}/tarball/${git.branch}
+            }
+            default {
+                return -code error &quot;invalid value \&quot;${args}\&quot; for github.tarball_from&quot;
+            }
+        }
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -77,8 +157,12 @@
</span><span class="cx">     distname                ${github.project}-${github.version}
</span><span class="cx">     fetch.ignore_sslcert    yes
</span><span class="cx"> 
</span><del>-    # if worksrcpath does not exist, try to guess the directory that should be and rename it
</del><span class="cx">     post-extract {
</span><ins>+        # When fetching from a tag, the extracted directory name will contain a
+        # truncated commit hash. So that the port author need not specify what
+        # that hash is every time the version number changes, rename the
+        # directory to the value of distname (not worksrcdir: ports may want to
+        # set worksrcdir to a subdirectory of the extracted directory).
</ins><span class="cx">         if {![file exists ${worksrcpath}] &amp;&amp; \
</span><span class="cx">                 ${fetch.type} eq &quot;standard&quot; &amp;&amp; \
</span><span class="cx">                 ${master_sites} eq ${github.master_sites} &amp;&amp; \
</span></span></pre>
</div>
</div>

</body>
</html>