Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 149087
b: refs/heads/try2
c: 9e133d1
h: refs/heads/master
i:
  149085: 5d716a7
  149083: 5603134
  149079: f748688
  149071: f73e182
  149055: 9e7ff93
v: v3
  • Loading branch information
bors committed Feb 11, 2014
1 parent 2362357 commit 6602083
Show file tree
Hide file tree
Showing 21 changed files with 218 additions and 170 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
refs/heads/try2: 8be1e3454490ffa15efc243674dd388271b0a478
refs/heads/try2: 9e133d113ba45e146d091c699f5235052f798012
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Expand Down
5 changes: 3 additions & 2 deletions branches/try2/mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
################################################################################

TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
uuid serialize sync getopts collections fourcc
HOST_CRATES := syntax rustc rustdoc
uuid serialize sync getopts collections num
HOST_CRATES := syntax rustc rustdoc fourcc
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
TOOLS := compiletest rustdoc rustc

Expand All @@ -75,6 +75,7 @@ DEPS_sync := std
DEPS_getopts := std
DEPS_collections := std serialize
DEPS_fourcc := syntax std
DEPS_num := std extra

TOOL_DEPS_compiletest := extra green rustuv getopts
TOOL_DEPS_rustdoc := rustdoc green rustuv
Expand Down
2 changes: 2 additions & 0 deletions branches/try2/src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ li {list-style-type: none; }
* [The Rust compiler, `librustc`](rustc/index.html)

* [The `arena` allocation library](arena/index.html)
* [The `num` arbitrary precision numerics library](num/index.html)
* [The `collections` library](collections/index.html)
* [The `flate` compression library](flate/index.html)
* [The `fourcc` four-character code library](fourcc/index.html)
* [The `getopts` argument parsing library](getopts/index.html)
* [The `glob` file path matching library](glob/index.html)
* [The `semver` version collation library](semver/index.html)
Expand Down
14 changes: 7 additions & 7 deletions branches/try2/src/doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -3026,12 +3026,12 @@ In Rust terminology, we need a way to refer to other crates.
For that, Rust offers you the `extern mod` declaration:

~~~
extern mod extra;
// extra ships with Rust, you'll find more details further down.
extern mod num;
// `num` ships with Rust (much like `extra`; more details further down).
fn main() {
// The rational number '1/2':
let one_half = ::extra::rational::Ratio::new(1, 2);
let one_half = ::num::rational::Ratio::new(1, 2);
}
~~~

Expand All @@ -3056,10 +3056,10 @@ of both `use` and local declarations.
Which can result in something like this:

~~~
extern mod extra;
extern mod num;
use farm::dog;
use extra::rational::Ratio;
use num::rational::Ratio;
mod farm {
pub fn dog() { println!("woof"); }
Expand Down Expand Up @@ -3224,9 +3224,9 @@ See the [API documentation][stddoc] for details.

## The extra library

Rust also ships with the [extra library], an accumulation of useful things,
Rust ships with crates such as the [extra library], an accumulation of useful things,
that are however not important enough to deserve a place in the standard
library. You can use them by linking to `extra` with an `extern mod extra;`.
library. You can link to a library such as `extra` with an `extern mod extra;`.

[extra library]: extra/index.html

Expand Down
228 changes: 115 additions & 113 deletions branches/try2/src/etc/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
import re, os, sys, glob, tarfile, shutil, subprocess, tempfile, distutils.spawn

try:
import hashlib
sha_func = hashlib.sha1
import hashlib
sha_func = hashlib.sha1
except ImportError:
import sha
sha_func = sha.new
import sha
sha_func = sha.new

def scrub(b):
if sys.version_info >= (3,) and type(b) == bytes:
return b.decode('ascii')
else:
return b
if sys.version_info >= (3,) and type(b) == bytes:
return b.decode('ascii')
else:
return b

src_dir = scrub(os.getenv("CFG_SRC_DIR"))
if not src_dir:
raise Exception("missing env var CFG_SRC_DIR")
raise Exception("missing env var CFG_SRC_DIR")

snapshotfile = os.path.join(src_dir, "src", "snapshots.txt")
download_url_base = "http://static.rust-lang.org/stage0-snapshots"
Expand All @@ -39,36 +39,37 @@ def scrub(b):
"freebsd": ["bin/rustc"],
}

winnt_runtime_deps = ["libgcc_s_dw2-1.dll", "libstdc++-6.dll"]
winnt_runtime_deps = ["libgcc_s_dw2-1.dll",
"libstdc++-6.dll"]

def parse_line(n, line):
global snapshotfile
global snapshotfile

if re.match(r"\s*$", line): return None
if re.match(r"\s*$", line): return None

if re.match(r"^T\s*$", line): return None
if re.match(r"^T\s*$", line): return None

match = re.match(r"\s+([\w_-]+) ([a-fA-F\d]{40})\s*$", line)
if match:
return { "type": "file",
"platform": match.group(1),
"hash": match.group(2).lower() }
match = re.match(r"\s+([\w_-]+) ([a-fA-F\d]{40})\s*$", line)
if match:
return { "type": "file",
"platform": match.group(1),
"hash": match.group(2).lower() }

match = re.match(r"([ST]) (\d{4}-\d{2}-\d{2}) ([a-fA-F\d]+)\s*$", line);
if not match:
raise Exception("%s:%d:E syntax error: " % (snapshotfile, n))
return { "type": "snapshot",
"date": match.group(2),
"rev": match.group(3) }
match = re.match(r"([ST]) (\d{4}-\d{2}-\d{2}) ([a-fA-F\d]+)\s*$", line);
if (not match):
raise Exception("%s:%d:E syntax error: " % (snapshotfile, n))
return {"type": "snapshot",
"date": match.group(2),
"rev": match.group(3)}


def partial_snapshot_name(date, rev, platform):
return ("rust-stage0-%s-%s-%s.tar.bz2"
% (date, rev, platform))
return ("rust-stage0-%s-%s-%s.tar.bz2"
% (date, rev, platform))

def full_snapshot_name(date, rev, platform, hsh):
return ("rust-stage0-%s-%s-%s-%s.tar.bz2"
% (date, rev, platform, hsh))
return ("rust-stage0-%s-%s-%s-%s.tar.bz2"
% (date, rev, platform, hsh))


def get_kernel(triple):
Expand All @@ -85,22 +86,23 @@ def get_kernel(triple):
def get_cpu(triple):
arch = triple.split('-')[0]
if arch == "i686":
return "i386"
return "i386"
return arch

def get_platform(triple):
return "%s-%s" % (get_kernel(triple), get_cpu(triple))
return "%s-%s" % (get_kernel(triple), get_cpu(triple))


def cmd_out(cmdline):
p = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
p = subprocess.Popen(cmdline,
stdout=subprocess.PIPE)
return scrub(p.communicate()[0].strip())


def local_rev_info(field):
return cmd_out(["git", "--git-dir=" + os.path.join(src_dir, ".git"),
"log", "-n", "1",
"--format=%%%s" % field, "HEAD"])
"log", "-n", "1",
"--format=%%%s" % field, "HEAD"])


def local_rev_full_sha():
Expand Down Expand Up @@ -133,10 +135,10 @@ def get_url_to_file(u,f):
os.rename(tmpf, f)

def snap_filename_hash_part(snap):
match = re.match(r".*([a-fA-F\d]{40}).tar.bz2$", snap)
if not match:
raise Exception("unable to find hash in filename: " + snap)
return match.group(1)
match = re.match(r".*([a-fA-F\d]{40}).tar.bz2$", snap)
if not match:
raise Exception("unable to find hash in filename: " + snap)
return match.group(1)

def hash_file(x):
h = sha_func()
Expand All @@ -148,13 +150,13 @@ def get_winnt_runtime_deps():
runtime_deps = []
path_dirs = os.environ["PATH"].split(';')
for name in winnt_runtime_deps:
for dir in path_dirs:
matches = glob.glob(os.path.join(dir, name))
if matches:
runtime_deps.append(matches[0])
break
else:
raise Exception("Could not find runtime dependency: %s" % name)
for dir in path_dirs:
matches = glob.glob(os.path.join(dir, name))
if matches:
runtime_deps.append(matches[0])
break
else:
raise Exception("Could not find runtime dependency: %s" % name)
return runtime_deps

def make_snapshot(stage, triple):
Expand All @@ -166,31 +168,31 @@ def make_snapshot(stage, triple):
file0 = partial_snapshot_name(date, rev, platform)

def in_tar_name(fn):
cs = re.split(r"[\\/]", fn)
if len(cs) >= 2:
return os.sep.join(cs[-2:])
cs = re.split(r"[\\/]", fn)
if len(cs) >= 2:
return os.sep.join(cs[-2:])

tar = tarfile.open(file0, "w:bz2")

for name in snapshot_files[kernel]:
dir = stage
if stage == "stage1" and re.match(r"^lib/(lib)?std.*", name):
dir = "stage0"
fn_glob = os.path.join(triple, dir, name)
matches = glob.glob(fn_glob)
if not matches:
raise Exception("Not found file with name like " + fn_glob)
if len(matches) == 1:
tar.add(matches[0], "rust-stage0/" + in_tar_name(matches[0]))
else:
raise Exception("Found stale files: \n %s\n"
"Please make a clean build." % "\n ".join(matches))
dir = stage
if stage == "stage1" and re.match(r"^lib/(lib)?std.*", name):
dir = "stage0"
fn_glob = os.path.join(triple, dir, name)
matches = glob.glob(fn_glob)
if not matches:
raise Exception("Not found file with name like " + fn_glob)
if len(matches) == 1:
tar.add(matches[0], "rust-stage0/" + in_tar_name(matches[0]))
else:
raise Exception("Found stale files: \n %s\n"
"Please make a clean build." % "\n ".join(matches))

if kernel=="winnt":
for path in get_winnt_runtime_deps():
tar.add(path, "rust-stage0/bin/" + os.path.basename(path))
tar.add(os.path.join(os.path.dirname(__file__), "third-party"),
"rust-stage0/bin/third-party")
for path in get_winnt_runtime_deps():
tar.add(path, "rust-stage0/bin/" + os.path.basename(path))
tar.add(os.path.join(os.path.dirname(__file__), "third-party"),
"rust-stage0/bin/third-party")

tar.close()

Expand All @@ -202,59 +204,59 @@ def in_tar_name(fn):
return file1

def curr_snapshot_rev():
i = 0
found_snap = False
date = None
rev = None
i = 0
found_snap = False
date = None
rev = None

f = open(snapshotfile)
for line in f.readlines():
i += 1
parsed = parse_line(i, line)
if (not parsed): continue
f = open(snapshotfile)
for line in f.readlines():
i += 1
parsed = parse_line(i, line)
if (not parsed): continue

if parsed["type"] == "snapshot":
date = parsed["date"]
rev = parsed["rev"]
found_snap = True
break
if parsed["type"] == "snapshot":
date = parsed["date"]
rev = parsed["rev"]
found_snap = True
break

if not found_snap:
raise Exception("no snapshot entries in file")
if not found_snap:
raise Exception("no snapshot entries in file")

return (date, rev)
return (date, rev)

def determine_curr_snapshot(triple):
i = 0
platform = get_platform(triple)

found_file = False
found_snap = False
hsh = None
date = None
rev = None

f = open(snapshotfile)
for line in f.readlines():
i += 1
parsed = parse_line(i, line)
if (not parsed): continue

if found_snap and parsed["type"] == "file":
if parsed["platform"] == platform:
hsh = parsed["hash"]
found_file = True
break;
elif parsed["type"] == "snapshot":
date = parsed["date"]
rev = parsed["rev"]
found_snap = True

if not found_snap:
raise Exception("no snapshot entries in file")

if not found_file:
raise Exception("no snapshot file found for platform %s, rev %s" %
(platform, rev))

return full_snapshot_name(date, rev, platform, hsh)
i = 0
platform = get_platform(triple)

found_file = False
found_snap = False
hsh = None
date = None
rev = None

f = open(snapshotfile)
for line in f.readlines():
i += 1
parsed = parse_line(i, line)
if (not parsed): continue

if found_snap and parsed["type"] == "file":
if parsed["platform"] == platform:
hsh = parsed["hash"]
found_file = True
break;
elif parsed["type"] == "snapshot":
date = parsed["date"]
rev = parsed["rev"]
found_snap = True

if not found_snap:
raise Exception("no snapshot entries in file")

if not found_file:
raise Exception("no snapshot file found for platform %s, rev %s" %
(platform, rev))

return full_snapshot_name(date, rev, platform, hsh)
Loading

0 comments on commit 6602083

Please sign in to comment.