[120144] trunk/dports/_resources/port1.0/group/github-1.0.tcl

ryandesign at macports.org ryandesign at macports.org
Fri May 16 16:49:58 PDT 2014


Revision: 120144
          https://trac.macports.org/changeset/120144
Author:   ryandesign at macports.org
Date:     2014-05-16 16:49:58 -0700 (Fri, 16 May 2014)
Log Message:
-----------
github-1.0.tcl: support "github.tarball_from releases" (#42273); improve documentation

Modified Paths:
--------------
    trunk/dports/_resources/port1.0/group/github-1.0.tcl

Modified: trunk/dports/_resources/port1.0/group/github-1.0.tcl
===================================================================
--- 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)
@@ -30,12 +30,83 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 #
-# This PortGroup sets up default behaviors for projects hosted at github.
+# This PortGroup accommodates projects hosted at github.
 #
 # Usage:
 #
-#   PortGroup               github 1.0
+# After the PortSystem 1.0 line, put:
+#
+#   PortGroup           github 1.0
+#
+# Then, replace the name and version lines with:
+#
 #   github.setup            author project version [tag_prefix]
+#
+# 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 "v1.2.3" then
+# tag_prefix should be specified as "v":
+#
+#   github.setup        someone someproject 1.2.3 v
+#
+# Some projects use github's "releases" service to offer distfiles:
+# 
+# https://github.com/blog/1547-release-your-software
+#
+# If the project offers a "release", 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 "release" distfiles, so you may need
+# to set distname as you would for other ports.
+#
+# Older projects use the discontinued "downloads" service. New "downloads" can
+# no longer be created, but old ones are still available:
+#
+# https://github.com/blog/1302-goodbye-uploads
+#
+# If the project doesn't have "releases" but does have "downloads", use them
+# this way (and set distname if needed):
+#
+#   github.tarball_from downloads
+#
+# If neither "releases" nor "downloads" 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 "releases" or "downloads" 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} "git submodule update --init"
+#   }
 
 options github.author github.project github.version github.tag_prefix github.livecheck_type
 options github.homepage github.raw github.master_sites github.tarball_from
@@ -46,18 +117,27 @@
 
 default master_sites {${github.master_sites}}
 
-# The ability to host downloads on github is going away
-# https://github.com/blog/1302-goodbye-uploads
 default github.tarball_from {tags}
 option_proc github.tarball_from handle_tarball_from
 proc handle_tarball_from {option action args} {
-    global github.author github.project github.master_sites
+    global github.author github.project github.master_sites git.branch github.homepage
 
-    # keeping the default at tags like many portfiles already do
-    # the port writer can set github.tarball_from to "downloads" and have the URI path accordingly changed
-    if {${action} eq "set" && $args eq "downloads"} {
+    if {${action} eq "set"} {
         github.tarball_from ${args}
-        github.master_sites https://github.com/downloads/${github.author}/${github.project}
+        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 "invalid value \"${args}\" for github.tarball_from"
+            }
+        }
     }
 }
 
@@ -77,8 +157,12 @@
     distname                ${github.project}-${github.version}
     fetch.ignore_sslcert    yes
 
-    # if worksrcpath does not exist, try to guess the directory that should be and rename it
     post-extract {
+        # 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).
         if {![file exists ${worksrcpath}] && \
                 ${fetch.type} eq "standard" && \
                 ${master_sites} eq ${github.master_sites} && \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140516/85bc4d94/attachment-0001.html>


More information about the macports-changes mailing list