diff options
-rwxr-xr-x | multiarchanalyze.py | 13 | ||||
-rw-r--r-- | multiarchanalyze.sql | 20 |
2 files changed, 33 insertions, 0 deletions
diff --git a/multiarchanalyze.py b/multiarchanalyze.py index 201ffc3..f00c66a 100755 --- a/multiarchanalyze.py +++ b/multiarchanalyze.py @@ -2,6 +2,7 @@ import argparse import os.path +import re import sqlite3 import sys @@ -77,6 +78,9 @@ def show_files(filenames): return "%d files starting with %s" % (len(filenames), prefix) return "%d files" % len(filenames) +def sqlite_regexp(pattern, value): + return re.match(pattern, value) is not None + def main(): parser = argparse.ArgumentParser() parser.add_argument("-d", "--database", action="store", @@ -85,6 +89,7 @@ def main(): args = parser.parse_args() hints = [] db = sqlite3.connect(args.database) + db.create_function("REGEXP", 2, sqlite_regexp) cur = db.cursor() cur.execute("SELECT name1, architecture1, architecture2, filename FROM masame_conflict;") same_conflicts = {} @@ -146,6 +151,14 @@ def main(): link="https://wiki.debian.org/MultiArch/Hints#dep-any", severity="normal")) + cur.execute("SELECT name FROM maforeign_library ORDER BY name;") + for name, in fetchiter(cur): + hints.append(dict( + binary=name, + description="%s is wrongly marked Multi-Arch: foreign" % name, + link="https://wiki.debian.org/MultiArch/Hints#ma-foreign-library", + severity="high")) + for hint in hints: if "source" not in hint: cur.execute("SELECT distinct(source) FROM package WHERE name = ?;", diff --git a/multiarchanalyze.sql b/multiarchanalyze.sql index 95ebd7d..b98092f 100644 --- a/multiarchanalyze.sql +++ b/multiarchanalyze.sql @@ -196,4 +196,24 @@ CREATE VIEW colonany_candidate AS HAVING count(dependee) = 1 AND min(CASE multiarch WHEN 'allowed' THEN 1 ELSE 0 END) = 1; +/* Packages that are wrongly marked Multi-Arch:foreign, because they + * * are architecture dependent + * * ship a shared library in a public path + * * and the library is not a plugin for a contained program + */ +DROP VIEW IF EXISTS maforeign_library; +CREATE VIEW maforeign_library AS + SELECT DISTINCT p.name + FROM package AS p + WHERE architecture != 'all' + AND multiarch = 'foreign' + AND EXISTS ( + SELECT 1 FROM content + WHERE pid = p.id + AND filename REGEXP '^\./(usr/)?lib/([a-z0-9_]*-linux-gnu[a-z0-9_*]*/)?lib.*\.so$') + AND NOT EXISTS ( + SELECT 1 FROM content + WHERE pid = p.id + AND filename REGEXP '^\./(usr/)?s?bin/.*'); + COMMIT; |