[PATCH] main: https is a sane package source URL scheme

Brian C. Lane bcl at redhat.com
Thu Jul 31 21:21:29 UTC 2014


On Thu, Jul 31, 2014 at 05:10:19PM -0400, Colin Walters wrote:
> On Thu, Jul 31, 2014, at 04:39 PM, Brian C. Lane wrote:
> > 
> > elif any(repo.startswith(p) for p in ('http://', 'https://', 'ftp://',
> > 'file'://)):
> > 
> > is more pythonic.
> 
> Ok, new patch attached.

> From c9be2562fd2cc3b170b66b2255b71e25c3ffbf77 Mon Sep 17 00:00:00 2001
> From: Colin Walters <walters at verbum.org>
> Date: Thu, 31 Jul 2014 15:39:06 -0400
> Subject: [PATCH] main: https is a sane package source URL scheme
> 
> Not sure exactly why sanitize_repo() was written this way; annotate
> traces it to a rename from an earlier file and I was too lazy
> to go back farther.
> 
> Anyways, I want to use https, so rework this code to add it.
> ---
>  src/sbin/lorax | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/sbin/lorax b/src/sbin/lorax
> index 8dfd20f..8937c63 100755
> --- a/src/sbin/lorax
> +++ b/src/sbin/lorax
> @@ -214,10 +214,10 @@ def get_yum_base_object(installroot, repositories, mirrorlists=None,
>                          tempdir="/var/tmp", proxy=None, excludepkgs=None):
>  
>      def sanitize_repo(repo):
> +        """Convert bare paths to file:/// URIs, and silently reject protocols unhandled by yum"""
>          if repo.startswith("/"):
>              return "file://{0}".format(repo)
> -        elif (repo.startswith("http://") or repo.startswith("ftp://")
> -              or repo.startswith("file://")):
> +        elif any(repo.startswith(p) for p in ('http://', 'https://', 'ftp://', 'file://')):
>              return repo
>          else:
>              return None
> -- 
> 1.8.3.1
> 

Ack, I'll get this added to lorax for you.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)


More information about the anaconda-patches mailing list