source: trunk/dports/_resources/port1.0/group/github-1.0.tcl @ 100626

Last change on this file since 100626 was 100626, checked in by ryandesign@…, 7 years ago

github-1.0.tcl: add note about deprecated downloads feature

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: github-1.0.tcl 100626 2012-12-18 00:50:58Z ryandesign@macports.org $
3#
4# Copyright (c) 2012 The MacPorts Project
5# All rights reserved.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions are
9# met:
10#
11# 1. Redistributions of source code must retain the above copyright
12#    notice, this list of conditions and the following disclaimer.
13# 2. Redistributions in binary form must reproduce the above copyright
14#    notice, this list of conditions and the following disclaimer in the
15#    documentation and/or other materials provided with the distribution.
16# 3. Neither the name of The MacPorts Project nor the names of its
17#    contributors may be used to endorse or promote products derived from
18#    this software without specific prior written permission.
19#
20# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31#
32#
33# This PortGroup sets up default behaviors for projects hosted at github.
34#
35# Usage:
36#
37#   PortGroup               github 1.0
38#   github.setup            author project version [tag_prefix]
39
40options github.author github.project github.version github.tag_prefix
41options github.homepage github.raw github.master_sites github.tarball_from
42
43default github.homepage {https://github.com/${github.author}/${github.project}}
44default github.raw {https://raw.github.com/${github.author}/${github.project}}
45default github.master_sites {${github.homepage}/tarball/[join ${github.tag_prefix} ""]${github.version}}
46
47default master_sites {${github.master_sites}}
48
49# The ability to host downloads on github is going away
50# https://github.com/blog/1302-goodbye-uploads
51default github.tarball_from {tags}
52option_proc github.tarball_from handle_tarball_from
53proc handle_tarball_from {option action args} {
54    global github.author github.project github.master_sites
55
56    # keeping the default at tags like many portfiles already do
57    # the port writer can set github.tarball_from to "downloads" and have the URI path accordingly changed
58    if {[string equal ${action} "set"] && $args == "downloads"} {
59        github.tarball_from ${args}
60        github.master_sites https://github.com/downloads/${github.author}/${github.project}
61    }
62}
63
64proc github.setup {gh_author gh_project gh_version {gh_tag_prefix ""}} {
65    global extract.suffix github.author github.project github.version github.tag_prefix github.homepage github.master_sites
66
67    github.author           ${gh_author}
68    github.project          ${gh_project}
69    github.version          ${gh_version}
70    github.tag_prefix       ${gh_tag_prefix}
71
72    name                    ${github.project}
73    version                 ${github.version}
74    homepage                ${github.homepage}
75    git.url                 ${github.homepage}.git
76    git.branch              [join ${github.tag_prefix}]${github.version}
77    distname                ${github.project}-${github.version}
78    fetch.ignore_sslcert    yes
79
80    post-extract {
81        if {![file exists ${worksrcpath}] && "standard" == ${fetch.type} && \
82            ${master_sites} == ${github.master_sites} && [llength ${distfiles}] > 0} {
83            move [glob ${workpath}/*] ${worksrcpath}
84        }
85    }
86
87    livecheck.type          regex
88    livecheck.version       ${github.version}
89    livecheck.url           ${github.homepage}/tags
90    livecheck.regex         archive/[join ${github.tag_prefix} ""](\[^"\]+)${extract.suffix}"
91}
Note: See TracBrowser for help on using the repository browser.