Skip to content

Commit 8d9cef4

Browse files
Directly import rust-installer submodule
This moves the rust-installer code to be directly hosted in rust-lang/rust, since it's not used elsewhere and this makes it easier to make and review changes without needing a separate upstream commit.
1 parent e733ff7 commit 8d9cef4

39 files changed

+4370
-4
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "src/rust-installer"]
2-
path = src/tools/rust-installer
3-
url = https://github.com/rust-lang/rust-installer.git
41
[submodule "src/doc/nomicon"]
52
path = src/doc/nomicon
63
url = https://github.com/rust-lang/nomicon.git

src/tools/rust-installer

-1
This file was deleted.

src/tools/rust-installer/.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*~
2+
tmp
3+
target/
4+
**/*.rs.bk
5+
Cargo.lock

src/tools/rust-installer/Cargo.toml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[package]
2+
authors = ["The Rust Project Developers"]
3+
name = "installer"
4+
version = "0.0.0"
5+
edition = "2018"
6+
7+
[[bin]]
8+
doc = false
9+
name = "rust-installer"
10+
path = "src/main.rs"
11+
12+
[dependencies]
13+
anyhow = "1.0.19"
14+
flate2 = "1.0.1"
15+
rayon = "1.0"
16+
tar = "0.4.13"
17+
walkdir = "2"
18+
xz2 = "0.1.4"
19+
num_cpus = "1"
20+
remove_dir_all = "0.5"
21+
22+
[dependencies.clap]
23+
features = ["derive"]
24+
version = "3.1"
25+
26+
[target."cfg(windows)".dependencies]
27+
lazy_static = "1"
28+
winapi = { version = "0.3", features = ["errhandlingapi", "handleapi", "ioapiset", "winerror", "winioctl", "winnt"] }

src/tools/rust-installer/README.md

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
[![Build Status](https://travis-ci.org/rust-lang/rust-installer.svg?branch=master)](https://travis-ci.org/rust-lang/rust-installer)
2+
3+
A generator for the install.sh script commonly used to install Rust in
4+
Unix environments. It is used By Rust, Cargo, and is intended to be
5+
used by a future combined installer of Rust + Cargo.
6+
7+
# Usage
8+
9+
```
10+
./gen-installer.sh --product-name=Rust \
11+
--rel-manifest-dir=rustlib \
12+
--success-message=Rust-is-ready-to-roll. \
13+
--image-dir=./install-image \
14+
--work-dir=./temp \
15+
--output-dir=./dist \
16+
--non-installed-overlay=./overlay \
17+
--package-name=rustc-nightly-i686-apple-darwin \
18+
--component-name=rustc \
19+
--legacy-manifest-dirs=rustlib \
20+
--bulk-dirs=share/doc
21+
```
22+
23+
Or, to just generate the script.
24+
25+
```
26+
./gen-install-script.sh --product-name=Rust \
27+
--rel-manifest-dir=rustlib \
28+
--success-message=Rust-is-ready-to-roll. \
29+
--output-script=install.sh \
30+
--legacy-manifest-dirs=rustlib
31+
```
32+
33+
*Note: the dashes in `success-message` are converted to spaces. The
34+
script's argument handling is broken with spaces.*
35+
36+
To combine installers.
37+
38+
```
39+
./combine-installers.sh --product-name=Rust \
40+
--rel-manifest-dir=rustlib \
41+
--success-message=Rust-is-ready-to-roll. \
42+
--work-dir=./temp \
43+
--output-dir=./dist \
44+
--non-installed-overlay=./overlay \
45+
--package-name=rustc-nightly-i686-apple-darwin \
46+
--legacy-manifest-dirs=rustlib \
47+
--input-tarballs=./rustc.tar.gz,cargo.tar.gz
48+
```
49+
50+
# Future work
51+
52+
* Make install.sh not have to be customized, pull it's data from a
53+
config file.
54+
* Be more resiliant to installation failures, particularly if the disk
55+
is full.
56+
* Pre-install and post-uninstall scripts.
57+
* Allow components to depend on or contradict other components.
58+
* Sanity check that expected destination dirs (bin, lib, share exist)?
59+
* Add --docdir flag. Is there a standard name for this?
60+
* Remove empty directories on uninstall.
61+
* Detect mismatches in --prefix, --mandir, etc. in follow-on
62+
installs/uninstalls.
63+
* Fix argument handling for spaces.
64+
* Add --bindir.
65+
66+
# License
67+
68+
This software is distributed under the terms of both the MIT license
69+
and/or the Apache License (Version 2.0), at your option.
70+
71+
See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT) for details.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ue
13+
14+
# Prints the absolute path of a directory to stdout
15+
abs_path() {
16+
local path="$1"
17+
# Unset CDPATH because it causes havok: it makes the destination unpredictable
18+
# and triggers 'cd' to print the path to stdout. Route `cd`'s output to /dev/null
19+
# for good measure.
20+
(unset CDPATH && cd "$path" > /dev/null && pwd)
21+
}
22+
23+
src_dir="$(abs_path $(dirname "$0"))"
24+
cargo run --manifest-path="$src_dir/Cargo.toml" -- combine "$@"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ue
13+
14+
# Prints the absolute path of a directory to stdout
15+
abs_path() {
16+
local path="$1"
17+
# Unset CDPATH because it causes havok: it makes the destination unpredictable
18+
# and triggers 'cd' to print the path to stdout. Route `cd`'s output to /dev/null
19+
# for good measure.
20+
(unset CDPATH && cd "$path" > /dev/null && pwd)
21+
}
22+
23+
src_dir="$(abs_path $(dirname "$0"))"
24+
cargo run --manifest-path="$src_dir/Cargo.toml" -- script "$@"
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ue
13+
14+
# Prints the absolute path of a directory to stdout
15+
abs_path() {
16+
local path="$1"
17+
# Unset CDPATH because it causes havok: it makes the destination unpredictable
18+
# and triggers 'cd' to print the path to stdout. Route `cd`'s output to /dev/null
19+
# for good measure.
20+
(unset CDPATH && cd "$path" > /dev/null && pwd)
21+
}
22+
23+
src_dir="$(abs_path $(dirname "$0"))"
24+
cargo run --manifest-path="$src_dir/Cargo.toml" -- generate "$@"

0 commit comments

Comments
 (0)