Re: [gentoo-portage-dev] [PATCH] Escape percent-signs in portage.package.ebuild.fetch.get_mirror_url()

2020-05-31 Thread Zac Medico
On 5/31/20 2:32 PM, Mike Gilbert wrote:
> This avoids double-escaping in emirrordist. We only want to escape the
> path when fetching the file from the mirror, not when mirroring the
> file.
> 
> Bug: https://bugs.gentoo.org/719810
> Fixes: 4c18f523bb86a8be4c148f365dabee06fca2e4fa
> Signed-off-by: Mike Gilbert 
> ---
>  lib/portage/package/ebuild/fetch.py | 7 ++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/portage/package/ebuild/fetch.py 
> b/lib/portage/package/ebuild/fetch.py
> index 28e7caf53..9682fea89 100644
> --- a/lib/portage/package/ebuild/fetch.py
> +++ b/lib/portage/package/ebuild/fetch.py
> @@ -26,6 +26,11 @@ try:
>  except ImportError:
>   from urlparse import urlparse
>  
> +try:
> + from urllib.parse import quote as urlquote
> +except ImportError:
> + from urllib import quote as urlquote
> +
>  import portage
>  portage.proxy.lazyimport.lazyimport(globals(),
>   'portage.package.ebuild.config:check_config_instance,config',
> @@ -520,7 +525,7 @@ def get_mirror_url(mirror_url, filename, mysettings, 
> cache_path=None):
>   f.close()
>  
>   return (mirror_url + "/distfiles/" +
> - 
> mirror_conf.get_best_supported_layout().get_path(filename))
> + 
> urlquote(mirror_conf.get_best_supported_layout().get_path(filename)))
>  
>  
>  def fetch(myuris, mysettings, listonly=0, fetchonly=0,
> 

Looks good. Please merge.
-- 
Thanks,
Zac



signature.asc
Description: OpenPGP digital signature


[gentoo-portage-dev] [PATCH] Escape percent-signs in portage.package.ebuild.fetch.get_mirror_url()

2020-05-31 Thread Mike Gilbert
This avoids double-escaping in emirrordist. We only want to escape the
path when fetching the file from the mirror, not when mirroring the
file.

Bug: https://bugs.gentoo.org/719810
Fixes: 4c18f523bb86a8be4c148f365dabee06fca2e4fa
Signed-off-by: Mike Gilbert 
---
 lib/portage/package/ebuild/fetch.py | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/portage/package/ebuild/fetch.py 
b/lib/portage/package/ebuild/fetch.py
index 28e7caf53..9682fea89 100644
--- a/lib/portage/package/ebuild/fetch.py
+++ b/lib/portage/package/ebuild/fetch.py
@@ -26,6 +26,11 @@ try:
 except ImportError:
from urlparse import urlparse
 
+try:
+   from urllib.parse import quote as urlquote
+except ImportError:
+   from urllib import quote as urlquote
+
 import portage
 portage.proxy.lazyimport.lazyimport(globals(),
'portage.package.ebuild.config:check_config_instance,config',
@@ -520,7 +525,7 @@ def get_mirror_url(mirror_url, filename, mysettings, 
cache_path=None):
f.close()
 
return (mirror_url + "/distfiles/" +
-   
mirror_conf.get_best_supported_layout().get_path(filename))
+   
urlquote(mirror_conf.get_best_supported_layout().get_path(filename)))
 
 
 def fetch(myuris, mysettings, listonly=0, fetchonly=0,
-- 
2.27.0.rc2