pf-tools commit: r729 [parmelan-guest] - in /branches/0.33-stable: Makefile README.doc debian/changelog lib/PFTools/Update.pm

parmelan-guest at users.alioth.debian.org parmelan-guest at users.alioth.debian.org
Wed Dec 9 13:28:49 UTC 2009


Author: parmelan-guest
Date: Wed Dec  9 13:28:48 2009
New Revision: 729

URL: http://svn.debian.org/wsvn/pf-tools/?sc=1&rev=729
Log:
* lib/PFTools/Update.pm:
  - update the "version" directive handler
* Makefile:
  - fix empty lines that should contain a tab


Modified:
    branches/0.33-stable/Makefile
    branches/0.33-stable/README.doc
    branches/0.33-stable/debian/changelog
    branches/0.33-stable/lib/PFTools/Update.pm

Modified: branches/0.33-stable/Makefile
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/Makefile?rev=729&op=diff
==============================================================================
--- branches/0.33-stable/Makefile (original)
+++ branches/0.33-stable/Makefile Wed Dec  9 13:28:48 2009
@@ -53,7 +53,7 @@
 	# PFTools PXE template files
 	mkdir -p $(TPL_DIR)
 	install -o root -g root -m 600 $(TPL) $(TPL_DIR)
-
+	
 	# PFTools Config file
 	mkdir -p $(CONF_DIR)
 	install -o root -g root -m 600 $(CONF) $(CONF_DIR)/pf-tools.conf.new
@@ -62,11 +62,12 @@
 	# PFHost tools
 	mkdir -p $(SBIN_DIR)
 	install --owner=root --group=root --mode=0755 $(TOOLS) $(SBIN_DIR)
-
+	
 	# PFHost installers
 	mkdir -p $(INSTALLERS_DIR)
 	install --owner=root --group=root --mode=0755 $(INSTALLERS) $(INSTALLERS_DIR)
-
+	
 	# PFHost config files sample
 	install -d $(DESTDIR)/usr/share/doc/pf-host/
 	install $(DOC_HOST) $(DESTDIR)/usr/share/doc/pf-host/
+

Modified: branches/0.33-stable/README.doc
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/README.doc?rev=729&op=diff
==============================================================================
--- branches/0.33-stable/README.doc (original)
+++ branches/0.33-stable/README.doc Wed Dec  9 13:28:48 2009
@@ -265,9 +265,12 @@
 
 * version
 
-  The version directive is valid for the 'apt-get' action only. It permits
-  to install a specified version of a package. A control is made for the
-  availability of the specified version.
+  The version directive is valid for the 'apt-get' action only. The specified
+  version of the package will be installed instead of the default (latest
+  version available).
+
+  NOTE: if the installed version is greater than the specified version, the
+  package will be DOWNGRADED.
 
   Sample use :
 

Modified: branches/0.33-stable/debian/changelog
URL: http://svn.debian.org/wsvn/pf-tools/branches/0.33-stable/debian/changelog?rev=729&op=diff
==============================================================================
--- branches/0.33-stable/debian/changelog (original)
+++ branches/0.33-stable/debian/changelog Wed Dec  9 13:28:48 2009
@@ -5,8 +5,8 @@
     - in Do_updateloop : skipping circular dependencies for avoiding infinite
       loop
     - in $FUNCTION->{'apt-get'} : adding handler for version directive which
-      specifies a version to install (NEED TESTING!!). A control is done for
-      the availability of the specified version.
+      specifies a version to install. A control is done for the availability of
+      the specified version.
   * filters/filter_privateresolve : substitution occured with POPNAME keyword
     according to the value extracted from the host parameter
   * lib/PFTools/Net.pm : permit different bonding definition for a specified
@@ -21,6 +21,9 @@
     - Get_conf: sort readdir result, in order to always read update-hostname
       before update-hostname01 (thus allowing to ignore in update-hostname01 a
       section defined in update-hostname).
+    - update the "version" directive handler
+  * Makefile:
+    - fix empty lines that should contain a tab
   * tools/kvmlaunch:
     - always keep eth0 first in the list of network interfaces on the kvm
       command line, otherwiser DHCP requests will go out on the wrong
@@ -28,7 +31,7 @@
   * tools/kvmlaunch-helper:
     - remove a bashism
 
- -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org>  Tue, 08 Dec 2009 16:37:27 +0100
+ -- Thomas Parmelan <tom+pf-tools at ankh.fr.EU.org>  Wed, 09 Dec 2009 11:59:27 +0100
 
 pf-tools (0.33.18-1) unstable; urgency=low
 

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=729&op=diff
==============================================================================
--- branches/0.33-stable/lib/PFTools/Update.pm (original)
+++ branches/0.33-stable/lib/PFTools/Update.pm Wed Dec  9 13:28:48 2009
@@ -620,11 +620,6 @@
 $FUNCTIONS{'apt-get'} = sub {
     my ( $S, $dest, $options ) = @_;
 
-    my $installed_version;
-    my $available_version;
-    my $specified_version = 0;
-    my $install;
-
     my $name_filter = $S->{'name_filter'};
     if ($name_filter) {
 	$SUBST{'SECTIONNAME'} = $dest;
@@ -643,6 +638,11 @@
 
     aptupdate();
 
+    my $installed_version;
+    my $candidate_version;
+    my $wanted_version = $S->{'version'};
+    my $wanted_version_available;
+
     open( APTPOLICY, $APT_POLICY . ' ' . $dest . ' 2>/dev/null |' );
     while (<APTPOLICY>) {
 	if (m/^  Installed: (.*)$/) {
@@ -653,29 +653,32 @@
 	    }
 	}
 	elsif (m/^  Candidate: (.*)$/) {
-	    $available_version = $1;
-	}
-	elsif ( defined $S->{'version'} && /\Q$S->{'version'}\E/ ) {
-	    $specified_version = 1 ;
+	    $candidate_version = $1;
+	}
+	elsif ( $wanted_version and m/\s\Q$wanted_version\E\s/ ) {
+	    $wanted_version_available = 1;
 	}
     }
     close(APTPOLICY);
 
-    if ( !defined($available_version) ) {
+    if ( !defined($candidate_version) ) {
 	Warn( $ERR_OPEN, "Package " . $dest . " indisponible" );
 	return 1;
     }
-    if ( defined $S->{'version'} && ! $specified_version ) {
-	Warn( $ERR_OPEN, "Package " . $dest . " en version " . $S->{'version'} . " indisponible" );
+    if ( $wanted_version and not $wanted_version_available ) {
+	Warn( $ERR_OPEN, "Package $dest en version $wanted_version indisponible" );
 	return 1;
     }
 
+    my $target_version = $wanted_version_available ? $wanted_version : $candidate_version;
+    my $install;
     if (!defined($installed_version)
+	|| ($wanted_version_available and $wanted_version ne $installed_version)
 	|| !deferredlogsystem(
 	          $DPKG
 		. ' --compare-versions '
 		. $installed_version . ' lt '
-		. $available_version
+		. $target_version
 	)
 	)
     {
@@ -695,8 +698,10 @@
 		    )
 		    . ", avail = "
 		    . (
-		    defined($available_version) ? $available_version : '?'
+		    defined($candidate_version) ? $candidate_version : '?'
 		    )
+		    . ( $wanted_version ? ", wanted = $wanted_version" : '' )
+		    . ", target = $target_version"
 		    . ")"
 	    );
 	}
@@ -744,16 +749,11 @@
 	}
 
 	if ( !$options->{'simul'} ) {
-	    my $install_cmd = $install . " " . $APT_GET . " install '" . $dest . "'";
-	    if ( $specified_version ) {
-		$install_cmd = $install . " " . $APT_GET . " install '" . $dest . "=". $S->{'version'} ."'";
-	    }
-	    if (deferredlogsystem(
-		    $install . " " . $APT_GET . " install '" . $dest . "'"
-		)
-		)
-	    {
-		Warn( $ERR_OPEN, "Installation de " . $dest . " impossible" );
+	    my $install_cmd
+		= $install . " " . $APT_GET . " install '"
+		. $dest . ($wanted_version_available ? "=$wanted_version" : '') . "'";
+	    if (deferredlogsystem($install_cmd)) {
+		Warn( $ERR_OPEN, "Installation de $dest impossible" );
 		return 1;
 	    }
 	}




More information about the pf-tools-commits mailing list