[PATCH 1/5] Make UPLOADEXTS a class variable that can be extended

Pavol Babincak pbabinca at redhat.com
Fri Sep 26 15:02:57 UTC 2014


Patch applied:
https://git.fedorahosted.org/cgit/rpkg.git/commit/?id=028fd4565a0cf33a4adf47efd28bd6868e34e21e

Thanks.


On 09/07/2014 05:25 AM, Lars R. Damerow wrote:
> From: "Lars R. Damerow" <lars at pixar.com>
> 
> If sites want to accept other file formats into their src rpms, they can
> subclass pyrpkg.Commands and add more values to Commands.UPLOADEXTS.
> ---
>  src/pyrpkg/__init__.py | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/pyrpkg/__init__.py b/src/pyrpkg/__init__.py
> index 00bcfab..9260894 100644
> --- a/src/pyrpkg/__init__.py
> +++ b/src/pyrpkg/__init__.py
> @@ -62,6 +62,11 @@ class Commands(object):
>      by clients
>      """
>  
> +    # This shouldn't change... often
> +    UPLOADEXTS = ['tar', 'gz', 'bz2', 'lzma', 'xz', 'Z', 'zip', 'tff',
> +                  'bin', 'tbz', 'tbz2', 'tgz', 'tlz', 'txz', 'pdf', 'rpm',
> +                  'jar', 'war', 'db', 'cpio', 'jisp', 'egg', 'gem', 'spkg']
> +
>      def __init__(self, path, lookaside, lookasidehash, lookaside_cgi,
>                   gitbaseurl, anongiturl, branchre, kojiconfig,
>                   build_client, user=None, dist=None, target=None,
> @@ -914,11 +919,6 @@ class Commands(object):
>      def _srpmdetails(self, srpm):
>          """Return a tuple of package name, package files, and upload files."""
>  
> -        # This shouldn't change... often
> -        UPLOADEXTS = ['tar', 'gz', 'bz2', 'lzma', 'xz', 'Z', 'zip', 'tff',
> -                      'bin', 'tbz', 'tbz2', 'tgz', 'tlz', 'txz', 'pdf', 'rpm',
> -                      'jar', 'war', 'db', 'cpio', 'jisp', 'egg', 'gem', 'spkg']
> -
>          # get the name
>          cmd = ['rpm', '-qp', '--nosignature', '--qf', '%{NAME}', srpm]
>                  # Run the command
> @@ -957,7 +957,7 @@ class Commands(object):
>          contents = output.strip().split('\n')
>          # Cycle through the stuff and sort correctly by its extension
>          for file in contents:
> -            if file.rsplit('.')[-1] in UPLOADEXTS:
> +            if file.rsplit('.')[-1] in self.UPLOADEXTS:
>                  uploadfiles.append(file)
>              else:
>                  files.append(file)
> 


-- 
Pavol Babincak
Release Engineering, Red Hat


More information about the buildsys mailing list