diff options
author | 2017-07-09 16:42:21 +0200 | |
---|---|---|
committer | 2017-07-09 16:42:21 +0200 | |
commit | eed2243011824ddb3525a75409fae1398a11fb11 (patch) | |
tree | 19dec56a1fa6ff1a37ec2b2fcbd00c2c12c89332 | |
parent | batch-stabilize: use include-arches option (diff) | |
download | arch-tools-eed2243011824ddb3525a75409fae1398a11fb11.tar.gz arch-tools-eed2243011824ddb3525a75409fae1398a11fb11.tar.bz2 arch-tools-eed2243011824ddb3525a75409fae1398a11fb11.zip |
stabilization-candidates: update for git
-rwxr-xr-x | stabilization-candidates.py | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/stabilization-candidates.py b/stabilization-candidates.py index d324bdb..2537ab4 100755 --- a/stabilization-candidates.py +++ b/stabilization-candidates.py @@ -20,7 +20,7 @@ if __name__ == "__main__": parser = optparse.OptionParser() parser.add_option("--arch", dest="arch", action="append", help="Gentoo arch to use, e.g. x86, amd64, ... Can be passed multiple times.") parser.add_option("--days", dest="days", type=int, default=30, help="Number of days in the tree after stabilization is possible.") - parser.add_option("--repo", dest="repo", help="Path to portage CVS repository") + parser.add_option("--repo", dest="repo", help="Path to portage git repository") parser.add_option("--category", dest="category", help="Portage category filter (default is all categories)") 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.") parser.add_option("-o", "--output", dest="output_filename", default="stabilization-candidates.txt", help="Output filename for generated stabilization candidates list.") @@ -116,18 +116,16 @@ if __name__ == "__main__": pv = portage.versions.catsplit(best_candidate)[1] try: - with open(os.path.join(options.repo, cp, 'ChangeLog')) as changelog_file: - regex = '\*%s \((.*)\)' % re.escape(pv) - match = re.search(regex, changelog_file.read()) - if not match: - print('error parsing ChangeLog') - continue - changelog_date = datetime.datetime.strptime(match.group(1), '%d %b %Y') - if now - changelog_date < datetime.timedelta(days=options.days): - print('not old enough') - continue - except IOError as e: - print(e) + git_log = subprocess.check_output( + ['git', 'log', '--date-order', '--date=short', '--format=%cd', '%s.ebuild' % pv], + cwd=os.path.join(options.repo, cp)) + changelog_date_str = git_log.splitlines()[0].decode('utf-8') + changelog_date = datetime.datetime.strptime(changelog_date_str, '%Y-%m-%d') + if now - changelog_date < datetime.timedelta(days=options.days): + print('not old enough') + continue + except subprocess.CalledProcessError as ex: + print('git error: ' + ex.output) continue keywords = portage.db["/"]["porttree"].dbapi.aux_get(best_candidate, ['KEYWORDS'])[0] |