Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add script to reserve ELA entry
Signed-off-by: Utkarsh Gupta <utkarsh@debian.org>
- Loading branch information
1 parent
ee65f9f
commit 614f131
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #! /usr/bin/ruby | ||
|
|
||
| ela = ARGV[0] | ||
| package = version = nil | ||
| cve = [] | ||
| fix = "" | ||
|
|
||
| file = File.read('ela') | ||
| file.each_line do |line| | ||
| if line =~ /package/ | ||
| package = line.split(': ', 2).last.chomp | ||
| end | ||
|
|
||
| if line =~ /version/ | ||
| version = line.split(': ', 2).last.chomp | ||
| end | ||
|
|
||
| cve << line.scan(/CVE-\d+-\d+/) | ||
| end | ||
|
|
||
| cve.flatten! | ||
| cve.uniq! | ||
|
|
||
| size = cve.length | ||
|
|
||
| if size == 1 | ||
| fix = "[#{cve[0]}](https://security-tracker.debian.org/tracker/#{cve[0]})" | ||
| elsif size == 2 | ||
| fix = "[#{cve[0]}](https://security-tracker.debian.org/tracker/#{cve[0]}) " \ | ||
| "and [#{cve[1]}](https://security-tracker.debian.org/tracker/#{cve[1]})" | ||
| elsif size > 2 | ||
| 0.upto size-2 do |i| | ||
| fix << "[#{cve[i]}](https://security-tracker.debian.org/tracker/#{cve[i]}), " | ||
| end | ||
| fix << "and [#{cve[size-1]}](https://security-tracker.debian.org/tracker/#{cve[size-1]})" | ||
| else | ||
| puts "Some error occured. 0 elements in CVE array." | ||
| end | ||
|
|
||
| sentence1 = "- Issued [ELA #{ela}-1](), fixing #{fix}, for " \ | ||
| "[#{package}](https://tracker.debian.org/pkg/#{package}). " | ||
| sentence2 = " For Debian 8 Jessie, these problems have been fixed in version #{version}." | ||
|
|
||
| puts sentence1 | ||
| puts sentence2 |