summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakbug
diff options
context:
space:
mode:
authorStew Benedict <stewb@mandriva.org>2003-09-15 18:47:59 +0000
committerStew Benedict <stewb@mandriva.org>2003-09-15 18:47:59 +0000
commit78318af8dad1a7518cefaa5595bee409ac066b03 (patch)
tree2970fa3df40ae617f96fca884287e5ac7b779746 /perl-install/standalone/drakbug
parentc455a6d485e203b47426021b527df278482e9dc1 (diff)
downloaddrakx-backup-do-not-use-78318af8dad1a7518cefaa5595bee409ac066b03.tar
drakx-backup-do-not-use-78318af8dad1a7518cefaa5595bee409ac066b03.tar.gz
drakx-backup-do-not-use-78318af8dad1a7518cefaa5595bee409ac066b03.tar.bz2
drakx-backup-do-not-use-78318af8dad1a7518cefaa5595bee409ac066b03.tar.xz
drakx-backup-do-not-use-78318af8dad1a7518cefaa5595bee409ac066b03.zip
Updates for stable release bug submission to anthill (vdanen)
Diffstat (limited to 'perl-install/standalone/drakbug')
-rwxr-xr-xperl-install/standalone/drakbug219
1 files changed, 201 insertions, 18 deletions
diff --git a/perl-install/standalone/drakbug b/perl-install/standalone/drakbug
index c05cee7d0..caacf1297 100755
--- a/perl-install/standalone/drakbug
+++ b/perl-install/standalone/drakbug
@@ -27,9 +27,17 @@ use ugtk2 qw(:all);
use Config;
my $bugzilla_url = "http://drakbug.mandrakesoft.com";
-my $version = "0.9.0";
+my $help_url = "http://qa.mandrakesoft.com";
+my $version = "0.9.1";
my $prog;
my $incident = 0;
+my $stable_release = 0;
+my $wizard_name = "Bugzilla wizard";
+my $bugdesc;
+my $bugwrite;
+my $winwidth;
+my $winht;
+my $upload_info = N("To submit a bug report, click on the button report.\nThis will open a web browser window on %s\n where you'll find a form to fill in. The information displayed above will be \ntransferred to that server.", $bugzilla_url);
foreach (@ARGV) {
next unless defined $_;
@@ -63,27 +71,93 @@ my @all_drakxtools = @{ $mdk_app->{N("Standalone Tools")} };
push(@generic_tool,@all_drakxtools);
my $kernel_release = chomp_(`uname -r`);
+my $mandrake_release = mandrake_release();
+if ($mandrake_release !~ /Cooker/) {
+ my @release_list = split(' ', $mandrake_release);
+ $mandrake_release = join(" ", $release_list[0], $release_list[1], $release_list[3]);
+ $bugzilla_url = "http://bugs.mandrakelinux.com/drakbug.php?request=1";
+ $help_url = "http://bugs.mandrakelinux.com/faq.php";
+ $stable_release = 1;
+ $wizard_name = "Anthill";
+ $winwidth = 600;
+ $winht = 460;
+ $upload_info = N("To submit a bug report, click the report button, which will open your default browser\nto Anthill where you will be able to upload the above information as a bug report.");
+}
+
+my $table;
+my $app_box;
+my $comb_app;
+my $button_pkg;
+my $package;
+my $extra_data;
+my $extra_text;
+my $summary;
+my $textview;
+my $kversion;
+my $cpuinfo;
+my $lspci;
-my $table = create_packtable({ col_spacings => 5, row_spacings => 10 },
- [ new Gtk2::Label(N("Application:")), my $comb_app = Gtk2::OptionMenu->new ],
- [ new Gtk2::Label(N("Package: ")), my $package = Gtk2::Entry->new_with_text("...") ], # complain on gtk-perl@ml
+if ($stable_release == 0) {
+ $table = create_packtable({ col_spacings => 5, row_spacings => 10 },
+ [ new Gtk2::Label(N("Application:")), $comb_app = Gtk2::OptionMenu->new ],
+ [ new Gtk2::Label(N("Package: ")), $package = Gtk2::Entry->new_with_text("...") ], # complain on gtk-perl@ml
[ Gtk2::Label->new(N("Kernel:")), gtkset_editable(Gtk2::Entry->new_with_text($kernel_release), 0) ],
- [ Gtk2::Label->new(N("Release: ")), gtkset_editable(Gtk2::Entry->new_with_text(mandrake_release()), 0) ]
+ [ Gtk2::Label->new(N("Release: ")), gtkset_editable(Gtk2::Entry->new_with_text($mandrake_release), 0) ]
);
-$comb_app->set_popdown_strings("", sort(@generic_tool));
+ $comb_app->set_popdown_strings("", sort(@generic_tool));
+} else {
+ $table = create_packtable({ col_spacings => 5, row_spacings => 5 },
+ [Gtk2::Label->new(N("Application Name\nor Full Path:")),
+ gtkpack_(new Gtk2::HBox(0,5),
+ 1, $comb_app = gtkset_editable(Gtk2::Entry->new, 1),
+ 0, $button_pkg = Gtk2::Button->new(N("Find Package")),
+ )],
+ [ Gtk2::Label->new(N("Package: ")), $package = gtkset_editable(Gtk2::Entry->new_with_text("..."), 0) ],
+ [ Gtk2::Label->new(N("Release: ")), gtkset_editable(Gtk2::Entry->new_with_text($mandrake_release), 0) ],
+ [ Gtk2::Label->new(N("Summary: ")), $summary = gtkset_editable(Gtk2::Entry->new_with_text(""), 1) ]
+ );
+
+ $textview = new Gtk2::TextView;
+ $textview->set_wrap_mode("GTK_WRAP_WORD");
+ my $scrolled_window = Gtk2::ScrolledWindow->new(undef, undef);
+ $scrolled_window->set_policy('automatic', 'automatic');
+ $scrolled_window->set_border_width(10);
+ $scrolled_window->add_with_viewport($textview);
+ $scrolled_window->set_size_request($winwidth-50, 180);
+ my $buffer = $textview->get_buffer;
+ my $iter = $buffer->get_iter_at_offset(0);
+ $buffer->insert($iter, N("YOUR TEXT HERE"));
+
+ $extra_data = gtkpack_(new Gtk2::VBox(0,1),
+ 0, Gtk2::Label->new(N("Bug Description/System Information")),
+ 1, $scrolled_window,
+ 0, gtkpack_(new Gtk2::HBox(0,20),
+ 0, new Gtk2::HBox(0,0),
+ 1, $kversion = new Gtk2::CheckButton(N("Submit kernel version")),
+ 1, $cpuinfo = new Gtk2::CheckButton(N("Submit cpuinfo")),
+ 1, $lspci = new Gtk2::CheckButton(N("Submit lspci")),
+ ),
+ 0, new Gtk2::HSeparator,
+ );
+ $kversion->set_active(1);
+ $cpuinfo->set_active(1);
+ $lspci->set_active(1);
+}
gtkadd(
$window->{window},
gtkpack2__(my $vbx = new Gtk2::VBox(0,5),
gtkadd($table),
+ gtkadd($extra_data),
gtkpack(new Gtk2::HBox(0,0),
- gtkpack(gtkset_justify(new Gtk2::Label(N("\n\nTo submit a bug report, click on the button report.\nThis will open a web browser window on https://drakbug.mandrakesoft.com\n where you'll find a form to fill in.The information displayed above will be \ntransferred to that server\n\n")), "left")),
+ gtkpack(gtkset_justify(new Gtk2::Label($upload_info), "left")),
),
gtkpack(new Gtk2::HSeparator),
gtkpack_(Gtk2::HBox->new(0,0),
- 0, gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { system("$ENV{BROWSER} https://qa.mandrakesoft.com &") }),
+ 0, gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub { system("$ENV{BROWSER} $help_url &") }),
1, Gtk2::Label->new(""),
- 0, gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => sub {
+ 0, gtksignal_connect(Gtk2::Button->new(N("Report")), clicked => sub {
+ if ($stable_release == 0) {
my $options = "mdkbugreport=1";
$options .= "&incident=1" if $incident;
my $p = $package->get_text;
@@ -93,19 +167,32 @@ gtkadd(
$options .= "&version=$r";
print($bugzilla_url . "?" . $options . "\n");
connect_bugzilla($bugzilla_url."?".$options);
- }
- ),
+ } else {
+ # anthill variant - we'll create a text file, then connect to upload
+ my $check = write_anthill_file();
+ connect_bugzilla($bugzilla_url) if !$check;
+ }
+ }
+ ),
0, gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { ugtk2->exit(0) }),
),
),
);
-if (defined $prog) {
- update_app($prog);
- $comb_app->entry->set_text($prog);
-};
+if ($stable_release == 0) {
+ if (defined $prog) {
+ update_app($prog);
+ $comb_app->entry->set_text($prog);
+ };
+ $comb_app->entry->signal_connect('changed', sub { update_app($comb_app->entry->get_text) });
+} else {
+ $window->{window}->set_size_request($winwidth, $winht);
+ $button_pkg->signal_connect('clicked', sub {
+ my $pkg_name = get_pkg_name($comb_app->get_text);
+ $package->set_text($pkg_name);
+ });
+}
-$comb_app->entry->signal_connect('changed', sub { update_app($comb_app->entry->get_text) });
$window->{window}->show_all;
$window->main;
ugtk2->exit(0);
@@ -147,14 +234,38 @@ sub get_package {
$rpm_package;
}
+sub get_pkg_name {
+ my ($executable) = @_;
+ my $which_app = chomp_(`which '$executable' 2> /dev/null`);
+ my $rpm_package;
+ my @tmp;
+ if ($which_app eq "") {
+ $rpm_package = chomp_(`rpm -q '$executable' --qf '%{NAME}' 2>&1`);
+ } else {
+ $rpm_package = chomp_(`rpm -qf '$which_app' --qf '%{NAME}' 2>&1`);
+ }
+ $rpm_package = "" if $rpm_package =~ /not installed$/;
+ if ($rpm_package eq "") {
+ $rpm_package = chomp_(`rpm -qf '$executable' --qf '%{NAME}' 2>&1`);
+ }
+ if ($rpm_package =~ /^kernel/) {
+ @tmp = split(/-2/, $rpm_package);
+ $rpm_package = $tmp[0];
+ }
+ $rpm_package = N("NOT FOUND") if $rpm_package eq "";
+ $rpm_package;
+}
+
sub parse_release() {
(mandrake_release() =~ /release\s(\S+\s\(.*\))/)[0];
}
sub connect_bugzilla {
my ($url) = @_;
- my $_w = create_dialog(N("Please wait"), N("connecting to Bugzilla wizard ..."));
- sleep(3);
+ if (!$stable_release) {
+ my $_w = create_dialog(N("Please wait"), N("connecting to %s ...", $wizard_name));
+ sleep(3);
+ }
exec $ENV{BROWSER},$url if exists $ENV{BROWSER};
my @browser = qw(mozilla konqueror galeon);
foreach (@browser) {
@@ -162,3 +273,75 @@ sub connect_bugzilla {
}
create_dialog(N("Error"), N("No browser available! Please install one"));
}
+
+sub write_anthill_file() {
+ my $buffer = $textview->get_buffer;
+ my $siter = $buffer->get_start_iter;
+ my $eiter = $buffer->get_end_iter;
+ $bugdesc = $buffer->get_text($siter, $eiter, 0);
+
+ #- create anthill upload file in specified format
+ local *F;
+ open(F, "> /tmp/drakbug.report") or return 1;
+ print F "--- BEGIN DRAKBUG REPORT ---\n";
+ print F "%product: $mandrake_release\n";
+ my $version = arch();
+ $version = "x86" if $version =~ /^i.86/;
+ print F "%version: $version\n";
+ my $pkg_name = $package->get_text;
+ if ($pkg_name eq "..." || $pkg_name eq "") {
+ my $_w = create_dialog(N("Error"), N("Please enter a package name."));
+ return 1;
+ }
+ print F "%component: $pkg_name\n";
+ my $summary_text = $summary->get_text;
+ if ($summary_text eq "") {
+ my $_w = create_dialog(N("Error"), N("Please enter summary text."));
+ return 1;
+ }
+
+ print F "%summary: $summary_text\n";
+ print F "%description:\n";
+
+ #- gave me fits wanted to wrap what was wrapped in the GUI
+ #- plus include user's \n
+ my @buglist = split("\n", $bugdesc);
+ foreach my $bugdesc (@buglist) {
+ if (length($bugdesc) > 77) {
+ $bugwrite = $bugdesc;
+ select(F);
+ local $~ = "PFORMAT";
+ write F;
+ select(STDOUT);
+ $bugwrite = '';
+ } else {
+ print F " $bugdesc\n";
+ }
+ }
+
+ print F "-" x 80 . "\n";
+ if ($kversion->get_active == 1) {
+ $bugdesc = "Kernel: $kernel_release\n";
+ $bugdesc .= "Uname: " . `uname -a` . "\n";
+ print F $bugdesc;
+ }
+ if ($cpuinfo->get_active == 1) {
+ $bugdesc = "Cpuinfo: \n";
+ $bugdesc .= cat_("/proc/cpuinfo");
+ print F $bugdesc;
+ }
+ if ($lspci->get_active == 1) {
+ $bugdesc = "Lspci Output:\n";
+ $bugdesc .= `lspci`;
+ print F $bugdesc;
+ }
+ print F "--- END DRAKBUG REPORT ---\n";
+ close F or return 1;
+ return 0
+}
+
+format PFORMAT =
+~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+$bugwrite
+.
+