pf-tools commit: r571 [ccaillet-guest] - in /trunk: debian/changelog lib/PFTools/Conf.pm lib/PFTools/Update.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Thu Jan 24 12:55:03 UTC 2008


Author: ccaillet-guest
Date: Thu Jan 24 12:55:03 2008
New Revision: 571

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=571
Log:
  ip.<vlan>.<hostnum> in private-network
* Better substitution on Subst_vars, now if a %VAR% is not defined on SUBST
  hash, the returned string is not broken
* adding %SECTIONNAME% handler on actions others than dpkg-purge and apt-get

Modified:
    trunk/debian/changelog
    trunk/lib/PFTools/Conf.pm
    trunk/lib/PFTools/Update.pm

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/trunk/debian/changelog?rev=571&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Thu Jan 24 12:55:03 2008
@@ -19,7 +19,10 @@
   * adding use strict on Net.pm and Conf.pm (WIP)
   * fix for mk_interfaces, now it works :)
   * adding non-contiguous IP on interfaces vlan by the directive
-    ip.<vlan>.<hostnum> in private-network 
+    ip.<vlan>.<hostnum> in private-network
+  * Better substitution on Subst_vars, now if a %VAR% is not defined on SUBST
+    hash, the returned string is not broken
+  * adding %SECTIONNAME% handler on actions others than dpkg-purge and apt-get
 
   [ Thomas Parmelan ]
   * lib-net: if no comment is specified in a zone, network or server
@@ -31,7 +34,7 @@
   * Update my email address.
   * Merge the remaining changes from 0.32.47-1 and 0.32.48-1.
 
- -- Christophe Caillet <quadchris at free.fr>  Tue, 22 Jan 2008 14:46:15 +0100
+ -- Christophe Caillet <quadchris at free.fr>  Thu, 24 Jan 2008 12:57:43 +0100
 
 pf-tools (0.32.48-1) unstable; urgency=low
 

Modified: trunk/lib/PFTools/Conf.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Conf.pm?rev=571&op=diff
==============================================================================
--- trunk/lib/PFTools/Conf.pm (original)
+++ trunk/lib/PFTools/Conf.pm Thu Jan 24 12:55:03 2008
@@ -33,6 +33,7 @@
     $DEFERREDLOG
     %SUBST
 
+    Subst_vars
     Load_conf
     deferredlogsystem
     deferredlogpipe
@@ -106,7 +107,13 @@
 sub Subst_vars {
     my ($str) = @_;
 
-    while ( $str =~ s/%([^%\s]*)%/$SUBST{"$1"}/ ) { }
+#     while ( $str =~ s/%([^%\s]*)%/$SUBST{"$1"}/ ) { }
+    foreach my $elt ( split ( '%', $str ) ) {
+        next if ( $elt eq '' );
+        if ( defined $SUBST{$elt} ) {
+            $str =~ s/%$elt%/$SUBST{$elt}/;
+        }
+    }
     return ($str);
 }
 

Modified: trunk/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Update.pm?rev=571&op=diff
==============================================================================
--- trunk/lib/PFTools/Update.pm (original)
+++ trunk/lib/PFTools/Update.pm Thu Jan 24 12:55:03 2008
@@ -382,7 +382,7 @@
     if ( !defined( $S->{'source'} ) ) {
 	Abort( $ERR_SYNTAX, "Source non definie pour " . $dest );
     }
-
+    $SUBST{'SECTIONNAME'} = $dest;
     if ( $S->{'source'} =~ /\s/ ) {
 	$source = Get_tmp_dest($dest) . ".merged";
 	unlink($source);
@@ -503,7 +503,7 @@
 
     my $name_filter = $S->{'name_filter'};
     if ($name_filter) {
-	$SUBST{SECTIONNAME} = $dest;
+	$SUBST{'SECTIONNAME'} = $dest;
 	my $newdest = deferredlogpipe( Subst_vars($name_filter) );
 	unless ( defined $newdest ) {
 	    Warn( $ERR_OPEN,
@@ -771,6 +771,7 @@
     if ( !defined( $S->{'source'} ) ) {
 	Abort( $ERR_SYNTAX, "Source non definie pour " . $dest );
     }
+    $SUBST{'SECTIONNAME'} = $dest;
     $source = Subst_vars( $S->{'source'} );
 
     my $sourceaddr = $source;
@@ -1202,6 +1203,7 @@
 
     my $cmp = 0;
 
+    $SUBST{'SECTIONNAME'} = $dest;
     if ( !defined( $S->{'source'} ) ) {
 	Abort( $ERR_SYNTAX, "Source non definie pour " . $dest );
     }
@@ -1259,6 +1261,7 @@
 
     my $cmp = 0;
 
+    $SUBST{'SECTIONNAME'} = $dest;
     if ( !defined $S->{'source'} ) {
 	if ( !-f $dest ) {
 	    $cmp = 1;
@@ -1380,6 +1383,7 @@
 
     my $cmp = 0;
 
+    $SUBST{'SECTIONNAME'} = $dest;
     if ( !-d $dest ) {
 	$cmp = 1;
 




More information about the pf-tools-commits mailing list