commit:     324b8f073cf290eb2f227aee92b3368e8046d199
Author:     stefson <herrtimson <AT> yahoo <DOT> de>
AuthorDate: Tue Oct 29 19:34:33 2019 +0000
Commit:     Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
CommitDate: Thu Oct 31 09:44:23 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/rust.git/commit/?id=324b8f07

dev-lang/rust: add upstream fix from pr65932

the bootstrap script uses python to extract the stage0, and given that
someone out there's still using python2 for that, it will fail, as there's
no built in support for lzma prior to python-3.4

the updated patch solves this problem, as it detects the used python version
and chooses tar.gz for users of python2 and tar.xz for those of python3

Signed-off-by: Steffen Kuhn <nielson2 <AT> yandex.com>
Signed-off-by: Mikhail Pukhlikov <cynede <AT> gentoo.org>

 .../37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch | 46 -------------
 dev-lang/rust/files/pr65932.patch                  | 79 ++++++++++++++++++++++
 dev-lang/rust/rust-999.ebuild                      |  2 +-
 dev-lang/rust/rust-9999.ebuild                     |  2 +-
 4 files changed, 81 insertions(+), 48 deletions(-)

diff --git a/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch 
b/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
deleted file mode 100644
index 6504fbe..0000000
--- a/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
+++ /dev/null
@@ -1,46 +0,0 @@
-From 37c5cb8118b6de04dd5d4e5e43787c8b83339472 Mon Sep 17 00:00:00 2001
-From: stefson <[email protected]>
-Date: Fri, 25 Oct 2019 13:20:03 +0200
-Subject: [PATCH] rust/src/bootstrap.py: change src url from tar.gz to tar.xz
-
----
- src/bootstrap/bootstrap.py | 8 ++++----
- 1 file changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
-index 4caf36a6f2a5..6c2f522f50d6 100644
---- a/src/bootstrap/bootstrap.py
-+++ b/src/bootstrap/bootstrap.py
-@@ -105,7 +105,7 @@ def verify(path, sha_path, verbose):
- def unpack(tarball, dst, verbose=False, match=None):
-     """Unpack the given tarball file"""
-     print("extracting", tarball)
--    fname = os.path.basename(tarball).replace(".tar.gz", "")
-+    fname = os.path.basename(tarball).replace(".tar.xz", "")
-     with contextlib.closing(tarfile.open(tarball)) as tar:
-         for member in tar.getnames():
-             if "/" not in member:
-@@ -349,12 +349,12 @@ def download_stage0(self):
-                  self.program_out_of_date(self.rustc_stamp())):
-             if os.path.exists(self.bin_root()):
-                 shutil.rmtree(self.bin_root())
--            filename = "rust-std-{}-{}.tar.gz".format(
-+            filename = "rust-std-{}-{}.tar.xz".format(
-                 rustc_channel, self.build)
-             pattern = "rust-std-{}".format(self.build)
-             self._download_stage0_helper(filename, pattern)
- 
--            filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build)
-+            filename = "rustc-{}-{}.tar.xz".format(rustc_channel, self.build)
-             self._download_stage0_helper(filename, "rustc")
-             self.fix_executable("{}/bin/rustc".format(self.bin_root()))
-             self.fix_executable("{}/bin/rustdoc".format(self.bin_root()))
-@@ -372,7 +372,7 @@ 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())):
--            filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
-+            filename = "cargo-{}-{}.tar.xz".format(cargo_channel, self.build)
-             self._download_stage0_helper(filename, "cargo")
-             self.fix_executable("{}/bin/cargo".format(self.bin_root()))
-             with output(self.cargo_stamp()) as cargo_stamp:

diff --git a/dev-lang/rust/files/pr65932.patch 
b/dev-lang/rust/files/pr65932.patch
new file mode 100644
index 0000000..8d8497a
--- /dev/null
+++ b/dev-lang/rust/files/pr65932.patch
@@ -0,0 +1,79 @@
+From f59c3fdc0906d2af60b52e9d5782f2e3cf39ad03 Mon Sep 17 00:00:00 2001
+From: Guanqun Lu <[email protected]>
+Date: Tue, 29 Oct 2019 16:48:05 +0800
+Subject: [PATCH] download .tar.xz if python3 is used
+
+---
+ src/bootstrap/bootstrap.py | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
+index 4caf36a6f2a5..efde8bd6ce10 100644
+--- a/src/bootstrap/bootstrap.py
++++ b/src/bootstrap/bootstrap.py
+@@ -102,10 +102,10 @@ def verify(path, sha_path, verbose):
+     return verified
+ 
+ 
+-def unpack(tarball, dst, verbose=False, match=None):
++def unpack(tarball, tarball_suffix, dst, verbose=False, match=None):
+     """Unpack the given tarball file"""
+     print("extracting", tarball)
+-    fname = os.path.basename(tarball).replace(".tar.gz", "")
++    fname = os.path.basename(tarball).replace(tarball_suffix, "")
+     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 = ''
+         self.use_vendored_sources = ''
++        self.tarball_suffix = '.tar.gz' if sys.version_info[0] == 2 else 
'.tar.xz'
+         self.verbose = False
+ 
+     def download_stage0(self):
+@@ -349,12 +350,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())
+-            filename = "rust-std-{}-{}.tar.gz".format(
+-                rustc_channel, self.build)
++            filename = "rust-std-{}-{}{}".format(
++                rustc_channel, self.build, self.tarball_suffix)
+             pattern = "rust-std-{}".format(self.build)
+             self._download_stage0_helper(filename, pattern)
+ 
+-            filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build)
++            filename = "rustc-{}-{}{}".format(rustc_channel, self.build,
++                                              self.tarball_suffix)
+             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):
+             # libraries/binaries that are included in rust-std with
+             # the system MinGW ones.
+             if "pc-windows-gnu" in self.build:
+-                filename = "rust-mingw-{}-{}.tar.gz".format(
+-                    rustc_channel, self.build)
++                filename = "rust-mingw-{}-{}{}".format(
++                    rustc_channel, self.build, self.tarball_suffix)
+                 self._download_stage0_helper(filename, "rust-mingw")
+ 
+         if self.cargo().startswith(self.bin_root()) and \
+                 (not os.path.exists(self.cargo()) or
+                  self.program_out_of_date(self.cargo_stamp())):
+-            filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
++            filename = "cargo-{}-{}{}".format(cargo_channel, self.build,
++                                              self.tarball_suffix)
+             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):
+         tarball = os.path.join(rustc_cache, filename)
+         if not os.path.exists(tarball):
+             get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
+-        unpack(tarball, self.bin_root(), match=pattern, verbose=self.verbose)
++        unpack(tarball, self.tarball_suffix, self.bin_root(), match=pattern, 
verbose=self.verbose)
+ 
+     @staticmethod
+     def fix_executable(fname):

diff --git a/dev-lang/rust/rust-999.ebuild b/dev-lang/rust/rust-999.ebuild
index ebb8421..0430773 100644
--- a/dev-lang/rust/rust-999.ebuild
+++ b/dev-lang/rust/rust-999.ebuild
@@ -92,7 +92,7 @@ PATCHES=(
        "${FILESDIR}"/pr65474.patch
 
        # upstream issue: https://github.com/rust-lang/rust/issues/65757
-       "${FILESDIR}"/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
+       "${FILESDIR}"/pr65932.patch
        )
 
 S="${WORKDIR}/${MY_P}-src"

diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild
index d149a29..6b601e8 100644
--- a/dev-lang/rust/rust-9999.ebuild
+++ b/dev-lang/rust/rust-9999.ebuild
@@ -88,7 +88,7 @@ REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
 
 PATCHES=(
        # upstream issue: https://github.com/rust-lang/rust/issues/65757
-       "${FILESDIR}"/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
+       "${FILESDIR}"/pr65932.patch
        )
 
 S="${WORKDIR}/${MY_P}-src"

Reply via email to