]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7988 FS-7989 add debug mode to fixbug and filebug and add -project to filebug...
authorAnthony Minessale <anthm@freeswitch.org>
Wed, 19 Aug 2015 18:09:33 +0000 (13:09 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Wed, 19 Aug 2015 18:09:33 +0000 (13:09 -0500)
support-d/utils/filebug.pl
support-d/utils/fixbug.pl

index d8b28e9b713c082c5b06927f47b6483de5fb0e37..18a8135984d85f25906963060e78ba4930250e49 100755 (executable)
@@ -39,6 +39,7 @@ my $hashtxt = `git log -1 --oneline 2>/dev/null`;
 my ($hash) = split(" ", $hashtxt);
 
 GetOptions(
+          'project=s' => \$opts{project},
           'summary=s' => \$opts{summary},
           'desc=s' => \$opts{desc},
           'components=s' => \$opts{components},
@@ -46,9 +47,12 @@ GetOptions(
           'user=s' => \$opts{user},
           'pass=s' => \$opts{pass},
           'type=s' => \$opts{type},
-         ) or die "Usage: $0 -summary <summary> -desc <desc> ....\n";
+          'debug' => \$opts{debug},
+         ) or die "Usage: $0 -summary <summary> -desc <desc> [-debug] ....\n";
 
 
+$opts{project} or $opts{project} = "FS";
+
 if ($opts{components}) {
   $opts{components_array} = [map {{name => $_}} split(" ", $opts{components})];
 } else {
@@ -63,12 +67,18 @@ if (!$opts{user}) {
   $opts{user} = getuser();
 }
 
-if (!$opts{pass}) {
+if (!$opts{pass} && !$opts{debug}) {
   $opts{pass} = getpass();
 }
 
-my $jira = JIRA::REST->new('https://freeswitch.org/jira', $opts{user}, $opts{pass}) or die "login incorrect:";
-my $issue = $jira->GET("/issue/FS-7985") or die "login incorrect:";
+my $jira;
+my $issue;
+
+if (!$opts{debug}) {
+    $jira = JIRA::REST->new('https://freeswitch.org/jira', $opts{user}, $opts{pass}) or die "login incorrect:";
+    $issue = $jira->GET("/issue/FS-7985") or die "login incorrect:";
+}
+
 #print $issue->{key};
 #exit;
 
@@ -96,29 +106,23 @@ if (!$opts{hash}) {
   }
 }
 
-
-
-my $issue = $jira->POST('/issue', undef, 
-                       { 
-                           fields => {
-                               project   => { key => 'FS' },
-                               issuetype => { name => $opts{type} },
-                               summary   => $opts{summary},
-                               description => $opts{desc},
-                               customfield_10024 => $opts{hash},
-                               customfield_10025 => $opts{hash},
-                               components => $opts{components_array}
-                           },
-                       }) or die "Issue was not created:";
-
-
-print "Issue Posted: " . $issue->{key};
-
-
-__END__
-
-my $jira = JIRA::REST->new('https://freeswitch.org/jira', $user, $pass);
-
-#$issue = $jira->GET("/issue/FS-7985");
-#print Dumper $issue;
+my $input = { 
+    fields => {
+       project   => { key => $opts{project} },
+       issuetype => { name => $opts{type} },
+       summary   => $opts{summary},
+       description => $opts{desc},
+       customfield_10024 => $opts{hash},
+       customfield_10025 => $opts{hash},
+       components => $opts{components_array}
+    },
+};
+
+if ($opts{debug}) {
+    print Dumper \%opts;
+    print Dumper $input;
+} else {
+    $issue = $jira->POST('/issue', undef, $input) or die "Issue was not created:";
+    print "Issue Posted: " . $issue->{key};
+}
 
index a445871806f379785fece2c47f185dac8631666c..3e82dda01d5cdd6caa7090ae3c53b35b2bba7a98 100755 (executable)
@@ -8,11 +8,15 @@ my %opts;
 
 GetOptions(
     'bug=s' => \$opts{bug},
-    'msg=s' => \$opts{msg}
-    ) or die "Usage: $0 -bug <bug-id> [-m [edit|<msg>]] <files>\n";
+    'msg=s' => \$opts{msg},
+    'debug' => \$opts{debug},
+    'append=s' => \$opts{append},
+    'comment=s' => \$opts{comment}
+    ) or die "Usage: $0 -bug <bug-id> [-m [edit|<msg>]] [-append <msg>] [-debug] <files>\n";
 
 
-$opts{bug} || die "missing bug";;
+$opts{bug} or $opts{bug} = shift;
+
 my $url = "https://freeswitch.org/jira/si/jira.issueviews:issue-xml/$opts{bug}/$opts{bug}.xml";
 my $cmd;
 my $prog = `which curl` || `which wget`;
@@ -46,18 +50,30 @@ if ($opts{msg} eq "edit") {
 my $args = join(" ", @ARGV);
 my $gitcmd;
 
+if ($opts{append}) {
+    $opts{append} = " " . $opts{append};
+}
+
+if ($opts{comment}) {
+    $opts{append} .= " #comment " . $opts{comment};
+}
+
 if ($auto) {
     if ($opts{msg}) {
        $opts{msg} =~ s/%s/$sum/;
        $opts{msg} =~ s/%b/$opts{bug}/;
-       $gitcmd = "git commit $args -m \"$opts{msg}\"";
+       $gitcmd = "git commit $args -m \"$opts{msg}$opts{append}\"";
     } else {
-       $gitcmd = "git commit $args -m \"$opts{bug} #resolve [$sum]\"";
+       $gitcmd = "git commit $args -m \"$opts{bug} #resolve [$sum]$opts{append}\"";
     }
 } else {
   $gitcmd = "git commit $args -t /tmp/$opts{bug}.tmp";
 }
 
-system $gitcmd;
+if ($opts{debug}) {
+    print "CMD: $gitcmd\n";
+} else {
+    system $gitcmd;
+}
 
 unlink("/tmp/$opts{bug}.tmp");