pf-tools commit: r875 [ccaillet-guest] - in /branches/0.33-stable: debian/changelog lib/PFTools/Conf.pm lib/PFTools/Update.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Mon Sep 6 09:10:41 UTC 2010


Author: ccaillet-guest
Date: Mon Sep  6 09:10:35 2010
New Revision: 875

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=875
Log:
  - introducing $SORT_CONFIG, permit to sort by read order if $SORT_CONFIG
  equal 1 else use the old sort method (Olivier Molteni's patch)
* lib/PFTools/Conf.pm
  - introducing read_order key (Olivier Molteni's patch) 

Modified:
    branches/0.33-stable/debian/changelog
    branches/0.33-stable/lib/PFTools/Conf.pm
    branches/0.33-stable/lib/PFTools/Update.pm

Modified: branches/0.33-stable/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/debian/changelog?rev=875&op=diff
==============================================================================
--- branches/0.33-stable/debian/changelog (original)
+++ branches/0.33-stable/debian/changelog Mon Sep  6 09:10:35 2010
@@ -10,8 +10,12 @@
   * lib/PFTools/Update.pm
     - FIX: use our instead of my definition var for CVS definition. These
     vars are defined into pf-tools.conf file
-
- -- Christophe Caillet <quadchris at free.fr>  Mon, 26 Jul 2010 11:10:06 +0200
+    - introducing $SORT_CONFIG, permit to sort by read order if $SORT_CONFIG
+    equal 1 else use the old sort method (Olivier Molteni's patch)
+  * lib/PFTools/Conf.pm
+    - introducing read_order key (Olivier Molteni's patch) 
+
+ -- Christophe Caillet <tof at sitadelle.com>  Mon, 06 Sep 2010 11:07:54 +0200
 
 pf-tools (0.33.20-1) unstable; urgency=low
 

Modified: branches/0.33-stable/lib/PFTools/Conf.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/lib/PFTools/Conf.pm?rev=875&op=diff
==============================================================================
--- branches/0.33-stable/lib/PFTools/Conf.pm (original)
+++ branches/0.33-stable/lib/PFTools/Conf.pm Mon Sep  6 09:10:35 2010
@@ -58,6 +58,10 @@
 my $sortie;
 my $tmpfile = "/tmp/update-config.log";
 
+
+# Global counter
+my $read_order = 1 ;
+
 # Table de substitution globale
 our %SUBST;
 
@@ -546,6 +550,7 @@
 		}
 		else {
 		    $CONF->{$current} = {};
+		    $CONF->{$current}->{'read_order'} = $read_order++;
 		    $LOCATION->{$current}->{_location}
 			= $FIC_CONF[0] . ":" . $line[0];
 		}

Modified: branches/0.33-stable/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/lib/PFTools/Update.pm?rev=875&op=diff
==============================================================================
--- branches/0.33-stable/lib/PFTools/Update.pm (original)
+++ branches/0.33-stable/lib/PFTools/Update.pm Mon Sep  6 09:10:35 2010
@@ -96,6 +96,10 @@
 our $CVS_CONFIG     = "config";
 our $CVS_COMMAND;
 our $CVS_BRANCHE;
+
+# If set to something, sort configuration entries in the reading order
+# default to legacy alphabetic order if not set
+our $SORT_CONFIG    = 0 ;
 
 # End Conf Par Defaut!
 
@@ -1795,7 +1799,13 @@
 	Abort( $ERR_OPEN, "Configuration desactivee [noupdate]" );
     }
 
-    @sortedkeys = sort { Trie_dependances( $C, $a, $b ) } keys %$C;
+    if ( $SORT_CONFIG )  {
+       @sortedkeys = sort { $C->{$a}->{'read_order'} <=> $C->{$b}->{'read_order'} } keys %$C;
+    }
+    else {
+       @sortedkeys = sort { Trie_dependances( $C, $a, $b ) } keys %$C;
+    }
+
 
     $| = 1;
     $errorcount = Do_updateloop( $C, $ref_options, @sortedkeys );




More information about the pf-tools-commits mailing list