pf-tools commit: r832 [ccaillet-guest] - in /branches/next-gen: debian/changelog lib/PFTools/Update.pm lib/PFTools/Update/Removedir.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Mon Aug 23 09:26:07 UTC 2010


Author: ccaillet-guest
Date: Mon Aug 23 09:26:06 2010
New Revision: 832

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=832
Log:
* lib/PFTools/Update/Removefile.pm
  - extrating apt-get functions (action and depends) from Update.pm
* lib/PFTools/Update/Removedir.pm
  - extrating apt-get functions (action and depends) from Update.pm

Added:
    branches/next-gen/lib/PFTools/Update/Removedir.pm   (with props)
Modified:
    branches/next-gen/debian/changelog
    branches/next-gen/lib/PFTools/Update.pm

Modified: branches/next-gen/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/debian/changelog?rev=832&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Mon Aug 23 09:26:06 2010
@@ -29,10 +29,14 @@
     - extrating apt-get functions (action and depends) from Update.pm
   * lib/PFTools/Update/Addlink.pm
     - extrating apt-get functions (action and depends) from Update.pm
+  * lib/PFTools/Update/Removefile.pm
+    - extrating apt-get functions (action and depends) from Update.pm
+  * lib/PFTools/Update/Removedir.pm
+    - extrating apt-get functions (action and depends) from Update.pm
   * debian/control
     - adding libtext-diff-perl as depends for pf-tools package
 
- -- Christophe Caillet <tof at sitadelle.com>  Mon, 23 Aug 2010 07:21:30 +0200
+ -- Christophe Caillet <quadchris at free.fr>  Mon, 23 Aug 2010 11:25:08 +0200
 
 pf-tools (0.99.98-1) unstable; urgency=low
 

Modified: branches/next-gen/lib/PFTools/Update.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update.pm?rev=832&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/Update.pm (original)
+++ branches/next-gen/lib/PFTools/Update.pm Mon Aug 23 09:26:06 2010
@@ -49,6 +49,7 @@
 use PFTools::Update::Createfile;
 use PFTools::Update::Addlink;
 use PFTools::Update::Removefile;
+use PFTools::Update::Removedir;
 use PFTools::Logger;
 use PFTools::Parser;
 use PFTools::Net;
@@ -67,33 +68,6 @@
 
 my %DEPENDS;
 my %FUNCTIONS;
-
-$FUNCTIONS{'removedir'} = sub ($$$$$) {
-    my ( $ref_section, $dest, $options, $hash_subst, $global_config ) = @_;
-
-    my $cmp = 0;
-	if ( -e $dest && !-d $dest ) {
-		Warn( $CODE->{'OPEN'},
-			"Destination ".$dest." MUST BE a directory" );
-		return 1;
-	}
-	if ( -d $dest ) {
-		$cmp = 1;
-		if ( $options->{'verbose'} || $options->{'simul'} ) {
-			Log("(action needed)");
-		}
-		Do_on_config( $ref_section, $options, $hash_subst ) && return 1;
-		Do_before_change( $ref_section, $options, $hash_subst ) && return 1;
-		if ( !$options->{'simul'} ) {
-			Do_moveold( $dest, $options );
-		}
-	}
-	if ( $cmp ) {
-		Do_after_change( $ref_section, $options, $hash_subst ) && return 1;
-		Do_on_noaction( $ref_section, $options, $hash_subst ) && return 1;
-	}
-	return 0;
-};
 
 sub Get_depends_for_action ($$$$) {
 	my ( $action, $ref_section, $dest, $options ) = @_;
@@ -116,9 +90,9 @@
 	elsif ( $action eq "addlink" ) {
 		Addlink_depends ( $ref_section, $dest, $options );
 	}
-	elsif ( $DEPENDS{$action} ) {
-		$DEPENDS{$action}->( $ref_section, $dest, $options );
-	}
+# 	elsif ( $DEPENDS{$action} ) {
+# 		$DEPENDS{$action}->( $ref_section, $dest, $options );
+# 	}
 }
 
 sub Exec_action ($$$$$$) {
@@ -141,7 +115,8 @@
 	return Createfile_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "createfile" );
 	return Addlink_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "addlink" );
 	return Removefile_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "removefile" );
-	return $FUNCTIONS{$action}->( $ref_section, $dest, $options, $hash_subst, $global_config );
+	return Removedir_action ( $ref_section, $dest, $options, $hash_subst, $global_config ) if ( $action eq "removedir" );
+# 	return $FUNCTIONS{$action}->( $ref_section, $dest, $options, $hash_subst, $global_config );
 }
 
 sub Trie_prio {

Added: branches/next-gen/lib/PFTools/Update/Removedir.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/Update/Removedir.pm?rev=832&op=file
==============================================================================
--- branches/next-gen/lib/PFTools/Update/Removedir.pm (added)
+++ branches/next-gen/lib/PFTools/Update/Removedir.pm Mon Aug 23 09:26:06 2010
@@ -1,0 +1,66 @@
+package PFTools::Update::Removedir;
+##
+##  $Id$
+##
+##  Copyright (C) 2010 Christophe Caillet <quadchris at free.fr>
+##
+##  This program is free software; you can redistribute it and/or
+##  modify it under the terms of the GNU General Public License
+##  as published by the Free Software Foundation; either version 2
+##  of the License, or (at your option) any later version.
+##
+##  This program is distributed in the hope that it will be useful,
+##  but WITHOUT ANY WARRANTY; without even the implied warranty of
+##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+##  GNU General Public License for more details.
+##
+##  You should have received a copy of the GNU General Public License
+##  along with this program; if not, write to the Free Software
+##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+##
+
+use strict;
+use warnings;
+
+use Exporter;
+
+our @ISA = ('Exporter');
+
+our @EXPORT = qw(
+	Removedir_action
+);
+
+our @EXPORT_OK = qw();
+
+use PFTools::Logger;
+use PFTools::Conf;
+use PFTools::Update::Common;
+
+sub Removedir_action ($$$$$) {
+    my ( $ref_section, $dest, $options, $hash_subst, $global_config ) = @_;
+
+    my $cmp = 0;
+	if ( -e $dest && !-d $dest ) {
+		Warn( $CODE->{'OPEN'},
+			"Destination ".$dest." MUST BE a directory" );
+		return 1;
+	}
+	if ( -d $dest ) {
+		$cmp = 1;
+		if ( $options->{'verbose'} || $options->{'simul'} ) {
+			Log("(action needed)");
+		}
+		Do_on_config( $ref_section, $options, $hash_subst ) && return 1;
+		Do_before_change( $ref_section, $options, $hash_subst ) && return 1;
+		if ( !$options->{'simul'} ) {
+			Do_moveold( $dest, $options );
+		}
+	}
+	if ( $cmp ) {
+		Do_after_change( $ref_section, $options, $hash_subst ) && return 1;
+		Do_on_noaction( $ref_section, $options, $hash_subst ) && return 1;
+	}
+	return 0;
+}
+
+1;

Propchange: branches/next-gen/lib/PFTools/Update/Removedir.pm
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Mon Aug 23 09:26:06 2010
@@ -1,0 +1,2 @@
+Id
+Revision




More information about the pf-tools-commits mailing list