From 58ff427d70d13f03ee831cd9be63a0b1cbf6475e Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 31 Jan 2008 14:46:48 +0000 Subject: (report_bug_to_bugzilla) split it out for readability & reasonable indentation --- perl-install/standalone/drakbug | 88 ++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 45 deletions(-) (limited to 'perl-install/standalone/drakbug') diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug index 63d4868da..365d90442 100755 --- a/perl-install/standalone/drakbug +++ b/perl-install/standalone/drakbug @@ -166,51 +166,7 @@ gtkadd($window->{window}, 0, gtkpack(create_hbox('edge'), gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { system("drakhelp --id drakbug &") }), gtkpack(create_hbox('end'), - gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => sub { - my $p = $package->get_text; - my ($product, $version) = $p =~ /^(.*)-([^-]+-[^-]+(mdk|mdv.*))$/; # FIXME: fragile! - my $app = $comb_app->entry->get_text; - my $component = $app ? - if_(member($app, @all_drakxtools), $app) || $mdk_app->{$app} : - $product; - my $text; - if ($incident) { - my $buffer = $user_descr->get_buffer; - $text = $buffer->get_text($buffer->get_start_iter, $buffer->get_end_iter, 0); - if (!$text) { - err_dialog(N("Warning"), - N("You must type in what you were doing when this bug happens in order to increase the reproductibility of this bug and the odds of fixing it") - . "\n\n" . N("Thanks.")); - return; - } - } - my $rel_data = mandrake_release_info(); - my $rel = standalone::real_version(); - my $options = join('&', - ($product || $version ? - 'cf_rpmpkg=' . join('-', $product, $version) : ()), -'version=' . ($rel_data->{branch} eq 'Devel' ? 'Cooker' : $rel_data->{version} ), - 'component=Core%20Packages', - 'classification=Mandriva%20Linux', - if_($incident, - "short_desc=$prog%20" . ($segfaulted ? 'segfaulted' : 'crashed'), - 'comment=' . uri_escape(qq(The "$prog" program crashed. Drakbug-$rel caught it. - -). ($text || "Please describe what you were doing when it crashed.") . "\n\n" -. ($error ? qq(Backtrace was: -$error) : -qq(If you can, try to run the "$prog" program from a terminal and copy and paste here any error messages and/or backtrace)) - . if_($gdb_trace, qq( -GDB backtrace was: -$gdb_trace)), - ), - ), - ); - print($bugzilla_url . "?" . $options . "\n"); - run_program::raw({ detach => 1, setuid => $parent_uid }, - '/usr/bin/www-browser', "$bugzilla_url?$options"); - } - ), + gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => \&report_bug_to_bugzilla), gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { ugtk2->exit(0) }), )))); @@ -266,4 +222,46 @@ sub get_package { $rpm_package; } +sub report_bug_to_bugzilla { + my $p = $package->get_text; + my ($product, $version) = $p =~ /^(.*)-([^-]+-[^-]+(mdk|mdv.*))$/; # FIXME: fragile! + my $app = $comb_app->entry->get_text; + my $component = $app ? + if_(member($app, @all_drakxtools), $app) || $mdk_app->{$app} : + $product; + my $text; + if ($incident) { + my $buffer = $user_descr->get_buffer; + $text = $buffer->get_text($buffer->get_start_iter, $buffer->get_end_iter, 0); + if (!$text) { + err_dialog(N("Warning"), + N("You must type in what you were doing when this bug happens in order to increase the reproductibility of this bug and the odds of fixing it") + . "\n\n" . N("Thanks.")); + return; + } + } + my $rel_data = mandrake_release_info(); + my $rel = standalone::real_version(); + my $options = join('&', + ($product || $version ? 'cf_rpmpkg=' . join('-', $product, $version) : ()), + 'version=' . ($rel_data->{branch} eq 'Devel' ? 'Cooker' : $rel_data->{version} ), + 'component=Core%20Packages', + 'classification=Mandriva%20Linux', + if_($incident, + "short_desc=$prog%20" . ($segfaulted ? 'segfaulted' : 'crashed'), + 'comment=' . uri_escape(qq(The "$prog" program crashed. Drakbug-$rel caught it. + +). ($text || "Please describe what you were doing when it crashed.") . "\n\n" + . ($error ? qq(Backtrace was: +$error) : + qq(If you can, try to run the "$prog" program from a terminal and copy and paste here any error messages and/or backtrace)) + . if_($gdb_trace, qq( +GDB backtrace was: +$gdb_trace)), + ), + ), + ); + print($bugzilla_url . "?" . $options . "\n"); + run_program::raw({ detach => 1, setuid => $parent_uid }, '/usr/bin/www-browser', "$bugzilla_url?$options"); +} -- cgit v1.2.1