pf-tools/pf-tools: 2 new changesets
parmelan-guest at users.alioth.debian.org
parmelan-guest at users.alioth.debian.org
Thu Jul 31 13:31:31 UTC 2014
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/c9144f4ede5c
changeset: 1292:c9144f4ede5c
user: shad
date: Thu Jul 31 14:57:13 2014 +0200
description:
broader range of include and final comments in translation tool
details: http://hg.debian.org/hg/pf-tools/pf-tools/rev/a1f9fe7d9b35
changeset: 1293:a1f9fe7d9b35
user: shad
date: Thu Jul 31 15:31:26 2014 +0200
description:
include is an action in update file
diffstat:
doc/updatefile-syntax | 8 +++++++-
lib/PFTools/Compat/Translation.pm | 2 +-
tools/Translate_old_config | 26 ++++++++++++++++++++++----
3 files changed, 30 insertions(+), 6 deletions(-)
diffs (104 lines):
diff -r 7ad268415676 -r a1f9fe7d9b35 doc/updatefile-syntax
--- a/doc/updatefile-syntax Thu Jul 31 11:28:52 2014 +0200
+++ b/doc/updatefile-syntax Thu Jul 31 15:31:26 2014 +0200
@@ -5,7 +5,7 @@
SO BE CAREFULL WITH your definition into a single file.
-SYNOPSYS : addfile or creatfile
+SYNOPSYS : addfile or createfile
* addfile : adding a file and updating it according to the source
* createfile : creating a file from source or "touch" it if no source is defined. If the file
already exist even if the file is not equal to the source the creation is done
@@ -133,3 +133,9 @@
? after_change ::= command(s) which is(are) executed after changing the file, if noaction parameter
is used with update-config, this(these) command(s) is(are) ignored. You can use
backslash char for using multiline command(s) like in bash script
+
+SYNOPSYS : include
+ * include : defining here update file to be included
+
+[<FILENAME>]
+ ! action ::= include
diff -r 7ad268415676 -r a1f9fe7d9b35 lib/PFTools/Compat/Translation.pm
--- a/lib/PFTools/Compat/Translation.pm Thu Jul 31 11:28:52 2014 +0200
+++ b/lib/PFTools/Compat/Translation.pm Thu Jul 31 15:31:26 2014 +0200
@@ -41,7 +41,7 @@
my $new_conf = $conf_parsed;
foreach my $section ( keys %{$new_conf} ) {
if ( $section =~ /^@(.*)$/ ) {
- $new_conf->{$1} = { 'type' => 'include' };
+ $new_conf->{$1} = { 'action' => 'include' };
delete $new_conf->{$section};
next;
} elsif ( $section =~ m{\A /distrib/tftpboot/pxelinux.cfg/(.*) \z}xms ) {
diff -r 7ad268415676 -r a1f9fe7d9b35 tools/Translate_old_config
--- a/tools/Translate_old_config Thu Jul 31 11:28:52 2014 +0200
+++ b/tools/Translate_old_config Thu Jul 31 15:31:26 2014 +0200
@@ -107,7 +107,9 @@
$current_section = $1;
$sectionorder{$current_section} = $sectionnumber;
$sectionorder{"__$current_section"} = $sectionnumber;
- if ( $current_section =~ m{\A /distrib/tftpboot/pxelinux.cfg/(.*) \z}xms ) {
+ if ( $current_section
+ =~ m{\A /distrib/tftpboot/pxelinux.cfg/(.*) \z}xms )
+ {
$current_section = qq{/usr/share/pf-tools/templates/$1};
$sectionorder{$current_section} = $sectionnumber;
}
@@ -117,15 +119,17 @@
undef @tempcomment;
}
}
- elsif ( $_ =~ m{\A \@include [ ] (.*) }msx ) {
+ elsif ( $_ =~ m{\A \@include \s* (.*) \z}msx ) {
if ( $options->{'type'} eq 'config' ) {
$current_section = qq{include-$1};
- } else {
+ }
+ else {
if ( $options->{'site'} eq q{UNDEFINED} ) {
$current_section = qq{COMMON:/include-$1};
}
else {
- $current_section = qq{CONFSITE_$options->{'site'}:/include-$1};
+ $current_section
+ = qq{CONFSITE_$options->{'site'}:/include-$1};
}
}
$sectionorder{"$current_section"} = $sectionnumber;
@@ -147,6 +151,10 @@
}
}
}
+if (@tempcomment) {
+ @{ $comments->{'FINALCOMMENTS'} } = @tempcomment;
+ undef @tempcomment;
+}
close $FILE
or croak qq{Can't close '$options->{'input'}': $OS_ERROR};
@@ -250,6 +258,12 @@
}
}
+sub testsort {
+ my ( $roota, $rootb ) = ( $a, $b );
+ print qq{comparing '$roota', '$rootb'\n};
+ return $sectionorder{$a} <=> $sectionorder{$b};
+}
+
if ( $options->{'type'} eq 'config' ) {
foreach my $section (
sort { $sectionorder{$a} <=> $sectionorder{$b} }
@@ -399,6 +413,10 @@
#print Dumper($trans);
}
+if ( $comments->{'FINALCOMMENTS'} ) {
+ $output_fh->print(
+ join( qq{\n}, @{ $comments->{'FINALCOMMENTS'} } ) . qq{\n} );
+}
$output_fh->close();
exit 0;
More information about the pf-tools-commits
mailing list