[arch-projects] [namcap] [PATCH] Don't report missing-vcs-makedeps when it is in depends

Michael Straube michael.straube at posteo.de
Sat Apr 11 08:41:27 UTC 2020


> Currently a PKGBUILD warning is shown when the package depends on git
> instead of makedepends on it. Since we also have the redundant_makedepends
> rule we should not write it again in makedepends. This patch checkes depends
> array too so this warning could be suppressed.
> ---
>  Namcap/rules/makedepends.py               | 2 ++
>  Namcap/tests/pkgbuild/test_makedepends.py | 8 ++++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/Namcap/rules/makedepends.py b/Namcap/rules/makedepends.py
> index 53676c2..8b938a0 100644
> --- a/Namcap/rules/makedepends.py
> +++ b/Namcap/rules/makedepends.py
> @@ -68,6 +68,8 @@ class VCSMakedepends(PkgbuildRule):
>  
>  		for v in protocols:
>  			d = vcs[v]
> +			if 'depends' in pkginfo and d in pkginfo["depends"]:
> +				continue
>  			if 'makedepends' not in pkginfo:
>  				missing.append(d)
>  				continue
> diff --git a/Namcap/tests/pkgbuild/test_makedepends.py b/Namcap/tests/pkgbuild/test_makedepends.py
> index d443b2b..73a3ba2 100644
> --- a/Namcap/tests/pkgbuild/test_makedepends.py
> +++ b/Namcap/tests/pkgbuild/test_makedepends.py
> @@ -111,4 +111,12 @@ package() {
>  		self.assertEqual(r.warnings, [])
>  		self.assertEqual(r.infos, [])
>  
> +	def test_example3(self):
> +		# Example 3
> +		r = self.run_on_pkg(self.pkgbuild1 + 'depends=(bzr git mercurial)')

Package 'bzr' was replaced with 'breezy' in commit 28fdd26b77ac.

		r = self.run_on_pkg(self.pkgbuild1 + 'depends=(breezy git mercurial)')

> +		self.assertEqual(r.errors, [])
> +		self.assertEqual(r.warnings,
> +			[("missing-vcs-makedeps %s", 'subversion')])
> +		self.assertEqual(r.infos, [])
> +
>  # vim: set ts=4 sw=4 noet:
> -- 
> 2.25.1


More information about the arch-projects mailing list