[libvirt] [security-notice PATCH 4/9] scripts: change to update notice files inplace
Ján Tomko
jtomko at redhat.com
Fri Jun 14 11:06:14 UTC 2019
On Mon, May 13, 2019 at 12:52:01PM +0100, Daniel P. Berrangé wrote:
>Instead of printing out a snippet which then has to be cut and pasted
>into the notice file, directly read the template notice file and
>update it in place with new branch/tag info.
>
>Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
>---
> scripts/report-vulnerable-tags.pl | 66 ++++++++++++++++++++++++-------
> 1 file changed, 52 insertions(+), 14 deletions(-)
>
Lots of new TABs in this patch,
>diff --git a/scripts/report-vulnerable-tags.pl b/scripts/report-vulnerable-tags.pl
>index 431a7bf..3a94721 100644
>--- a/scripts/report-vulnerable-tags.pl
>+++ b/scripts/report-vulnerable-tags.pl
>@@ -5,12 +5,37 @@ use warnings;
>
> use Sort::Versions;
>
>-if (int(@ARGV) != 1 && int(@ARGV) != 2) {
>- die "syntax: $0 BROKEN-CHANGESET [FIXED-CHANGESET]\n";
>+if (int(@ARGV) != 1) {
>+ die "syntax: $0 NOTICE.XML\n";
> }
>
>-my $broken = shift @ARGV;
>-my $fixed = shift @ARGV;
>+my $broken;
>+my $fixed;
>+my $notice = shift @ARGV;
>+my @notice;
>+
>+open NOTICE, $notice or die "cannot read $notice: $!";
>+my $master;
>+my $discard;
>+for my $line (<NOTICE>) {
>+ push @notice, $line unless $discard;
>+ if ($line =~ m,<repository>,) {
>+ $discard = 1;
>+ } elsif ($line =~ m,<name>master</name>,) {
>+ $master = 1;
>+ } elsif ($line =~ m,</branch>,) {
>+ $master = 0;
>+ } elsif ($master) {
>+ if ($line =~ m,<change state="(vulnerable|fixed)">([a-zA-Z0-9]+)</change>,) {
>+ if ($1 eq "vulnerable") {
>+ $broken = $2;
>+ } else {
>+ $fixed = $2;
>+ }
>+ }
>+ }
>+}
>+close NOTICE;
>
> # branch name to hash with keys
> # - brokenchanges -> list of commit ids
>@@ -154,7 +179,7 @@ for my $tag (get_tags("--contains", $broken)) {
> }
>
> if (int(@tagbranches) > 1) {
>- print "Tag $tag appears in multiple branches\n";
>+ print "Tag $tag appears in multiple branches\n";
Here the TAB is the only change.
> }
> my $branch = $tagbranches[0];
>
Reviewed-by: Ján Tomko <jtomko at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190614/07b3f459/attachment-0001.sig>
More information about the libvir-list
mailing list