Skip to content

Commit 5f8b236

Browse files
authored
Merge branch 'master' into rustup-from-non-existing-path
2 parents 3c7726c + 09fb0f5 commit 5f8b236

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+5769
-3511
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
/target
33
/Cargo.lock
44
/.settings
5+
/.idea/
56
*~
67
/**/target

.travis.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,3 @@ deploy:
156156
secure: "fcKM0bWHz1UJVnZdQl/kCrFCykDkdwOAy1o5LAsUEkgNwSiWF4qC2sqHUbz2hCIe2tD5D8UCqa7brgSz0HNTL1yvSeOO/0Vim8xP9ev9SMf0Muekq0Wj/Kw4kJ3C4ajHdOdF2zXGnw9tsitzylLqx/r8cu0S8UtI49sIAWF3+/dD/uGnXu+wtaYiUJ1znirDzq74rHLrk8M/kQDFTrDJ8D+wXbKSJP9nmKkFShkW8A71QmaCOUqG3q7SpylY81rKRjHjtXCWJ3CHkD7XpdxdsImnukDtt8OndJH+9691TPKcR/RUC/dnUYg5QignmV83AN84c2/6ZykarQ9M/ziBYRI92bj0vPhoHu/vk2HY1VgWlX9qbXfVzd8glfmtS6be7eNYPtEHxoSu9o6WSbVaFv/07IapY/f7vE0kflvW58hRjdy8k4Sv31qPFO0hs7NFJMCRCam/uPpWKTEhfIjAJH6PoXOvND92ZHi9rjnwfVtXEClYtl5vPkRgPTkKJXzF+jVl9sDX1WhZhfgqRNNWEVyfoiptNxHygavDGCPsjpKVMmvntM8dsMZmewSeKemratN2seTP5q4d/IVbgONXiH/SDFhzXkIy4W/MdbxEjXBaVW0DT7x5k/CZhx1ZBIquWhE52nZWpBsJdpCiWl9AORDYVQnCjNp8hWXX7TlIBe4="
157157
on:
158158
branch: stable
159-
160-
# FIXME: I don't know if this really works
161-
after_deploy:
162-
- sudo pip install awscli
163-
- aws configure set preview.cloudfront true
164-
- aws cloudfront create-invalidation --paths "rustup/$TARGET/* rustup/dev/$TARGET/* rustup/www/* rustup/dev/www/* rustup/* rustup/dev/*"

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,12 @@ If you need a more complex setup, rustup supports the convention used by
500500
the __curl__ program, documented in the ENVIRONMENT section of
501501
[its manual page][curlman].
502502

503+
Note that some versions of `libcurl` apparently require you to drop the
504+
`http://` or `https://` prefix in environment variables. For example,
505+
`export http_proxy=proxy.example.com:1080` (and likewise for HTTPS).
506+
If you are getting an SSL `unknown protocol` error from `rustup` via `libcurl`
507+
but the command-line `curl` command works fine, this may be the problem.
508+
503509
[curlman]: https://curl.haxx.se/docs/manpage.html
504510

505511

build.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ use std::process::Command;
88
struct Ignore;
99

1010
impl<E> From<E> for Ignore
11-
where E: Error
11+
where
12+
E: Error,
1213
{
1314
fn from(_: E) -> Ignore {
1415
Ignore
@@ -35,18 +36,21 @@ fn commit_info() -> String {
3536
}
3637

3738
fn commit_hash() -> Result<String, Ignore> {
38-
Ok(try!(String::from_utf8(try!(Command::new("git")
39-
.args(&["rev-parse", "--short=9", "HEAD"])
40-
.output())
41-
.stdout)))
39+
Ok(try!(String::from_utf8(
40+
try!(
41+
Command::new("git")
42+
.args(&["rev-parse", "--short=9", "HEAD"])
43+
.output()
44+
).stdout
45+
)))
4246
}
4347

4448
fn commit_date() -> Result<String, Ignore> {
45-
Ok(try!(String::from_utf8(try!(Command::new("git")
46-
.args(&["log",
47-
"-1",
48-
"--date=short",
49-
"--pretty=format:%cd"])
50-
.output())
51-
.stdout)))
49+
Ok(try!(String::from_utf8(
50+
try!(
51+
Command::new("git")
52+
.args(&["log", "-1", "--date=short", "--pretty=format:%cd"])
53+
.output()
54+
).stdout
55+
)))
5256
}

ci/sync-dist.py

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,15 @@ def usage():
8989
if os.path.exists("local-rustup/dist"):
9090
shutil.rmtree("local-rustup/dist")
9191
os.makedirs("local-rustup/dist")
92-
s3cmd = "s3cmd sync s3://{}/rustup/dist/ ./local-rustup/dist/".format(s3_bucket)
92+
s3cmd = "aws s3 cp --recursive s3://{}/rustup/dist/ ./local-rustup/dist/".format(s3_bucket)
9393
elif command == "local-to-dev-archives" \
9494
or command == "local-to-prod-archives":
95-
s3cmd = "s3cmd sync ./local-rustup/dist/ s3://{}/rustup/archive/{}/".format(s3_bucket, archive_version)
95+
s3cmd = "aws s3 cp --recursive ./local-rustup/dist/ s3://{}/rustup/archive/{}/".format(s3_bucket, archive_version)
9696
elif command == "local-to-prod":
97-
s3cmd = "s3cmd sync ./local-rustup/dist/ s3://{}/rustup/dist/".format(s3_bucket)
97+
s3cmd = "aws s3 cp --recursive local-rustup/dist/ s3://{}/rustup/dist/".format(s3_bucket)
9898
elif command == "update-dev-release" \
9999
or command == "update-prod-release":
100-
s3cmd = "s3cmd put ./local-rustup/release-stable.toml s3://{}/rustup/release-stable.toml".format(s3_bucket)
100+
s3cmd = "aws s3 cp ./local-rustup/release-stable.toml s3://{}/rustup/release-stable.toml".format(s3_bucket)
101101
else:
102102
sys.exit(1)
103103

@@ -115,11 +115,13 @@ def run_s3cmd(command):
115115
s3cmd = command.split(" ")
116116

117117
if not live_run:
118-
s3cmd += ["--dry-run"]
118+
s3cmd += ["--dryrun"]
119119

120120
# These are old installer names for compatibility. They don't need to
121121
# be touched ever again.
122-
s3cmd += ["--exclude=*rustup-setup*"]
122+
if "cloudfront" not in command:
123+
s3cmd += ["--exclude=*rustup-setup*"]
124+
print('executing: ', s3cmd);
123125

124126
subprocess.check_call(s3cmd)
125127

@@ -130,16 +132,30 @@ def run_s3cmd(command):
130132
if command == "dev-to-local":
131133
if os.path.exists("local-rustup/rustup-init.sh"):
132134
os.remove("local-rustup/rustup-init.sh")
133-
run_s3cmd("s3cmd get s3://{}/rustup/rustup-init.sh ./local-rustup/rustup-init.sh"
135+
run_s3cmd("aws s3 cp s3://{}/rustup/rustup-init.sh ./local-rustup/rustup-init.sh"
134136
.format(s3_bucket))
135137
if os.path.exists("local-rustup/www"):
136138
shutil.rmtree("local-rustup/www")
137139
os.makedirs("local-rustup/www")
138-
run_s3cmd("s3cmd sync s3://{}/rustup/www/ ./local-rustup/www/"
140+
run_s3cmd("aws s3 cp --recursive s3://{}/rustup/www/ ./local-rustup/www/"
139141
.format(s3_bucket))
140142

141143
if command == "local-to-prod":
142-
run_s3cmd("s3cmd put ./local-rustup/rustup-init.sh s3://{}/rustup/rustup-init.sh"
144+
run_s3cmd("aws s3 cp ./local-rustup/rustup-init.sh s3://{}/rustup/rustup-init.sh"
143145
.format(s3_bucket))
144-
run_s3cmd("s3cmd sync ./local-rustup/www/ s3://{}/rustup/www/"
146+
run_s3cmd("aws s3 cp --recursive ./local-rustup/www/ s3://{}/rustup/www/"
145147
.format(s3_bucket))
148+
if live_run:
149+
# Invalidate sh.rustup.rs
150+
run_s3cmd("aws cloudfront create-invalidation --distribution-id " +
151+
"E70E9RGZ6Q27W --paths /*".format(s3_bucket))
152+
# Invalidate win.rustup.rs
153+
run_s3cmd("aws cloudfront create-invalidation --distribution-id " +
154+
"E2XBMULPACBLNE --paths /*".format(s3_bucket))
155+
# Invalidate rustup.rs
156+
run_s3cmd("aws cloudfront create-invalidation --distribution-id " +
157+
"EVJCMYBQ0EX26 --paths /*".format(s3_bucket))
158+
159+
if command == "update-dev-release" and live_run:
160+
run_s3cmd("aws cloudfront create-invalidation --distribution-id " +
161+
"E30AO2GXMDY230 --paths /rustup/*".format(s3_bucket))

rustup-init.sh

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT
33
# file at the top-level directory of this distribution and at
44
# http://rust-lang.org/COPYRIGHT.
@@ -9,8 +9,8 @@
99
# option. This file may not be copied, modified, or distributed
1010
# except according to those terms.
1111

12-
# This is just a little script that can be curled from the internet to
13-
# install rustup. It just does platform detection, curls the installer
12+
# This is just a little script that can be downloaded from the internet to
13+
# install rustup. It just does platform detection, downloads the installer
1414
# and runs it.
1515

1616
set -u
@@ -41,8 +41,8 @@ EOF
4141
}
4242

4343
main() {
44+
downloader --check
4445
need_cmd uname
45-
need_cmd curl
4646
need_cmd mktemp
4747
need_cmd chmod
4848
need_cmd mkdir
@@ -100,7 +100,7 @@ main() {
100100
fi
101101

102102
ensure mkdir -p "$_dir"
103-
ensure curl -sSfL "$_url" -o "$_file"
103+
ensure downloader "$_url" "$_file"
104104
ensure chmod u+x "$_file"
105105
if [ ! -x "$_file" ]; then
106106
printf '%s\n' "Cannot execute $_file (likely because of mounting /tmp as noexec)." 1>&2
@@ -331,11 +331,16 @@ err() {
331331
}
332332

333333
need_cmd() {
334-
if ! command -v "$1" > /dev/null 2>&1
334+
if ! check_cmd "$1"
335335
then err "need '$1' (command not found)"
336336
fi
337337
}
338338

339+
check_cmd() {
340+
command -v "$1" > /dev/null 2>&1
341+
return $?
342+
}
343+
339344
need_ok() {
340345
if [ $? != 0 ]; then err "$1"; fi
341346
}
@@ -359,4 +364,24 @@ ignore() {
359364
"$@"
360365
}
361366

367+
# This wraps curl or wget. Try curl first, if not installed,
368+
# use wget instead.
369+
downloader() {
370+
if check_cmd curl
371+
then _dld=curl
372+
elif check_cmd wget
373+
then _dld=wget
374+
else _dld='curl or wget' # to be used in error message of need_cmd
375+
fi
376+
377+
if [ "$1" = --check ]
378+
then need_cmd "$_dld"
379+
elif [ "$_dld" = curl ]
380+
then curl -sSfL "$1" -o "$2"
381+
elif [ "$_dld" = wget ]
382+
then wget "$1" -O "$2"
383+
else err "Unknown downloader" # should not reach here
384+
fi
385+
}
386+
362387
main "$@" || exit 1

src/download/src/errors.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
error_chain! {
42
links { }
53

0 commit comments

Comments
 (0)