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

Allan McRae allan at archlinux.org
Thu Sep 16 00:21:46 EDT 2010


Thanks.  I just ran into a situation where this would have been useful 
and remembered this patch way back in my mail archive.

@Dan: are you OK to pull this?

Allan

On 02/08/10 10:47, David Campbell 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"""
>   	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
>   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
>
>
>



More information about the arch-general mailing list