summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2003-08-19 14:16:46 +0000
committerPascal Rigaux <pixel@mandriva.com>2003-08-19 14:16:46 +0000
commitadc642b291761c466daed3dc45de1eb334650df7 (patch)
tree6b3b97f19566f4c70a951d06942001f1b0e208d2 /perl-install
parentd23267bd5650d3d6269a5c696a480046c1473deb (diff)
downloaddrakx-adc642b291761c466daed3dc45de1eb334650df7.tar
drakx-adc642b291761c466daed3dc45de1eb334650df7.tar.gz
drakx-adc642b291761c466daed3dc45de1eb334650df7.tar.bz2
drakx-adc642b291761c466daed3dc45de1eb334650df7.tar.xz
drakx-adc642b291761c466daed3dc45de1eb334650df7.zip
adapt to new documentation layout
Diffstat (limited to 'perl-install')
-rwxr-xr-xperl-install/share/po/help_xml2pm.pl62
1 files changed, 34 insertions, 28 deletions
diff --git a/perl-install/share/po/help_xml2pm.pl b/perl-install/share/po/help_xml2pm.pl
index e9875b831..de70dfc49 100755
--- a/perl-install/share/po/help_xml2pm.pl
+++ b/perl-install/share/po/help_xml2pm.pl
@@ -12,21 +12,23 @@ if ( ! -x "$xsltproc" ){
print "so type \"urpmi libxslt-proc\" please.\n";
exit 1;
}
-my @langs = grep { !/pt/ } grep { /^..$/ && -e "$dir/$_/drakx-chapter.xml" } all($dir) or die "no XML help found in $dir\n";
my %helps = map {
my $lang = $_;
- my $file = "$dir/$lang/drakx_full.xml";
- my $template_file = "$dir/$lang/drakx.xml";
+ my @l = grep { !/drakx-MNF-chapter/ } map { /(drakx-.*).xml$/ } all("$dir/$lang");
+ warn int(@l), " ", "\n";
+ if (@l < 20) { () } else {
+ my $template_file = "$dir/$lang/drakx.xml";
+ my $file = "$dir/$lang/drakx_full.xml";
+ output($template_file, template($lang, @l));
+ system("$xsltproc id.xsl $template_file > $file") == 0 or die "$xsltproc id.xsl $template_file failed\n";
- output($template_file, do { (my $s = $template) =~ s/__LANG__/$lang/g; $s });
- system("$xsltproc id.xsl $template_file > $file") == 0 or die "$xsltproc id.xsl $template_file failed\n";
-
- my $p = new XML::Parser(Style => 'Tree');
- my $tree = $p->parsefile($file);
+ my $p = new XML::Parser(Style => 'Tree');
+ my $tree = $p->parsefile($file);
- $lang => rewrite2(rewrite1(@$tree), $lang);
-} @langs;
+ $lang => rewrite2(rewrite1(@$tree), $lang);
+ }
+} all($dir);
my $base = delete $helps{en} || die;
save_help($base);
@@ -162,7 +164,7 @@ sub rewrite2_ {
!$tree->{attr}{condition} || $tree->{attr}{condition} !~ /no-inline-help/ or return '';
my @prev_inside_strings;
- my ($id) = $tree->{attr}{id} ? $tree->{attr}{id} =~ /drakxid-(.+)/ : ();
+ my ($id) = $tree->{attr}{id} ? $tree->{attr}{id} =~ /drakxid-([^-]+)$/ : ();
if ($id) {
@prev_inside_strings = @inside_strings;
@inside_strings = ();
@@ -267,41 +269,45 @@ sub to_ascii {
$_;
}
-BEGIN {
- $template = <<'EOF';
+sub template {
+ my ($lang, @l) = @_;
+ my $entities = join("\n", map { qq(<!ENTITY $_ SYSTEM '$_.xml'>) } @l);
+ my $body = join("\n", map { '&' . $_ . ';' } @l);
+
+ <<EOF;
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"/usr/share/sgml/docbook/xml-dtd-4.1.2/docbookx.dtd"[
-<!ENTITY drakx-chapter SYSTEM 'drakx-chapter.xml'>
+$entities
-<!ENTITY % params.ent SYSTEM "../../manuals/Starter/__LANG__/params.ent">
+<!ENTITY % params.ent SYSTEM "../../manuals/Starter/$lang/params.ent">
%params.ent;
-<!ENTITY % strings.ent SYSTEM "../../manuals/Starter/__LANG__/strings.ent">
+<!ENTITY % strings.ent SYSTEM "../../manuals/Starter/$lang/strings.ent">
%strings.ent;
<!ENTITY step-only-for-expert "">
-<!ENTITY % acronym-list SYSTEM "../../entities/__LANG__/acronym_list.ent" >
+<!ENTITY % acronym-list SYSTEM "../../entities/$lang/acronym_list.ent" >
%acronym-list;
-<!ENTITY % button-list SYSTEM "../../entities/__LANG__/button_list.ent" >
+<!ENTITY % button-list SYSTEM "../../entities/$lang/button_list.ent" >
%button-list;
-<!ENTITY % companies SYSTEM "../../entities/__LANG__/companies.ent" >
+<!ENTITY % companies SYSTEM "../../entities/$lang/companies.ent" >
%companies;
-<!ENTITY % icon-list SYSTEM "../../entities/__LANG__/icon_list.ent" >
+<!ENTITY % icon-list SYSTEM "../../entities/$lang/icon_list.ent" >
%icon-list;
-<!ENTITY % menu-list SYSTEM "../../entities/__LANG__/menu_list.ent" >
+<!ENTITY % menu-list SYSTEM "../../entities/$lang/menu_list.ent" >
%menu-list;
-<!ENTITY % tab-list SYSTEM "../../entities/__LANG__/tab_list.ent" >
+<!ENTITY % tab-list SYSTEM "../../entities/$lang/tab_list.ent" >
%tab-list;
-<!ENTITY % tech SYSTEM "../../entities/__LANG__/tech.ent" >
+<!ENTITY % tech SYSTEM "../../entities/$lang/tech.ent" >
%tech;
-<!ENTITY % text-field-list SYSTEM "../../entities/__LANG__/text_field_list.ent" >
+<!ENTITY % text-field-list SYSTEM "../../entities/$lang/text_field_list.ent" >
%text-field-list;
-<!ENTITY % titles SYSTEM "../../entities/__LANG__/titles.ent" >
+<!ENTITY % titles SYSTEM "../../entities/$lang/titles.ent" >
%titles;
-<!ENTITY % typo SYSTEM "../../entities/__LANG__/typo.ent" >
+<!ENTITY % typo SYSTEM "../../entities/$lang/typo.ent" >
%typo;
<!ENTITY % common SYSTEM "../../entities/common.ent" >
%common;
@@ -310,14 +316,14 @@ BEGIN {
<!ENTITY % prog-list SYSTEM "../../entities/prog_list.ent" >
%prog-list;
-<!ENTITY lang '__LANG__'>
+<!ENTITY lang '$lang'>
]>
<book>
<title>DrakX Documentation</title>
- &drakx-chapter;
+$body
</book>
EOF
ect_devices.pm
index dde0ce63f..57dd842f1 100644
--- a/perl-install/detect_devices.pm
+++ b/perl-install/detect_devices.pm
@@ -368,8 +368,7 @@ sub getCPUs() {
push @cpus, $cpu if $cpu;
$cpu = {};
}
- /^([^\t]*).*:\s(.*)$/;
- $cpu->{$1} = $2 if $1;
+ $cpu->{$1} = $2 if /^([^\t]+).*:\s(.*)$/;
}
push @cpus, $cpu;
@cpus;
diff --git a/perl-install/http.pm b/perl-install/http.pm
index 34158f7bd..4e19eed8b 100644
--- a/perl-install/http.pm
+++ b/perl-install/http.pm
@@ -29,7 +29,7 @@ sub getFile {
#- skip until empty line
my ($now, $last, $buf, $tmp) = 0;
- my $read = sub { sysread($sock, $buf, 1) || die; $tmp .= $buf };
+ my $read = sub { sysread($sock, $buf, 1) or die ''; $tmp .= $buf };
do {
$last = $now;
&$read; &$read if $buf =~ /\015/;
diff --git a/perl-install/install2.pm b/perl-install/install2.pm
index e019b8538..47fdca801 100644
--- a/perl-install/install2.pm
+++ b/perl-install/install2.pm
@@ -343,9 +343,9 @@ sub main {
#- c::unlimit_core() unless $::testing;
my ($cfg, $patch, @auto);
- my %cmdline; map {
+ my %cmdline = map {
my ($n, $v) = split '=';
- $cmdline{$n} = $v || 1;
+ $n => $v || 1;
} split ' ', cat_("/proc/cmdline");
my $opt; foreach (@_) {
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 6de423d50..ff886ad3d 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -99,8 +99,7 @@ sub selectLanguage {
$o->{locale}{langs} ||= { $o->{locale}{lang} => 1 };
if (!exists $o->{locale}{country}) {
- lang::l2locale($o->{locale}{lang}) =~ /^.._(..)/;
- $o->{locale}{country} = $1;
+ $o->{locale}{country} = $1 if lang::l2locale($o->{locale}{lang}) =~ /^.._(..)/;
}
lang::langs_selected($o->{locale});
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm
index 603b5d81a..f497c438a 100644
--- a/perl-install/interactive.pm
+++ b/perl-install/interactive.pm
@@ -107,7 +107,7 @@ sub vnew {
require 'log.pm'; #- "require log" causes some pb, perl thinking that "log" is the log() function
undef *log::l;
- *log::l = sub() {}; # otherwise, it will bother us :(
+ *log::l = sub {}; # otherwise, it will bother us :(
require interactive::newt;
interactive::newt->new;
}
diff --git a/perl-install/lang.pm b/perl-install/lang.pm
index 6a13bad9a..04f1d9c69 100644
--- a/perl-install/lang.pm
+++ b/perl-install/lang.pm
@@ -1027,7 +1027,7 @@ sub during_install__l2charset {
}
sub get_unneeded_png_lang_files() {
- print join(' ', map { m|(langs/lang-(.*)\.png)|; if_(!member($2, list_langs()), $1) } glob("pixmaps/langs/lang-*.png"));
+ print join(' ', map { if_(m|(langs/lang-(.*)\.png)| && !member($2, list_langs()), $1) } glob("pixmaps/langs/lang-*.png"));
}
sub check() {
diff --git a/perl-install/network/adsl.pm b/perl-install/network/adsl.pm
index 893a9955b..d7605a90e 100644
--- a/perl-install/network/adsl.pm
+++ b/perl-install/network/adsl.pm
@@ -161,11 +161,11 @@ user "$adsl->{login}"
}
if ($adsl_type eq 'speedtouch') {
- $netc->{vpivci} =~ /(\d+)_(\d+)/;
+ my ($vpi, $vci) = $netc->{vpivci} =~ /(\d+)_(\d+)/ or return;
output("$prefix/etc/ppp/peers/adsl",
qq(noauth
noipdefault
-pty "/usr/sbin/pppoa3 -c -vpi $1 -vci $2"
+pty "/usr/sbin/pppoa3 -c -vpi $vpi -vci $vci"
sync
kdebug 1
noaccomp
@@ -195,13 +195,13 @@ and copy the mgmt.o in /usr/share/speedtouch"));
}
if ($adsl_type eq 'eci') {
- $netc->{vpivci} =~ /(\d+)_(\d+)/;
+ my ($vpi, $vci) = $netc->{vpivci} =~ /(\d+)_(\d+)/ or return;
output("$prefix/etc/ppp/peers/adsl",
qq(debug
kdebug 1
noipdefault
defaultroute
-pty "/usr/bin/pppoeci -v 1 -vpi $1 -vci $2"
+pty "/usr/bin/pppoeci -v 1 -vpi $vpi -vci $vci"
sync
noaccomp
nopcomp
diff --git a/perl-install/network/isdn.pm b/perl-install/network/isdn.pm
index 0028ecce7..b3da0ff16 100644
--- a/perl-install/network/isdn.pm
+++ b/perl-install/network/isdn.pm
@@ -159,8 +159,7 @@ sub isdn_read_config {
$isdn->{driver} = $c->{ippp0}{alias};
#- 'type' 'protocol' 'mem' 'io' 'io0' 'io1' 'irq' 'id'
foreach (split(' ', $c->{$isdn->{driver}}{options})) {
- /(.*)=(.*)/;
- $isdn->{$1} = $2;
+ $isdn->{$1} = $2 if /(.*)=(.*)/;
}
foreach my $f ('ioptions1B', 'ioptions2B') {
foreach (cat_("$prefix/etc/ppp/$f")) {
diff --git a/perl-install/partition_table/sun.pm b/perl-install/partition_table/sun.pm
index bcae6d296..9dcae18de 100644
--- a/perl-install/partition_table/sun.pm
+++ b/perl-install/partition_table/sun.pm
@@ -66,7 +66,7 @@ sub compute_crc($) {
my @l2b = unpack "n256", $tmp;
my $crc = 0;
- map { $crc ^= $_ } @l2b;
+ $crc ^= $_ foreach @l2b;
$crc;
}
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index e780927cc..001d7bc3c 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -1039,8 +1039,8 @@ sub install($$$;$$) {
my @allpids = grep { /^\d+$/ } all("/proc");
my %ppids;
foreach (@allpids) {
- cat_("/proc/$_/status") =~ /^PPid:\s+(\d+)/m;
- push @{$ppids{$1 || 1}}, $_;
+ push @{$ppids{$1 || 1}}, $_
+ if cat_("/proc/$_/status") =~ /^PPid:\s+(\d+)/m;
}
my @killpid = difference2(\@allpids, [ @prev_pids,
difference2([ $$, hashtree2list(getppid(), \%ppids) ],
diff --git a/perl-install/swap.pm b/perl-install/swap.pm
index 659c9da07..512c72c27 100644
--- a/perl-install/swap.pm
+++ b/perl-install/swap.pm
@@ -28,7 +28,7 @@ my $signature_format_v1 = "x1024 I I I I125"; #- bootbits, version, last_page, n
1;
sub kernel_greater_or_equal($$$) {
- c::kernel_version() =~ /(\d*)\.(\d*)\.(\d*)/;
+ c::kernel_version() =~ /(\d*)\.(\d*)\.(\d*)/ or return;
($1 <=> $_[0] || $2 <=> $_[1] || $3 <=> $_[2]) >= 0;
}