[arch-general] [namcap] [PATCH] Check for packages that should be 'any'

Dan McGee dpmcgee at gmail.com
Thu Sep 16 07:57:17 EDT 2010


On Sun, Aug 1, 2010 at 7:47 PM, David Campbell <davekong at archlinux.us> wrote:
> If a package has no elf files but is not 'any', throw a warning saying that
> the package could be 'any'.
> ---
>  Namcap/anyelf.py |   18 ++++++++++--------
>  namcap-tags      |    1 +
>  2 files changed, 11 insertions(+), 8 deletions(-)
>
> diff --git a/Namcap/anyelf.py b/Namcap/anyelf.py
> index f3414af..c037ff0 100644
> --- a/Namcap/anyelf.py
> +++ b/Namcap/anyelf.py
> @@ -33,20 +33,22 @@ class package:
>        def short_name(self):
>                return "anyelf"
>        def long_name(self):
> -               return "If package is 'any' architecture, check for ELF files"
> +               return """Check for ELF files to see if a package should be 'any'
> +               architecture"""
This will be really ugly when it prints; you should just use a single
quoted string.

>        def prereq(self):
>                return "extract"
>        def analyze(self, pkginfo, data):
>                ret = [[], [], []]
> -               if pkginfo.arch and pkginfo.arch[0] != 'any':
> -                       return ret
>                found_elffiles = []
> -
>                os.path.walk(data, scanelf, found_elffiles)
> -               if len(found_elffiles) > 0:
> -                       for i in found_elffiles:
> -                               ret[0].append(("elffile-in-any-package %s", i))
> -
> +
> +               if pkginfo.arch and pkginfo.arch[0] == 'any':
> +                       if len(found_elffiles) > 0:
> +                               for i in found_elffiles:
> +                                       ret[0].append(("elffile-in-any-package %s", i))
> +               else:
> +                       if len(found_elffiles) == 0:
> +                               ret[1].append(("no-elffiles-and-not-any-package", ()))
>                return ret
>
>        def type(self):
> diff --git a/namcap-tags b/namcap-tags
> index acb8e9c..4040136 100644
> --- a/namcap-tags
> +++ b/namcap-tags
> @@ -47,6 +47,7 @@ missing-license :: Missing license
>  missing-maintainer :: Missing Maintainer tag
>  missing-checksums :: Missing checksums
>  missing-url :: Missing url
> +no-elffiles-and-not-any-package :: No ELF files and not an "any" package
Let's drop the 'and' from here to shorten it up.

>  non-fhs-info-page %s :: Non-FHS info page (%s) found. Use /usr/share/info instead
>  non-fhs-man-page %s :: Non-FHS man page (%s) found. Use /usr/share/man instead
>  not-a-common-license %s :: %s is not a common license (it's not in /usr/share/licenses/common/)
> --
> 1.7.1.1

Applied, made a few small changes as stated above. Sorry this got lost
in the depths of the inbox.


More information about the arch-general mailing list