[arch-projects] [namcap] [PATCH v2] makedepends: Make VCS matching more robust
If a VCS source is renamed using the "::" syntax the makedepends are not
detected. If there are files starting with <name of VCS binary> in the source
array false positives are produced. See the gitlab package for example. Make
the matching more robust to avoid such issues.
Signed-off-by: Michael Straube
On 12/2/18 8:01 AM, Michael Straube via arch-projects wrote:
If a VCS source is renamed using the "::" syntax the makedepends are not detected. If there are files starting with <name of VCS binary> in the source array false positives are produced. See the gitlab package for example. Make the matching more robust to avoid such issues.
Signed-off-by: Michael Straube
--- v1 -> v2 Make it also work for e.g. git:// Namcap/rules/makedepends.py | 10 +++++++++- Namcap/tests/pkgbuild/test_makedepends.py | 15 +++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/Namcap/rules/makedepends.py b/Namcap/rules/makedepends.py index 2a0ceaa..65747c4 100644 --- a/Namcap/rules/makedepends.py +++ b/Namcap/rules/makedepends.py @@ -54,9 +54,17 @@ class VCSMakedepends(PkgbuildRule): 'svn' : 'subversion', } missing = [] + protocols = set() + + for s in pkginfo["source"]: + p = s.split("::", 1)[-1] + p = p.split("://", 1)[0] + p = p.split("+", 1)[0] + if p in vcs: + protocols.add(p)
for v in vcs: - if not any(s.startswith(v) for s in pkginfo["source"]): + if not v in protocols:
Why not just check if protocols is empty? -- Eli Schwartz Bug Wrangler and Trusted User
Am 02.12.18 um 14:14 schrieb Eli Schwartz via arch-projects:
On 12/2/18 8:01 AM, Michael Straube via arch-projects wrote:
If a VCS source is renamed using the "::" syntax the makedepends are not detected. If there are files starting with <name of VCS binary> in the source array false positives are produced. See the gitlab package for example. Make the matching more robust to avoid such issues.
Signed-off-by: Michael Straube
--- v1 -> v2 Make it also work for e.g. git:// Namcap/rules/makedepends.py | 10 +++++++++- Namcap/tests/pkgbuild/test_makedepends.py | 15 +++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/Namcap/rules/makedepends.py b/Namcap/rules/makedepends.py index 2a0ceaa..65747c4 100644 --- a/Namcap/rules/makedepends.py +++ b/Namcap/rules/makedepends.py @@ -54,9 +54,17 @@ class VCSMakedepends(PkgbuildRule): 'svn' : 'subversion', } missing = [] + protocols = set() + + for s in pkginfo["source"]: + p = s.split("::", 1)[-1] + p = p.split("://", 1)[0] + p = p.split("+", 1)[0] + if p in vcs: + protocols.add(p)
for v in vcs: - if not any(s.startswith(v) for s in pkginfo["source"]): + if not v in protocols:
Why not just check if protocols is empty?
Good point, thanks again.
participants (2)
-
Eli Schwartz
-
Michael Straube