1 |
On 5/30/20 8:26 PM, Mike Gilbert wrote: |
2 |
> Bug: https://bugs.gentoo.org/719810 |
3 |
> Signed-off-by: Mike Gilbert <floppym@g.o> |
4 |
> --- |
5 |
> lib/portage/package/ebuild/fetch.py | 9 +++++++-- |
6 |
> 1 file changed, 7 insertions(+), 2 deletions(-) |
7 |
> |
8 |
> diff --git a/lib/portage/package/ebuild/fetch.py b/lib/portage/package/ebuild/fetch.py |
9 |
> index 28e7caf53..47c3ad28f 100644 |
10 |
> --- a/lib/portage/package/ebuild/fetch.py |
11 |
> +++ b/lib/portage/package/ebuild/fetch.py |
12 |
> @@ -26,6 +26,11 @@ try: |
13 |
> except ImportError: |
14 |
> from urlparse import urlparse |
15 |
> |
16 |
> +try: |
17 |
> + from urllib.parse import quote as urlquote |
18 |
> +except ImportError: |
19 |
> + from urllib import quote as urlquote |
20 |
> + |
21 |
> import portage |
22 |
> portage.proxy.lazyimport.lazyimport(globals(), |
23 |
> 'portage.package.ebuild.config:check_config_instance,config', |
24 |
> @@ -351,7 +356,7 @@ _size_suffix_map = { |
25 |
> |
26 |
> class FlatLayout(object): |
27 |
> def get_path(self, filename): |
28 |
> - return filename |
29 |
> + return urlquote(filename) |
30 |
> |
31 |
> def get_filenames(self, distdir): |
32 |
> for dirpath, dirnames, filenames in os.walk(distdir, |
33 |
> @@ -382,7 +387,7 @@ class FilenameHashLayout(object): |
34 |
> c = c // 4 |
35 |
> ret += fnhash[:c] + '/' |
36 |
> fnhash = fnhash[c:] |
37 |
> - return ret + filename |
38 |
> + return ret + urlquote(filename) |
39 |
> |
40 |
> def get_filenames(self, distdir): |
41 |
> pattern = '' |
42 |
> |
43 |
|
44 |
In order to ensure that the filename will not have an extra level of quoting |
45 |
in the mirror path, we'll have to do something like this wherever we |
46 |
translate a uri in SRC_URI to a filename: |
47 |
|
48 |
diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py |
49 |
index 08af17bcd..99d8ab720 100644 |
50 |
--- a/lib/portage/dbapi/porttree.py |
51 |
+++ b/lib/portage/dbapi/porttree.py |
52 |
@@ -1547,7 +1547,7 @@ def _parse_uri_map(cpv, metadata, use=None): |
53 |
myuris.pop() |
54 |
distfile = myuris.pop() |
55 |
else: |
56 |
- distfile = os.path.basename(uri) |
57 |
+ distfile = unquote(os.path.basename(uri)) |
58 |
if not distfile: |
59 |
raise portage.exception.InvalidDependString( |
60 |
("getFetchMap(): '%s' SRC_URI has no file " + \ |
61 |
|
62 |
-- |
63 |
Thanks, |
64 |
Zac |