Revision
89670
Author
and.damore@macports.org
Date
2012-02-06 05:25:52 -0800 (Mon, 06 Feb 2012)

Log Message

github portgroup: support both "downloads" and "tags" download, when tag_prefix argument to github.setup is specified then master_sites URI path is set accordingly otherwise a "download" path is used

Modified Paths

Diff

Modified: trunk/dports/_resources/port1.0/group/github-1.0.tcl (89669 => 89670)


--- trunk/dports/_resources/port1.0/group/github-1.0.tcl	2012-02-06 13:20:28 UTC (rev 89669)
+++ trunk/dports/_resources/port1.0/group/github-1.0.tcl	2012-02-06 13:25:52 UTC (rev 89670)
@@ -41,7 +41,6 @@
 
 default github.homepage {https://github.com/${github.author}/${github.project}}
 default github.raw {https://raw.github.com/${github.author}/${github.project}}
-default github.master_sites {${github.homepage}/tarball/[join ${github.tag_prefix} ""]}
 
 proc github.setup {gh_author gh_project gh_version {gh_tag_prefix ""}} {
     global github.author github.project github.version github.tag_prefix github.homepage github.master_sites
@@ -56,6 +55,13 @@
     homepage                ${github.homepage}
     git.url                 ${github.homepage}.git
     git.branch              [join ${github.tag_prefix}]${github.version}
+    # github supports two types of downloads "tags" and "downloads" with different URI scheme
+    # choose either one according to existence of tag_prefix optional argument
+    if {[info exists github.tag_prefix] && ![string equal ${github.tag_prefix} "{}"]} {
+        github.master_sites ${github.homepage}/tarball/[join ${github.tag_prefix} ""]
+    } else {
+        github.master_sites https://github.com/downloads/${github.author}/${github.project}
+    }
     master_sites            ${github.master_sites}
     distname                ${github.project}-${github.version}
     fetch.ignore_sslcert    yes