r36951 - in /trunk/libconfig-augeas-perl: Build.PL ChangeLog META.yml debian/changelog lib/Config/Augeas.pm lib/Config/Augeas.xs t/Config-Augeas.t t/Config-AugeasC.t

gregoa at users.alioth.debian.org gregoa at users.alioth.debian.org
Sun May 31 14:39:09 UTC 2009


Author: gregoa
Date: Sun May 31 14:39:04 2009
New Revision: 36951

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=36951
Log:
New upstream release.

Modified:
    trunk/libconfig-augeas-perl/Build.PL
    trunk/libconfig-augeas-perl/ChangeLog
    trunk/libconfig-augeas-perl/META.yml
    trunk/libconfig-augeas-perl/debian/changelog
    trunk/libconfig-augeas-perl/lib/Config/Augeas.pm
    trunk/libconfig-augeas-perl/lib/Config/Augeas.xs
    trunk/libconfig-augeas-perl/t/Config-Augeas.t
    trunk/libconfig-augeas-perl/t/Config-AugeasC.t

Modified: trunk/libconfig-augeas-perl/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-augeas-perl/Build.PL?rev=36951&op=diff
==============================================================================
--- trunk/libconfig-augeas-perl/Build.PL (original)
+++ trunk/libconfig-augeas-perl/Build.PL Sun May 31 14:39:04 2009
@@ -54,11 +54,11 @@
 my $aug_version = `pkg-config --modversion augeas` ;
 chomp($aug_cflags, $aug_libs, $aug_version) ;
 
-if (   not defined $aug_version or ( $aug_version lt '0.4.0')) {
+if (   not defined $aug_version or ( $aug_version lt '0.5.0')) {
     warn << "EOW2" ;
 ***
 *** 'pkg-config' did find augeas version $aug_version but 
-*** version 0.4.0 minimum is required
+*** version 0.5.0 minimum is required
 ***
 EOW2
     exit 0;

Modified: trunk/libconfig-augeas-perl/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-augeas-perl/ChangeLog?rev=36951&op=diff
==============================================================================
--- trunk/libconfig-augeas-perl/ChangeLog (original)
+++ trunk/libconfig-augeas-perl/ChangeLog Sun May 31 14:39:04 2009
@@ -1,3 +1,10 @@
+2009-05-27  Dominique Dumont  <dominique.dumont at hp.com> v 0.500
+
+	* lib/Config/Augeas.pm (new): added no_load, save => noop,
+	no_std_inc options
+	(defvar): new method for Augeas 0.5.0
+	(defnode): new method for Augeas 0.5.0
+
 2009-02-17  Dominique Dumont  <dominique.dumont at hp.com> v0.400
 
 	* lib/Config/Augeas.xs (match): dies if aug_match returns -1. Perl

Modified: trunk/libconfig-augeas-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-augeas-perl/META.yml?rev=36951&op=diff
==============================================================================
--- trunk/libconfig-augeas-perl/META.yml (original)
+++ trunk/libconfig-augeas-perl/META.yml Sun May 31 14:39:04 2009
@@ -1,6 +1,6 @@
 ---
 name: Config-Augeas
-version: 0.400
+version: 0.500
 author:
   - Dominique Dumont (ddumont at cpan dot org)
 abstract: Edit configuration files through Augeas C library
@@ -13,8 +13,8 @@
 provides:
   Config::Augeas:
     file: lib/Config/Augeas.pm
-    version: 0.400
-generated_by: Module::Build version 0.3
+    version: 0.500
+generated_by: Module::Build version 0.33
 meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.2.html
-  version: 1.2
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4

Modified: trunk/libconfig-augeas-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-augeas-perl/debian/changelog?rev=36951&op=diff
==============================================================================
--- trunk/libconfig-augeas-perl/debian/changelog (original)
+++ trunk/libconfig-augeas-perl/debian/changelog Sun May 31 14:39:04 2009
@@ -1,3 +1,9 @@
+libconfig-augeas-perl (0.500-1) UNRELEASED; urgency=low
+
+  * New upstream release.
+
+ -- gregor herrmann <gregoa at debian.org>  Sun, 31 May 2009 16:36:59 +0200
+
 libconfig-augeas-perl (0.400-1) unstable; urgency=low
 
   * New upstream release 

Modified: trunk/libconfig-augeas-perl/lib/Config/Augeas.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-augeas-perl/lib/Config/Augeas.pm?rev=36951&op=diff
==============================================================================
--- trunk/libconfig-augeas-perl/lib/Config/Augeas.pm (original)
+++ trunk/libconfig-augeas-perl/lib/Config/Augeas.pm Sun May 31 14:39:04 2009
@@ -22,7 +22,7 @@
 use Carp;
 use IO::File ;
 
-our $VERSION = '0.400';
+our $VERSION = '0.500';
 
 require XSLoader;
 XSLoader::load('Config::Augeas', $VERSION);
@@ -87,16 +87,26 @@
 the environment variable C<AUGEAS_ROOT>. If that doesn't exist either,
 use "C</>".
 
-=item save => backup | newfile
+=item save => backup | newfile | noop
 
 Specify how to save the configuration file. Either create a newfile
 (with extension C<.augnew>, and do not overwrite the original file) or
-move the original file into a backup file (C<.augsave> extension)
+move the original file into a backup file (C<.augsave> extension).
+C<noop> make saves a no-op process, just record what would have
+changed
 
 =item type_check => 1
 
 Typecheck lenses; since it can be very expensive it is not done by
 default.
+
+=item no_std_inc
+
+Do not use the builtin load path for modules
+
+=item no_load
+
+Do not load the tree from AUG_INIT
 
 =back
 
@@ -113,13 +123,15 @@
     my $save = delete $args{save} || '';
     if    ($save eq 'backup')  { $flags ||= &AUG_SAVE_BACKUP }
     elsif ($save eq 'newfile') { $flags ||= &AUG_SAVE_NEWFILE }
+    elsif ($save =~ 'noop')    { $flags ||= &AUG_SAVE_NOOP }
     elsif ($save) { 
 	croak  __PACKAGE__," new: unexpected save value: $save. ",
 	  "Expected backup or newfile";
     }
 
-    my $check = delete $args{type_check} || 0;
-    $flags ||= &AUG_TYPE_CHECK if $check ;
+    $flags ||= &AUG_TYPE_CHECK if ( delete $args{type_check} || 0 );
+    $flags ||= &AUG_NO_STDINC  if ( delete $args{no_std_inc} || 0 ) ;
+    $flags ||= &AUG_NO_LOAD    if ( delete $args{no_load}    || 0 ) ;
 
     croak  __PACKAGE__," new: unexpected parameters: ",
       join (' ',keys %args) 
@@ -133,6 +145,70 @@
 }
 
 =head1 Methods
+
+=head2 defvar( name, [ expr ])
+
+Define a variable C<name> whose value is the result of evaluating
+C<expr>. If a variable C<name> already exists, its name will be replaced
+with the result of evaluating C<expr>.
+
+If C<expr> is omitted, the variable C<name> will be removed if it is
+defined.
+
+Path variables can be used in path expressions later on by prefixing
+them with '$'.
+
+Returns -1 on error; on success, returns 0 if C<expr> evaluates to anything
+other than a nodeset, and the number of nodes if C<expr> evaluates to a
+nodeset
+
+=cut
+
+sub defvar {
+    my $self = shift ;
+    my $name = shift || croak __PACKAGE__," defvar: undefined name";
+    my $expr = shift || 0 ;
+
+    return $self->{aug_c} -> defvar($name, $expr) ;
+}
+
+=head2 defnode ( name, expr, value )
+
+Define a variable C<name> whose value is the result of evaluating
+C<expr>, which must evaluate to a nodeset. If a variable C<name>
+already exists, its name will be replaced with the result of
+evaluating C<expr>.
+
+If C<expr> evaluates to an empty nodeset, a node is created, equivalent to
+calling C<set( expr, value)> and C<name> will be the nodeset containing
+that single node.
+
+Returns undef on error
+
+Returns an array containing:
+
+=over
+
+=item *
+
+the number of nodes in the nodeset
+
+=item *
+
+1 if a node was created, and 0 if it already existed.
+
+=back
+
+=cut
+
+sub defnode {
+    my $self = shift ;
+    my $name = shift || croak __PACKAGE__," defnode: undefined name";
+    my $expr = shift || croak __PACKAGE__," defnode: undefined expr";
+    my $value = shift || croak __PACKAGE__," defnode: undefined value";
+
+    return ($self->{aug_c} -> defnode($name, $expr, $value)) ;
+}
 
 =head2 get( path )
 

Modified: trunk/libconfig-augeas-perl/lib/Config/Augeas.xs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-augeas-perl/lib/Config/Augeas.xs?rev=36951&op=diff
==============================================================================
--- trunk/libconfig-augeas-perl/lib/Config/Augeas.xs (original)
+++ trunk/libconfig-augeas-perl/lib/Config/Augeas.xs Sun May 31 14:39:04 2009
@@ -46,6 +46,9 @@
     newCONSTSUB(stash, "AUG_SAVE_BACKUP",  newSViv(AUG_SAVE_BACKUP));
     newCONSTSUB(stash, "AUG_SAVE_NEWFILE", newSViv(AUG_SAVE_NEWFILE));
     newCONSTSUB(stash, "AUG_TYPE_CHECK",   newSViv(AUG_TYPE_CHECK));
+    newCONSTSUB(stash, "AUG_NO_STDINC",    newSViv(AUG_NO_STDINC));
+    newCONSTSUB(stash, "AUG_SAVE_NOOP",    newSViv(AUG_SAVE_NOOP));
+    newCONSTSUB(stash, "AUG_NO_LOAD",      newSViv(AUG_NO_LOAD));
   }
 
 Config_Augeas*
@@ -63,6 +66,30 @@
     CODE:
       //printf("destroying aug object\n");
       aug_close(aug);
+
+int
+aug_defvar(aug, name, expr)
+      Config_Augeas* aug
+      const char* name
+      const char* expr
+
+ # returns an array ( return value, created ) 
+int
+aug_defnode(aug, name, expr, value)
+      Config_Augeas* aug
+      const char* name
+      const char* expr
+      const char* value
+    INIT:
+      int created ;
+      int ret ;
+    PPCODE:
+      created = 1 ;
+      ret = aug_defnode(aug, name, expr, value, &created ) ;
+      if (ret >= 0 ) {
+        XPUSHs(sv_2mortal(newSVnv(ret)));
+        XPUSHs(sv_2mortal(newSVnv(created)));
+      }
 
 const char*
 aug_get(aug, path)

Modified: trunk/libconfig-augeas-perl/t/Config-Augeas.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-augeas-perl/t/Config-Augeas.t?rev=36951&op=diff
==============================================================================
--- trunk/libconfig-augeas-perl/t/Config-Augeas.t (original)
+++ trunk/libconfig-augeas-perl/t/Config-Augeas.t Sun May 31 14:39:04 2009
@@ -8,7 +8,7 @@
 
 use warnings ;
 use strict;
-use Test::More tests => 14 ;
+use Test::More tests => 18 ;
 
 ok(1,"Compilation done");
 
@@ -88,3 +88,18 @@
 is_deeply(\@content,\@expect,"check written file content");
 
 #$aug->print('/files/') ; # print all nodes into $data string
+
+$ret = $aug->defvar(etc => '/files/etc/*') ;
+is($ret,2,"defvar /files/etc/*") ;
+
+$ret = $aug->defvar(etc2 => '/files/etc') ;
+is($ret,1,"defvar etc2 /files/etc/*") ;
+
+$ret = $aug->get('$etc2/hosts/2/canonical') ;
+is($ret,'newbilbo',"Called get defvar (returned $ret )");
+
+my $v = '$etc2/hosts/1/ipaddr';
+ at a =  $aug->defnode(local => $v,'127.0.0.2') ;
+is_deeply(\@a,[1,0],"defnode $v") ;
+
+#$aug->print('') ;

Modified: trunk/libconfig-augeas-perl/t/Config-AugeasC.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libconfig-augeas-perl/t/Config-AugeasC.t?rev=36951&op=diff
==============================================================================
--- trunk/libconfig-augeas-perl/t/Config-AugeasC.t (original)
+++ trunk/libconfig-augeas-perl/t/Config-AugeasC.t Sun May 31 14:39:04 2009
@@ -21,8 +21,9 @@
 
 # constants are not exported so we switch package
 my $fail = 0;
-foreach my $constname (qw(
-	AUG_NONE AUG_SAVE_BACKUP AUG_SAVE_NEWFILE AUG_TYPE_CHECK)) {
+foreach my $constname (qw(AUG_NONE AUG_SAVE_BACKUP AUG_SAVE_NEWFILE 
+			  AUG_TYPE_CHECK AUG_NO_STDINC AUG_SAVE_NOOP
+			  AUG_NO_LOAD)) {
   next if (eval "my \$a = $constname; 1");
   if ($@ =~ /^Your vendor has not defined Config::Augeas macro $constname/) {
     print "# pass: $@";




More information about the Pkg-perl-cvs-commits mailing list