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
199
200
201
202
203
204
205
|
#!/usr/bin/perl
# Drak Bug Report
# C$opyright (C) 2002 MandrakeSoft (daouda@mandrakesoft.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 lib qw(/usr/lib/libDrakX);
use standalone;
use interactive;
use MDK::Common;
require Gtk;
require Gtk::Gdk::ImlibImage;
use my_gtk qw(:helpers :wrappers :ask);
use Config;
Gtk::Gdk::ImlibImage->init;
my $in = 'interactive'->vnew;
my $bugzilla_url = "http://drakbug.mandrakesoft.com";
my $version = "0.9.0";
my $prog;
my $incident=0;
sub usage {
print STDERR _("drakbug version %s
Copyright (C) 2002 MandrakeSoft.
This is free software and may be redistributed under the terms of the GNU GPL.
usage: drakbug [OPTIONS] [PROGRAM_NAME]
OPTIONS:
", $version) . _(" --help - print this help message.
") . "\n" . _(" --report - program should be one of mandrake tools
") . "\n" . _(" --incident - program should be one of mandrake tools
");
exit(0);
}
while (defined($_ = shift @ARGV)) {
/^--help$/ and do { usage; next };
/^--report$/ and do { $prog = shift @ARGV };
/^--incident$/ and do {$incident = 1 ; $prog = shift @ARGV };
}
my $window_g = new Gtk::Window -toplevel;
$window_g->set_policy($false,$false,$true);
$window_g->set_position(1);
$window_g->border_width(5);
$window_g->set_title(_("Mandrake Bug Report Tool"));
#$window_g->set_usize(540, 350);
$window_g->signal_connect("delete_event", \&quit_global);
my $mdk_app = {
_("Mandrake Control Center") => 'drakconf',
_("First Time Wizard") => 'drakfw',
_("Synchronization tool") => 'draksync',
_("Standalone Tools") => ['adduserdrake','diskdrake','drakautoinst','drakbackup','drakboot','drakbug','drakfloppy','drakfont','drakgw','drakconnect','drakxservices','drakxtv','keyboardrake','logdrake','mousedrake','net_monitor','printerdrake','scannerdrake','drakfirewall','XFdrake'],
_("HardDrake") => 'harddrake2',
_("Mandrake Online") => 'mdkonline',
_("Menudrake") => 'menudrake',
_("Msec") => 'msec',
_("Remote Control") => 'rfbdrake',
_("Software Manager") => 'rpmdrake',
_("Urpmi") => 'urpmi',
_("Windows Migration tool") => 'transfugdrake',
_("Userdrake") => 'userdrake',
_("Configuration Wizards") => 'wizdrake',
};
my @generic_tool = keys %{$mdk_app};
my @all_drakxtools = @ { $mdk_app->{_("Standalone Tools")} };
push(@generic_tool,@all_drakxtools);
my $kernel_release = chomp_(`uname -r`);
$kernel_release.="";
my $mdk_release = chomp_(cat_("/etc/mandrake-release"));
my $table = new Gtk::Table(4,2,'TRUE');
#$table->set_border_width(5);
$table->set_row_spacings(10);
$table->set_col_spacings(5);
$table->attach(new Gtk::Label(_("Application:")), 0, 1, 0, 1,'fill', 'fill',20,0);
$table->attach(new Gtk::Label(_("Package: ")), 0, 1, 1, 2, 'fill', 'fill',0,0);
$table->attach(new Gtk::Label(_("Kernel:")), 0, 1, 2, 3, 'fill', 'fill',0,0);
$table->attach(new Gtk::Label(_("Release: ")), 0, 1, 3, 4, 'fill', 'fill',0,0);
$table->attach(my $comb_app = new Gtk::Combo(), 1, 2, 0, 1, 'fill', 'fill',0,0);
$comb_app->set_usize(270,undef);
$comb_app->set_popdown_strings("",sort(@generic_tool));
$table->attach(my $package = new Gtk::Entry(), 1, 2, 1, 2, 'fill', 'fill',0,0);
$package->set_text("...");
$table->attach(my $kernel_rel = new Gtk::Entry(), 1, 2, 2, 3, 'fill', 'fill',0,0);
$kernel_rel->set_text("$kernel_release");
$table->attach(my $mdk_rel = new Gtk::Entry(), 1, 2, 3, 4, 'fill', 'fill',0,0);
$mdk_rel->set_text("$mdk_release");
gtkpack2__(
gtkpack2__(my $vbx = new Gtk::VBox(0,5),
gtkadd($table),
gtkpack(new Gtk::HBox(0,0),
gtkpack(gtkset_justify(new Gtk::Label(_("\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(new Gtk::HSeparator),
),
);
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()) });
my $kernel = $kernel_rel->get_chars(0,-1);
my $hbx = new Gtk::HBox(0,0);
my $Close_Button = new Gtk::Button(_("Close"));
$Close_Button->signal_connect(clicked => sub { Gtk->exit(0) });
$hbx->pack_start($Close_Button,0,0,0);
my $Report_Button = new Gtk::Button(_("Report"));
$Report_Button->signal_connect(clicked => sub { my $options = "mdkwizard=1";
$options.="&incident=1" if $incident;
$p = $package->get_text(); $k=$kernel_rel->get_text(); ($r =parse_release()) =~ s/\s//;
$options.="&package=$p" if $p =~ /rpm/;
$options.="&kernel=$k";
$options.="&mdkrelease=$r";
print "$bugzilla_url"."?"."$options" ."\n";
connect_bugzilla("$bugzilla_url/wizard?"."$options") });
$hbx->pack_end($Report_Button,0,0,0);
$vbx->pack_start($hbx,0,0,0);
$window_g->add($vbx);
$window_g->show_all();
Gtk->main();
Gtk->exit(0);
in->exit(0);
sub update_app {
my ($text) = @_;
my $app_choice;
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
if (member($text,@all_drakxtools) || $text eq _("Standalone Tools")) {
$app_choice = chomp_(`rpm -q drakxtools`) ;
} elsif (member($text,keys %{$mdk_app}) && $text ne _("Standalone Tools")) {
$app_choice = get_package($mdk_app->{$text});
} else {
LOOP: while (($key,$value) = each %{$mdk_app}) {
next if $key eq _("Standalone Tools");
if ($value eq $text) {
$app_choice = get_package($text);
$prog = $key;
last LOOP;
}
}
}
$app_choice ne '' ? $package->set_text("$app_choice") : $package->set_text(_("Not installed"));
}
sub get_package {
my ($executable) = @_;
my ($rpm_package, $which_app);
$which_app = chomp_(`which '$executable'`);
$rpm_package = chomp_(`rpm -qf '$which_app' 2>1&`);
$rpm_package;
}
sub parse_release {
my ($rel) = cat_('/etc/mandrake-release') =~ /release\s(\S+\s\(.*\))/;
$rel;
}
sub connect_bugzilla {
my($url) = @_;
my $w = $in->wait_message('',_("connecting to Bugzilla wizard ..."));
sleep(3);
exec $ENV{BROWSER},$url if exists $ENV{BROWSER} ;
my @browser = qw (mozilla konqueror galeon);
foreach (@browser) {
if (-e "/usr/bin/$_") { standalone::explanations("Contacting $url with $_\n "); exec $_,$url }
}
$in->ask_warn('', _("No browser available! Please install one"));
}
sub read_app_context {
my ($name) = @_;
}
sub quit_global {
Gtk->exit(0);
}
|