[Reproducible-commits] [libextutils-depends-perl] 160/187: Imported Upstream version 0.400

Maria Valentina Marin Rodrigues akira-guest at moszumanska.debian.org
Wed Jan 21 21:17:00 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 78469e589a205df2f6863eaccec64012b3d98dfd
Author: gregor herrmann <gregoa at debian.org>
Date:   Tue Aug 12 23:15:26 2014 +0200

    Imported Upstream version 0.400
---
 Changes                 |  13 ++++++
 MANIFEST                |   2 -
 META.json               |   4 +-
 META.yml                |   4 +-
 MYMETA.json             |  77 -----------------------------------
 MYMETA.yml              |  41 -------------------
 Makefile.PL             |   2 +-
 README                  |  44 ++++++++++++++++----
 lib/ExtUtils/Depends.pm | 104 ++++++++++++++++++++++++++++++++++++------------
 t/02_save_load.t        |  80 ++++++++++++++++++++++++++++---------
 10 files changed, 193 insertions(+), 178 deletions(-)

diff --git a/Changes b/Changes
index cc82def..d60bba6 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,18 @@
 Revision history for Perl extension ExtUtils::Depends.
 
+0.400 Sun Aug 10 13:58:24 CEST 2014
+    - In addition to the package variables $inc, $libs and @typemaps, write an
+      'Inline' method to <package>::Install::Files for easier interoperability
+      with the Inline module.
+    - Accompany the 'Inline' method with a 'deps' method in
+      <package>::Install::Files in addition to the @deps package variable.
+    - Make ExtUtils::Depends->load use the 'Inline' and 'deps' methods by
+      default, falling back to the package variables if the methods are not
+      defined.
+    - Make the docs recommend the 'Inline' and 'deps' approach for creating
+      <package>::Install::Files manually, without
+      ExtUtils::Depends::save_config.
+
 0.309 Sat Aug  2 15:23:03 PDT 2014
     - Depends.pm: use $DLEXT instead of $SO for library filename extensions
     - MANIFEST: remove MYMETA.* files
diff --git a/MANIFEST b/MANIFEST
index eea3748..13b4a10 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3,8 +3,6 @@ lib/ExtUtils/Depends.pm
 Makefile.PL
 MANIFEST			This list of files
 MANIFEST.SKIP
-MYMETA.json
-MYMETA.yml
 perl-ExtUtils-Depends.spec.in
 README
 t/01_load.t
diff --git a/META.json b/META.json
index 0a6a603..19f2739 100644
--- a/META.json
+++ b/META.json
@@ -31,7 +31,7 @@
       "build" : {
          "requires" : {
             "ExtUtils::MakeMaker" : "0",
-            "Test::More" : "0"
+            "Test::More" : "0.88"
          }
       },
       "configure" : {
@@ -73,5 +73,5 @@
       },
       "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list"
    },
-   "version" : "0.309"
+   "version" : "0.400"
 }
diff --git a/META.yml b/META.yml
index 93a68ba..3c5c7a7 100644
--- a/META.yml
+++ b/META.yml
@@ -4,7 +4,7 @@ author:
   - 'Gtk2-Perl Team <gtk-perl-list at gnome dot org>'
 build_requires:
   ExtUtils::MakeMaker: '0'
-  Test::More: '0'
+  Test::More: '0.88'
 configure_requires:
   Data::Dumper: '0'
   ExtUtils::MakeMaker: '0'
@@ -38,4 +38,4 @@ resources:
   homepage: http://gtk2-perl.sourceforge.net
   license: http://dev.perl.org/licenses/
   repository: git://git.gnome.org/perl-ExtUtils-Depends
-version: '0.309'
+version: '0.400'
diff --git a/MYMETA.json b/MYMETA.json
deleted file mode 100644
index 4c4e42f..0000000
--- a/MYMETA.json
+++ /dev/null
@@ -1,77 +0,0 @@
-{
-   "abstract" : "unknown",
-   "author" : [
-      "Gtk2-Perl Team <gtk-perl-list at gnome dot org>"
-   ],
-   "dynamic_config" : 0,
-   "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520",
-   "keywords" : [
-      "XS",
-      "XS extensions",
-      "dependency"
-   ],
-   "license" : [
-      "perl_5"
-   ],
-   "meta-spec" : {
-      "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
-      "version" : "2"
-   },
-   "name" : "ExtUtils-Depends",
-   "no_index" : {
-      "directory" : [
-         "t",
-         "inc"
-      ],
-      "package" : [
-         "ExtUtils::MM"
-      ]
-   },
-   "prereqs" : {
-      "build" : {
-         "requires" : {
-            "ExtUtils::MakeMaker" : "0",
-            "Test::More" : "0"
-         }
-      },
-      "configure" : {
-         "requires" : {
-            "Data::Dumper" : "0",
-            "ExtUtils::MakeMaker" : "0",
-            "File::Spec" : "0",
-            "IO::File" : "0"
-         }
-      },
-      "runtime" : {
-         "requires" : {
-            "Data::Dumper" : "0",
-            "File::Spec" : "0",
-            "IO::File" : "0",
-            "perl" : "5.006"
-         }
-      },
-      "test" : {
-         "recommends" : {
-            "Test::Number::Delta" : "1"
-         }
-      }
-   },
-   "release_status" : "stable",
-   "resources" : {
-      "bugtracker" : {
-         "mailto" : "bug-ExtUtils-Depends [at] rt.cpan.org",
-         "web" : "http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depends"
-      },
-      "homepage" : "http://gtk2-perl.sourceforge.net",
-      "license" : [
-         "http://dev.perl.org/licenses/"
-      ],
-      "repository" : {
-         "type" : "git",
-         "url" : "git://git.gnome.org/perl-ExtUtils-Depends",
-         "web" : "http://git.gnome.org/browse/perl-ExtUtils-Depends"
-      },
-      "x_MailingList" : "https://mail.gnome.org/mailman/listinfo/gtk-perl-list"
-   },
-   "version" : "0.309"
-}
diff --git a/MYMETA.yml b/MYMETA.yml
deleted file mode 100644
index a89e095..0000000
--- a/MYMETA.yml
+++ /dev/null
@@ -1,41 +0,0 @@
----
-abstract: unknown
-author:
-  - 'Gtk2-Perl Team <gtk-perl-list at gnome dot org>'
-build_requires:
-  ExtUtils::MakeMaker: '0'
-  Test::More: '0'
-configure_requires:
-  Data::Dumper: '0'
-  ExtUtils::MakeMaker: '0'
-  File::Spec: '0'
-  IO::File: '0'
-dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.141520'
-keywords:
-  - XS
-  - 'XS extensions'
-  - dependency
-license: perl
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: '1.4'
-name: ExtUtils-Depends
-no_index:
-  directory:
-    - t
-    - inc
-  package:
-    - ExtUtils::MM
-requires:
-  Data::Dumper: '0'
-  File::Spec: '0'
-  IO::File: '0'
-  perl: '5.006'
-resources:
-  MailingList: https://mail.gnome.org/mailman/listinfo/gtk-perl-list
-  bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=ExtUtils-Depends
-  homepage: http://gtk2-perl.sourceforge.net
-  license: http://dev.perl.org/licenses/
-  repository: git://git.gnome.org/perl-ExtUtils-Depends
-version: '0.309'
diff --git a/Makefile.PL b/Makefile.PL
index e8ee529..9e3e608 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -42,7 +42,7 @@ my %meta_merge = (
         },
         build => {
             requires => {
-                'Test::More' => 0,
+                'Test::More' => 0.88,
             },
         },
         test => {
diff --git a/README b/README
index c5c80d4..9bb3e3a 100644
--- a/README
+++ b/README
@@ -64,6 +64,28 @@ DESCRIPTION
          this command automatically brings in all the stuff needed
          for Glib, since Gtk2 depends on it.
 
+    When the configuration information is saved, it also includes a class
+    method called "Inline", inheritable by your module. This allows you in
+    your module to simply say at the top:
+
+      package Mymod;
+      use parent 'Mymod::Install::Files'; # to inherit 'Inline' method
+
+    And users of "Mymod" who want to write inline code (using Inline) will
+    simply be able to write:
+
+      use Inline with => 'Mymod';
+
+    And all the necessary header files, defines, and libraries will be added
+    for them.
+
+    The "Mymod::Install::Files" will also implement a "deps" method, which
+    will return a list of any modules that "Mymod" depends on - you will not
+    normally need to use this:
+
+      require Mymod::Install::Files;
+      @deps = Mymod::Install::Files->deps;
+
 METHODS
     $object = ExtUtils::Depends->new($name, @deps)
         Create a new depends object named *$name*. Any modules listed in
@@ -111,8 +133,9 @@ METHODS
         Save the important information from *$depends* to *$filename*, and
         set it up to be installed as *name*::Install::Files.
 
-        Note: the actual value of *$filename* seems to be irrelevant, but
-        its usage is kept for backward compatibility.
+        Note: the actual value of *$filename* is unimportant so long as it
+        doesn't clash with any other local files. It will be installed as
+        *name*::Install::Files.
 
     hash = $depends->get_makefile_vars
         Return the information in *$depends* in a format digestible by
@@ -153,12 +176,17 @@ METHODS
             ExtUtils::Depends.
 
         If you want to make module *name* support this, you must provide a
-        module *name*::Install::Files, which on loading will provide the
-        following package variables: @typemaps, $inc, $libs, $deps, with the
-        same contents as above (not coincidentally). The "load" function
-        will supply the "instpath". An easy way to achieve this is to use
-        the method "$depends->save_config ($filename)", but your package may
-        have different facilities already.
+        module *name*::Install::Files, which on loading will implement the
+        following class methods:
+
+          $hashref = name::Install::Files->Inline('C');
+          # hash to contain any necessary TYPEMAPS (array-ref), LIBS, INC
+          @deps = name::Install::Files->deps;
+          # any modules on which "name" depends
+
+        An easy way to achieve this is to use the method
+        "$depends->save_config ($filename)", but your package may have
+        different facilities already.
 
     $depends->load_deps
         Load *$depends* dependencies, by calling "load" on each dependency
diff --git a/lib/ExtUtils/Depends.pm b/lib/ExtUtils/Depends.pm
index 89d3365..22291fd 100644
--- a/lib/ExtUtils/Depends.pm
+++ b/lib/ExtUtils/Depends.pm
@@ -12,7 +12,7 @@ use File::Find;
 use File::Spec;
 use Data::Dumper;
 
-our $VERSION = '0.309';
+our $VERSION = '0.400';
 
 sub import {
 	my $class = shift;
@@ -128,10 +128,13 @@ sub save_config {
 		typemaps => [ map { basename $_ } @{ $self->{typemaps} } ],
 		deps => [keys %{ $self->{deps} }],
 	}], ['self']);
-	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";
+	print $file <<'EOF';
+
+ at deps = @{ $self->{deps} };
+ at typemaps = @{ $self->{typemaps} };
+$libs = $self->{libs};
+$inc = $self->{inc};
+EOF
 	# this is ridiculous, but old versions of ExtUtils::Depends take
 	# first $loadedmodule::CORE and then $INC{$file} --- the fallback
 	# includes the Filename.pm, which is not useful.  so we must add
@@ -147,6 +150,17 @@ sub save_config {
 			last;
 		}
 	}
+
+	sub deps { \@{ \$self->{deps} }; }
+
+	sub Inline {
+		my (\$class, \$lang) = \@_;
+		if (\$lang ne 'C') {
+			warn "Warning: Inline hints not available for \$lang language\n";
+			return;
+		}
+		+{ map { (uc(\$_) => \$self->{\$_}) } qw(inc libs typemaps) };
+	}
 EOT
 
 	print $file "\n1;\n";
@@ -168,14 +182,13 @@ sub load {
 	eval {
 		require $relpath 
 	} or die " *** Can't load dependency information for $dep:\n   $@\n";
-	#
 	#print Dumper(\%INC);
 
 	# effectively $instpath = dirname($INC{$relpath})
 	@pieces = File::Spec->splitdir ($INC{$relpath});
 	pop @pieces;
 	my $instpath = File::Spec->catdir (@pieces);
-	
+
 	no strict;
 
 	croak "No dependency information found for $dep"
@@ -185,20 +198,32 @@ sub load {
 		$instpath = File::Spec->rel2abs ($instpath);
 	}
 
-	my @typemaps = map {
-		File::Spec->rel2abs ($_, $instpath)
-	} @{"$depinstallfiles\::typemaps"};
+	my (@typemaps, $inc, $libs, @deps);
+
+	# this will not exist when loading files from old versions
+	# of ExtUtils::Depends.
+	@deps = eval { $depinstallfiles->deps };
+	@deps = @{"$depinstallfiles\::deps"}
+		if $@ and exists ${"$depinstallfiles\::"}{deps};
+
+	my $inline = eval { $depinstallfiles->Inline('C') };
+	if (!$@) {
+		$inc = $inline->{INC} || '';
+		$libs = $inline->{LIBS} || '';
+		@typemaps = @{ $inline->{TYPEMAPS} || [] };
+	} else {
+		$inc = ${"$depinstallfiles\::inc"} || '';
+		$libs = ${"$depinstallfiles\::libs"} || '';
+		@typemaps = @{"$depinstallfiles\::typemaps"};
+	}
+	@typemaps = map { File::Spec->rel2abs ($_, $instpath) } @typemaps;
 
 	{
 		instpath => $instpath,
 		typemaps => \@typemaps,
-		inc      => "-I$instpath ".${"$depinstallfiles\::inc"},
-		libs     => ${"$depinstallfiles\::libs"},
-		# this will not exist when loading files from old versions
-		# of ExtUtils::Depends.
-		(exists ${"$depinstallfiles\::"}{deps}
-		  ? (deps => \@{"$depinstallfiles\::deps"})
-		  : ()), 
+		inc      => "-I$instpath $inc",
+		libs     => $libs,
+		deps     => \@deps,
 	}
 }
 
@@ -240,7 +265,7 @@ sub get_makefile_vars {
 	# collect and uniquify things from the dependencies.
 	# first, ensure they are completely loaded.
 	$self->load_deps;
-	
+
 	##my @defbits = map { split } @{ $self->{defines} };
 	my @incbits = map { split } @{ $self->{inc} };
 	my @libsbits = split /\s+/, $self->{libs};
@@ -451,6 +476,27 @@ For example:
      this command automatically brings in all the stuff needed
      for Glib, since Gtk2 depends on it.
 
+When the configuration information is saved, it also includes a class
+method called C<Inline>, inheritable by your module. This allows you in
+your module to simply say at the top:
+
+  package Mymod;
+  use parent 'Mymod::Install::Files'; # to inherit 'Inline' method
+
+And users of C<Mymod> who want to write inline code (using L<Inline>)
+will simply be able to write:
+
+  use Inline with => 'Mymod';
+
+And all the necessary header files, defines, and libraries will be added
+for them.
+
+The C<Mymod::Install::Files> will also implement a C<deps> method,
+which will return a list of any modules that C<Mymod> depends on -
+you will not normally need to use this:
+
+  require Mymod::Install::Files;
+  @deps = Mymod::Install::Files->deps;
 
 =head1 METHODS
 
@@ -513,8 +559,9 @@ passed through WriteMakefile's PM key.
 Save the important information from I<$depends> to I<$filename>, and
 set it up to be installed as I<name>::Install::Files.
 
-Note: the actual value of I<$filename> seems to be irrelevant, but its
-usage is kept for backward compatibility.
+Note: the actual value of I<$filename> is unimportant so long as it
+doesn't clash with any other local files. It will be installed as
+I<name>::Install::Files.
 
 =item hash = $depends->get_makefile_vars
 
@@ -566,12 +613,17 @@ 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.
+a module I<name>::Install::Files, which on loading will implement the
+following class methods:
+
+  $hashref = name::Install::Files->Inline('C');
+  # hash to contain any necessary TYPEMAPS (array-ref), LIBS, INC
+  @deps = name::Install::Files->deps;
+  # any modules on which "name" depends
+
+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
 
diff --git a/t/02_save_load.t b/t/02_save_load.t
index c68fa3f..3e52c7d 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 => 28;
+use Test::More;
 
 use FindBin;
 use lib "$FindBin::Bin/lib";
@@ -40,6 +40,34 @@ my @installed_files = qw(dep.h
                          dep-private.h);
 $dep_info->install (@installed_files);
 
+my $INC_FRAG = '-Ddistinctive';
+map { make_fake($_) } qw(Fakenew Fakeold);
+sub Fakenew::Install::Files::Inline { +{ INC => $INC_FRAG } }
+sub Fakenew::Install::Files::deps { qw(Fakeold) }
+{
+  no warnings 'once';
+  @Fakeold::Install::Files::deps = qw(Fakenew);
+  $Fakeold::Install::Files::inc = $INC_FRAG;
+  $Fakeold::Install::Files::libs = '';
+}
+sub make_fake {
+  my $class = shift . '::Install::Files';
+  my @pieces = split '::', $class;
+  require File::Spec;
+  my $pm = join('/', @pieces) . '.pm';
+  $INC{$pm} = File::Spec->catdir(qw(build fake), split '/', $pm);
+}
+sub test_load {
+  my ($info, $msg) = @_;
+  my $install_part = qr|Fake.*Install|;
+  like ($info->{inc}, $install_part, "$msg inc generic");
+  like ($info->{inc}, qr/$INC_FRAG/, "$msg inc specific");
+  ok (scalar(grep { /Fake/ } @{$info->{deps}}), $msg);
+  ok (exists $info->{libs}, $msg);
+}
+test_load (ExtUtils::Depends::load('Fakenew'), 'load new scheme');
+test_load (ExtUtils::Depends::load('Fakeold'), 'load old scheme');
+
 use Data::Dumper;
 $Data::Dumper::Terse = 1;
 $dep_info->save_config (catfile $tmp_inc, qw(DepTest Install Files.pm));
@@ -47,28 +75,28 @@ $dep_info->save_config (catfile $tmp_inc, qw(DepTest Install Files.pm));
 # --------------------------------------------------------------------------- #
 
 my %vars = $dep_info->get_makefile_vars;
-is_deeply ($vars{TYPEMAPS}, \@typemaps);
-is ($vars{INC}, $inc);
-is ($vars{LIBS}, $libs);
+is_deeply ($vars{TYPEMAPS}, \@typemaps, 'makefile vars typemaps');
+is ($vars{INC}, $inc, 'makefile vars inc');
+is ($vars{LIBS}, $libs, 'makefile vars libs');
 
 foreach my $pm (keys %pm_mapping) {
-  like ($vars{PM}{$pm}, qr/\Q$pm_mapping{$pm}\E/);
+  like ($vars{PM}{$pm}, qr/\Q$pm_mapping{$pm}\E/, 'makefile vars PM');
 }
 
-ok (exists $vars{PM}{catfile $tmp_inc, qw(DepTest Install Files.pm)});
+ok (exists $vars{PM}{catfile $tmp_inc, qw(DepTest Install Files.pm)}, 'PM');
 
 foreach my $file (@installed_files) {
-  like ($vars{PM}{$file}, qr/\Q$file\E/);
+  like ($vars{PM}{$file}, qr/\Q$file\E/, "PM $file");
 }
 
 foreach my $xs_file (@xs_files) {
-  ok (exists $vars{XS}{$xs_file});
+  ok (exists $vars{XS}{$xs_file}, "XS $xs_file");
 }
 
 foreach my $file (@c_files, @xs_files) {
   (my $stem = $file) =~ s/\.(?:c|xs)\z//;
-  like ($vars{OBJECT}, qr/\Q$stem\E/);
-  like ($vars{clean}{FILES}, qr/\Q$stem\E/);
+  like ($vars{OBJECT}, qr/\Q$stem\E/, "OBJECT $stem");
+  like ($vars{clean}{FILES}, qr/\Q$stem\E/, "FILES $stem");
 }
 
 # --------------------------------------------------------------------------- #
@@ -76,8 +104,8 @@ foreach my $file (@c_files, @xs_files) {
 my $info = ExtUtils::Depends::load ('DepTest');
 
 my $install_part = qr|DepTest.Install|;
-like ($info->{inc}, $install_part);
-isnt (index($info->{inc}, $inc), -1);
+like ($info->{inc}, $install_part, "loaded inc");
+isnt (index($info->{inc}, $inc), -1, "loaded inc content");
 
 my @typemaps_expected = map { my $t = $_; $t =~ s#build/##; $t } @typemaps;
 sub strip_typemap { my $t = $_; my $tmp = catfile('DepTest','Install',' '); $tmp =~ s# $##; $t =~ s#.*\Q$tmp\E##; $t }
@@ -87,23 +115,37 @@ is_deeply (
   'check typemaps actually saved/loaded'
 );
 
-like ($info->{instpath}, $install_part);
+like ($info->{instpath}, $install_part, 'instpath');
 
-is_deeply ($info->{deps}, []);
+is_deeply ($info->{deps}, [], 'basic deps');
 
-is ($info->{libs}, $libs);
+is ($info->{libs}, $libs, 'basic libs');
 
 # now check package vars are set, per the ::load doc!
 {
 no warnings qw(once);
-is ($DepTest::Install::Files::inc, $inc);
+is ($DepTest::Install::Files::inc, $inc, 'package inc');
 is_deeply (
   [ map { strip_typemap($_) } @DepTest::Install::Files::typemaps ],
   \@typemaps_expected,
-  'api check typemaps'
+  'package typemaps'
 );
-is_deeply (\@DepTest::Install::Files::deps, []);
-is ($DepTest::Install::Files::libs, $libs);
+is_deeply (\@DepTest::Install::Files::deps, [], 'package deps');
+is ($DepTest::Install::Files::libs, $libs, 'package libs');
 }
 
+# test Inline class methods
+is_deeply (
+  DepTest::Install::Files->Inline('C'),
+  {
+    INC => $inc,
+    LIBS => $libs,
+    TYPEMAPS => \@typemaps_expected,
+  },
+  'api check Inline method'
+);
+is_deeply ([ DepTest::Install::Files->deps ], [], 'api check deps method');
+
 # --------------------------------------------------------------------------- #
+
+done_testing;

-- 
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