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

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Mon Aug 30 08:50:01 UTC 2010


Author: ccaillet-guest
Date: Mon Aug 30 08:50:00 2010
New Revision: 861

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=861
Log:
* lib/PFTools/VCS.pm
  - basic SVN implementation, need to write documentation about his usage

Modified:
    branches/next-gen/debian/changelog
    branches/next-gen/lib/PFTools/VCS.pm

Modified: branches/next-gen/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/debian/changelog?rev=861&op=diff
==============================================================================
--- branches/next-gen/debian/changelog (original)
+++ branches/next-gen/debian/changelog Mon Aug 30 08:50:00 2010
@@ -37,6 +37,8 @@
     - parameter for order sections list is now passed with an array ref instead
     of an array
     - renaming __Trie_prio and Trie_dependances
+  * lib/PFTools/VCS.pm
+    - basic SVN implementation, need to write documentation about his usage
   * lib/PFTools/Update/Common.pm
     - extracting common functions from Update.pm which are used by $FUNCTION
     and $DEPENDS in lib/PFTools/Update.pm
@@ -71,7 +73,7 @@
   * lib/PFTools/Compat/Translation.pm
     - library for translating old configuration (pf-tools 0.X) to new syntax
 
- -- Christophe Caillet <quadchris at free.fr>  Fri, 27 Aug 2010 16:28:06 +0200
+ -- Christophe Caillet <quadchris at free.fr>  Mon, 30 Aug 2010 10:48:08 +0200
 
 pf-tools (0.99.98-1) unstable; urgency=low
 

Modified: branches/next-gen/lib/PFTools/VCS.pm
URL: http://svn.debian.org/wsvn/pf-tools/branches/next-gen/lib/PFTools/VCS.pm?rev=861&op=diff
==============================================================================
--- branches/next-gen/lib/PFTools/VCS.pm (original)
+++ branches/next-gen/lib/PFTools/VCS.pm Mon Aug 30 08:50:00 2010
@@ -90,11 +90,60 @@
 	return $ret;
 }
 
+sub __SVN_update ($$$) {
+	my ( $hostname, $pf_config, $options ) = @_;
+	my $svn_cmd = $pf_config->{'vcs'}->{'command'};
+
+	if ( defined $options->{'branch'} && $options->{'branch'} ne '' ) {
+		if ( $svn_cmd ne '' ) {
+			Warn ( $CODE->{'DUPLICATE_VALUE'},
+				"Ignoring SVN command ".$svn_cmd." for using branche ".$options->{'branch'} );
+		}
+	}
+	elsif ( $pf_config->{'vcs'}->{'branch'} ) {
+		$options->{'branch'} = $pf_config->{'vcs'}->{'branch'};
+	}
+	else {
+		$options->{'branch'} = "";
+	}
+
+	my $ret;
+	my $umask = umask ( $pf_config->{'vcs'}->{'umask'} );
+
+	unless ( $svn_cmd ne "" ) {
+		$svn_cmd = "svn checkout "
+			.$pf_config->{'vcs'}->{'method'}."://".$pf_config->{'vcs'}->{'server'}."/"
+			.$pf_config->{'vcs'}->{'module'}
+			." --user ".$pf_config->{'vcs'}->{'user'}." --password ".$pf_config->{'vcs'}->{'password'};
+	}
+	print $svn_cmd."\n" if ( $options->{'debug'} || $options->{'verbose'} );
+
+	my $co_dir = $pf_config->{'path'}->{'checkout_dir'};
+	if ( ! -d  $co_dir ) {
+		system ( "/bin/mkdir -p '".$co_dir. "' 2>/dev/null" );
+	}
+    
+	$ret = deferredlogsystem ( "cd '".$co_dir."';".$svn_cmd );
+	if ($ret) {
+		FlushLog();
+	}
+	else {
+		DelLog();
+	}
+	umask($umask);
+	return $ret;
+}
+
 sub VCS_update ($$$) {
 	my ( $hostname, $pf_config, $options ) = @_;
 
 	if ( $pf_config->{'vcs'}->{'type'} eq 'cvs' ) {
 		if ( __CVS_update ( $hostname, $pf_config, $options ) ) {
+			return 0;
+		}
+	}
+	elsif ( $pf_config->{'vcs'}->{'type'} eq 'svn' ) {
+		if ( __SVN_update ( $hostname, $pf_config, $options ) ) {
 			return 0;
 		}
 	}




More information about the pf-tools-commits mailing list