Skip to content

Revert "Move the combined components instead of copying" #63

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

Merged
merged 1 commit into from
May 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 6 additions & 3 deletions src/combiner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,18 @@ impl Combiner {
bail!("incorrect installer version in {}", input_tarball);
}

// Move components to the new combined installer
// Copy components to the new combined installer
let mut pkg_components = String::new();
open_file(pkg_dir.join("components"))
.and_then(|mut file| file.read_to_string(&mut pkg_components).map_err(Error::from))
.chain_err(|| format!("failed to read components in '{}'", input_tarball))?;
for component in pkg_components.split_whitespace() {
// All we need to do is move the component directory
// All we need to do is copy the component directory. We could
// move it, but rustbuild wants to reuse the unpacked package
// dir for OS-specific installers on macOS and Windows.
let component_dir = package_dir.join(&component);
rename(&pkg_dir.join(&component), component_dir)?;
create_dir(&component_dir)?;
copy_recursive(&pkg_dir.join(&component), &component_dir)?;

// Merge the component name
writeln!(&components, "{}", component)
Expand Down
7 changes: 0 additions & 7 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ pub fn remove_file<P: AsRef<Path>>(path: P) -> Result<()> {
.chain_err(|| format!("failed to remove file '{}'", path.as_ref().display()))
}

/// Wrap `fs::rename` with a nicer error message
pub fn rename<P: AsRef<Path>, Q: AsRef<Path>>(from: P, to: Q) -> Result<()> {
fs::rename(&from, &to)
.chain_err(|| format!("failed to rename '{}' to '{}'",
from.as_ref().display(), to.as_ref().display()))
}

/// Copies the `src` directory recursively to `dst`. Both are assumed to exist
/// when this function is called.
pub fn copy_recursive(src: &Path, dst: &Path) -> Result<()> {
Expand Down
32 changes: 32 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,38 @@ list_components() {
}
runtest list_components

combined_remains() {
try sh "$S/gen-installer.sh" \
--image-dir="$TEST_DIR/image1" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR" \
--package-name=rustc \
--component-name=rustc
try sh "$S/gen-installer.sh" \
--image-dir="$TEST_DIR/image3" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR" \
--package-name=cargo \
--component-name=cargo
try sh "$S/gen-installer.sh" \
--image-dir="$TEST_DIR/image4" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR" \
--package-name=rust-docs \
--component-name=rust-docs
try sh "$S/combine-installers.sh" \
--work-dir="$WORK_DIR" \
--output-dir="$OUT_DIR" \
--package-name=rust \
--input-tarballs="$OUT_DIR/rustc.tar.gz,$OUT_DIR/cargo.tar.gz,$OUT_DIR/rust-docs.tar.gz"
for component in rustc cargo rust-docs; do
# rustbuild wants the original extracted package intact too
try test -d "$WORK_DIR/$component/$component"
try test -d "$WORK_DIR/rust/$component"
done
}
runtest combined_remains

# Upgrade tests

upgrade_from_v1() {
Expand Down