[123559] trunk/dports/lang/rust/Portfile

larryv at macports.org larryv at macports.org
Sun Aug 10 16:44:11 PDT 2014


Revision: 123559
          https://trac.macports.org/changeset/123559
Author:   larryv at macports.org
Date:     2014-08-10 16:44:11 -0700 (Sun, 10 Aug 2014)
Log Message:
-----------
rust: Use a Git checkout to fetch source.

Rust is a fast-moving project that currently expects its users to be on
the bleeding edge, so we should start providing frequent development
snapshots instead of releases, which go out of date very quickly.

We'll continue treating the snapshot compiler as a distfile so that it's
checksummed and mirrored as usual.

Modified Paths:
--------------
    trunk/dports/lang/rust/Portfile

Modified: trunk/dports/lang/rust/Portfile
===================================================================
--- trunk/dports/lang/rust/Portfile	2014-08-10 23:44:09 UTC (rev 123558)
+++ trunk/dports/lang/rust/Portfile	2014-08-10 23:44:11 UTC (rev 123559)
@@ -4,9 +4,9 @@
 PortSystem          1.0
 PortGroup           active_variants 1.1
 PortGroup           compiler_blacklist_versions 1.0
+PortGroup           github 1.0
 
-name                rust
-version             0.11.0
+github.setup        rust-lang rust 0.11.0
 categories          lang devel
 platforms           darwin
 supported_archs     i386 x86_64
@@ -33,13 +33,38 @@
     }
 }
 
-master_sites        http://static.rust-lang.org/dist:dist
-distfiles           ${distname}${extract.suffix}:dist
-checksums           ${distname}${extract.suffix} \
-                        rmd160  09f2fd0f5da3a7851b1984602d2acd0304764618 \
-                        sha256  d1b3e36448bf12b8c9289024df416de10774b6d3235d7b1d22b248ef634411ba
+worksrcdir              ${github.project}
 
-# Select the snapshot compiler; see src/snapshots.txt in distribution.
+# To take advantage of distfile mirroring and checksumming for the
+# snapshot compiler, we let base treat it as the distfile and deal with
+# the actual Rust source "manually".
+
+depends_fetch-append    bin:git:git
+pre-fetch {
+    # Clone repository.
+    set cmdstring "${git.cmd} clone -q ${git.url} \"${worksrcpath}\" 2>&1"
+    ui_debug "Executing ${cmdstring}"
+    if {[catch {system ${cmdstring}} -]} {
+        return -code error [msgcat::mc "Git clone failed"]
+    }
+    set dirs "--git-dir=\"${worksrcpath}/.git\" --work-tree=\"${worksrcpath}\""
+    # Check out branch.
+    set cmdstring "${git.cmd} ${dirs} checkout -q ${git.branch} 2>&1"
+    ui_debug "Executing $cmdstring"
+    if {[catch {system -W ${worksrcpath} ${cmdstring}} -]} {
+        return -code error [msgcat::mc "Git checkout failed"]
+    }
+    # Update submodules.
+    set cmdstring "${git.cmd} ${dirs} submodule update --init 2>&1"
+    ui_debug "Executing $cmdstring"
+    if {[catch {system -W ${worksrcpath} ${cmdstring}} -]} {
+        return -code error [msgcat::mc "Git submodule update failed"]
+    }
+}
+
+# Download the snapshot compiler; see src/snapshots.txt in the Rust
+# distribution.
+master_sites            http://static.rust-lang.org/stage0-snapshots
 set stage0(distdir)     rust-stage0
 set stage0(date)        2014-06-21
 set stage0(rev)         db9af1d
@@ -47,35 +72,18 @@
 set stage0(hash)        [expr {${configure.build_arch} eq "i386" ?
                                 "3f25b2680efbab16ad074477a19d49dcce475977" :
                                 "4a8c2e1b7634d73406bac32a1a97893ec3ed818d"}]
-set stage0(distfile)    [join "rust stage0 ${stage0(date)}
+use_bzip2               yes
+distname                [join "rust stage0 ${stage0(date)}
                                            ${stage0(rev)}
                                            ${stage0(platform)}
-                                           ${stage0(hash)}" -].tar.bz2
-
-master_sites-append     http://static.rust-lang.org/stage0-snapshots:stage0
-distfiles-append        ${stage0(distfile)}:stage0
+                                           ${stage0(hash)}" -]
 switch ${configure.build_arch} {
-    i386 {
-        set stage0(rmd160)  7c344247d62a417d703de720ac01881bcbf4fc25
-        set stage0(sha256)  42cef980dee52ad2cbd07795df07d3a3e96d013e08ea5a83cd54c266eecab698
-    }
-    default {
-        set stage0(rmd160)  6c7da644b90a567c615d83ff4af99b411a81a419
-        set stage0(sha256)  2c63e45ae276812f4429389584cf1eb0a9c0ef182f6f9e15a2731d3e30c03ea8
-    }
+    i386    {checksums  rmd160  7c344247d62a417d703de720ac01881bcbf4fc25 \
+                        sha256  42cef980dee52ad2cbd07795df07d3a3e96d013e08ea5a83cd54c266eecab698}
+    default {checksums  rmd160  6c7da644b90a567c615d83ff4af99b411a81a419 \
+                        sha256  2c63e45ae276812f4429389584cf1eb0a9c0ef182f6f9e15a2731d3e30c03ea8}
 }
-checksums-append        ${stage0(distfile)} \
-                            rmd160  ${stage0(rmd160)} \
-                            sha256  ${stage0(sha256)}
 
-depends_extract             bin:bzip2:bzip2
-extract.only-delete         ${stage0(distfile)}
-post-extract {
-    set expand "bzip2 -dc ${distpath}/${stage0(distfile)}"
-    set untar "${portutil::autoconf::tar_command} -xf -"
-    system -W ${workpath} "${expand} | ${untar}"
-}
-
 # Only use compilers supported by upstream
 # (https://github.com/rust-lang/rust#building-from-source).
 compiler.blacklist  {clang < 211} \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140810/110d2bbf/attachment.html>


More information about the macports-changes mailing list