[Fedora-security-commits] fedora-security/tools add-cve-bug, 1.1.2.2, 1.1.2.3 add-tracking-bugs, 1.2.2.1, 1.2.2.2

fedora-security-commits at redhat.com fedora-security-commits at redhat.com
Mon Nov 19 09:10:40 UTC 2007


Author: lkundrak

Update of /cvs/fedora/fedora-security/tools
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv19685

Modified Files:
      Tag: lkundrak-tools-ng
	add-cve-bug add-tracking-bugs 
Log Message:
Fix tempfile handling, add comments to parent bugs.



Index: add-cve-bug
===================================================================
RCS file: /cvs/fedora/fedora-security/tools/Attic/add-cve-bug,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- add-cve-bug	7 Nov 2007 16:58:50 -0000	1.1.2.2
+++ add-cve-bug	19 Nov 2007 09:10:37 -0000	1.1.2.3
@@ -26,7 +26,6 @@
 ';
 
 use XMLRPC::Lite;
-use File::Temp ('tempfile');
 use Getopt::Long;
 use Data::Dumper;
 


Index: add-tracking-bugs
===================================================================
RCS file: /cvs/fedora/fedora-security/tools/add-tracking-bugs,v
retrieving revision 1.2.2.1
retrieving revision 1.2.2.2
diff -u -r1.2.2.1 -r1.2.2.2
--- add-tracking-bugs	7 Nov 2007 16:58:50 -0000	1.2.2.1
+++ add-tracking-bugs	19 Nov 2007 09:10:37 -0000	1.2.2.2
@@ -103,7 +103,7 @@
 		'bug_id'	=> $bugs,
 		'bug_status'	=> [],
 		'column_list'	=> $columns,
-	}, $username, $password);
+	}, ($dryrun ? () : ($username, $password)));
 
 	my $result = $call->result
 		or die $call->faultstring;
@@ -115,15 +115,15 @@
 # Add blockers (unless dryrun) to a bug
 sub add_blockers
 {
+	return 0 if $dryrun;
+
 	my $bug = shift or die 'No blocker!';
 	my $parents = shift or die 'No bug to block!';
 
-	return 0 if $dryrun;
-
 	my $call = $bugzilla_rpc->call('bugzilla.updateDepends', $bug, {
 		'blocked'	=> $parents,
 		'action'	=> 'add',
-	}, $username, $password);
+	}, $username, $password, 1);
 
 	my $result = $call->result
 		or die $call->faultstring;
@@ -132,6 +132,23 @@
 	return undef;
 }
 
+# Add private comment (unless dryrun) to a bug
+sub add_private_comment
+{
+	return 0 if $dryrun;
+
+	my $bug = shift or die 'No bug!';
+	my $comment = shift or die 'No comment!';
+
+	my $call = $bugzilla_rpc->call('bugzilla.addComment', $bug, $comment, $username, $password, 1);
+
+	my $result = $call->result
+		or die $call->faultstring;
+
+	print STDERR 'Bugzilla answered to updateComment: '.Dumper($result) if $debug;
+	return undef;
+}
+
 # Parse command line options:
 
 my %options;
@@ -154,7 +171,7 @@
 $options{'bugs'} or die 'bugs argument is mandatory';
 @bugs = split (/,/, $options{'bugs'});
 
-$options{'versions'} or die 'bugs argument is mandatory';
+$options{'versions'} or die 'versions argument is mandatory';
 @versions = split (/,/, $options{'versions'});
 $versions{$_} or die "Invalid version: $_" foreach (@versions);
 
@@ -211,6 +228,8 @@
 
 # File for each version
 
+my $comment = "Created Fedora tracking bugs for $component:\n\n";
+
 foreach my $version (@versions) {
 	my %bug = %bug_tmpl;
 	$bug{'short_desc'} .= " [$versions{$version}]";
@@ -218,6 +237,14 @@
 
 	print Dumper (\%bug) if $debug;
 	my $bug_id = file_bug (\%bug);
-	print $bug{'version'}.": $bug_id\n";
 	add_blockers ($bug_id, \@bugs);
+	$comment .= $bug{'version'}.": bug #$bug_id\n";
 }
+
+# Add comment to original bugs
+
+foreach my $bug (@bugs) {
+	add_private_comment ($bug, $comment);
+}
+
+print STDERR $comment;




More information about the Fedora-security-commits mailing list