示例#1
0
def install_via_tarballs():
    if os.path.isdir("rustc-install"):
        shutil.rmtree("rustc-install")

    host_fname = 'rustc-nightly-' + host + '.tar.gz'
    download.get(url + '/' + host_fname, host_fname)
    download.unpack(host_fname, "rustc-install", quiet=True)
    os.remove(host_fname)

    if extra != None:
        extra_fname = 'rustc-nightly-' + extra + '.tar.gz'
        print("adding target libs for " + extra)
        download.get(url + '/' + extra_fname, extra_fname)
        folder = extra_fname.replace(".tar.gz", "")
        with contextlib.closing(tarfile.open(extra_fname)) as tar:
            for p in tar.getnames():
                if not "rustc/" + libdir + "/rustlib/" + extra in p:
                    continue
                name = p.replace(folder + "/", "", 1)
                dst = "rustc-install/" + name
                tar.extract(p, "rustc-install")
                tp = os.path.join("rustc-install", p)
                if os.path.isdir(tp) and os.path.exists(dst):
                    continue
                shutil.move(tp, dst)
        shutil.rmtree("rustc-install/" + folder)
        os.remove(extra_fname)

    if os.path.isdir("rustc"):
        shutil.rmtree("rustc")
    os.rename("rustc-install/rustc", "rustc")
    shutil.rmtree("rustc-install")
示例#2
0
def install_via_tarballs():
    if os.path.isdir("rustc-install"):
        shutil.rmtree("rustc-install")

    host_fname = 'rustc-nightly-' + host + '.tar.gz'
    download.get(url + '/' + host_fname, host_fname)
    download.unpack(host_fname, "rustc-install", quiet=True)
    os.remove(host_fname)

    if extra != None:
        extra_fname = 'rustc-nightly-' + extra + '.tar.gz'
        print("adding target libs for " + extra)
        download.get(url + '/' + extra_fname, extra_fname)
        manifest = open("rustc-install/rustc/manifest.in", "a")
        folder = extra_fname.replace(".tar.gz", "")
        with contextlib.closing(tarfile.open(extra_fname)) as tar:
            for p in tar.getnames():
                if not "rustc/lib/rustlib/" + extra in p:
                    continue
                name = p.replace(folder + "/", "", 1)
                dst = "rustc-install/" + name
                f = tar.extract(p, "rustc-install")
                tp = os.path.join("rustc-install", p)
                if os.path.isdir(tp) and os.path.exists(dst):
                    continue
                shutil.move(tp, dst)
                if not os.path.isdir(dst):
                    manifest.write(p.replace(folder + "/rustc/", "file:") + "\n")
        shutil.rmtree("rustc-install/" + folder)
        os.remove(extra_fname)

    if os.path.isdir("rustc"):
        shutil.rmtree("rustc")
    os.rename("rustc-install/rustc", "rustc")
    shutil.rmtree("rustc-install")
示例#3
0
def install_via_tarballs():
    if os.path.isdir("rustc-install"):
        shutil.rmtree("rustc-install")

    # Download the compiler
    host_fname = 'rustc-nightly-' + host + '.tar.gz'
    download.get(url + '/' + host_fname, host_fname)
    download.unpack(host_fname, "rustc-install", quiet=True, strip=2)
    os.remove(host_fname)

    # Download all target libraries needed
    for target in targets:
        fetch_std(target)

    if os.path.isdir("rustc"):
        shutil.rmtree("rustc")
    os.rename("rustc-install", "rustc")
示例#4
0
def install_via_tarballs():
    if os.path.isdir("rustc-install"):
        shutil.rmtree("rustc-install")

    # Download the compiler
    host_fname = 'rustc-nightly-' + host + '.tar.gz'
    download.get(url + '/' + host_fname, host_fname)
    download.unpack(host_fname, "rustc-install", quiet=True, strip=2)
    os.remove(host_fname)

    # Download all target libraries needed
    for target in targets:
        fetch_std(target)

    if os.path.isdir("rustc"):
        shutil.rmtree("rustc")
    os.rename("rustc-install", "rustc")
示例#5
0
    vendor = "pc"
    target_os = "windows-gnu"
triple = "%s-%s-%s" % (arch, vendor, target_os)
hash = snaps[date][platform]

tarball = "cargo-nightly-" + triple + ".tar.gz"
url = "https://static.rust-lang.org/cargo-dist/%s/%s" % (date.strip(), tarball)
dl_path = "target/dl/" + tarball
dst = "target/snapshot"

if not os.path.isdir("target/dl"):
    os.makedirs("target/dl")

if os.path.isdir(dst):
    shutil.rmtree(dst)

exists = False
if os.path.exists(dl_path):
    h = hashlib.sha1(open(dl_path, "rb").read()).hexdigest()
    if h == hash:
        print("file already present %s (%s)" % (dl_path, hash))
        exists = True

if not exists:
    download.get(url, dl_path)
    h = hashlib.sha1(open(dl_path, "rb").read()).hexdigest()
    if h != hash:
        raise Exception("failed to verify the checksum of the snapshot")

download.unpack(dl_path, dst, strip=2)
示例#6
0
    target_os = 'windows-gnu'
triple = "%s-%s-%s" % (arch, vendor, target_os)
hash = snaps[date][platform]

tarball = 'cargo-nightly-' + triple + '.tar.gz'
url = 'https://static.rust-lang.org/cargo-dist/%s/%s' % \
    (date.strip(), tarball)
dl_path = "target/dl/" + tarball
dst = "target/snapshot"

if not os.path.isdir('target/dl'):
    os.makedirs('target/dl')

if os.path.isdir(dst):
    shutil.rmtree(dst)

exists = False
if os.path.exists(dl_path):
    h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
    if h == hash:
        print("file already present %s (%s)" % (dl_path, hash,))
        exists = True

if not exists:
    download.get(url, dl_path)
    h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
    if h != hash:
        raise Exception("failed to verify the checksum of the snapshot")

download.unpack(dl_path, dst)
示例#7
0
def fetch_std(target):
    fname = 'rust-std-nightly-' + target + '.tar.gz'
    print("adding target libs for " + target)
    download.get(url + '/' + fname, fname)
    download.unpack(fname, "rustc-install", quiet=True, strip=2)
    os.remove(fname)
示例#8
0
def fetch_std(target):
    fname = 'rust-std-nightly-' + target + '.tar.gz'
    print("adding target libs for " + target)
    download.get(url + '/' + fname, fname)
    download.unpack(fname, "rustc-install", quiet=True, strip=2)
    os.remove(fname)
示例#9
0
tarball = 'cargo-nightly-' + triple + '.tar.gz'
url = 'https://static.rust-lang.org/cargo-dist/%s/%s' % \
  (date.strip(), tarball)
dl_path = "target/dl/" + tarball
dst = "target/snapshot"

if not os.path.isdir('target/dl'):
    os.makedirs('target/dl')

if os.path.isdir(dst):
    shutil.rmtree(dst)

exists = False
if os.path.exists(dl_path):
    h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
    if h == hash:
        print("file already present %s (%s)" % (
            dl_path,
            hash,
        ))
        exists = True

if not exists:
    download.get(url, dl_path)
    h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
    if h != hash:
        raise Exception("failed to verify the checksum of the snapshot")

download.unpack(dl_path, dst)
示例#10
0
tarball = 'cargo-nightly-' + triple + '.tar.gz'
url = 'https://static.rust-lang.org/cargo-dist/%s/%s' % \
    (date.strip(), tarball)
dl_path = "target/dl/" + tarball
dst = "target/snapshot"

if not os.path.isdir('target/dl'):
    os.makedirs('target/dl')

if os.path.isdir(dst):
    shutil.rmtree(dst)

exists = False
if os.path.exists(dl_path):
    h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
    if h == hash:
        print("file already present %s (%s)" % (
            dl_path,
            hash,
        ))
        exists = True

if not exists:
    download.get(url, dl_path)
    h = hashlib.sha1(open(dl_path, 'rb').read()).hexdigest()
    if h != hash:
        raise Exception("failed to verify the checksum of the snapshot")

download.unpack(dl_path, dst, strip=2)