1 |
commit: eed2243011824ddb3525a75409fae1398a11fb11 |
2 |
Author: Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 9 14:42:21 2017 +0000 |
4 |
Commit: Paweł Hajdan <phajdan.jr <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 9 14:42:21 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/arch-tools.git/commit/?id=eed22430 |
7 |
|
8 |
stabilization-candidates: update for git |
9 |
|
10 |
stabilization-candidates.py | 24 +++++++++++------------- |
11 |
1 file changed, 11 insertions(+), 13 deletions(-) |
12 |
|
13 |
diff --git a/stabilization-candidates.py b/stabilization-candidates.py |
14 |
index d324bdb..2537ab4 100755 |
15 |
--- a/stabilization-candidates.py |
16 |
+++ b/stabilization-candidates.py |
17 |
@@ -20,7 +20,7 @@ if __name__ == "__main__": |
18 |
parser = optparse.OptionParser() |
19 |
parser.add_option("--arch", dest="arch", action="append", help="Gentoo arch to use, e.g. x86, amd64, ... Can be passed multiple times.") |
20 |
parser.add_option("--days", dest="days", type=int, default=30, help="Number of days in the tree after stabilization is possible.") |
21 |
- parser.add_option("--repo", dest="repo", help="Path to portage CVS repository") |
22 |
+ parser.add_option("--repo", dest="repo", help="Path to portage git repository") |
23 |
parser.add_option("--category", dest="category", help="Portage category filter (default is all categories)") |
24 |
parser.add_option("--exclude", dest="exclude", default=".*(kde-base|sci|lisp|perl-core|virtual|gnome|ruby|x11|mono|dotnet|games|xfce|xfburn|mousepad|orage|xfbib|thunar|ristretto|pragha|xfmpc|parole|midori|gigolo|rodent|xfwm|girara|zathura|leechcraft).*", help="Regular expression for excluded packages.") |
25 |
parser.add_option("-o", "--output", dest="output_filename", default="stabilization-candidates.txt", help="Output filename for generated stabilization candidates list.") |
26 |
@@ -116,18 +116,16 @@ if __name__ == "__main__": |
27 |
|
28 |
pv = portage.versions.catsplit(best_candidate)[1] |
29 |
try: |
30 |
- with open(os.path.join(options.repo, cp, 'ChangeLog')) as changelog_file: |
31 |
- regex = '\*%s \((.*)\)' % re.escape(pv) |
32 |
- match = re.search(regex, changelog_file.read()) |
33 |
- if not match: |
34 |
- print('error parsing ChangeLog') |
35 |
- continue |
36 |
- changelog_date = datetime.datetime.strptime(match.group(1), '%d %b %Y') |
37 |
- if now - changelog_date < datetime.timedelta(days=options.days): |
38 |
- print('not old enough') |
39 |
- continue |
40 |
- except IOError as e: |
41 |
- print(e) |
42 |
+ git_log = subprocess.check_output( |
43 |
+ ['git', 'log', '--date-order', '--date=short', '--format=%cd', '%s.ebuild' % pv], |
44 |
+ cwd=os.path.join(options.repo, cp)) |
45 |
+ changelog_date_str = git_log.splitlines()[0].decode('utf-8') |
46 |
+ changelog_date = datetime.datetime.strptime(changelog_date_str, '%Y-%m-%d') |
47 |
+ if now - changelog_date < datetime.timedelta(days=options.days): |
48 |
+ print('not old enough') |
49 |
+ continue |
50 |
+ except subprocess.CalledProcessError as ex: |
51 |
+ print('git error: ' + ex.output) |
52 |
continue |
53 |
|
54 |
keywords = portage.db["/"]["porttree"].dbapi.aux_get(best_candidate, ['KEYWORDS'])[0] |