]>
git.ipfire.org Git - people/trikolon/ipfire-2.x.git/blob - src/hwinfo/src/ids/cdb_x11
2 # Copyright (c) 1996 SuSE GmbH Nuernberg, Germany. All rights reserved.
4 # Author: Dirk Hessing <dhess@suse.de>, 08/2001
6 # Exporting hw-data for x11 from developer-CDB
14 # MySQL-Host / MySQL-User
15 my $hostname = "cdbintern.suse.de";
16 my $mysql_user = "cdbclient";
17 my $mysql_passwd = "cdb";
20 my $driver = DBI
->install_driver('mysql');
21 my $dbh = DBI
->connect('DBI:mysql:'.$target.':'.$hostname,$mysql_user,$mysql_passwd)
22 or die "Can't connect to the MySQL Database, table $target";
24 ### Log-Handle und STDOUT-Handle auf ungepufferte Ausgabe setzten (schlechtere Performance ;-)
28 my $dist_name = "Stable";
29 my $date = localtime();
31 my (@query,$x,$result,$arch_name,@arch_names,$filename,$count);
32 my ($product_id,$product_name,$vendor_name,$bus_name,$subclass_name);
33 my ($vId,$dId,$sdId,$svId);
34 my (%tooltopics,$tooltopic_name,$vario_name,$charvalue);
39 # convert to new id format
42 my ($old_id, $id_class, $tag, $id);
44 ($old_id, $id_class) = @_;
46 if($old_id =~ /^([us]?)(\S{4})$/) {
51 die "invalid id format: \"$old_id\"\n";
54 if($tag eq "" && $id_class && $id_class =~ /^([us]?)(\S{4})$/) {
68 die "invalid id format: \"$old_id\"\n";
78 my ($arch, $xfree, $has3d, $vId, $dId, $svId, $sdId, $vName, $dName, $tt, $raw, @raw);
80 ($arch, $xfree, $has3d, $vId, $dId, $svId, $sdId, $vName, $dName, $tt) = @_;
82 return unless $vId ne "" && $dId ne "";
84 # print FH "\n# vId = $vId, dId = $dId, svId = $svId, sdId = $sdId, vName = \"$vName\", dName = \"$dName\"\n";
86 if($svId ne "" && $sdId ne "") {
87 print FH
"\n vendor.id\t\t${\new_id $vId}\n";
88 print FH
"+vendor.name\t\t$vName\n";
90 print FH
"\n vendor.id\t\t${\new_id $vId}\n";
91 print FH
"&device.id\t\t${\new_id $dId, $vId}\n";
92 print FH
"&subvendor.id\t\t${\new_id $svId, $vId}\n";
93 print FH
"&subdevice.id\t\t${\new_id $sdId, $vId}\n";
94 print FH
"+subdevice.name\t\t$dName\n";
97 print FH
"\n vendor.id\t\t${\new_id $vId}\n";
98 print FH
"+vendor.name\t\t$vName\n";
100 print FH
"\n vendor.id\t\t${\new_id $vId}\n";
101 print FH
"&device.id\t\t${\new_id $dId, $vId}\n";
102 print FH
"+device.name\t\t$dName\n";
105 if($$tt{resol
} ne "") {
106 $$tt{resol
} =~ s/bpp//g;
109 # Teste ob mehr als ein driver- oder installscript-topic vorhanden ist:
110 if(($$tt{driver
} =~ /,/) || ($$tt{installscript
} =~ /,/)) {
112 "\nMore than one driver- or installscript-topic.\n" .
113 " Product-id = $product_id, Vario = $vario_name, Arch = $arch\n" .
114 " Id = (${\new_id $vId}, ${\new_id $dId, $vId}), Name = $dName\n" .
115 " Driver = \"$$tt{driver}\", script = \"$$tt{installscript}\"\n";
119 "+driver.xfree\t\t$xfree|$$tt{driver}|" .
120 ($has3d ?
"3d" : "") .
121 "|$$tt{package}|$$tt{extension}|$$tt{option}|$$tt{resol}||$$tt{installscript}|\n";
123 if ($$tt{raw
} ne "") {
124 @raw = (split(',',$$tt{raw
}));
125 foreach $raw (@raw) {
126 print FH
"+driver.xfree.config\t$raw\n";
132 # get product info and write everything to FH
135 my ($arch_name, $xfree, $has3d);
137 ($arch_name, $vario_name) = @_;
139 $xfree = $vario_name =~ /XFree3/ ?
3 : 4;
140 $has3d = $vario_name =~ /3D/ ?
1 : 0;
142 $tooltopics{driver
} = "";
143 $tooltopics{package} = "";
144 $tooltopics{extension
} = "";
145 $tooltopics{option
} = "";
146 $tooltopics{resol
} = "";
147 $tooltopics{installscript
} = "";
148 $tooltopics{raw
} = "";
150 # Product supported=full?
151 $query[2] = $dbh->prepare("SELECT toolproperty.charvalue FROM toolproperty
152 LEFT JOIN tooltopic ON toolproperty.tooltopic_id=tooltopic.id
153 LEFT JOIN arch_dist_l_vario ON toolproperty.arch_dist_l_vario_id=arch_dist_l_vario.id
154 LEFT JOIN arch ON arch_dist_l_vario.arch_id=arch.id
155 LEFT JOIN distribution ON arch_dist_l_vario.distribution_id=distribution.id
156 LEFT JOIN vario ON arch_dist_l_vario.vario_id=vario.id
157 WHERE toolproperty.product_id=$product_id
158 AND tooltopic.name='supported'
159 AND arch.name='$arch_name'
160 AND distribution.name='$dist_name'
161 AND vario.name='$vario_name'
162 AND toolproperty.valid=1
163 AND tooltopic.valid=1
164 AND arch_dist_l_vario.valid=1")
165 or die "Can\'t select table toolproperty";
166 $query[2]->execute or die "Can\'t select table toolproperty";
170 while ($x = $query[2]->fetchrow_array) {
171 $result = $x if defined $x;
172 multiple_supportedtopics
($dbh,$product_id,$product_name,$arch_name,$dist_name,$vario_name) if $count > 0;
175 $result = "" if not defined $result;
177 if ($result eq "full") {
178 $query[2] = $dbh->prepare("SELECT tooltopic.name,toolproperty.charvalue FROM toolproperty
179 LEFT JOIN tooltopic ON toolproperty.tooltopic_id=tooltopic.id
180 LEFT JOIN arch_dist_l_vario ON toolproperty.arch_dist_l_vario_id=arch_dist_l_vario.id
181 LEFT JOIN arch ON arch_dist_l_vario.arch_id=arch.id
182 LEFT JOIN distribution ON arch_dist_l_vario.distribution_id=distribution.id
183 LEFT JOIN language ON arch_dist_l_vario.lang_id=language.id
184 LEFT JOIN vario ON arch_dist_l_vario.vario_id=vario.id
185 WHERE arch.name='$arch_name'
186 AND distribution.name='$dist_name'
187 AND vario.name='$vario_name'
188 AND toolproperty.product_id=$product_id
189 AND tooltopic.name != 'supported'
190 AND toolproperty.valid=1
191 AND tooltopic.valid=1
192 AND arch_dist_l_vario.valid=1")
193 or die "Can\'t select table toolproperty";
194 $query[2]->execute or die "Can\'t select table toolproperty";
196 while ( ($tooltopic_name,$charvalue) = ($query[2]->fetchrow_array) ) {
197 if (($charvalue eq "none") || ($charvalue eq "None")) {
200 next if $charvalue eq "";
201 if (!$tooltopics{"$tooltopic_name"}) {
202 $tooltopics{"$tooltopic_name"} = $charvalue;
204 $tooltopics{"$tooltopic_name"} .= ",".$charvalue;
208 write_info
$arch_name, $xfree, $has3d, $vId, $dId, $svId, $sdId, $vendor_name, $product_name, \
%tooltopics;
218 print "\n\nGenerating x11.hwinfo-files, one for each architecture.\n";
219 mkdir($opt_dir, 0755) || die "\nmkdir: $opt_dir: $!\n" unless -d
$opt_dir;
221 print "\nStoring files in \"$opt_dir\"\n\n";
223 $query[0] = $dbh->prepare("SELECT name FROM arch WHERE valid=1")
224 or die "Can\'t select table arch";
225 $query[0]->execute or die "Can\'t select table arch";
226 while ($result = $query[0]->fetchrow_array) {
227 push(@arch_names,$result);
230 # Für jede Architektur wird eine eigene Datei geschrieben
231 foreach $arch_name (@arch_names) {
232 $filename = "$opt_dir/x11.hwinfo.$arch_name";
233 open(FH
,"> $filename") or die "Can\'t open $filename";
235 print FH
"# x11.hwinfo-file for architecture $arch_name\n";
237 print FH
"# generated at: $date\n";
238 print FH
"# data source: CDB\n";
239 print FH
"# distribution: $dist_name\n";
242 $query[0] = $dbh->prepare("SELECT product.id,product.name,
243 product.vId,product.dId,product.svId,product.sdId,
244 vendor.longname,product.vId,
245 bus.name,subclass.name FROM product
246 LEFT JOIN product_area ON product.id=product_area.product_id
247 LEFT JOIN groups ON product_area.group_id=groups.id
248 LEFT JOIN vendor ON product.vendor_id=vendor.id
249 LEFT JOIN bus ON product.bus_id=bus.id
250 LEFT JOIN subclass ON product.subclass_id=subclass.id
251 WHERE groups.name='graphic-developer'
252 AND product_area.valid=1
253 AND product.valid=1")
254 or die "Can\'t select table product";
255 $query[0]->execute or die "Can\'t select table product";
256 while ( ($product_id,$product_name,$vId,$dId,$svId,$sdId,$vendor_name,$vId,$bus_name,$subclass_name) = ($query[0]->fetchrow_array) ) {
257 # Postinitialisierung, falls undefinierte Werte
258 $vId = "----" if !defined($vId);
259 $dId = "----" if !defined($dId);
260 $svId = "----" if !defined($svId);
261 $sdId = "----" if !defined($sdId);
263 $vId = "" if $vId eq "----";
264 $dId = "" if $dId eq "----";
265 $svId = "" if $svId eq "----";
266 $sdId = "" if $sdId eq "----";
268 # Step 1: Erzeuge Zeilen für XFree 3 ohne 3D
269 get_info
$arch_name, "XFree3";
271 # Step 2: Erzeuge Zeilen für XFree 3 mit 3D
272 get_info
$arch_name, "XFree3 with 3D";
274 # Step 2: Erzeuge Zeilen für XFree 4 ohne 3D
275 get_info
$arch_name, "XFree4";
277 # Step 2: Erzeuge Zeilen für XFree 4 mit 3D
278 get_info
$arch_name, "XFree4 with 3D";
280 } # Ende der Produktschleife
282 } # Ende der Arch-Schleife
287 sub multiple_supportedtopics
{
289 my $product_id = shift;
290 my $product_name = shift;
291 my $arch_name = shift;
292 my $dist_name = shift;
293 my $vario_name = shift;
294 my ($query,$id,$value,$name,$time,$htime,%topic,$key,$answer,%key);
299 print "\n *********** Unconsistency registered *******************";
300 print "\nMultiple supported-topics:";
301 print "\nProduct_name: $product_name ID=$product_id";
302 print "\nArch=$arch_name Dist=$dist_name Vario=$vario_name";
305 $query = $handle->prepare("SELECT toolproperty.id,tooltopic.name,
306 toolproperty.charvalue,toolproperty.createtime
308 LEFT JOIN tooltopic ON toolproperty.tooltopic_id=tooltopic.id
309 LEFT JOIN arch_dist_l_vario ON toolproperty.arch_dist_l_vario_id=arch_dist_l_vario.id
310 LEFT JOIN arch ON arch_dist_l_vario.arch_id=arch.id
311 LEFT JOIN distribution ON arch_dist_l_vario.distribution_id=distribution.id
312 LEFT JOIN vario ON arch_dist_l_vario.vario_id=vario.id
313 WHERE toolproperty.product_id=$product_id
314 AND tooltopic.name='supported'
315 AND toolproperty.valid=1
316 AND arch.name='$arch_name'
317 AND distribution.name='$dist_name'
318 AND vario.name='$vario_name'")
319 or die "Can\'t select table toolproperty";
320 $query->execute or die "Can\'t select table toolproperty";
321 while (($id,$name,$value,$time) = ($query->fetchrow_array)) {
322 $htime = localtime($time);
323 $topic{$id} = $htime." ".$value;
326 foreach $key (sort keys %topic) {
327 $min_key = $key if $key<$min_key;
329 foreach $key (sort keys %topic) {
330 print "\nD toolproperty-ID $key: $topic{$key}" if $key != $min_key;
332 print "\n* toolproperty-ID $min_key:$topic{$min_key}";
333 print "\n\nDeleting doublettes marked with D (* will be left the valid one) [N|y] ?";
336 if ( ($answer eq "y") || ($answer eq "Y") ) {
337 print "\n\nDeleting supported-doublettes.... done\n";
338 foreach $key (keys %topic) {
339 if ($key != $min_key) {
340 $query = $handle->prepare("DELETE FROM toolproperty
342 or die "Can\'t delete from toolproperty";
343 $query->execute or die "Can\'t delete from toolproperty";