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/
Date: Thu, 14 Nov 2019 09:18:07
Message-Id: 1573723071.29b61f1e450d316737986b424c62ead823fcd395.cynede@gentoo
1 commit: 29b61f1e450d316737986b424c62ead823fcd395
2 Author: stefson <herrtimson <AT> yahoo <DOT> de>
3 AuthorDate: Tue Nov 12 21:49:57 2019 +0000
4 Commit: Mikhail Pukhlikov <cynede <AT> gentoo <DOT> org>
5 CommitDate: Thu Nov 14 09:17:51 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/rust.git/commit/?id=29b61f1e
7
8 dev-lang/rust: update patch from pr65932
9
10 Signed-off-by: Steffen Kuhn <nielson2 <AT> yandex.com>
11 Closes: https://github.com/gentoo/gentoo-rust/pull/466
12 Signed-off-by: Mikhail Pukhlikov <cynede <AT> gentoo.org>
13
14 dev-lang/rust/files/pr65932.patch | 167 +++++++++++++++++++++++++-------------
15 1 file changed, 111 insertions(+), 56 deletions(-)
16
17 diff --git a/dev-lang/rust/files/pr65932.patch b/dev-lang/rust/files/pr65932.patch
18 index b383e34..8a7a5b3 100644
19 --- a/dev-lang/rust/files/pr65932.patch
20 +++ b/dev-lang/rust/files/pr65932.patch
21 @@ -1,14 +1,14 @@
22 -From f59c3fdc0906d2af60b52e9d5782f2e3cf39ad03 Mon Sep 17 00:00:00 2001
23 +From 8d56bcc59c92c5770f585cd433230e7771da2dad Mon Sep 17 00:00:00 2001
24 From: Guanqun Lu <guanqun.lu@×××××.com>
25 Date: Tue, 29 Oct 2019 16:48:05 +0800
26 -Subject: [PATCH 1/3] download .tar.xz if python3 is used
27 +Subject: [PATCH 1/2] download .tar.xz if python3 is used
28
29 ---
30 - src/bootstrap/bootstrap.py | 21 ++++++++++++---------
31 - 1 file changed, 12 insertions(+), 9 deletions(-)
32 + src/bootstrap/bootstrap.py | 32 +++++++++++++++++++++++---------
33 + 1 file changed, 23 insertions(+), 9 deletions(-)
34
35 diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
36 -index 4caf36a6f2a5..efde8bd6ce10 100644
37 +index 4caf36a6f2a5..9cc58e03d564 100644
38 --- a/src/bootstrap/bootstrap.py
39 +++ b/src/bootstrap/bootstrap.py
40 @@ -102,10 +102,10 @@ def verify(path, sha_path, verbose):
41 @@ -24,15 +24,26 @@ index 4caf36a6f2a5..efde8bd6ce10 100644
42 with contextlib.closing(tarfile.open(tarball)) as tar:
43 for member in tar.getnames():
44 if "/" not in member:
45 -@@ -329,6 +329,7 @@ def __init__(self):
46 - self.rust_root = ''
47 - self.use_locked_deps = ''
48 +@@ -331,6 +331,18 @@ def __init__(self):
49 self.use_vendored_sources = ''
50 -+ self.tarball_suffix = '.tar.gz' if sys.version_info[0] == 2 else '.tar.xz'
51 self.verbose = False
52
53 ++ def support_xz():
54 ++ try:
55 ++ with tempfile.NamedTemporaryFile(delete=False) as temp_file:
56 ++ temp_path = temp_file.name
57 ++ with tarfile.open(temp_path, "w:xz") as tar:
58 ++ pass
59 ++ return True
60 ++ except tarfile.CompressionError:
61 ++ return False
62 ++
63 ++ self.tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz'
64 ++
65 def download_stage0(self):
66 -@@ -349,12 +350,13 @@ def download_stage0(self):
67 + """Fetch the build system for Rust, written in Rust
68 +
69 +@@ -349,12 +361,13 @@ def download_stage0(self):
70 self.program_out_of_date(self.rustc_stamp())):
71 if os.path.exists(self.bin_root()):
72 shutil.rmtree(self.bin_root())
73 @@ -49,7 +60,7 @@ index 4caf36a6f2a5..efde8bd6ce10 100644
74 self._download_stage0_helper(filename, "rustc")
75 self.fix_executable("{}/bin/rustc".format(self.bin_root()))
76 self.fix_executable("{}/bin/rustdoc".format(self.bin_root()))
77 -@@ -365,14 +367,15 @@ def download_stage0(self):
78 +@@ -365,14 +378,15 @@ def download_stage0(self):
79 # libraries/binaries that are included in rust-std with
80 # the system MinGW ones.
81 if "pc-windows-gnu" in self.build:
82 @@ -68,7 +79,7 @@ index 4caf36a6f2a5..efde8bd6ce10 100644
83 self._download_stage0_helper(filename, "cargo")
84 self.fix_executable("{}/bin/cargo".format(self.bin_root()))
85 with output(self.cargo_stamp()) as cargo_stamp:
86 -@@ -388,7 +391,7 @@ def _download_stage0_helper(self, filename, pattern):
87 +@@ -388,7 +402,7 @@ def _download_stage0_helper(self, filename, pattern):
88 tarball = os.path.join(rustc_cache, filename)
89 if not os.path.exists(tarball):
90 get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
91 @@ -78,62 +89,106 @@ index 4caf36a6f2a5..efde8bd6ce10 100644
92 @staticmethod
93 def fix_executable(fname):
94
95 -From afd1a575fc561c60dc640ebc4b4bbb0ffe2f127e Mon Sep 17 00:00:00 2001
96 +From 0019371e3d878c1031bd7395b52ab40f2441049c Mon Sep 17 00:00:00 2001
97 From: Guanqun Lu <guanqun.lu@×××××.com>
98 -Date: Wed, 30 Oct 2019 23:01:46 +0800
99 -Subject: [PATCH 2/3] python3 only has lzma support after 3.3
100 +Date: Tue, 12 Nov 2019 00:16:05 +0800
101 +Subject: [PATCH 2/2] bootstrap: don't call support_xz in hot-path
102
103 ---
104 - src/bootstrap/bootstrap.py | 2 +-
105 - 1 file changed, 1 insertion(+), 1 deletion(-)
106 + src/bootstrap/bootstrap.py | 43 +++++++++++++++++++-------------------
107 + 1 file changed, 22 insertions(+), 21 deletions(-)
108
109 diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
110 -index efde8bd6ce10..06c439082c76 100644
111 +index 9cc58e03d564..730e8cf05d41 100644
112 --- a/src/bootstrap/bootstrap.py
113 +++ b/src/bootstrap/bootstrap.py
114 -@@ -329,7 +329,7 @@ def __init__(self):
115 - self.rust_root = ''
116 - self.use_locked_deps = ''
117 +@@ -331,17 +331,6 @@ def __init__(self):
118 self.use_vendored_sources = ''
119 -- self.tarball_suffix = '.tar.gz' if sys.version_info[0] == 2 else '.tar.xz'
120 -+ self.tarball_suffix = '.tar.xz' if sys.version_info[0:2] >= (3, 3) else '.tar.gz'
121 self.verbose = False
122
123 +- def support_xz():
124 +- try:
125 +- with tempfile.NamedTemporaryFile(delete=False) as temp_file:
126 +- temp_path = temp_file.name
127 +- with tarfile.open(temp_path, "w:xz") as tar:
128 +- pass
129 +- return True
130 +- except tarfile.CompressionError:
131 +- return False
132 +-
133 +- self.tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz'
134 +
135 def download_stage0(self):
136 -
137 -From bbb5ac2ff22de6d8021aa200270af2cdc92e4d0d Mon Sep 17 00:00:00 2001
138 -From: Guanqun Lu <guanqun.lu@×××××.com>
139 -Date: Thu, 31 Oct 2019 12:13:51 +0800
140 -Subject: [PATCH 3/3] try import lzma to detect if xz is supported
141 -
142 ----
143 - src/bootstrap/bootstrap.py | 8 +++++++-
144 - 1 file changed, 7 insertions(+), 1 deletion(-)
145 -
146 -diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
147 -index 06c439082c76..a192e3a1cc00 100644
148 ---- a/src/bootstrap/bootstrap.py
149 -+++ b/src/bootstrap/bootstrap.py
150 -@@ -314,6 +314,12 @@ def output(filepath):
151 - shutil.copy2(tmp, filepath)
152 - os.remove(tmp)
153 + """Fetch the build system for Rust, written in Rust
154 +@@ -356,19 +345,30 @@ def download_stage0(self):
155 + rustc_channel = self.rustc_channel
156 + cargo_channel = self.cargo_channel
157
158 -+def supports_lzma():
159 -+ try:
160 -+ import lzma
161 -+ return True
162 -+ except ImportError:
163 -+ return False
164 ++ def support_xz():
165 ++ try:
166 ++ with tempfile.NamedTemporaryFile(delete=False) as temp_file:
167 ++ temp_path = temp_file.name
168 ++ with tarfile.open(temp_path, "w:xz") as tar:
169 ++ pass
170 ++ return True
171 ++ except tarfile.CompressionError:
172 ++ return False
173 ++
174 + if self.rustc().startswith(self.bin_root()) and \
175 + (not os.path.exists(self.rustc()) or
176 + self.program_out_of_date(self.rustc_stamp())):
177 + if os.path.exists(self.bin_root()):
178 + shutil.rmtree(self.bin_root())
179 ++ tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz'
180 + filename = "rust-std-{}-{}{}".format(
181 +- rustc_channel, self.build, self.tarball_suffix)
182 ++ rustc_channel, self.build, tarball_suffix)
183 + pattern = "rust-std-{}".format(self.build)
184 +- self._download_stage0_helper(filename, pattern)
185 ++ self._download_stage0_helper(filename, pattern, tarball_suffix)
186
187 - class RustBuild(object):
188 - """Provide all the methods required to build Rust"""
189 -@@ -329,7 +335,7 @@ def __init__(self):
190 - self.rust_root = ''
191 - self.use_locked_deps = ''
192 - self.use_vendored_sources = ''
193 -- self.tarball_suffix = '.tar.xz' if sys.version_info[0:2] >= (3, 3) else '.tar.gz'
194 -+ self.tarball_suffix = '.tar.xz' if supports_lzma() else '.tar.gz'
195 - self.verbose = False
196 + filename = "rustc-{}-{}{}".format(rustc_channel, self.build,
197 +- self.tarball_suffix)
198 +- self._download_stage0_helper(filename, "rustc")
199 ++ tarball_suffix)
200 ++ self._download_stage0_helper(filename, "rustc", tarball_suffix)
201 + self.fix_executable("{}/bin/rustc".format(self.bin_root()))
202 + self.fix_executable("{}/bin/rustdoc".format(self.bin_root()))
203 + with output(self.rustc_stamp()) as rust_stamp:
204 +@@ -379,20 +379,21 @@ def download_stage0(self):
205 + # the system MinGW ones.
206 + if "pc-windows-gnu" in self.build:
207 + filename = "rust-mingw-{}-{}{}".format(
208 +- rustc_channel, self.build, self.tarball_suffix)
209 +- self._download_stage0_helper(filename, "rust-mingw")
210 ++ rustc_channel, self.build, tarball_suffix)
211 ++ self._download_stage0_helper(filename, "rust-mingw", tarball_suffix)
212
213 - def download_stage0(self):
214 + if self.cargo().startswith(self.bin_root()) and \
215 + (not os.path.exists(self.cargo()) or
216 + self.program_out_of_date(self.cargo_stamp())):
217 ++ tarball_suffix = '.tar.xz' if support_xz() else '.tar.gz'
218 + filename = "cargo-{}-{}{}".format(cargo_channel, self.build,
219 +- self.tarball_suffix)
220 +- self._download_stage0_helper(filename, "cargo")
221 ++ tarball_suffix)
222 ++ self._download_stage0_helper(filename, "cargo", tarball_suffix)
223 + self.fix_executable("{}/bin/cargo".format(self.bin_root()))
224 + with output(self.cargo_stamp()) as cargo_stamp:
225 + cargo_stamp.write(self.date)
226 +
227 +- def _download_stage0_helper(self, filename, pattern):
228 ++ def _download_stage0_helper(self, filename, pattern, tarball_suffix):
229 + cache_dst = os.path.join(self.build_dir, "cache")
230 + rustc_cache = os.path.join(cache_dst, self.date)
231 + if not os.path.exists(rustc_cache):
232 +@@ -402,7 +403,7 @@ def _download_stage0_helper(self, filename, pattern):
233 + tarball = os.path.join(rustc_cache, filename)
234 + if not os.path.exists(tarball):
235 + get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
236 +- unpack(tarball, self.tarball_suffix, self.bin_root(), match=pattern, verbose=self.verbose)
237 ++ unpack(tarball, tarball_suffix, self.bin_root(), match=pattern, verbose=self.verbose)
238 +
239 + @staticmethod
240 + def fix_executable(fname):