r49139 - in /branches/upstream/libconfig-augeas-perl/current: Build.PL ChangeLog META.yml lib/Config/Augeas.pm lib/Config/Augeas.xs t/Config-Augeas.t t/Config-AugeasC.t
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Tue Dec 22 03:19:40 UTC 2009
Author: jawnsy-guest
Date: Tue Dec 22 03:19:28 2009
New Revision: 49139
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=49139
Log:
[svn-upgrade] Integrating new upstream version, libconfig-augeas-perl (0.601)
Modified:
branches/upstream/libconfig-augeas-perl/current/Build.PL
branches/upstream/libconfig-augeas-perl/current/ChangeLog
branches/upstream/libconfig-augeas-perl/current/META.yml
branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.pm
branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.xs
branches/upstream/libconfig-augeas-perl/current/t/Config-Augeas.t
branches/upstream/libconfig-augeas-perl/current/t/Config-AugeasC.t
Modified: branches/upstream/libconfig-augeas-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-augeas-perl/current/Build.PL?rev=49139&op=diff
==============================================================================
--- branches/upstream/libconfig-augeas-perl/current/Build.PL (original)
+++ branches/upstream/libconfig-augeas-perl/current/Build.PL Tue Dec 22 03:19:28 2009
@@ -54,11 +54,13 @@
my $aug_version = `pkg-config --modversion augeas` ;
chomp($aug_cflags, $aug_libs, $aug_version) ;
-if ( not defined $aug_version or ( $aug_version lt '0.5.0')) {
+my $min_version = '0.6.0' ;
+
+if ( not defined $aug_version or ( $aug_version lt $min_version)) {
warn << "EOW2" ;
***
*** 'pkg-config' did find augeas version $aug_version but
-*** version 0.5.0 minimum is required
+*** version $min_version minimum is required
***
EOW2
exit 0;
Modified: branches/upstream/libconfig-augeas-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-augeas-perl/current/ChangeLog?rev=49139&op=diff
==============================================================================
--- branches/upstream/libconfig-augeas-perl/current/ChangeLog (original)
+++ branches/upstream/libconfig-augeas-perl/current/ChangeLog Tue Dec 22 03:19:28 2009
@@ -1,7 +1,15 @@
+2009-12-21 Dominique Dumont <domi.dumont at free.fr> v0.601
+
+ * lib/Config/Augeas.pm : Added methods load, error, error_message,
+ error_minor_message and error_details
+
+ * lib/Config/Augeas.xs : Added interface for aug_load and
+ aug_error* from Augeas 0.6.0
+
2009-07-10 Dominique Dumont <dominique.dumont at hp.com> v0.501
* Build.PL: modified gcc options to issue more warnings (and fixed
- them
+ them
* lib/Config/Augeas.xs: Fixed compiler warnings (Thanks to
Guillaume Rousse)
@@ -27,7 +35,7 @@
* t/Config-AugeasC.t: Removed test involving AUGROOT environment
variable (Lead to FTBS on Debian amd64). The removed tests are
already performed passing augeas root through aug_init.
-
+
2008-11-21 Dominique Dumont <dominique.dumont at hp.com> v0.304
* lib/Config/Augeas.pm (print): Improved print method. Can now
Modified: branches/upstream/libconfig-augeas-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-augeas-perl/current/META.yml?rev=49139&op=diff
==============================================================================
--- branches/upstream/libconfig-augeas-perl/current/META.yml (original)
+++ branches/upstream/libconfig-augeas-perl/current/META.yml Tue Dec 22 03:19:28 2009
@@ -1,6 +1,6 @@
---
name: Config-Augeas
-version: 0.501
+version: 0.601
author:
- Dominique Dumont (ddumont at cpan dot org)
abstract: Edit configuration files through Augeas C library
@@ -9,12 +9,14 @@
license: http://opensource.org/licenses/lgpl-license.php
build_requires:
Test::More: 0
+configure_requires:
+ Module::Build: 0.35
dynamic_config: 1
provides:
Config::Augeas:
file: lib/Config/Augeas.pm
- version: 0.501
-generated_by: Module::Build version 0.33
+ version: 0.601
+generated_by: Module::Build version 0.35
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: 1.4
Modified: branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.pm?rev=49139&op=diff
==============================================================================
--- branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.pm (original)
+++ branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.pm Tue Dec 22 03:19:28 2009
@@ -22,7 +22,7 @@
use Carp;
use IO::File ;
-our $VERSION = '0.501';
+our $VERSION = '0.601';
require XSLoader;
XSLoader::load('Config::Augeas', $VERSION);
@@ -386,6 +386,43 @@
return $ret == 0 ? 1 : 0 ;
}
+=head2 load
+
+Load files into the tree. Which files to load and what lenses to use on
+them is specified under C</augeas/load> in the tree; each entry
+C</augeas/load/NAME> specifies a 'transform', by having itself exactly one
+child 'lens' and any number of children labelled 'incl' and 'excl'. The
+value of NAME has no meaning.
+
+The 'lens' grandchild of C</augeas/load> specifies which lens to use, and
+can either be the fully qualified name of a lens 'Module.lens' or
+'C<@Module>'. The latter form means that the lens from the transform marked
+for autoloading in C<MODULE> should be used.
+
+The 'incl' and 'excl' grandchildren of C</augeas/load> indicate which files
+to transform. Their value are used as glob patterns. Any file that
+matches at least one 'incl' pattern and no 'excl' pattern is
+transformed. The order of 'incl' and 'excl' entries is irrelevant.
+
+When L<init> is first called, it populates C</augeas/load> with the
+transforms marked for autoloading in all the modules it finds.
+
+Before loading any files, C<load> will remove everything underneath
+C</augeas/files> and C</files>, regardless of whether any entries have been
+modified or not.
+
+Returns 0 on error, 1 on success. Note that success includes the case
+where some files could not be loaded. Details of such files can be found
+as 'C</augeas//error>'.
+
+=cut
+
+sub load {
+ my $self = shift ;
+ my $ret = $self->{aug_c} -> load() ;
+ return $ret == 0 ? 1 : 0 ;
+}
+
=head2 print ( [ path , [ file ] ] )
Print each node matching C<path> and its descendants on STDOUT or in a file
@@ -412,8 +449,7 @@
$aug->print('/files') ; # print all file nodes to STDOUT
$aug->print('/augeas/','bar.txt'); # print Augeas meta data in bar.txt
-WARNING: The orders of the parameter are reversed compared to Augeas C
-API.
+WARNING: The parameter order is reversed compared to Augeas C API.
=cut
@@ -436,9 +472,69 @@
return $ret == 0 ? 1 : 0 ;
}
+=head1 Error reporting
+
+=head2 error
+
+Returns the error code from the last API call as a short string:
+noerror, nomem, internal, pathx, nomatch, manymatch, syntax
+
+=cut
+
+my @errcode = qw/noerror nomem internal pathx nomatch manymatch syntax/;
+
+sub error {
+ my $self = shift ;
+ my $code = $self->{aug_c} -> error() ;
+ return $errcode[$code] ;
+}
+
+=head2 error_message
+
+Return a human-readable message for the error code.
+
+=cut
+
+sub error_message {
+ my $self = shift ;
+ $self->{aug_c} -> error_message() ;
+}
+
+=head2 error_minor_message
+
+Return a human-readable message elaborating the error code; might be
+undef. For example, when the error code is C<pathx>, this will explain
+how the path expression is invalid.
+
+=cut
+
+sub error_minor_message {
+ my $self = shift ;
+ $self->{aug_c} -> error_minor_message() ;
+}
+
+=head2 error_details
+
+Return details about the error, which might be undef. For example, for
+C<pathx>, indicates where in the path expression the error
+occurred. The returned value can only be used until the next API call
+
+=cut
+
+sub error_details {
+ my $self = shift ;
+ $self->{aug_c} -> error_details() ;
+}
+
1;
__END__
+
+=head1 CAVEATS
+
+Object oriented design would suggest to use a new class to represent
+Augeas errors, but this would stray too far from current Augeas design
+and API.
=head1 SEE ALSO
Modified: branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.xs?rev=49139&op=diff
==============================================================================
--- branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.xs (original)
+++ branches/upstream/libconfig-augeas-perl/current/lib/Config/Augeas.xs Tue Dec 22 03:19:28 2009
@@ -41,7 +41,7 @@
BOOT:
{
HV *stash;
- stash = gv_stashpv("Config::Augeas", TRUE);
+ stash = gv_stashpv("Config::Augeas", TRUE);
newCONSTSUB(stash, "AUG_NONE", newSViv(AUG_NONE));
newCONSTSUB(stash, "AUG_SAVE_BACKUP", newSViv(AUG_SAVE_BACKUP));
newCONSTSUB(stash, "AUG_SAVE_NEWFILE", newSViv(AUG_SAVE_NEWFILE));
@@ -49,6 +49,18 @@
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));
+ newCONSTSUB(stash, "AUG_NO_MODL_AUTOLOAD", newSViv(AUG_NO_MODL_AUTOLOAD));
+
+
+ /* Error reporting */
+ newCONSTSUB(stash, "AUG_NOERROR", newSViv(AUG_NOERROR));
+ newCONSTSUB(stash, "AUG_ENOMEM", newSViv(AUG_ENOMEM));
+ newCONSTSUB(stash, "AUG_EINTERNAL", newSViv(AUG_EINTERNAL));
+ newCONSTSUB(stash, "AUG_EPATHX", newSViv(AUG_EPATHX));
+ newCONSTSUB(stash, "AUG_ENOMATCH", newSViv(AUG_ENOMATCH));
+ newCONSTSUB(stash, "AUG_EMMATCH", newSViv(AUG_EMMATCH));
+ newCONSTSUB(stash, "AUG_ESYNTAX", newSViv(AUG_ESYNTAX));
+
}
Config_Augeas*
@@ -177,6 +189,11 @@
aug_save( aug );
Config_Augeas *aug
+int
+aug_load( aug );
+ Config_Augeas *aug
+
+
# See example 9 in perlxstut man page
int
aug_print(aug, stream, path);
@@ -194,3 +211,22 @@
}
OUTPUT:
RETVAL
+
+
+ # Error reporting
+
+int
+aug_error( aug );
+ Config_Augeas *aug
+
+const char*
+aug_error_message(aug)
+ Config_Augeas* aug
+
+const char*
+aug_error_minor_message(aug)
+ Config_Augeas* aug
+
+const char*
+aug_error_details(aug)
+ Config_Augeas* aug
Modified: branches/upstream/libconfig-augeas-perl/current/t/Config-Augeas.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-augeas-perl/current/t/Config-Augeas.t?rev=49139&op=diff
==============================================================================
--- branches/upstream/libconfig-augeas-perl/current/t/Config-Augeas.t (original)
+++ branches/upstream/libconfig-augeas-perl/current/t/Config-Augeas.t Tue Dec 22 03:19:28 2009
@@ -8,7 +8,7 @@
use warnings ;
use strict;
-use Test::More tests => 18 ;
+use Test::More tests => 23 ;
ok(1,"Compilation done");
@@ -110,4 +110,17 @@
@a = $aug->defnode(local => $v,'127.0.0.2') ;
is_deeply(\@a,[1,0],"defnode $v") ;
+my $ec= $aug->error ;
+is($ec, 'noerror', "no error found") ;
+my $emsg= $aug->error_minor_message ;
+is($emsg, undef, "no error message") ;
+
+$ret = $aug->get('/files/[blast]') ;
+$ec= $aug->error ;
+is($ec, 'pathx', "found path error") ;
+$emsg= $aug->error_minor_message ;
+ok($emsg, "error_minor_message: $emsg") ;
+$emsg= $aug->error_details ;
+ok($emsg, "error_details: $emsg") ;
+
#$aug->print('') ;
Modified: branches/upstream/libconfig-augeas-perl/current/t/Config-AugeasC.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libconfig-augeas-perl/current/t/Config-AugeasC.t?rev=49139&op=diff
==============================================================================
--- branches/upstream/libconfig-augeas-perl/current/t/Config-AugeasC.t (original)
+++ branches/upstream/libconfig-augeas-perl/current/t/Config-AugeasC.t Tue Dec 22 03:19:28 2009
@@ -23,7 +23,9 @@
my $fail = 0;
foreach my $constname (qw(AUG_NONE AUG_SAVE_BACKUP AUG_SAVE_NEWFILE
AUG_TYPE_CHECK AUG_NO_STDINC AUG_SAVE_NOOP
- AUG_NO_LOAD)) {
+ AUG_NO_LOAD AUG_NO_MODL_AUTOLOAD AUG_NOERROR
+ AUG_ENOMEM AUG_EINTERNAL AUG_EPATHX
+ AUG_ENOMATCH AUG_EMMATCH AUG_ESYNTAX)) {
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