pf-tools commit: r461 [ccaillet-guest] - /trunk/lib/PFTools/Update.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Thu Mar 8 13:40:06 CET 2007


Author: ccaillet-guest
Date: Thu Mar  8 12:40:05 2007
New Revision: 461

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=461
Log:
Preventing bareword on hash key by quoting constant key name

Modified:
    trunk/lib/PFTools/Update.pm

Modified: trunk/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/trunk/lib/PFTools/Update.pm?rev=461&op=diff
==============================================================================
--- trunk/lib/PFTools/Update.pm (original)
+++ trunk/lib/PFTools/Update.pm Thu Mar  8 12:40:05 2007
@@ -49,9 +49,9 @@
 my $ERR_OPEN	= 1 ;
 my $ERR_SYNTAX	= 2 ;
 
-$ENV{PATH}            = $ENV{PATH} . ":/usr/local/sbin:/usr/local/bin";
-$ENV{DEBIAN_FRONTEND} = "noninteractive";
-$ENV{DEBIAN_PRIORITY} = "critical";
+$ENV{'PATH'}            = $ENV{'PATH'} . ":/usr/local/sbin:/usr/local/bin";
+$ENV{'DEBIAN_FRONTEND'} = "noninteractive";
+$ENV{'DEBIAN_PRIORITY'} = "critical";
 
 my $STARTTIME   = time();
 $DEFERREDLOG = 0 ;
@@ -59,8 +59,8 @@
 # Constantes
 my $PFTOOLSCONF     = "/etc/pf-tools.conf";
 my $CVS_CHECKOUT    = "/var/lib/cvsguest";
-my $HOSTNAME        = $SUBST{HOSTNAME};
-my $HOSTTYPE        = $SUBST{HOSTTYPE};
+my $HOSTNAME        = $SUBST{'HOSTNAME'};
+my $HOSTTYPE        = $SUBST{'HOSTTYPE'};
 my $CVS_UMASK       = 0077;
 my $COMMON          = "update-common";
 my $DEFAULT_MODE    = '0640';
@@ -177,11 +177,11 @@
         return 0;
     }
 
-    if ( $options->{verbose} || $options->{simul} ) {
+    if ( $options->{'verbose'} || $options->{'simul'} ) {
         Log("(chown needed)");
     }
 
-    if ( $options->{simul} ) {
+    if ( $options->{'simul'} ) {
         return 0;
     }
 
@@ -214,11 +214,11 @@
         return 0;
     }
 
-    if ( $options->{verbose} || $options->{simul} ) {
+    if ( $options->{'verbose'} || $options->{'simul'} ) {
         Log("(chmod needed)");
     }
 
-    if ( $options->{simul} ) {
+    if ( $options->{'simul'} ) {
         return 0;
     }
 
@@ -254,11 +254,11 @@
     if ( -e $dest ) {
         my $old = $CVS_OLD_DIR . "/" . $dest . "." . $STARTTIME;
 
-        if ( $options->{verbose} ) {
+        if ( $options->{'verbose'} ) {
             Log( "(moving old to " . $old . ")" );
         }
 
-        if ( !$options->{simul} ) {
+        if ( !$options->{'simul'} ) {
             Mk_dest_dir($old);
             deferredlogsystem( "/bin/mv '" . $dest . "' '" . $old . "'" );
         }
@@ -272,8 +272,8 @@
     my $group;
     my $mode;
 
-    $owner = defined( $S->{owner} ) ? $S->{owner} : $DEFAULT_OWNER;
-    $group = defined( $S->{group} ) ? $S->{group} : $DEFAULT_GROUP;
+    $owner = defined( $S->{'owner'} ) ? $S->{'owner'} : $DEFAULT_OWNER;
+    $group = defined( $S->{'group'} ) ? $S->{'group'} : $DEFAULT_GROUP;
 
     if ( fullchown( $owner, $group, $dest, $options ) ) {
         Warn( $ERR_OPEN,
@@ -282,8 +282,8 @@
     }
 
     $mode =
-      defined( $S->{mode} ) 
-      ? $S->{mode}
+      defined( $S->{'mode'} ) 
+      ? $S->{'mode'}
       : ( ( -d $dest ) ? $DEFAULT_DIRMODE : $DEFAULT_MODE );
     $mode =~ s/^[^0]/0$&/;
 
@@ -297,8 +297,8 @@
 sub Do_on_config {
     my ( $S, $options ) = @_;
 
-    if ( !$options->{simul} && defined( $S->{on_config} ) ) {
-        my $changed = Subst_vars( $S->{on_config} );
+    if ( !$options->{'simul'} && defined( $S->{'on_config'} ) ) {
+        my $changed = Subst_vars( $S->{'on_config'} );
         if ( deferredlogsystem($changed) ) {
             Warn( $ERR_OPEN, "Impossible d'executer [" . $changed . "]" );
             return 1;
@@ -310,11 +310,11 @@
 sub Do_before_change {
     my ( $S, $options ) = @_;
 
-    if ( !$options->{simul}
-        && defined( $S->{before_change} )
-        && !$options->{noaction} )
+    if ( !$options->{'simul'}
+        && defined( $S->{'before_change'} )
+        && !$options->{'noaction'} )
     {
-        my $changed = Subst_vars( $S->{before_change} );
+        my $changed = Subst_vars( $S->{'before_change'} );
         if ( deferredlogsystem($changed) ) {
             Warn( $ERR_OPEN, "Impossible d'executer [" . $changed . "]" );
             return 1;
@@ -326,11 +326,11 @@
 sub Do_after_change {
     my ( $S, $options ) = @_;
 
-    if ( !$options->{simul}
-        && defined( $S->{after_change} )
-        && !$options->{noaction} )
+    if ( !$options->{'simul'}
+        && defined( $S->{'after_change'} )
+        && !$options->{'noaction'} )
     {
-        my $changed = Subst_vars( $S->{after_change} );
+        my $changed = Subst_vars( $S->{'after_change'} );
         if ( deferredlogsystem($changed) ) {
             Warn( $ERR_OPEN, "Impossible d'executer [" . $changed . "]" );
             return 1;
@@ -342,11 +342,11 @@
 sub Do_on_noaction {
     my ( $S, $options ) = @_;
 
-    if ( !$options->{simul}
-        && defined( $S->{on_noaction} )
-        && $options->{noaction} )
+    if ( !$options->{'simul'}
+        && defined( $S->{'on_noaction'} )
+        && $options->{'noaction'} )
     {
-        my $changed = Subst_vars( $S->{on_noaction} );
+        my $changed = Subst_vars( $S->{'on_noaction'} );
         if ( deferredlogsystem($changed) ) {
             Warn( $ERR_OPEN, "Impossible d'executer [" . $changed . "]" );
             return 1;
@@ -358,32 +358,32 @@
 my %DEPENDS ;
 my %FUNCTIONS ;
 
-$DEPENDS{addfile} = sub {
+$DEPENDS{'addfile'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     while ( $dest ne '/' && $dest ne '.' ) {
-        $S->{depends} .= " " . dirname($dest);
+        $S->{'depends'} .= " " . dirname($dest);
         $dest = dirname($dest);
     }
 };
 
-$FUNCTIONS{addfile} = sub {
+$FUNCTIONS{'addfile'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     my $source;
     my $tmp;
     my $cmp;
 
-    if ( !defined( $S->{source} ) ) {
+    if ( !defined( $S->{'source'} ) ) {
         Abort( $ERR_SYNTAX, "Source non definie pour " . $dest );
     }
 
-    if ( $S->{source} =~ /\s/ ) {
+    if ( $S->{'source'} =~ /\s/ ) {
         $source = Get_tmp_dest($dest) . ".merged";
         unlink($source);
 
         my $splitsource;
-        foreach $splitsource ( split ( ' ', $S->{source} ) ) {
+        foreach $splitsource ( split ( ' ', $S->{'source'} ) ) {
             $splitsource = Get_source( Subst_vars($splitsource) );
             if ( !-f $splitsource ) {
                 Warn( $ERR_OPEN, "Impossible d'ouvrir " . $splitsource );
@@ -400,15 +400,15 @@
         }
     }
     else {
-        $source = Get_source( Subst_vars( $S->{source} ) );
-    }
-
-    $SUBST{SOURCE} = $source;
+        $source = Get_source( Subst_vars( $S->{'source'} ) );
+    }
+
+    $SUBST{'SOURCE'} = $source;
     $tmp = Get_tmp_dest($dest);
-    $SUBST{DESTINATION} = $tmp;
-
-    if ( defined( $S->{filter} ) ) {
-        my $filter = Subst_vars( $S->{filter} );
+    $SUBST{'DESTINATION'} = $tmp;
+
+    if ( defined( $S->{'filter'} ) ) {
+        my $filter = Subst_vars( $S->{'filter'} );
         if ( deferredlogsystem($filter) ) {
             Warn( $ERR_OPEN, "Impossible d'appliquer " . $filter );
             return 1;
@@ -436,11 +436,11 @@
 
         $cmp = 1;
 
-        if ( $options->{verbose} || $options->{simul} ) {
+        if ( $options->{'verbose'} || $options->{'simul'} ) {
             Log("(action needed)");
         }
 
-        if ( $options->{diff} ) {
+        if ( $options->{'diff'} ) {
             deferredlogsystem(
                 "/usr/bin/diff -uN '" . $dest . "' '" . $tmp . "'" );
         }
@@ -449,10 +449,10 @@
 
         Do_before_change( $S, $options ) && return 1;
 
-        if ( !$options->{simul} ) {
+        if ( !$options->{'simul'} ) {
 
             # Fuck dpkg conffiles
-            if ( $options->{noaction} && -e $dest && !-e $dest . ".dpkg-dist" )
+            if ( $options->{'noaction'} && -e $dest && !-e $dest . ".dpkg-dist" )
             {
                 deferredlogsystem(
                     "/bin/cp -a '" . $dest . "' '" . $dest . ".dpkg-dist'" );
@@ -485,7 +485,7 @@
 $FUNCTIONS{'dpkg-purge'} = sub {
     my ( $S, $dest, $options ) = @_;
 
-    my $name_filter = $S->{name_filter};
+    my $name_filter = $S->{'name_filter'};
     if ($name_filter) {
 	$SUBST{SECTIONNAME} = $dest;
 	my $newdest = deferredlogpipe( Subst_vars($name_filter) );
@@ -520,7 +520,7 @@
 
     if ($installed_version) {
 
-        if ( $options->{verbose} || $options->{simul} ) {
+        if ( $options->{'verbose'} || $options->{'simul'} ) {
             Log("(action needed)");
         }
 
@@ -528,7 +528,7 @@
 
         Do_before_change( $S, $options ) && return 1;
 
-        if ( !$options->{simul} ) {
+        if ( !$options->{'simul'} ) {
             if ( deferredlogsystem( $DPKG . " -P '" . $dest . "'" ) ) {
                 Warn( $ERR_OPEN, "Purge du package " . $dest . " impossible" );
                 return 1;
@@ -570,7 +570,7 @@
             my $pkg;
             foreach $pkg ( split ( ' ', $1 ) ) {
                 if ( $pkg ne $dest ) {
-                    $S->{depends} .= " " . $pkg;
+                    $S->{'depends'} .= " " . $pkg;
                 }
             }
         }
@@ -585,9 +585,9 @@
     my $available_version;
     my $install;
 
-    my $name_filter = $S->{name_filter};
+    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, "Impossible d'appliquer name_filter $name_filter" );
@@ -632,11 +632,11 @@
 
     if ($install) {
 
-        if ( $options->{verbose} || $options->{simul} ) {
+        if ( $options->{'verbose'} || $options->{'simul'} ) {
             Log("(action needed)");
         }
 
-        if ( $options->{diff} ) {
+        if ( $options->{'diff'} ) {
             Log( "(inst = "
                 . ( defined($installed_version) ? $installed_version : '?' )
                 . ", avail = "
@@ -644,21 +644,21 @@
                 . ")" );
         }
 
-        if ( defined( $S->{delay} ) && !$options->{noaction} ) {
+        if ( defined( $S->{'delay'} ) && !$options->{'noaction'} ) {
             $HOSTNAME =~ /\d+$/;
             if ( $& ne "" ) {
                 sleep( 120 * $& );
             }
         }
 
-        if ( !$options->{simul} && defined( $S->{debconf} ) ) {
+        if ( !$options->{'simul'} && defined( $S->{'debconf'} ) ) {
 
             my $DEB;
             my $conf;
             my $pkg;
 
             Debconf::Db->load;
-            foreach $conf ( keys %{ $S->{debconf} } ) {
+            foreach $conf ( keys %{ $S->{'debconf'} } ) {
 
                 ($pkg) = split ( m:/:, $conf );
 
@@ -668,7 +668,7 @@
                 }
 
                 Debconf::ConfModule->command_set( $conf,
-                    $S->{debconf}->{$conf} );
+                    $S->{'debconf'}->{$conf} );
                 Debconf::ConfModule->command_fset( $conf, "seen", "true" );
             }
             Debconf::Db->save;
@@ -678,15 +678,15 @@
 
         Do_before_change( $S, $options ) && return 1;
 
-        if ( defined( $S->{reply} ) ) {
-            $install = $S->{reply};
+        if ( defined( $S->{'reply'} ) ) {
+            $install = $S->{'reply'};
             eval "\$install = sprintf (\"echo '$install' |\")";
         }
         else {
             $install = '';
         }
 
-        if ( !$options->{simul} ) {
+        if ( !$options->{'simul'} ) {
             if (
                 deferredlogsystem(
                     $install . " " . $APT_GET . " install '" . $dest . "'" ) )
@@ -704,11 +704,11 @@
     return 0;
 };
 
-$DEPENDS{addmount} = sub {
+$DEPENDS{'addmount'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     while ( $dest ne '/' && $dest ne '.' ) {
-        $S->{depends} .= " " . dirname($dest);
+        $S->{'depends'} .= " " . dirname($dest);
         $dest = dirname($dest);
     }
 };
@@ -739,10 +739,10 @@
 
     my $Z;
 
-    if ( !defined( $S->{source} ) ) {
+    if ( !defined( $S->{'source'} ) ) {
         Abort( $ERR_SYNTAX, "Source non definie pour " . $dest );
     }
-    $source = Subst_vars( $S->{source} );
+    $source = Subst_vars( $S->{'source'} );
 
     my $sourceaddr = $source;
     $sourceaddr =~ s/^([^:]+):(.+)$/$1/;    # NFS
@@ -756,9 +756,9 @@
         }
     }
 
-    $SUBST{SOURCE} = $source;
-
-    $opts = defined( $S->{options} ) ? $S->{options} : $DEFAULT_OPTIONS;
+    $SUBST{'SOURCE'} = $source;
+
+    $opts = defined( $S->{'options'} ) ? $S->{'options'} : $DEFAULT_OPTIONS;
 
     my $optsaddr = $opts;
     $optsaddr =~ s/^(.*,)?ip=([^,]+)(,.*)?$/$2/;
@@ -772,11 +772,11 @@
         }
     }
 
-    $SUBST{OPTIONS} = $opts;
+    $SUBST{'OPTIONS'} = $opts;
     $sortedopts = join ( ',', sort split ( ',', $opts ) );
 
-    $fstype = defined( $S->{fstype} ) ? $S->{fstype} : $DEFAULT_FSTYPE;
-    $SUBST{FSTYPE} = $fstype;
+    $fstype = defined( $S->{'fstype'} ) ? $S->{'fstype'} : $DEFAULT_FSTYPE;
+    $SUBST{'FSTYPE'} = $fstype;
 
     if ( !open( FSTAB, "< /etc/fstab" ) ) {
         Warn( $ERR_OPEN, "Impossible de lire /etc/fstab" );
@@ -854,7 +854,7 @@
         $addmountfstab = 0;
     }
 
-    if ( !$options->{noaction} ) {
+    if ( !$options->{'noaction'} ) {
         if ( !open( MOUNTS, "< /proc/mounts" ) ) {
             Warn( $ERR_OPEN, "Impossible de lire /proc/mounts" );
         }
@@ -920,7 +920,7 @@
 
     if ( $addmountfstab || $addmountmounts || !-d $dest ) {
 
-        if ( $options->{verbose} || $options->{simul} ) {
+        if ( $options->{'verbose'} || $options->{'simul'} ) {
             Log("(action needed)");
         }
 
@@ -929,11 +929,11 @@
         Do_before_change( $S, $options ) && return 1;
 
         if ( !-d $dest && $dest ne 'none' ) {
-            if ( !defined( $FUNCTIONS{mkdir} ) ) {
+            if ( !defined( $FUNCTIONS{'mkdir'} ) ) {
                 Warn( $ERR_OPEN, "Fonction mkdir necessaire pour addmount" );
                 return 1;
             }
-            $FUNCTIONS{mkdir}->( $S, $dest, $options );
+            $FUNCTIONS{'mkdir'}->( $S, $dest, $options );
         }
 
         if ($addmountfstab) {
@@ -994,11 +994,11 @@
             close(NEWFSTAB);
             close(FSTAB);
 
-            if ( $options->{diff} ) {
+            if ( $options->{'diff'} ) {
                 deferredlogsystem( "diff -uN '/etc/fstab' '" . $tmp . "'" );
             }
 
-            if ( !$options->{simul} ) {
+            if ( !$options->{'simul'} ) {
                 if ( system( "cat '" . $tmp . "' > /etc/fstab" ) ) {
                     Warn( $ERR_OPEN,
                         "Impossible de recopier " . $tmp . " dans /etc/fstab" );
@@ -1009,7 +1009,7 @@
 
         if ($addmountmounts) {
 
-            if ( $options->{diff} ) {
+            if ( $options->{'diff'} ) {
                 if ( ( ( defined $oldmresolvedsource ) 
                     ? $oldmresolvedsource
                     : '?' ) ne $source )
@@ -1043,7 +1043,7 @@
                 }
             }
 
-            if ( !$options->{simul} && !$options->{noaction} ) {
+            if ( !$options->{'simul'} && !$options->{'noaction'} ) {
 
                 if ( defined($oldmsource)
                     && $oldmsource ne $source
@@ -1117,44 +1117,44 @@
     return 0;
 };
 
-$FUNCTIONS{ignore} = sub {
+$FUNCTIONS{'ignore'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     return 0;
 };
 
-$DEPENDS{addlink} = sub {
+$DEPENDS{'addlink'} = sub {
     my ( $S, $dest, $options ) = @_;
-    my $source = Subst_vars( $S->{source} );
+    my $source = Subst_vars( $S->{'source'} );
 
     while ( $source ne '/' && $source ne '.' ) {
-        $S->{depends} .= " " . dirname($source);
+        $S->{'depends'} .= " " . dirname($source);
         $source = dirname($source);
     }
     while ( $dest ne '/' && $dest ne '.' ) {
-        $S->{depends} .= " " . dirname($dest);
+        $S->{'depends'} .= " " . dirname($dest);
         $dest = dirname($dest);
     }
 };
 
-$FUNCTIONS{addlink} = sub {
+$FUNCTIONS{'addlink'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     my $cmp = 0;
 
-    if ( !defined( $S->{source} ) ) {
+    if ( !defined( $S->{'source'} ) ) {
         Abort( $ERR_SYNTAX, "Source non definie pour " . $dest );
     }
-    my $source = Subst_vars( $S->{source} );
+    my $source = Subst_vars( $S->{'source'} );
 
     if ( !-l $dest || ( -l $dest && readlink($dest) ne $source ) ) {
         $cmp = 1;
 
-        if ( $options->{verbose} || $options->{simul} ) {
+        if ( $options->{'verbose'} || $options->{'simul'} ) {
             Log("(action needed)");
         }
 
-        if ( $options->{diff} ) {
+        if ( $options->{'diff'} ) {
             if ( -l $dest ) {
                 Log( "( readlink = " . readlink($dest) . ")" );
             }
@@ -1167,7 +1167,7 @@
 
         Do_before_change( $S, $options ) && return 1;
 
-        if ( !$options->{simul} ) {
+        if ( !$options->{'simul'} ) {
             Do_moveold( $dest, $options );
 
             if ( Mk_dest_dir($dest) || ln_sfn( $source, $dest ) ) {
@@ -1185,25 +1185,25 @@
     return 0;
 };
 
-$DEPENDS{createfile} = sub {
+$DEPENDS{'createfile'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     while ( $dest ne '/' && $dest ne '.' ) {
-        $S->{depends} .= " " . dirname($dest);
+        $S->{'depends'} .= " " . dirname($dest);
         $dest = dirname($dest);
     }
 };
 
-$FUNCTIONS{createfile} = sub {
+$FUNCTIONS{'createfile'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     my $cmp = 0;
 
-    if ( !defined $S->{source} ) {
+    if ( !defined $S->{'source'} ) {
         if ( !-f $dest ) {
             $cmp = 1;
 
-            if ( $options->{verbose} || $options->{simul} ) {
+            if ( $options->{'verbose'} || $options->{'simul'} ) {
                 Log("(action needed)");
             }
 
@@ -1211,7 +1211,7 @@
 
             Do_before_change( $S, $options ) && return 1;
 
-            if ( !$options->{simul} ) {
+            if ( !$options->{'simul'} ) {
 
                 #Do_moveold( $dest, $options );
 
@@ -1230,19 +1230,19 @@
         my $source;
         my $tmp;
 
-        $source = Get_source( Subst_vars( $S->{source} ) );
-        $SUBST{SOURCE} = $source;
+        $source = Get_source( Subst_vars( $S->{'source'} ) );
+        $SUBST{'SOURCE'} = $source;
 
         $tmp = Get_tmp_dest($dest);
-        $SUBST{DESTINATION} = $tmp;
+        $SUBST{'DESTINATION'} = $tmp;
 
         if ( !-f $source ) {
             Warn( $ERR_OPEN, "Impossible d'ouvrir " . $source );
             return 1;
         }
 
-        if ( defined( $S->{filter} ) ) {
-            my $filter = Subst_vars( $S->{filter} );
+        if ( defined( $S->{'filter'} ) ) {
+            my $filter = Subst_vars( $S->{'filter'} );
             if ( deferredlogsystem($filter) ) {
                 Warn( $ERR_OPEN, "Impossible d'appliquer " . $filter );
                 return 1;
@@ -1268,7 +1268,7 @@
         if ( !-f $dest ) {
             $cmp = 1;
 
-            if ( $options->{verbose} || $options->{simul} ) {
+            if ( $options->{'verbose'} || $options->{'simul'} ) {
                 Log("(action needed)");
             }
 
@@ -1276,7 +1276,7 @@
 
             Do_before_change( $S, $options ) && return 1;
 
-            if ( !$options->{simul} ) {
+            if ( !$options->{'simul'} ) {
 
                 #Do_moveold( $dest, $options );
 
@@ -1303,16 +1303,16 @@
     return 0;
 };
 
-$DEPENDS{mkdir} = sub {
+$DEPENDS{'mkdir'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     while ( $dest ne '/' && $dest ne '.' ) {
-        $S->{depends} .= " " . dirname($dest);
+        $S->{'depends'} .= " " . dirname($dest);
         $dest = dirname($dest);
     }
 };
 
-$FUNCTIONS{mkdir} = sub {
+$FUNCTIONS{'mkdir'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     my $cmp = 0;
@@ -1320,7 +1320,7 @@
     if ( !-d $dest ) {
         $cmp = 1;
 
-        if ( $options->{verbose} || $options->{simul} ) {
+        if ( $options->{'verbose'} || $options->{'simul'} ) {
             Log("(action needed)");
         }
 
@@ -1328,7 +1328,7 @@
 
         Do_before_change( $S, $options ) && return 1;
 
-        if ( !$options->{simul} ) {
+        if ( !$options->{'simul'} ) {
             Do_moveold( $dest, $options );
 
             if ( deferredlogsystem( "/bin/mkdir -p '" . $dest . "'" ) ) {
@@ -1349,7 +1349,7 @@
     return 0;
 };
 
-$FUNCTIONS{removefile} = sub {
+$FUNCTIONS{'removefile'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     my $cmp = 0;
@@ -1360,7 +1360,7 @@
     if ( -f $dest ) {
         $cmp = 1;
 
-        if ( $options->{verbose} || $options->{simul} ) {
+        if ( $options->{'verbose'} || $options->{'simul'} ) {
             Log("(action needed)");
         }
 
@@ -1368,7 +1368,7 @@
 
         Do_before_change( $S, $options ) && return 1;
 
-        if ( !$options->{simul} ) {
+        if ( !$options->{'simul'} ) {
 
             Do_moveold( $dest, $options );
 
@@ -1394,7 +1394,7 @@
     return 0;
 };
 
-$FUNCTIONS{removedir} = sub {
+$FUNCTIONS{'removedir'} = sub {
     my ( $S, $dest, $options ) = @_;
 
     my $cmp = 0;
@@ -1406,7 +1406,7 @@
     if ( -d $dest ) {
         $cmp = 1;
 
-        if ( $options->{verbose} || $options->{simul} ) {
+        if ( $options->{'verbose'} || $options->{'simul'} ) {
             Log("(action needed)");
         }
 
@@ -1414,7 +1414,7 @@
 
         Do_before_change( $S, $options ) && return 1;
 
-        if ( !$options->{simul} ) {
+        if ( !$options->{'simul'} ) {
 
             Do_moveold( $dest, $options );
 
@@ -1509,11 +1509,11 @@
     }
     $prio++;
 
-    if ( $C->{$a}->{action} eq 'mkdir' ) {
+    if ( $C->{$a}->{'action'} eq 'mkdir' ) {
         return $prio;
     }
     $prio++;
-    if ( $C->{$a}->{action} eq 'addmount' ) {
+    if ( $C->{$a}->{'action'} eq 'addmount' ) {
         return $prio;
     }
     $prio++;
@@ -1527,32 +1527,32 @@
     }
     $prio++;
 
-    if ( $C->{$a}->{action} eq 'dpkg-purge' ) {
+    if ( $C->{$a}->{'action'} eq 'dpkg-purge' ) {
         return $prio;
     }
     $prio++;
-    if ( $C->{$a}->{action} eq 'apt-get' ) {
+    if ( $C->{$a}->{'action'} eq 'apt-get' ) {
         return $prio;
     }
     $prio++;
 
-    if ( $C->{$a}->{action} eq 'createfile' ) {
+    if ( $C->{$a}->{'action'} eq 'createfile' ) {
         return $prio;
     }
     $prio++;
-    if ( $C->{$a}->{action} eq 'addfile' ) {
+    if ( $C->{$a}->{'action'} eq 'addfile' ) {
         return $prio;
     }
     $prio++;
 
-    if ( $C->{$a}->{action} eq 'addlink' ) {
+    if ( $C->{$a}->{'action'} eq 'addlink' ) {
         return $prio;
     }
 
-    if ( $C->{$a}->{action} eq 'removefile' ) {
+    if ( $C->{$a}->{'action'} eq 'removefile' ) {
         return $prio;
     }
-    if ( $C->{$a}->{action} eq 'removedir' ) {
+    if ( $C->{$a}->{'action'} eq 'removedir' ) {
         return $prio;
     }
     $prio++;
@@ -1580,29 +1580,29 @@
 
     foreach $s (@sortedkeys) {
         if ( defined( $C->{$s} )
-            && !defined( $C->{$s}->{doing} )
-            && !defined( $C->{$s}->{done} ) )
+            && !defined( $C->{$s}->{'doing'} )
+            && !defined( $C->{$s}->{'done'} ) )
         {
 
-            $C->{$s}->{doing} = 1;
-
-            if ( defined( $C->{$s}->{action} )
-                && defined( $DEPENDS{ $C->{$s}->{action} } ) )
+            $C->{$s}->{'doing'} = 1;
+
+            if ( defined( $C->{$s}->{'action'} )
+                && defined( $DEPENDS{ $C->{$s}->{'action'} } ) )
             {
-                $DEPENDS{ $C->{$s}->{action} }->( $C->{$s}, $s, $options );
-            }
-
-            if ( defined( $C->{$s}->{depends} ) ) {
+                $DEPENDS{ $C->{$s}->{'action'} }->( $C->{$s}, $s, $options );
+            }
+
+            if ( defined( $C->{$s}->{'depends'} ) ) {
                 my @dependsraw;
                 my @depends;
                 my $d;
 
-                @dependsraw = split ( /[ ,]+/, $C->{$s}->{depends} );
+                @dependsraw = split ( /[ ,]+/, $C->{$s}->{'depends'} );
 
                 foreach $d (@dependsraw) {
                     if ( defined($d) && $d ne "" && defined( $C->{$d} ) ) {
                         push @depends, $d;
-                        if ( $C->{$d}->{action} eq 'addmount' ) {
+                        if ( $C->{$d}->{'action'} eq 'addmount' ) {
                             Warn( $ERR_OPEN,
                                 "[" . $s
                                 . "] depends on addmount [" . $d
@@ -1620,15 +1620,15 @@
 
             Log( "[" . $s . "]" );
 
-            if ( !defined( $C->{$s}->{action} ) ) {
+            if ( !defined( $C->{$s}->{'action'} ) ) {
                 Abort( $ERR_SYNTAX, "Action non definie" );
             }
-            if ( !defined( $FUNCTIONS{ $C->{$s}->{action} } ) ) {
+            if ( !defined( $FUNCTIONS{ $C->{$s}->{'action'} } ) ) {
                 Abort( $ERR_SYNTAX,
-                    "Action inconnue '" . $C->{$s}->{action} . "'" );
-            }
-
-            if ( $FUNCTIONS{ $C->{$s}->{action} }->( $C->{$s}, $s, $options ) )
+                    "Action inconnue '" . $C->{$s}->{'action'} . "'" );
+            }
+
+            if ( $FUNCTIONS{ $C->{$s}->{'action'} }->( $C->{$s}, $s, $options ) )
             {
                 FlushLog();
                 $errorcount++;
@@ -1637,7 +1637,7 @@
                 DelLog();
             }
 
-            $C->{$s}->{done} = 1;
+            $C->{$s}->{'done'} = 1;
         }
     }
 
@@ -1657,7 +1657,7 @@
     
     $options = Get_options(@options);
 
-    if ( $options->{help} ) {
+    if ( $options->{'help'} ) {
         Do_help();
         exit;
     }
@@ -1676,7 +1676,7 @@
    SaveRunningBrancheName($branchecvs); 
 
 
-    if ( defined( $options->{noupdate} ) ) {
+    if ( defined( $options->{'noupdate'} ) ) {
         Abort( $ERR_OPEN, "Configuration desactivee [noupdate]" );
     }
 
@@ -1721,22 +1721,22 @@
 
     $options = \%optionshash;
 
-    if ( $options->{quiet} ) {
+    if ( $options->{'quiet'} ) {
         Log("update-config started in quiet mode...");
         $DEFERREDLOG = 1;
     }
 
-    if ( $options->{diff} ) {
-        $options->{simul} = 1;
+    if ( $options->{'diff'} ) {
+        $options->{'simul'} = 1;
     }
 
     if ( defined( $ARGV[0] ) && $ARGV[0] eq ':NO-ACTION:' ) {
         Warn( $ERR_OPEN, ":NO-ACTION: depreciated, please use --noaction" );
-        $options->{noaction} = 1;
+        $options->{'noaction'} = 1;
     }
     if ( defined( $ARGV[0] ) && $ARGV[0] eq ':NO-UPDATE:' ) {
         Warn( $ERR_OPEN, ":NO-UPDATE: depreciated, please use --noupdate" );
-        $options->{noupdate} = 1;
+        $options->{'noupdate'} = 1;
     }
 
     return $options;
@@ -1756,7 +1756,7 @@
     foreach $conf ( $COMMON, grep ( /^$template$/, readdir(CONFIG) ) ) {
         my $c = Load_conf( Get_source( "GLOBAL:" . $conf ), 1 );
         foreach ( keys %$c ) {
-            if ( $c->{$_}->{action} eq 'ignore' && !defined( $C->{$_} ) ) {
+            if ( $c->{$_}->{'action'} eq 'ignore' && !defined( $C->{$_} ) ) {
                 Warn( $ERR_OPEN,
                     "ignoring previous inexistant [" . $_ . "] in " . $conf );
             }
@@ -1834,7 +1834,7 @@
   my $umask = umask($CVS_UMASK);
   my $olddeferredlog;
 
-  $ENV{CVS_RSH} = $CVS_RSH;
+  $ENV{'CVS_RSH'} = $CVS_RSH;
 
 
   # CVS_COMMAND peut deja etre def dans /etc/pf-tools.conf 
@@ -1863,7 +1863,7 @@
   
   }
 
-  print $CVS_COMMAND."\n" if $options->{debug} or $options->{verbose};
+  print $CVS_COMMAND."\n" if $options->{'debug'} or $options->{'verbose'};
 
   system( "/bin/mkdir -p '" . $CVS_WORKING_DIR . "' 2>/dev/null" );
 




More information about the Pf-tools-commits mailing list