diff options
author | 2019-11-12 22:49:57 +0100 | |
---|---|---|
committer | 2019-11-14 13:17:51 +0400 | |
commit | 29b61f1e450d316737986b424c62ead823fcd395 (patch) | |
tree | 05ce363ae3be25806e2746a1496440a28e6aff51 | |
parent | dev-lang/rust-9999: all patches have been commited to the master branch (diff) | |
download | rust-29b61f1e450d316737986b424c62ead823fcd395.tar.gz rust-29b61f1e450d316737986b424c62ead823fcd395.tar.bz2 rust-29b61f1e450d316737986b424c62ead823fcd395.zip |
dev-lang/rust: update patch from pr65932
Signed-off-by: Steffen Kuhn <nielson2@yandex.com>
Closes: https://github.com/gentoo/gentoo-rust/pull/466
Signed-off-by: Mikhail Pukhlikov <cynede@gentoo.org>
-rw-r--r-- | dev-lang/rust/files/pr65932.patch | 167 |
1 files changed, 111 insertions, 56 deletions
diff --git a/dev-lang/rust/files/pr65932.patch b/dev-lang/rust/files/pr65932.patch index b383e34..8a7a5b3 100644 --- a/dev-lang/rust/files/pr65932.patch +++ b/dev-lang/rust/files/pr65932.patch @@ -1,14 +1,14 @@ -From f59c3fdc0906d2af60b52e9d5782f2e3cf39ad03 Mon Sep 17 00:00:00 2001 +From 8d56bcc59c92c5770f585cd433230e7771da2dad Mon Sep 17 00:00:00 2001 From: Guanqun Lu <guanqun.lu@gmail.com> Date: Tue, 29 Oct 2019 16:48:05 +0800 -Subject: [PATCH 1/3] download .tar.xz if python3 is used +Subject: [PATCH 1/2] download .tar.xz if python3 is used --- - src/bootstrap/bootstrap.py | 21 ++++++++++++--------- - 1 file changed, 12 insertions(+), 9 deletions(-) + src/bootstrap/bootstrap.py | 32 +++++++++++++++++++++++--------- + 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py -index 4caf36a6f2a5..efde8bd6ce10 100644 +index 4caf36a6f2a5..9cc58e03d564 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -102,10 +102,10 @@ def verify(path, sha_path, verbose): @@ -24,15 +24,26 @@ index 4caf36a6f2a5..efde8bd6ce10 100644 with contextlib.closing(tarfile.open(tarball)) as tar: for member in tar.getnames(): if "/" not in member: -@@ -329,6 +329,7 @@ def __init__(self): - self.rust_root = '' - self.use_locked_deps = '' +@@ -331,6 +331,18 @@ def __init__(self): self.use_vendored_sources = '' -+ self.tarball_suffix = '.tar.gz' if sys.version_info[0] == 2 else '.tar.xz' self.verbose = False ++ def support_xz(): ++ try: ++ with tempfile.NamedTemporaryFile(delete=False) as temp_file: ++ temp_path = temp_file.name ++ with tarfile.open(temp_path, "w:xz") as tar: ++ pass ++ return True ++ except tarfile.CompressionError: ++ return False ++ ++ self.tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz' ++ def download_stage0(self): -@@ -349,12 +350,13 @@ def download_stage0(self): + """Fetch the build system for Rust, written in Rust + +@@ -349,12 +361,13 @@ def download_stage0(self): self.program_out_of_date(self.rustc_stamp())): if os.path.exists(self.bin_root()): shutil.rmtree(self.bin_root()) @@ -49,7 +60,7 @@ index 4caf36a6f2a5..efde8bd6ce10 100644 self._download_stage0_helper(filename, "rustc") self.fix_executable("{}/bin/rustc".format(self.bin_root())) self.fix_executable("{}/bin/rustdoc".format(self.bin_root())) -@@ -365,14 +367,15 @@ def download_stage0(self): +@@ -365,14 +378,15 @@ def download_stage0(self): # libraries/binaries that are included in rust-std with # the system MinGW ones. if "pc-windows-gnu" in self.build: @@ -68,7 +79,7 @@ index 4caf36a6f2a5..efde8bd6ce10 100644 self._download_stage0_helper(filename, "cargo") self.fix_executable("{}/bin/cargo".format(self.bin_root())) with output(self.cargo_stamp()) as cargo_stamp: -@@ -388,7 +391,7 @@ def _download_stage0_helper(self, filename, pattern): +@@ -388,7 +402,7 @@ def _download_stage0_helper(self, filename, pattern): tarball = os.path.join(rustc_cache, filename) if not os.path.exists(tarball): get("{}/{}".format(url, filename), tarball, verbose=self.verbose) @@ -78,62 +89,106 @@ index 4caf36a6f2a5..efde8bd6ce10 100644 @staticmethod def fix_executable(fname): -From afd1a575fc561c60dc640ebc4b4bbb0ffe2f127e Mon Sep 17 00:00:00 2001 +From 0019371e3d878c1031bd7395b52ab40f2441049c Mon Sep 17 00:00:00 2001 From: Guanqun Lu <guanqun.lu@gmail.com> -Date: Wed, 30 Oct 2019 23:01:46 +0800 -Subject: [PATCH 2/3] python3 only has lzma support after 3.3 +Date: Tue, 12 Nov 2019 00:16:05 +0800 +Subject: [PATCH 2/2] bootstrap: don't call support_xz in hot-path --- - src/bootstrap/bootstrap.py | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + src/bootstrap/bootstrap.py | 43 +++++++++++++++++++------------------- + 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py -index efde8bd6ce10..06c439082c76 100644 +index 9cc58e03d564..730e8cf05d41 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py -@@ -329,7 +329,7 @@ def __init__(self): - self.rust_root = '' - self.use_locked_deps = '' +@@ -331,17 +331,6 @@ def __init__(self): self.use_vendored_sources = '' -- self.tarball_suffix = '.tar.gz' if sys.version_info[0] == 2 else '.tar.xz' -+ self.tarball_suffix = '.tar.xz' if sys.version_info[0:2] >= (3, 3) else '.tar.gz' self.verbose = False +- def support_xz(): +- try: +- with tempfile.NamedTemporaryFile(delete=False) as temp_file: +- temp_path = temp_file.name +- with tarfile.open(temp_path, "w:xz") as tar: +- pass +- return True +- except tarfile.CompressionError: +- return False +- +- self.tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz' + def download_stage0(self): - -From bbb5ac2ff22de6d8021aa200270af2cdc92e4d0d Mon Sep 17 00:00:00 2001 -From: Guanqun Lu <guanqun.lu@gmail.com> -Date: Thu, 31 Oct 2019 12:13:51 +0800 -Subject: [PATCH 3/3] try import lzma to detect if xz is supported - ---- - src/bootstrap/bootstrap.py | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py -index 06c439082c76..a192e3a1cc00 100644 ---- a/src/bootstrap/bootstrap.py -+++ b/src/bootstrap/bootstrap.py -@@ -314,6 +314,12 @@ def output(filepath): - shutil.copy2(tmp, filepath) - os.remove(tmp) + """Fetch the build system for Rust, written in Rust +@@ -356,19 +345,30 @@ def download_stage0(self): + rustc_channel = self.rustc_channel + cargo_channel = self.cargo_channel -+def supports_lzma(): -+ try: -+ import lzma -+ return True -+ except ImportError: -+ return False ++ def support_xz(): ++ try: ++ with tempfile.NamedTemporaryFile(delete=False) as temp_file: ++ temp_path = temp_file.name ++ with tarfile.open(temp_path, "w:xz") as tar: ++ pass ++ return True ++ except tarfile.CompressionError: ++ return False ++ + if self.rustc().startswith(self.bin_root()) and \ + (not os.path.exists(self.rustc()) or + self.program_out_of_date(self.rustc_stamp())): + if os.path.exists(self.bin_root()): + shutil.rmtree(self.bin_root()) ++ tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz' + filename = "rust-std-{}-{}{}".format( +- rustc_channel, self.build, self.tarball_suffix) ++ rustc_channel, self.build, tarball_suffix) + pattern = "rust-std-{}".format(self.build) +- self._download_stage0_helper(filename, pattern) ++ self._download_stage0_helper(filename, pattern, tarball_suffix) - class RustBuild(object): - """Provide all the methods required to build Rust""" -@@ -329,7 +335,7 @@ def __init__(self): - self.rust_root = '' - self.use_locked_deps = '' - self.use_vendored_sources = '' -- self.tarball_suffix = '.tar.xz' if sys.version_info[0:2] >= (3, 3) else '.tar.gz' -+ self.tarball_suffix = '.tar.xz' if supports_lzma() else '.tar.gz' - self.verbose = False + filename = "rustc-{}-{}{}".format(rustc_channel, self.build, +- self.tarball_suffix) +- self._download_stage0_helper(filename, "rustc") ++ tarball_suffix) ++ self._download_stage0_helper(filename, "rustc", tarball_suffix) + self.fix_executable("{}/bin/rustc".format(self.bin_root())) + self.fix_executable("{}/bin/rustdoc".format(self.bin_root())) + with output(self.rustc_stamp()) as rust_stamp: +@@ -379,20 +379,21 @@ def download_stage0(self): + # the system MinGW ones. + if "pc-windows-gnu" in self.build: + filename = "rust-mingw-{}-{}{}".format( +- rustc_channel, self.build, self.tarball_suffix) +- self._download_stage0_helper(filename, "rust-mingw") ++ rustc_channel, self.build, tarball_suffix) ++ self._download_stage0_helper(filename, "rust-mingw", tarball_suffix) - def download_stage0(self): + if self.cargo().startswith(self.bin_root()) and \ + (not os.path.exists(self.cargo()) or + self.program_out_of_date(self.cargo_stamp())): ++ tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz' + filename = "cargo-{}-{}{}".format(cargo_channel, self.build, +- self.tarball_suffix) +- self._download_stage0_helper(filename, "cargo") ++ tarball_suffix) ++ self._download_stage0_helper(filename, "cargo", tarball_suffix) + self.fix_executable("{}/bin/cargo".format(self.bin_root())) + with output(self.cargo_stamp()) as cargo_stamp: + cargo_stamp.write(self.date) + +- def _download_stage0_helper(self, filename, pattern): ++ def _download_stage0_helper(self, filename, pattern, tarball_suffix): + cache_dst = os.path.join(self.build_dir, "cache") + rustc_cache = os.path.join(cache_dst, self.date) + if not os.path.exists(rustc_cache): +@@ -402,7 +403,7 @@ def _download_stage0_helper(self, filename, pattern): + tarball = os.path.join(rustc_cache, filename) + if not os.path.exists(tarball): + get("{}/{}".format(url, filename), tarball, verbose=self.verbose) +- unpack(tarball, self.tarball_suffix, self.bin_root(), match=pattern, verbose=self.verbose) ++ unpack(tarball, tarball_suffix, self.bin_root(), match=pattern, verbose=self.verbose) + + @staticmethod + def fix_executable(fname): |