Gentoo Archives: gentoo-commits

From: Mikhail Pukhlikov <cynede@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/rust:master commit in: dev-lang/rust/files/, dev-lang/rust/
Date: Thu, 31 Oct 2019 09:44:40
Message-Id: 1572515063.324b8f073cf290eb2f227aee92b3368e8046d199.cynede@gentoo
1 commit: 324b8f073cf290eb2f227aee92b3368e8046d199
2 Author: stefson <herrtimson <AT> yahoo <DOT> de>
3 AuthorDate: Tue Oct 29 19:34:33 2019 +0000
4 Commit: Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 31 09:44:23 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/rust.git/commit/?id=324b8f07
7
8 dev-lang/rust: add upstream fix from pr65932
9
10 the bootstrap script uses python to extract the stage0, and given that
11 someone out there's still using python2 for that, it will fail, as there's
12 no built in support for lzma prior to python-3.4
13
14 the updated patch solves this problem, as it detects the used python version
15 and chooses tar.gz for users of python2 and tar.xz for those of python3
16
17 Signed-off-by: Steffen Kuhn <nielson2 <AT> yandex.com>
18 Signed-off-by: Mikhail Pukhlikov <cynede <AT> gentoo.org>
19
20 .../37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch | 46 -------------
21 dev-lang/rust/files/pr65932.patch | 79 ++++++++++++++++++++++
22 dev-lang/rust/rust-999.ebuild | 2 +-
23 dev-lang/rust/rust-9999.ebuild | 2 +-
24 4 files changed, 81 insertions(+), 48 deletions(-)
25
26 diff --git a/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch b/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
27 deleted file mode 100644
28 index 6504fbe..0000000
29 --- a/dev-lang/rust/files/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
30 +++ /dev/null
31 @@ -1,46 +0,0 @@
32 -From 37c5cb8118b6de04dd5d4e5e43787c8b83339472 Mon Sep 17 00:00:00 2001
33 -From: stefson <hidden@×××××.de>
34 -Date: Fri, 25 Oct 2019 13:20:03 +0200
35 -Subject: [PATCH] rust/src/bootstrap.py: change src url from tar.gz to tar.xz
36 -
37 ----
38 - src/bootstrap/bootstrap.py | 8 ++++----
39 - 1 file changed, 4 insertions(+), 4 deletions(-)
40 -
41 -diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
42 -index 4caf36a6f2a5..6c2f522f50d6 100644
43 ---- a/src/bootstrap/bootstrap.py
44 -+++ b/src/bootstrap/bootstrap.py
45 -@@ -105,7 +105,7 @@ def verify(path, sha_path, verbose):
46 - def unpack(tarball, dst, verbose=False, match=None):
47 - """Unpack the given tarball file"""
48 - print("extracting", tarball)
49 -- fname = os.path.basename(tarball).replace(".tar.gz", "")
50 -+ fname = os.path.basename(tarball).replace(".tar.xz", "")
51 - with contextlib.closing(tarfile.open(tarball)) as tar:
52 - for member in tar.getnames():
53 - if "/" not in member:
54 -@@ -349,12 +349,12 @@ def download_stage0(self):
55 - self.program_out_of_date(self.rustc_stamp())):
56 - if os.path.exists(self.bin_root()):
57 - shutil.rmtree(self.bin_root())
58 -- filename = "rust-std-{}-{}.tar.gz".format(
59 -+ filename = "rust-std-{}-{}.tar.xz".format(
60 - rustc_channel, self.build)
61 - pattern = "rust-std-{}".format(self.build)
62 - self._download_stage0_helper(filename, pattern)
63 -
64 -- filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build)
65 -+ filename = "rustc-{}-{}.tar.xz".format(rustc_channel, self.build)
66 - self._download_stage0_helper(filename, "rustc")
67 - self.fix_executable("{}/bin/rustc".format(self.bin_root()))
68 - self.fix_executable("{}/bin/rustdoc".format(self.bin_root()))
69 -@@ -372,7 +372,7 @@ def download_stage0(self):
70 - if self.cargo().startswith(self.bin_root()) and \
71 - (not os.path.exists(self.cargo()) or
72 - self.program_out_of_date(self.cargo_stamp())):
73 -- filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
74 -+ filename = "cargo-{}-{}.tar.xz".format(cargo_channel, self.build)
75 - self._download_stage0_helper(filename, "cargo")
76 - self.fix_executable("{}/bin/cargo".format(self.bin_root()))
77 - with output(self.cargo_stamp()) as cargo_stamp:
78
79 diff --git a/dev-lang/rust/files/pr65932.patch b/dev-lang/rust/files/pr65932.patch
80 new file mode 100644
81 index 0000000..8d8497a
82 --- /dev/null
83 +++ b/dev-lang/rust/files/pr65932.patch
84 @@ -0,0 +1,79 @@
85 +From f59c3fdc0906d2af60b52e9d5782f2e3cf39ad03 Mon Sep 17 00:00:00 2001
86 +From: Guanqun Lu <guanqun.lu@×××××.com>
87 +Date: Tue, 29 Oct 2019 16:48:05 +0800
88 +Subject: [PATCH] download .tar.xz if python3 is used
89 +
90 +---
91 + src/bootstrap/bootstrap.py | 21 ++++++++++++---------
92 + 1 file changed, 12 insertions(+), 9 deletions(-)
93 +
94 +diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
95 +index 4caf36a6f2a5..efde8bd6ce10 100644
96 +--- a/src/bootstrap/bootstrap.py
97 ++++ b/src/bootstrap/bootstrap.py
98 +@@ -102,10 +102,10 @@ def verify(path, sha_path, verbose):
99 + return verified
100 +
101 +
102 +-def unpack(tarball, dst, verbose=False, match=None):
103 ++def unpack(tarball, tarball_suffix, dst, verbose=False, match=None):
104 + """Unpack the given tarball file"""
105 + print("extracting", tarball)
106 +- fname = os.path.basename(tarball).replace(".tar.gz", "")
107 ++ fname = os.path.basename(tarball).replace(tarball_suffix, "")
108 + with contextlib.closing(tarfile.open(tarball)) as tar:
109 + for member in tar.getnames():
110 + if "/" not in member:
111 +@@ -329,6 +329,7 @@ def __init__(self):
112 + self.rust_root = ''
113 + self.use_locked_deps = ''
114 + self.use_vendored_sources = ''
115 ++ self.tarball_suffix = '.tar.gz' if sys.version_info[0] == 2 else '.tar.xz'
116 + self.verbose = False
117 +
118 + def download_stage0(self):
119 +@@ -349,12 +350,13 @@ def download_stage0(self):
120 + self.program_out_of_date(self.rustc_stamp())):
121 + if os.path.exists(self.bin_root()):
122 + shutil.rmtree(self.bin_root())
123 +- filename = "rust-std-{}-{}.tar.gz".format(
124 +- rustc_channel, self.build)
125 ++ filename = "rust-std-{}-{}{}".format(
126 ++ rustc_channel, self.build, self.tarball_suffix)
127 + pattern = "rust-std-{}".format(self.build)
128 + self._download_stage0_helper(filename, pattern)
129 +
130 +- filename = "rustc-{}-{}.tar.gz".format(rustc_channel, self.build)
131 ++ filename = "rustc-{}-{}{}".format(rustc_channel, self.build,
132 ++ self.tarball_suffix)
133 + self._download_stage0_helper(filename, "rustc")
134 + self.fix_executable("{}/bin/rustc".format(self.bin_root()))
135 + self.fix_executable("{}/bin/rustdoc".format(self.bin_root()))
136 +@@ -365,14 +367,15 @@ def download_stage0(self):
137 + # libraries/binaries that are included in rust-std with
138 + # the system MinGW ones.
139 + if "pc-windows-gnu" in self.build:
140 +- filename = "rust-mingw-{}-{}.tar.gz".format(
141 +- rustc_channel, self.build)
142 ++ filename = "rust-mingw-{}-{}{}".format(
143 ++ rustc_channel, self.build, self.tarball_suffix)
144 + self._download_stage0_helper(filename, "rust-mingw")
145 +
146 + if self.cargo().startswith(self.bin_root()) and \
147 + (not os.path.exists(self.cargo()) or
148 + self.program_out_of_date(self.cargo_stamp())):
149 +- filename = "cargo-{}-{}.tar.gz".format(cargo_channel, self.build)
150 ++ filename = "cargo-{}-{}{}".format(cargo_channel, self.build,
151 ++ self.tarball_suffix)
152 + self._download_stage0_helper(filename, "cargo")
153 + self.fix_executable("{}/bin/cargo".format(self.bin_root()))
154 + with output(self.cargo_stamp()) as cargo_stamp:
155 +@@ -388,7 +391,7 @@ def _download_stage0_helper(self, filename, pattern):
156 + tarball = os.path.join(rustc_cache, filename)
157 + if not os.path.exists(tarball):
158 + get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
159 +- unpack(tarball, self.bin_root(), match=pattern, verbose=self.verbose)
160 ++ unpack(tarball, self.tarball_suffix, self.bin_root(), match=pattern, verbose=self.verbose)
161 +
162 + @staticmethod
163 + def fix_executable(fname):
164
165 diff --git a/dev-lang/rust/rust-999.ebuild b/dev-lang/rust/rust-999.ebuild
166 index ebb8421..0430773 100644
167 --- a/dev-lang/rust/rust-999.ebuild
168 +++ b/dev-lang/rust/rust-999.ebuild
169 @@ -92,7 +92,7 @@ PATCHES=(
170 "${FILESDIR}"/pr65474.patch
171
172 # upstream issue: https://github.com/rust-lang/rust/issues/65757
173 - "${FILESDIR}"/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
174 + "${FILESDIR}"/pr65932.patch
175 )
176
177 S="${WORKDIR}/${MY_P}-src"
178
179 diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild
180 index d149a29..6b601e8 100644
181 --- a/dev-lang/rust/rust-9999.ebuild
182 +++ b/dev-lang/rust/rust-9999.ebuild
183 @@ -88,7 +88,7 @@ REQUIRED_USE="|| ( ${ALL_LLVM_TARGETS[*]} )
184
185 PATCHES=(
186 # upstream issue: https://github.com/rust-lang/rust/issues/65757
187 - "${FILESDIR}"/37c5cb8118b6de04dd5d4e5e43787c8b83339472.patch
188 + "${FILESDIR}"/pr65932.patch
189 )
190
191 S="${WORKDIR}/${MY_P}-src"