From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 120F4138330 for ; Thu, 15 Sep 2016 16:11:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 16A55E0944; Thu, 15 Sep 2016 16:11:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DB87EE0944 for ; Thu, 15 Sep 2016 16:11:55 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6F675340906 for ; Thu, 15 Sep 2016 16:11:54 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 79954247E for ; Thu, 15 Sep 2016 16:11:51 +0000 (UTC) From: "Mike Gilbert" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Gilbert" Message-ID: <1473955849.f1b0fc1adfd405ff9ebb5738959ce4966371f936.floppym@gentoo> Subject: [gentoo-commits] proj/chromium-tools:master commit in: / X-VCS-Repository: proj/chromium-tools X-VCS-Files: extract-cves.py X-VCS-Directories: / X-VCS-Committer: floppym X-VCS-Committer-Name: Mike Gilbert X-VCS-Revision: f1b0fc1adfd405ff9ebb5738959ce4966371f936 X-VCS-Branch: master Date: Thu, 15 Sep 2016 16:11:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 9122e84c-44ff-424a-96df-8603b9f609af X-Archives-Hash: 3b7577ff18965264e5ced6cb61bcee36 commit: f1b0fc1adfd405ff9ebb5738959ce4966371f936 Author: Mike Gilbert gentoo org> AuthorDate: Thu Sep 15 16:10:49 2016 +0000 Commit: Mike Gilbert gentoo org> CommitDate: Thu Sep 15 16:10:49 2016 +0000 URL: https://gitweb.gentoo.org/proj/chromium-tools.git/commit/?id=f1b0fc1a extract-cves: simplify output This allows for easy copy/paste into the bugzilla alias field. extract-cves.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/extract-cves.py b/extract-cves.py index 4ccfbf7..a1dc5ee 100755 --- a/extract-cves.py +++ b/extract-cves.py @@ -9,25 +9,13 @@ try: except ImportError: from urllib2 import urlopen -CVE_PATTERN = re.compile('CVE-(\d{4})-(\d+)') +CVE_PATTERN = re.compile('CVE-\d{4}-\d+') def main(argv): response = urlopen(argv[0]) - cves = CVE_PATTERN.findall(str(response.read())) - years = {} - for year, no in cves: - if year not in years: - years[year] = [] - years[year].append(no) - result = [] - for year in sorted(years.keys()): - nos = years[year] - if len(nos) == 1: - result.append('CVE-%s-%s' % (year, nos[0])) - else: - result.append('CVE-%s-{%s}' % (year, ','.join(sorted(nos)))) - print(' '.join(result)) + cves = set(CVE_PATTERN.findall(str(response.read()))) + print(','.join(cves)) return 0