Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/qa-scripts:master commit in: /
Date: Tue, 17 Sep 2019 06:30:57
Message-Id: 1568701828.224b76acde7c9242497e53b1ce72448b9a471f8c.mgorny@gentoo
1 commit: 224b76acde7c9242497e53b1ce72448b9a471f8c
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Sep 17 06:30:28 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 17 06:30:28 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=224b76ac
7
8 pkg-newest-commit.py: Support specifying sep work & git tree
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 pkg-newest-commit.py | 14 +++++++++++---
13 1 file changed, 11 insertions(+), 3 deletions(-)
14
15 diff --git a/pkg-newest-commit.py b/pkg-newest-commit.py
16 index 52372d4..ecd5699 100755
17 --- a/pkg-newest-commit.py
18 +++ b/pkg-newest-commit.py
19 @@ -3,22 +3,29 @@
20 import argparse
21 import glob
22 import os
23 +import os.path
24 import subprocess
25 import sys
26
27
28 def main(argv):
29 argp = argparse.ArgumentParser(prog=argv[0])
30 + argp.add_argument('--git-dir', default='.',
31 + help='Path to repo git clone (used for git log)')
32 + argp.add_argument('--work-dir', default='.',
33 + help='Path to repo working directory (used to grab '
34 + 'package list when no packages specified)')
35 argp.add_argument('package', nargs='*',
36 help='List of packages to find (defaults to all)')
37 args = argp.parse_args(argv[1:])
38
39 packages = set(args.package)
40 if not packages:
41 - with open('profiles/categories') as f:
42 + with open(os.path.join(args.work_dir, 'profiles/categories')) as f:
43 for cat in f:
44 - packages.update(x.rstrip('/')
45 - for x in glob.glob('{}/*/'.format(cat.strip())))
46 + packages.update('/'.join(x.rsplit('/', 3)[-3:-1])
47 + for x in glob.glob(os.path.join(
48 + args.work_dir, cat.strip(), '*/')))
49
50 excludes = frozenset([
51 # specify EAPI=0 explicitly
52 @@ -33,6 +40,7 @@ def main(argv):
53 s = subprocess.Popen(['git', 'log', '--date=iso-local', '--name-only',
54 '--diff-filter=AM', '--no-renames',
55 '--pretty=COMMIT|%H|%cd', '**.ebuild'],
56 + cwd=args.git_dir,
57 stdout=subprocess.PIPE)
58 for l in s.stdout:
59 l = l.decode('utf8').strip()