Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rust-lang/rust-installer
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b4ff403041f17957f735ad750c3241a3a428b9b7
Choose a base ref
...
head repository: rust-lang/rust-installer
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0ddd53c4bc2a76df565a1c1fc0cc6f19f254b51e
Choose a head ref
  • 9 commits
  • 7 files changed
  • 3 contributors

Commits on Aug 7, 2017

  1. Remove get_host_triple() from install-template.sh

    Rather than adding SunOS/Solaris (or any future supported OSes) to
    `get_host_triple()`'s list of known OSes, recognize that the function is
    called in exactly two places, and both times the only thing that matters
    is whether it's Linux or not.
    Danek Duvall committed Aug 7, 2017
    Copy the full SHA
    f18de0d View commit details
  2. Merge pull request #70 from dhduvall/rm-get-host-triple

    Remove get_host_triple() from install-template.sh
    alexcrichton authored Aug 7, 2017
    Copy the full SHA
    761a3d6 View commit details

Commits on Aug 8, 2017

  1. Use cp/chmod instead of install, because Solaris

    The install command on Solaris is some weird SVr4 piece of craziness.
    Use cp and chmod to have the same effect as a BSD install without having
    to special case Solaris to use GNU install.
    Danek Duvall committed Aug 8, 2017
    Copy the full SHA
    fc92e84 View commit details
  2. /bin/sh on Solaris doesn't understand "local" keyword

    Use bash explicitly, which should be available everywhere.
    Danek Duvall committed Aug 8, 2017
    Copy the full SHA
    7effdc4 View commit details

Commits on Aug 9, 2017

  1. Merge pull request #71 from dhduvall/solaris-fixes

    Solaris fixes
    alexcrichton authored Aug 9, 2017
    Copy the full SHA
    c7e8847 View commit details

Commits on Sep 6, 2017

  1. Update error-chain and binary name

    Don't have "install" in the name so it doesn't hit permission problems on
    Windows
    alexcrichton committed Sep 6, 2017
    Copy the full SHA
    fbb00db View commit details
  2. Copy the full SHA
    adea17e View commit details

Commits on Sep 15, 2017

  1. Copy the full SHA
    cb40a3d View commit details
  2. Merge pull request #73 from RalfJung/executable

    preserve executable bit during installation
    alexcrichton authored Sep 15, 2017
    Copy the full SHA
    0ddd53c View commit details
Showing with 37 additions and 98 deletions.
  1. +2 −2 Cargo.toml
  2. +1 −1 combine-installers.sh
  3. +1 −1 gen-install-script.sh
  4. +1 −1 gen-installer.sh
  5. +10 −66 install-template.sh
  6. +21 −26 src/tarballer.rs
  7. +1 −1 test.sh
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -5,11 +5,11 @@ version = "0.0.0"

[[bin]]
doc = false
name = "rust-installer"
name = "fabricate"
path = "src/main.rs"

[dependencies]
error-chain = "0.10.0"
error-chain = "0.11.0"
flate2 = "0.2.19"
tar = "0.4.13"
walkdir = "1.0.7"
2 changes: 1 addition & 1 deletion combine-installers.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
2 changes: 1 addition & 1 deletion gen-install-script.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
2 changes: 1 addition & 1 deletion gen-installer.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
76 changes: 10 additions & 66 deletions install-template.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
@@ -319,62 +319,6 @@ abs_path() {
(unset CDPATH && cd "$path" > /dev/null && pwd)
}

get_host_triple() {
local _uname_value=$(uname -s)
local _ostype
case $_uname_value in

Linux)
_ostype=unknown-linux-gnu
;;

FreeBSD)
_ostype=unknown-freebsd
;;

DragonFly)
_ostype=unknown-dragonfly
;;

Bitrig)
_ostype=unknown-bitrig
;;

NetBSD)
_ostype=unknown-netbsd
;;

OpenBSD)
_ostype=unknown-openbsd
;;

Darwin)
_ostype=apple-darwin
;;

MINGW*)
_ostype=pc-windows-gnu
;;

MSYS*)
_ostype=pc-windows-gnu
;;

CYGWIN*)
_ostype=pc-windows-gnu
;;
Haiku)
_ostype=unknown-haiku
;;

*)
err "unknown value from uname -s: $_uname_value"
;;
esac

RETVAL="$_ostype"
}

uninstall_legacy() {
local _abs_libdir="$1"

@@ -675,11 +619,13 @@ install_components() {

maybe_backup_path "$_file_install_path"

if echo "$_file" | grep "^bin/" > /dev/null
if echo "$_file" | grep "^bin/" > /dev/null || test -x "$_src_dir/$_component/$_file"
then
run install -m755 "$_src_dir/$_component/$_file" "$_file_install_path"
run cp "$_src_dir/$_component/$_file" "$_file_install_path"
run chmod 755 "$_file_install_path"
else
run install -m644 "$_src_dir/$_component/$_file" "$_file_install_path"
run cp "$_src_dir/$_component/$_file" "$_file_install_path"
run chmod 644 "$_file_install_path"
fi
critical_need_ok "file creation failed"

@@ -719,11 +665,10 @@ install_components() {
maybe_configure_ld() {
local _abs_libdir="$1"

get_host_triple
local _ostype="$RETVAL"
local _ostype="$(uname -s)"
assert_nz "$_ostype" "ostype"

if [ "$_ostype" = "unknown-linux-gnu" -a ! -n "${CFG_DISABLE_LDCONFIG-}" ]; then
if [ "$_ostype" = "Linux" -a ! -n "${CFG_DISABLE_LDCONFIG-}" ]; then

# Fedora-based systems do not configure the dynamic linker to look
# /usr/local/lib, which is our default installation directory. To
@@ -756,11 +701,10 @@ maybe_configure_ld() {
}

maybe_unconfigure_ld() {
get_host_triple
local _ostype="$RETVAL"
local _ostype="$(uname -s)"
assert_nz "$_ostype" "ostype"

if [ "$_ostype" != "unknown-linux-gnu" ]; then
if [ "$_ostype" != "Linux" ]; then
return 0
fi

47 changes: 21 additions & 26 deletions src/tarballer.rs
Original file line number Diff line number Diff line change
@@ -9,8 +9,10 @@
// except according to those terms.

use std::fs::File;
use std::io::{self, Write};
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
use std::thread;

use flate2;
use flate2::write::GzEncoder;
@@ -55,15 +57,9 @@ impl Tarballer {
.chain_err(|| "failed to collect file paths")?;
files.sort_by(|a, b| a.bytes().rev().cmp(b.bytes().rev()));

// Prepare the .tar.gz file
let gz = GzEncoder::new(create_new_file(tar_gz)?, flate2::Compression::Best);

// Prepare the .tar.xz file
let xz = XzEncoder::new(create_new_file(tar_xz)?, 9);

// Write the tar into both encoded files. We write all directories
// first, so files may be directly created. (see rustup.rs#1092)
let mut builder = Builder::new(Tee(gz, xz));
let mut builder = Builder::new(Vec::new());
for path in dirs {
let src = Path::new(&self.work_dir).join(&path);
builder.append_dir(&path, &src)
@@ -75,12 +71,25 @@ impl Tarballer {
builder.append_data(&mut header(&src, &file)?, &path, &file)
.chain_err(|| format!("failed to tar file '{}'", src.display()))?;
}
let Tee(gz, xz) = builder.into_inner()
let contents = builder.into_inner()
.chain_err(|| "failed to finish writing .tar stream")?;
let contents = Arc::new(contents);

// Prepare the .tar.gz file
let contents2 = contents.clone();
let t = thread::spawn(move || {
let mut gz = GzEncoder::new(create_new_file(tar_gz)?,
flate2::Compression::Best);
gz.write_all(&contents2).chain_err(|| "failed to write .gz")?;
gz.finish().chain_err(|| "failed to finish .gz")
});

// Prepare the .tar.xz file
let mut xz = XzEncoder::new(create_new_file(tar_xz)?, 9);
xz.write_all(&contents).chain_err(|| "failed to write .xz")?;
xz.finish().chain_err(|| "failed to finish .xz")?;

// Finish both encoded files
gz.finish().chain_err(|| "failed to finish .tar.gz file")?;
xz.finish().chain_err(|| "failed to finish .tar.xz file")?;
t.join().unwrap()?;

Ok(())
}
@@ -129,17 +138,3 @@ fn get_recursive_paths<P, Q>(root: P, name: Q) -> Result<(Vec<String>, Vec<Strin
}
Ok((dirs, files))
}

struct Tee<A, B>(A, B);

impl<A: Write, B: Write> Write for Tee<A, B> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.0.write_all(buf)
.and(self.1.write_all(buf))
.and(Ok(buf.len()))
}

fn flush(&mut self) -> io::Result<()> {
self.0.flush().and(self.1.flush())
}
}
2 changes: 1 addition & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

set -e -u