1
1
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2025-01-18 08:06:16 +01:00
infrastructure/roles/flyspray/files/removed-packages-bugs.py
Jelle van der Waa 12c76f0da7 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.
2023-02-21 20:20:33 +00:00

26 lines
785 B
Python

#!/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}')