From 12c76f0da70bf78895bd05b32ee4b77abc6de019 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa <jelle@archlinux.org> Date: Sun, 19 Feb 2023 12:15:37 +0100 Subject: [PATCH] flyspray: add removed packages script This script goes through all open bugs in the Arch Linux and Community tracker and extracts the packagename from "[$pkgname]" and tries match it to the list of packages in the repo. If there is no match the package is assumed to be dropped from the repo and printed. This script will give false positives, but not enough which requires some extra filtering. --- roles/flyspray/files/removed-packages-bugs.py | 25 +++++++++++++++++++ roles/flyspray/tasks/main.yml | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 roles/flyspray/files/removed-packages-bugs.py diff --git a/roles/flyspray/files/removed-packages-bugs.py b/roles/flyspray/files/removed-packages-bugs.py new file mode 100644 index 000000000..74059bae4 --- /dev/null +++ b/roles/flyspray/files/removed-packages-bugs.py @@ -0,0 +1,25 @@ +#!/usr/bin/python + +from re import search +from subprocess import check_output + +import sqlalchemy + +REGEX = r'\[([A-Za-z0-9_-]+)\]' + +packages = check_output(['/usr/bin/pacman', '-Slq']).decode().splitlines() + +engine = sqlalchemy.create_engine('mysql://localhost/flyspray', connect_args={'read_default_file': '/root/.my.cnf'}) + + +with engine.connect() as conn: + result = conn.execute("SELECT task_id,item_summary from flyspray_tasks where is_closed=0 and project_id in (1,5)") + for row in result: + m = search(REGEX, row['item_summary']) + if not m: + continue + + pkgname = m.group(1) + if pkgname not in packages: + task_id = row['task_id'] + print(f'Removed package {pkgname} found - https://bugs.archlinux.org/task/{task_id}') diff --git a/roles/flyspray/tasks/main.yml b/roles/flyspray/tasks/main.yml index 97ccfa3f0..95427fff7 100644 --- a/roles/flyspray/tasks/main.yml +++ b/roles/flyspray/tasks/main.yml @@ -91,3 +91,6 @@ - name: Start and enable systemd socket service: name=php-fpm7@flyspray.socket state=started enabled=true + +- name: Copy removed package bugs script + copy: src=removed-packages-bugs.py dest=/usr/local/bin/removed-packages-bugs.py mode=0755 owner=root group=root -- GitLab