1 |
commit: 4e45c5e9c03cda84ee6ab456ef69ed3b2a75ae43 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Sep 17 06:00:38 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Sep 17 06:00:38 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=4e45c5e9 |
7 |
|
8 |
Add a script to print newest commits for each package |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
pkg-newest-commit.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ |
13 |
1 file changed, 54 insertions(+) |
14 |
|
15 |
diff --git a/pkg-newest-commit.py b/pkg-newest-commit.py |
16 |
new file mode 100755 |
17 |
index 0000000..52372d4 |
18 |
--- /dev/null |
19 |
+++ b/pkg-newest-commit.py |
20 |
@@ -0,0 +1,54 @@ |
21 |
+#!/usr/bin/env python |
22 |
+ |
23 |
+import argparse |
24 |
+import glob |
25 |
+import os |
26 |
+import subprocess |
27 |
+import sys |
28 |
+ |
29 |
+ |
30 |
+def main(argv): |
31 |
+ argp = argparse.ArgumentParser(prog=argv[0]) |
32 |
+ argp.add_argument('package', nargs='*', |
33 |
+ help='List of packages to find (defaults to all)') |
34 |
+ args = argp.parse_args(argv[1:]) |
35 |
+ |
36 |
+ packages = set(args.package) |
37 |
+ if not packages: |
38 |
+ with open('profiles/categories') as f: |
39 |
+ for cat in f: |
40 |
+ packages.update(x.rstrip('/') |
41 |
+ for x in glob.glob('{}/*/'.format(cat.strip()))) |
42 |
+ |
43 |
+ excludes = frozenset([ |
44 |
+ # specify EAPI=0 explicitly |
45 |
+ '4a409a1ecd75d064e8b471f6131bb1feb83c37a8', |
46 |
+ # drop $id |
47 |
+ '61b861acd7b49083dab687e133f30f3331cb7480', |
48 |
+ # initial git commit |
49 |
+ '56bd759df1d0c750a065b8c845e93d5dfa6b549d', |
50 |
+ ]) |
51 |
+ |
52 |
+ os.environ['TZ'] = 'UTC' |
53 |
+ s = subprocess.Popen(['git', 'log', '--date=iso-local', '--name-only', |
54 |
+ '--diff-filter=AM', '--no-renames', |
55 |
+ '--pretty=COMMIT|%H|%cd', '**.ebuild'], |
56 |
+ stdout=subprocess.PIPE) |
57 |
+ for l in s.stdout: |
58 |
+ l = l.decode('utf8').strip() |
59 |
+ if l.startswith('COMMIT|'): |
60 |
+ commit_data = l[7:] |
61 |
+ elif l: |
62 |
+ pkg = '/'.join(l.split('/', 2)[:2]) |
63 |
+ if pkg in packages: |
64 |
+ commit, date = commit_data.split('|') |
65 |
+ if commit in excludes: |
66 |
+ continue |
67 |
+ print('{:.<65} {} {}'.format(pkg + ' ', date, commit)) |
68 |
+ packages.remove(pkg) |
69 |
+ if not packages: |
70 |
+ break |
71 |
+ |
72 |
+ |
73 |
+if __name__ == '__main__': |
74 |
+ sys.exit(main(sys.argv)) |