From fa8f3042488a210c7705c7d0de38df76a9c7e4e6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 18 Aug 2015 18:46:21 -0500 Subject: [PATCH] FS-7988 FS-7989 cleanup scripts --- support-d/utils/filebug.pl | 3 +-- support-d/utils/fixbug.pl | 33 +++++++++++++++++++++++---------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/support-d/utils/filebug.pl b/support-d/utils/filebug.pl index 57cacc35a5..d8b28e9b71 100755 --- a/support-d/utils/filebug.pl +++ b/support-d/utils/filebug.pl @@ -46,8 +46,7 @@ GetOptions( 'user=s' => \$opts{user}, 'pass=s' => \$opts{pass}, 'type=s' => \$opts{type}, - 'debug' => \$opts{debug}, - ) or die "Usage: $0 --debug --from NAME\n"; + ) or die "Usage: $0 -summary -desc ....\n"; if ($opts{components}) { diff --git a/support-d/utils/fixbug.pl b/support-d/utils/fixbug.pl index 958f45af58..ddf6d3cd53 100755 --- a/support-d/utils/fixbug.pl +++ b/support-d/utils/fixbug.pl @@ -2,11 +2,18 @@ use XML::Simple; use Data::Dumper; +use Getopt::Long qw(GetOptions); + +my %opts; + +GetOptions( + 'bug=s' => \$opts{bug}, + 'msg=s' => \$opts{msg} + ) or die "Usage: $0 -bug [-m [edit|]] \n"; - -my $bug = shift || die "missing bug";; -my $url = "https://freeswitch.org/jira/si/jira.issueviews:issue-xml/${bug}/${bug}.xml"; +$opts{bug} || die "missing bug";; +my $url = "https://freeswitch.org/jira/si/jira.issueviews:issue-xml/$opts{bug}/$opts{bug}.xml"; my $cmd; my $prog = `which curl` || `which wget`; my $auto = 1; @@ -28,11 +35,11 @@ my $r = $xs->XMLin($xml); my $sum = $r->{channel}->{item}->{summary}; -if ($ARGV[0] eq "edit") { - shift; +if ($opts{msg} eq "edit") { $auto = 0; - open T, ">/tmp/$bug.tmp"; - print T "$bug #resolve [$sum]\n\n"; + $opts{msg} = undef; + open T, ">/tmp/$opts{bug}.tmp"; + print T "$opts{bug} #resolve [$sum]\n\n"; close T; } @@ -40,11 +47,17 @@ my $args = join(" ", @ARGV); my $gitcmd; if ($auto) { - $gitcmd = "git commit $args -m \"$bug #resolve [$sum]\""; + if ($opts{msg}) { + $opts{msg} =~ s/%s/$sum/; + $opts{msg} =~ s/%b/$bug/; + $gitcmd = "git commit $args -m \"$opts{msg}\""; + } else { + $gitcmd = "git commit $args -m \"$opts{bug} #resolve [$sum]\""; + } } else { - $gitcmd = "git commit $args -t /tmp/$bug.tmp"; + $gitcmd = "git commit $args -t /tmp/$opts{bug}.tmp"; } system $gitcmd; -unlink("/tmp/$bug.tmp"); +unlink("/tmp/$opts{bug}.tmp");