Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scripts: get_feat.pl: make complete table more coincise

Currently, there are too many white spaces at the tables,
and the information is very sparsed on it.

Make the format a lot more compact.

Suggested-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/8165ff379313e63a69898db19d790e4436224ffd.1607095090.git.mchehab+huawei@kernel.org
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Mauro Carvalho Chehab and committed by
Jonathan Corbet
dbb90902 7d2c6b1e

+70 -39
+70 -39
scripts/get_feat.pl
··· 325 325 # Output all features for all architectures 326 326 # 327 327 328 - sub matrix_lines($$) { 329 - my $partial = shift; 328 + sub matrix_lines($$$) { 329 + my $desc_size = shift; 330 + my $status_size = shift; 330 331 my $header = shift; 331 - my $split; 332 332 my $fill; 333 333 my $ln_marker; 334 334 ··· 338 338 $ln_marker = "-"; 339 339 } 340 340 341 - if ($partial) { 342 - $split = "|"; 343 - $fill = " "; 344 - } else { 345 - $split = "+"; 346 - $fill = $ln_marker; 347 - } 341 + $fill = $ln_marker; 348 342 349 - print $split; 343 + print "+"; 350 344 print $fill x $max_size_name; 351 - print $split; 352 - print $fill x $max_size_kconfig; 353 - print $split; 354 - print $fill x $max_size_description; 355 345 print "+"; 356 - print $ln_marker x $max_size_arch; 346 + print $fill x $desc_size; 357 347 print "+"; 358 - print $ln_marker x $max_size_status; 348 + print $ln_marker x $status_size; 359 349 print "+\n"; 360 350 } 361 351 ··· 355 365 print "=" x length($title) . "\n"; 356 366 print "$title\n"; 357 367 print "=" x length($title) . "\n\n"; 368 + 369 + my $desc_title = "$h_kconfig / $h_description"; 370 + 371 + my $desc_size = $max_size_kconfig + 4; 372 + $desc_size = $max_size_description if ($max_size_description > $desc_size); 373 + $desc_size = length($desc_title) if (length($desc_title) > $desc_size); 374 + 375 + my $status_size = 60; 358 376 359 377 my $cur_subsys = ""; 360 378 foreach my $name (sort { ··· 381 383 print "$title\n"; 382 384 print "=" x length($title) . "\n\n"; 383 385 384 - matrix_lines(0, 0); 386 + 387 + matrix_lines($desc_size, $status_size, 0); 388 + 385 389 printf "|%-${max_size_name}s", $h_name; 386 - printf "|%-${max_size_kconfig}s", $h_kconfig; 387 - printf "|%-${max_size_description}s", $h_description; 390 + printf "|%-${desc_size}s", $desc_title; 388 391 389 - printf "|%-${max_size_arch}s", $h_arch; 390 - printf "|%-${max_size_status}s|\n", $h_status; 391 - 392 - matrix_lines(0, 1); 392 + printf "|%-${status_size}s|\n", "Status per architecture"; 393 + matrix_lines($desc_size, $status_size, 1); 393 394 } 394 395 395 396 my %arch_table = %{$data{$name}->{table}}; 396 - my $first = 1; 397 - foreach my $arch (sort keys %arch_table) { 398 - if ($first) { 399 - printf "|%-${max_size_name}s", $name; 400 - printf "|%-${max_size_kconfig}s", $data{$name}->{kconfig}; 401 - printf "|%-${max_size_description}s", $data{$name}->{description}; 402 - $first = 0; 403 - } else { 404 - matrix_lines(1, 0); 397 + my $cur_status = ""; 405 398 406 - printf "|%-${max_size_name}s", ""; 407 - printf "|%-${max_size_kconfig}s", ""; 408 - printf "|%-${max_size_description}s", ""; 399 + my @lines; 400 + my $line = ""; 401 + foreach my $arch (sort { 402 + ($arch_table{$a} cmp $arch_table{$b}) or 403 + ("\L$a" cmp "\L$b") 404 + } keys %arch_table) { 405 + 406 + my $status = $arch_table{$arch}; 407 + 408 + if ($status eq "---") { 409 + $status = "Not compatible"; 409 410 } 410 - printf "|%-${max_size_arch}s", $arch; 411 - printf "|%-${max_size_status}s|\n", $arch_table{$arch}; 411 + 412 + if ($status ne $cur_status) { 413 + if ($line ne "") { 414 + push @lines, $line; 415 + $line = ""; 416 + } 417 + $line = "- **" . $status . "**: " . $arch; 418 + } elsif (length($line) + length ($arch) + 2 < $status_size) { 419 + $line .= ", " . $arch; 420 + } else { 421 + push @lines, $line; 422 + $line = " " . $arch; 423 + } 424 + $cur_status = $status; 412 425 } 413 - matrix_lines(0, 0); 426 + push @lines, $line if ($line ne ""); 427 + 428 + # Ensure that description will be printed 429 + push @lines, "" while (scalar(@lines) < 2); 430 + 431 + my $ln = 0; 432 + for my $line(@lines) { 433 + if (!$ln) { 434 + printf "|%-${max_size_name}s", $name; 435 + printf "|%-${desc_size}s", "``" . $data{$name}->{kconfig} . "``"; 436 + } elsif ($ln == 2) { 437 + printf "|%-${max_size_name}s", ""; 438 + printf "|%-${desc_size}s", $data{$name}->{description}; 439 + } else { 440 + printf "|%-${max_size_name}s", ""; 441 + printf "|%-${desc_size}s", ""; 442 + } 443 + 444 + printf "|%-${status_size}s|\n", $line; 445 + 446 + $ln++; 447 + } 448 + matrix_lines($desc_size, $status_size, 0); 414 449 } 415 450 } 416 451