[Reproducible-commits] [libextutils-depends-perl] 124/187: Document API expected by ::load function. Removed some comments about supporting "ancient" code as ::load currently uses that info!

Maria Valentina Marin Rodrigues akira-guest at moszumanska.debian.org
Wed Jan 21 21:16:56 UTC 2015


This is an automated email from the git hooks/post-receive script.

akira-guest pushed a commit to branch pu/reproducible_builds
in repository libextutils-depends-perl.

commit 1c452362a78c6bebfd606d42dd32ba580e690013
Author: Ed J <m8r-35s8eo at mailinator.com>
Date:   Sun Apr 13 02:21:25 2014 +0100

    Document API expected by ::load function. Removed some comments about supporting "ancient" code as ::load currently uses that info!
---
 lib/ExtUtils/Depends.pm | 16 ++++++++++++----
 t/02_save_load.t        | 21 ++++++++++++++++++---
 2 files changed, 30 insertions(+), 7 deletions(-)

diff --git a/lib/ExtUtils/Depends.pm b/lib/ExtUtils/Depends.pm
index 5431839..e481bca 100644
--- a/lib/ExtUtils/Depends.pm
+++ b/lib/ExtUtils/Depends.pm
@@ -121,16 +121,13 @@ sub save_config {
 		or croak "can't open '$filename' for writing: $!\n";
 
 	print $file "package $self->{name}\::Install::Files;\n\n";
-	# for modern stuff
 	print $file "".Data::Dumper->Dump([{
 		inc => join (" ", @{ $self->{inc} }),
 		libs => $self->{libs},
 		typemaps => [ map { basename $_ } @{ $self->{typemaps} } ],
 		deps => [keys %{ $self->{deps} }],
 	}], ['self']);
-	# for ancient stuff
-	print $file "\n\n# this is for backwards compatiblity\n";
-	print $file "\@deps = \@{ \$self->{deps} };\n";
+	print $file "\n\n\@deps = \@{ \$self->{deps} };\n";
 	print $file "\@typemaps = \@{ \$self->{typemaps} };\n";
 	print $file "\$libs = \$self->{libs};\n";
 	print $file "\$inc = \$self->{inc};\n";
@@ -415,6 +412,9 @@ may be retrieved later.  The object can also reformat this information
 into the data structures required by ExtUtils::MakeMaker's WriteMakefile
 function.
 
+For information on how to make your module fit into this scheme, see
+L</"hashref = ExtUtils::Depends::load (name)">.
+
 When creating a new Depends object, you give it a name, which is the name
 of the module you are building.   You can also specify the names of modules
 on which this module depends.  These dependencies will be loaded
@@ -547,6 +547,14 @@ loading files created by old versions of ExtUtils::Depends.
 
 =back
 
+If you want to make module I<name> support this, you must provide
+a module I<name>::Install::Files, which on loading will provide the
+following package variables: C<@typemaps>, C<$inc>, C<$libs>, C<$deps>,
+with the same contents as above (not coincidentally). The C<load>
+function will supply the C<instpath>. An easy way to achieve this is
+to use the method L</"$depends-E<gt>save_config ($filename)">, but your
+package may have different facilities already.
+
 =item $depends->load_deps
 
 Load I<$depends> dependencies, by calling C<load> on each dependency module.
diff --git a/t/02_save_load.t b/t/02_save_load.t
index 5392d7b..101acf8 100644
--- a/t/02_save_load.t
+++ b/t/02_save_load.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 24;
+use Test::More tests => 28;
 
 use FindBin;
 use lib "$FindBin::Bin/lib";
@@ -79,9 +79,11 @@ my $install_part = qr|DepTest.Install|;
 like ($info->{inc}, $install_part);
 isnt (index($info->{inc}, $inc), -1);
 
+my @typemaps_expected = map { my $t = $_; $t =~ s#build/##; $t } @typemaps;
+sub strip_typemap { my $t = $_; $t =~ s#.*DepTest/Install/##; $t }
 is_deeply (
-  [ map { my $t = $_; $t =~ s#.*DepTest/Install/##; $t } @{$info->{typemaps}} ],
-  [ map { my $t = $_; $t =~ s#build/##; $t } @typemaps ],
+  [ map { strip_typemap($_) } @{$info->{typemaps}} ],
+  \@typemaps_expected,
   'check typemaps actually saved/loaded'
 );
 
@@ -91,4 +93,17 @@ is_deeply ($info->{deps}, []);
 
 is ($info->{libs}, $libs);
 
+# now check package vars are set, per the ::load doc!
+{
+no warnings qw(once);
+is ($DepTest::Install::Files::inc, $inc);
+is_deeply (
+  [ map { strip_typemap($_) } @DepTest::Install::Files::typemaps ],
+  \@typemaps_expected,
+  'api check typemaps'
+);
+is_deeply (\@DepTest::Install::Files::deps, []);
+is ($DepTest::Install::Files::libs, $libs);
+}
+
 # --------------------------------------------------------------------------- #

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/libextutils-depends-perl.git



More information about the Reproducible-commits mailing list