Re: (semi-)automatic unclaim of packages with more than 2 weeks of inactivity (and missing DLAs on www.do)
On 13/02/2020 14:02, Holger Levsen wrote:
> Hi Emilio,
>
> On Mon, Feb 10, 2020 at 04:18:08PM +0100, Emilio Pozuelo Monfort wrote:
>>>>> ERROR: .data or .wml file missing for DLA 2098-1
>>>> It would be useful if this info came with the person who reserved that DLA.
>> Is this script living somewhere? I could take a look at extracting that
>> information from data/DLA/list's git history.
>
> the script is available in https://salsa.debian.org/webmaster-team/cron/merge_requests/1
> and has to be run in the directory of a clone of https://salsa.debian.org/webmaster-team/webwml/
> with "../cron/parts/10-check-advisories --mode DLA", so
> I'm running this in a script:
>
> cd ~/Projects/security-tracker
> git pull
> cd ~/Projects/debian-www/webwml
> git pull
> ../cron/parts/10-check-advisories --mode DLA 2>&1
>
> where ~/Projects/debian-www/cron is on the branch mr-origin-1...
The attached patch allows that script to also print author information when
using a local copy of the security-tracker repo with the --list option.
Otherwise it should fall back to the status quo. The current output is:
ERROR: .data or .wml file missing for DLA 2106-1 (reserved by Roberto C. Sánchez)
ERROR: .data or .wml file missing for DLA 2105-1 (reserved by Christoph Berg)
ERROR: .data or .wml file missing for DLA 2103-1 (reserved by Holger Levsen)
ERROR: .data or .wml file missing for DLA 2101-1 (reserved by Bastian Blank)
ERROR: .data or .wml file missing for DLA 2083-1 (reserved by Chris Lamb)
ERROR: .data or .wml file missing for DLA 2079-1 (reserved by Abhijith PA)
ERROR: .data or .wml file missing for DLA 2053-1 (reserved by Abhijith PA)
ERROR: .data or .wml file missing for DLA 2043-2 (reserved by Thorsten Alteholz)
ERROR: .data or .wml file missing for DLA 2031-1 (reserved by Hugo Lefeuvre)
ERROR: .data or .wml file missing for DLA 2017-2 (reserved by Adrian Bunk)
ERROR: .data or .wml file missing for DLA 2000-1 (reserved by Hugo Lefeuvre)
ERROR: .data or .wml file missing for DLA 1993-1 (reserved by Sylvain Beucler)
ERROR: .data or .wml file missing for DLA 1985-1 (reserved by Chris Lamb)
ERROR: .data or .wml file missing for DLA 1983-1 (reserved by Thijs Kinkhorst)
ERROR: .data or .wml file missing for DLA 1714-2 (reserved by Hugo Lefeuvre)
ERROR: .data or .wml file missing for DLA 1713-2 (reserved by Hugo Lefeuvre)
ERROR: .data or .wml file missing for DLA 1953-2 (reserved by Hugo Lefeuvre)
ERROR: .data or .wml file missing for DLA 1949-1 (reserved by Bastian Blank)
btw I wonder if that script shouldn't leave elsewhere, such as in the webwml
repo or in the security-tracker.
Cheers,
Emilio
From bed41e8f79f1344c08fa8f9787c8bb3dcfcdd500 Mon Sep 17 00:00:00 2001
From: Emilio Pozuelo Monfort <pochu@debian.org>
Date: Wed, 19 Feb 2020 10:38:05 +0100
Subject: [PATCH] 10-check-advisories: optionally fetch author info
---
parts/10-check-advisories | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/parts/10-check-advisories b/parts/10-check-advisories
index a2524c6..6353ccc 100755
--- a/parts/10-check-advisories
+++ b/parts/10-check-advisories
@@ -71,9 +71,18 @@ def main():
for adv in parse_advisories(response.iter_lines(decode_unicode=True)):
check_advisory(args.mode, args.directory, **adv)
else:
- with open(args.list) as text:
- for adv in parse_advisories(text):
- check_advisory(args.mode, args.directory, **adv)
+ try:
+ import git
+ repodir = '/'.join(args.list.split('/')[:-3])
+ repofile = '/'.join(args.list.split('/')[-3:])
+ repo = git.Repo(repodir)
+ for commit, lines in repo.blame('HEAD', repofile):
+ for adv in parse_advisories(lines):
+ check_advisory(args.mode, args.directory, **adv, author=commit.author)
+ except:
+ with open(args.list) as text:
+ for adv in parse_advisories(text):
+ check_advisory(args.mode, args.directory, **adv)
def parse_advisories(stream):
@@ -87,7 +96,7 @@ def parse_advisories(stream):
logging.warning('malformed line: "%s"', line)
-def check_advisory(mode, directory, year, number, errata):
+def check_advisory(mode, directory, year, number, errata, author=None):
if errata is None:
errata = '1'
logging.info('checking %s-%s-%s (%s)', mode, number, errata, year)
@@ -102,8 +111,11 @@ def check_advisory(mode, directory, year, number, errata):
logging.debug('both data and wml files found, without -1')
found = True
if not found:
- logging.error('.data or .wml file missing for %s %s-%s',
- mode, number, errata)
+ author_info = ""
+ if author:
+ author_info = "(reserved by %s)" % (author)
+ logging.error('.data or .wml file missing for %s %s-%s %s',
+ mode, number, errata, author_info)
if __name__ == '__main__':
--
2.20.1
Reply to: