Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 11 pull requests #117405

Merged
merged 36 commits into from
Oct 30, 2023
Merged
Changes from 2 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
351d532
interpret: call caller_location logic the same way codegen does, and …
RalfJung Oct 28, 2023
04fa124
share the track_caller handling within a mir::Body
RalfJung Oct 28, 2023
552abdc
Rename a few remaining references to abort terminator
tmiasko Oct 29, 2023
82b447a
Add support for mipsel-unknown-netbsd, 32-bit LE mips.
he32 Oct 29, 2023
5e6c313
mipsel_unknown_netbsd.rs: fix indentation.
he32 Oct 29, 2023
28e60de
Remove `memoffset` dependency from `rustc_query_impl`.
nnethercote Oct 23, 2023
8ff624a
Clean up `rustc_*/Cargo.toml`.
nnethercote Oct 20, 2023
8c04999
On object safety error, mention new enum as alternative
estebank Oct 24, 2023
678e01a
Delay parsing of `--cfg` and `--check-cfg` options.
nnethercote Oct 30, 2023
bfcff79
Reduce exposure of cfg parsers.
nnethercote Oct 30, 2023
8e4ac98
Change cfg parsers to produce symbols instead of strings.
nnethercote Oct 30, 2023
5c6a12c
Make `Cfg` and `CheckCfg` non-generic.
nnethercote Oct 30, 2023
371f972
Improve readability of `parse_check_cfg`.
nnethercote Oct 30, 2023
85e56e8
Remove out-of-date comment.
nnethercote Oct 30, 2023
a60d643
Wrap some overlong comments.
nnethercote Oct 30, 2023
95b0088
Remove `check_output`.
nnethercote Oct 30, 2023
4b14048
improve and fix x install
onur-ozkan Oct 30, 2023
be8fd8b
Streamline `collect_crate_types`.
nnethercote Oct 30, 2023
90862f6
Remove an unnecessary `drop`.
nnethercote Oct 30, 2023
0c381ec
Streamline some `use` items.
nnethercote Oct 30, 2023
a2486db
Fix missing leading space in suggestion
gurry Oct 30, 2023
82f34fd
Fix #117284, Fix unused variables lint issue for args in macro
chenyukang Oct 30, 2023
8508e65
Fix bad-c-variadic error being emitted multiple times
nicholasbishop Oct 29, 2023
f91b5ce
Explicitly reject const C-variadic functions
nicholasbishop Oct 29, 2023
58a80c8
rustdoc: elide cross-crate default generic arguments
fmease Jun 9, 2023
b9dce53
Rollup merge of #112463 - fmease:rustdoc-elide-x-crate-def-gen-args, …
GuillaumeGomez Oct 30, 2023
824e367
Rollup merge of #117068 - nnethercote:clean-up-Cargo-toml, r=wesleywiser
GuillaumeGomez Oct 30, 2023
95de91b
Rollup merge of #117132 - estebank:issue-80194, r=petrochenkov
GuillaumeGomez Oct 30, 2023
73100d8
Rollup merge of #117317 - RalfJung:track-caller, r=oli-obk
GuillaumeGomez Oct 30, 2023
99b032f
Rollup merge of #117356 - he32:netbsd-mipsel, r=oli-obk
GuillaumeGomez Oct 30, 2023
5ac999f
Rollup merge of #117357 - tmiasko:terminate, r=wesleywiser
GuillaumeGomez Oct 30, 2023
784f04b
Rollup merge of #117370 - nicholasbishop:bishop-better-c-variadic-err…
GuillaumeGomez Oct 30, 2023
d96bdbe
Rollup merge of #117376 - nnethercote:rustc_interface-more, r=oli-obk
GuillaumeGomez Oct 30, 2023
c994bdb
Rollup merge of #117383 - onur-ozkan:fix-x-install, r=albertlarsan68
GuillaumeGomez Oct 30, 2023
02d32d2
Rollup merge of #117390 - chenyukang:yukang-fix-117284-unused-macro, …
GuillaumeGomez Oct 30, 2023
9e4ab9f
Rollup merge of #117395 - gurry:117380-wrong-parent-sugg, r=Nilstrieb
GuillaumeGomez Oct 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 30 additions & 22 deletions src/bootstrap/src/core/build_steps/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,27 @@ fn install_sh(

let prefix = default_path(&builder.config.prefix, "/usr/local");
let sysconfdir = prefix.join(default_path(&builder.config.sysconfdir, "/etc"));
let destdir_env = env::var_os("DESTDIR").map(PathBuf::from);

// Sanity check for the user write access on prefix and sysconfdir
assert!(
is_dir_writable_for_user(&prefix),
"User doesn't have write access on `install.prefix` path in the `config.toml`.",
);
assert!(
is_dir_writable_for_user(&sysconfdir),
"User doesn't have write access on `install.sysconfdir` path in `config.toml`."
);
// Sanity checks on the write access of user.
//
// When the `DESTDIR` environment variable is present, there is no point to
// check write access for `prefix` and `sysconfdir` individually, as they
// are combined with the path from the `DESTDIR` environment variable. In
// this case, we only need to check the `DESTDIR` path, disregarding the
// `prefix` and `sysconfdir` paths.
if let Some(destdir) = &destdir_env {
assert!(is_dir_writable_for_user(destdir), "User doesn't have write access on DESTDIR.");
} else {
assert!(
is_dir_writable_for_user(&prefix),
"User doesn't have write access on `install.prefix` path in the `config.toml`.",
);
assert!(
is_dir_writable_for_user(&sysconfdir),
"User doesn't have write access on `install.sysconfdir` path in `config.toml`."
);
}

let datadir = prefix.join(default_path(&builder.config.datadir, "share"));
let docdir = prefix.join(default_path(&builder.config.docdir, "share/doc/rust"));
Expand All @@ -95,13 +106,13 @@ fn install_sh(
let mut cmd = Command::new(SHELL);
cmd.current_dir(&empty_dir)
.arg(sanitize_sh(&tarball.decompressed_output().join("install.sh")))
.arg(format!("--prefix={}", prepare_dir(prefix)))
.arg(format!("--sysconfdir={}", prepare_dir(sysconfdir)))
.arg(format!("--datadir={}", prepare_dir(datadir)))
.arg(format!("--docdir={}", prepare_dir(docdir)))
.arg(format!("--bindir={}", prepare_dir(bindir)))
.arg(format!("--libdir={}", prepare_dir(libdir)))
.arg(format!("--mandir={}", prepare_dir(mandir)))
.arg(format!("--prefix={}", prepare_dir(&destdir_env, prefix)))
.arg(format!("--sysconfdir={}", prepare_dir(&destdir_env, sysconfdir)))
.arg(format!("--datadir={}", prepare_dir(&destdir_env, datadir)))
.arg(format!("--docdir={}", prepare_dir(&destdir_env, docdir)))
.arg(format!("--bindir={}", prepare_dir(&destdir_env, bindir)))
.arg(format!("--libdir={}", prepare_dir(&destdir_env, libdir)))
.arg(format!("--mandir={}", prepare_dir(&destdir_env, mandir)))
.arg("--disable-ldconfig");
builder.run(&mut cmd);
t!(fs::remove_dir_all(&empty_dir));
Expand All @@ -111,19 +122,16 @@ fn default_path(config: &Option<PathBuf>, default: &str) -> PathBuf {
config.as_ref().cloned().unwrap_or_else(|| PathBuf::from(default))
}

fn prepare_dir(mut path: PathBuf) -> String {
fn prepare_dir(destdir_env: &Option<PathBuf>, mut path: PathBuf) -> String {
// The DESTDIR environment variable is a standard way to install software in a subdirectory
// while keeping the original directory structure, even if the prefix or other directories
// contain absolute paths.
//
// More information on the environment variable is available here:
// https://www.gnu.org/prep/standards/html_node/DESTDIR.html
if let Some(destdir) = env::var_os("DESTDIR").map(PathBuf::from) {
// Sanity check for the user write access on DESTDIR
assert!(is_dir_writable_for_user(&destdir), "User doesn't have write access on DESTDIR.");

if let Some(destdir) = destdir_env {
let without_destdir = path.clone();
path = destdir;
path = destdir.clone();
// Custom .join() which ignores disk roots.
for part in without_destdir.components() {
if let Component::Normal(s) = part {
Expand Down