1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
#!/usr/bin/perl
# Drak Bug Report
# Copyright (C) 2002-2006 Mandriva (daouda at mandriva dot com)
# Stew Benedict (sbenedict at mandriva dot com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
use strict;
use diagnostics;
use lib qw(/usr/lib/libDrakX);
use any;
use standalone;
use common;
use mygtk2 qw(gtknew);
use ugtk2 qw(:all);
use Config;
use URI::Escape;
my $prog;
my $incident = 0;
my ($table, $comb_app, $com_app, $button_pkg, $package, $distrocode, $error);
my $i;
foreach (@ARGV) {
next unless defined $_;
$i++;
/^--error$/ and do { $error = splice(@ARGV, $i, 1) };
/^--report$/ and $prog = splice(@ARGV, $i, 1);
/^--incident$/ and do { $incident = 1; $prog = splice(@ARGV, $i, 1) };
}
$ugtk2::wm_icon = 'drakbug-16';
my $window = ugtk2->new(N("Mandriva Linux Bug Report Tool"), center => 1);
$window->{rwindow}->set_border_width(5);
$window->{window}->signal_connect("delete_event", sub { ugtk2->exit(0) });
my $mdk_app = {
N("Mandriva Linux Control Center") => 'drakconf',
N("First Time Wizard") => 'drakfw',
N("Synchronization tool") => 'draksync',
N("Standalone Tools") => 'drakxtools',
"harddrake" => 'harddrake2',
N("Mandriva Online") => 'mdkonline',
N("Mandriva Online") => 'mdkapplet',
N("Remote Control") => 'rfbdrake',
N("Software Manager") => 'rpmdrake',
N("Windows Migration tool") => 'transfugdrake',
N("Configuration Wizards") => 'wizdrake',
};
my @generic_tool = keys %$mdk_app;
my @all_drakxtools = qw(adduserdrake diskdrake drakautoinst drakboot drakbug drakclock drakfloppy drakfont draksec drakxservices draksplash drakxtools drakxtv logdrake scannerdrake);
push @generic_tool, @all_drakxtools, qw(MandrivaUpdate drakbackup drakconnect drakfirewall drakhosts drakmenustyle draknfs draksambashare drakgw drakroam drakvpn keyboarddrake msec mousedrake net_monitor printerdrake urpmi userdrake XFdrake);
my $kernel_release = chomp_(`uname -r`);
my $mandrake_release = chomp_(cat_('/etc/mandrakelinux-release'));
#- unused for now
#- (my $mandrake_version) = $mandrake_release =~ /(\d+\.\d+)/;
if ($mandrake_release =~ /(official|community)/i) {
$distrocode = $mandrake_release;
$distrocode =~ s/^.*?(\d+\.\d+) \((\w+)\).*$/$1-\l$2/;
} else {
$distrocode = "cooker";
}
my $bugzilla_url = 'http://qa.mandriva.com/enter_bug.cgi';
my $wizard_name = "Bugzilla";
$table = create_packtable({ col_spacings => 5, row_spacings => 10 },
[ gtknew('Label_Left', text => N("Select Mandriva Tool:")), $comb_app = Gtk2::ComboBox->new_text, $comb_app->set_wrap_width(3) ],
[ gtknew('Label_Left', text => N("or Application Name\n(or Full Path):")),
gtkpack_(Gtk2::HBox->new(0, 5),
1, $com_app = gtkset_editable(Gtk2::Entry->new, 1),
0, $button_pkg = Gtk2::Button->new(N("Find Package")),
) ],
[ gtknew('Label_Left', text => N("Package: ")), $package = Gtk2::Entry->new_with_text("...") ], # complain on gtk-perl@ml
[ gtknew('Label_Left', text => N("Kernel:")), gtkset_editable(Gtk2::Entry->new_with_text($kernel_release), 0) ]
);
$comb_app->set_popdown_strings("", uniq(sort(@generic_tool), if_($prog, $prog)));
$comb_app->set_text("");
gtkadd($window->{window},
gtkpack_(Gtk2::VBox->new(0, 5),
0, gtknew('Title1', label => $mandrake_release),
1, create_scrolled_window(
gtknew('TextView',
text => formatAlaTeX(
join("\n\n",
if_($prog, $error ?
N("The \"%s\" program has crashed with the following error:", $prog)
. join("\n\n", "\n", split("\n", $error), '')
: N("The \"%s\" program has crashed.", $prog)
),
N("To submit a bug report, click on the report button. \nThis will open a web browser window on %s where you'll find a form to fill in. The information displayed above will be transferred to that server. \nThings useful to include in your report are the output of lspcidrake -v, kernel version, and /proc/cpuinfo.", $wizard_name)))), "left"),
0, gtkadd($table),
0, gtkpack(Gtk2::HSeparator->new),
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 $rel = standalone::real_version();
my $options = join('&',
($product || $version ?
'cf_rpmpkg=' . join('-', $product, $version) : ()),
'component=Core%20Packages',
'classification=Mandriva%20Linux',
if_($prog,
"short_desc=$prog%20crashed",
'comment=' . uri_escape(qq(The "$prog" program crashed. Drakbug-$rel catched it.
Please describe what you were doing when it crashed.
) . ($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)),
),
),
);
print($bugzilla_url . "?" . $options . "\n");
require run_program;
run_program::raw({ detach => 1 }, '/usr/bin/www-browser', "$bugzilla_url?$options");
}
),
gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub { ugtk2->exit(0) }),
))));
if (defined $prog) {
update_app($prog);
$comb_app->set_text($prog);
}
$comb_app->entry->signal_connect('changed', sub {
my $text = $comb_app->entry->get_text;
$text and update_app($text);
});
$button_pkg->signal_connect('clicked', sub {
$comb_app->set_text("");
my $pkg_name = get_package($com_app->get_text);
$package->set_text($pkg_name);
});
$window->{window}->show_all;
$window->main;
ugtk2->exit(0);
sub update_app {
my ($text) = @_;
my $app_choice;
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
if (member($text, @all_drakxtools) || $text eq N("Standalone Tools")) {
$app_choice = chomp_(`rpm -q drakxtools`);
} elsif (exists($mdk_app->{$text})) {
$app_choice = get_package($mdk_app->{$text});
} else {
$app_choice = get_package($text);
if (my $tool = { reverse %$mdk_app }->{$text}) {
$prog = $tool;
}
}
$app_choice ? $package->set_text($app_choice) : $package->set_text(N("Not installed"));
}
my %packages;
sub get_package {
my ($executable) = @_;
my ($rpm_package, $which_app);
$rpm_package = $packages{$executable};
if (!defined $rpm_package) {
local $ENV{PATH} = "$ENV{PATH}:/sbin:/usr/sbin";
$which_app = chomp_(`which '$executable' 2> /dev/null`);
# deush, rpm can takes some time aka it'll sleeps if something has opened rpm db !
$rpm_package = $which_app eq "" ? N("Package not installed") : common::to_utf8(chomp_(`rpm -qf '$which_app' 2>&1`));
$packages{$executable} = $rpm_package;
}
$rpm_package;
}
|