Hello community,

here is the log from the commit of package perl-Devel-CheckLib for 
openSUSE:Factory checked in at 2016-04-12 19:39:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Devel-CheckLib (Old)
 and      /work/SRC/openSUSE:Factory/.perl-Devel-CheckLib.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "perl-Devel-CheckLib"

Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Devel-CheckLib/perl-Devel-CheckLib.changes  
2016-02-26 00:38:20.000000000 +0100
+++ 
/work/SRC/openSUSE:Factory/.perl-Devel-CheckLib.new/perl-Devel-CheckLib.changes 
    2016-04-12 19:39:13.000000000 +0200
@@ -1,0 +2,8 @@
+Mon Apr 11 12:25:14 UTC 2016 - [email protected]
+
+- updated to 1.07
+   see /usr/share/doc/packages/perl-Devel-CheckLib/CHANGES
+
+  1.07    2016-04-09      Add analyze_binary feature.
+
+-------------------------------------------------------------------

Old:
----
  Devel-CheckLib-1.06.tar.gz

New:
----
  Devel-CheckLib-1.07.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ perl-Devel-CheckLib.spec ++++++
--- /var/tmp/diff_new_pack.mWno5v/_old  2016-04-12 19:39:13.000000000 +0200
+++ /var/tmp/diff_new_pack.mWno5v/_new  2016-04-12 19:39:13.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           perl-Devel-CheckLib
-Version:        1.06
+Version:        1.07
 Release:        0
 %define cpan_name Devel-CheckLib
 Summary:        Check That a Library Is Available

++++++ Devel-CheckLib-1.06.tar.gz -> Devel-CheckLib-1.07.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Devel-CheckLib-1.06/CHANGES 
new/Devel-CheckLib-1.07/CHANGES
--- old/Devel-CheckLib-1.06/CHANGES     2016-02-19 17:23:31.000000000 +0100
+++ new/Devel-CheckLib-1.07/CHANGES     2016-04-08 17:57:00.000000000 +0200
@@ -1,3 +1,5 @@
+1.07    2016-04-09      Add analyze_binary feature.
+
 1.06    2016-02-20      Fix linking on MSVC.
 
 1.05    2015-09-16      Fix handling $PERL_MM_OPT.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Devel-CheckLib-1.06/MANIFEST 
new/Devel-CheckLib-1.07/MANIFEST
--- old/Devel-CheckLib-1.06/MANIFEST    2016-02-19 17:27:17.000000000 +0100
+++ new/Devel-CheckLib-1.07/MANIFEST    2016-04-08 17:59:28.000000000 +0200
@@ -20,4 +20,6 @@
 t/cmdline-LIBS-INC.t
 t/custom-function.t
 META.yml                                 Module meta-data (added by MakeMaker)
+t/analyze-binary.t
+t/flags.t
 META.json                                Module JSON meta-data (added by 
MakeMaker)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Devel-CheckLib-1.06/META.json 
new/Devel-CheckLib-1.07/META.json
--- old/Devel-CheckLib-1.06/META.json   2016-02-19 17:27:16.000000000 +0100
+++ new/Devel-CheckLib-1.07/META.json   2016-04-08 17:59:28.000000000 +0200
@@ -46,5 +46,5 @@
          "url" : "http://github.com/mattn/p5-Devel-CheckLib";
       }
    },
-   "version" : "1.06"
+   "version" : "1.07"
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Devel-CheckLib-1.06/META.yml 
new/Devel-CheckLib-1.07/META.yml
--- old/Devel-CheckLib-1.06/META.yml    2016-02-19 17:27:16.000000000 +0100
+++ new/Devel-CheckLib-1.07/META.yml    2016-04-08 17:59:28.000000000 +0200
@@ -25,4 +25,4 @@
   perl: 5.00405
 resources:
   repository: http://github.com/mattn/p5-Devel-CheckLib
-version: 1.06
+version: 1.07
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Devel-CheckLib-1.06/lib/Devel/CheckLib.pm 
new/Devel-CheckLib-1.07/lib/Devel/CheckLib.pm
--- old/Devel-CheckLib-1.06/lib/Devel/CheckLib.pm       2016-02-19 
17:23:39.000000000 +0100
+++ new/Devel-CheckLib-1.07/lib/Devel/CheckLib.pm       2016-04-08 
17:57:06.000000000 +0200
@@ -5,7 +5,7 @@
 use 5.00405; #postfix foreach
 use strict;
 use vars qw($VERSION @ISA @EXPORT);
-$VERSION = '1.06';
+$VERSION = '1.07';
 use Config qw(%Config);
 use Text::ParseWords 'quotewords';
 
@@ -54,7 +54,7 @@
 
 It works by trying to compile some code - which defaults to this:
 
-    int main(void) { return 0; }
+    int main(int argc, char *argv[]) { return 0; }
 
 and linking it to the specified libraries.  If something pops out the end
 which looks executable, it gets executed, and if main() returns 0 we know
@@ -142,6 +142,23 @@
 
 This can also be supplied on the command-line.
 
+=item ccflags
+
+Extra flags to pass to the compiler.
+
+=item ldflags
+
+Extra flags to pass to the linker.
+
+=item analyze_binary
+
+a callback function that will be invoked in order to perform custom
+analysis of the generated binary. The callback arguments are the
+library name and the path to the binary just compiled.
+
+It is possible to use this callback, for instance, to inspect the
+binary for further dependencies.
+
 =back
 
 =head2 check_lib_or_exit
@@ -252,6 +269,7 @@
         if $args{header};
     @incpaths = (ref($args{incpath}) ? @{$args{incpath}} : $args{incpath}) 
         if $args{incpath};
+    my $analyze_binary = $args{analyze_binary};
 
     my @argv = @ARGV;
     push @argv, _parse_line('\s+', 0, $ENV{PERL_MM_OPT}||'');
@@ -283,9 +301,10 @@
         }
     }
 
-    my ($cc, $ld) = _findcc($args{debug});
+    my ($cc, $ld) = _findcc($args{debug}, $args{ccflags}, $args{ldflags});
     my @missing;
     my @wrongresult;
+    my @wronganalysis;
     my @use_headers;
 
     # first figure out which headers we can't find ...
@@ -344,7 +363,7 @@
     my $ofile = $cfile;
     $ofile =~ s/\.c$/$Config{_o}/;
     print $ch qq{#include <$_>\n} foreach (@headers);
-    print $ch "int main(void) { ".($args{function} || 'return 0;')." }\n";
+    print $ch "int main(int argc, char *argv[]) { ".($args{function} || 
'return 0;')." }\n";
     close($ch);
     for my $lib ( @libs ) {
         my $exefile = File::Temp::mktemp( 'assertlibXXXXXXXX' ) . 
$Config{_exe};
@@ -390,10 +409,21 @@
         }
         warn "# @sys_cmd\n" if $args{debug};
         my $rv = $args{debug} ? system(@sys_cmd) : _quiet_system(@sys_cmd);
-        push @missing, $lib if $rv != 0 || ! -x $exefile;
-        my $absexefile = File::Spec->rel2abs($exefile);
-        $absexefile = '"'.$absexefile.'"' if $absexefile =~ m/\s/;
-        push @wrongresult, $lib if $rv == 0 && -x $exefile && 
system($absexefile) != 0;
+        if ($rv != 0 || ! -x $exefile) {
+            push @missing, $lib;
+        }
+        else {
+            my $absexefile = File::Spec->rel2abs($exefile);
+            $absexefile = '"'.$absexefile.'"' if $absexefile =~ m/\s/;
+            if (system($absexefile) != 0) {
+                push @wrongresult, $lib;
+            }
+            else {
+                if ($analyze_binary) {
+                    push @wronganalysis, $lib if !$analyze_binary->($lib, 
$exefile)
+                }
+            }
+        }
         _cleanup_exe($exefile);
     } 
     unlink $cfile;
@@ -402,6 +432,8 @@
     die("Can't link/include C library $miss_string, aborting.\n") if @missing;
     my $wrong_string = join( q{, }, map { qq{'$_'} } @wrongresult);
     die("wrong result: $wrong_string\n") if @wrongresult;
+    my $analysis_string = join(q{, }, map { qq{'$_'} } @wronganalysis );
+    die("wrong analysis: $analysis_string") if @wronganalysis;
 }
 
 sub _cleanup_exe {
@@ -431,15 +463,15 @@
 # where $cc is an array ref of compiler name, compiler flags
 # where $ld is an array ref of linker flags
 sub _findcc {
-    my ($debug) = @_;
+    my ($debug, $user_ccflags, $user_ldflags) = @_;
     # Need to use $keep=1 to work with MSWin32 backslashes and quotes
     my $Config_ccflags =  $Config{ccflags};  # use copy so ASPerl will compile
     my @Config_ldflags = ();
     for my $config_val ( @Config{qw(ldflags)} ){
         push @Config_ldflags, $config_val if ( $config_val =~ /\S/ );
     }
-    my @ccflags = grep { length } quotewords('\s+', 1, $Config_ccflags||'');
-    my @ldflags = grep { length } quotewords('\s+', 1, @Config_ldflags);
+    my @ccflags = grep { length } quotewords('\s+', 1, $Config_ccflags||'', 
$user_ccflags||'');
+    my @ldflags = grep { length } quotewords('\s+', 1, @Config_ldflags, 
$user_ldflags||'');
     my @paths = split(/$Config{path_sep}/, $ENV{PATH});
     my @cc = split(/\s+/, $Config{cc});
     if (check_compiler ($cc[0], $debug)) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Devel-CheckLib-1.06/t/analyze-binary.t 
new/Devel-CheckLib-1.07/t/analyze-binary.t
--- old/Devel-CheckLib-1.06/t/analyze-binary.t  1970-01-01 01:00:00.000000000 
+0100
+++ new/Devel-CheckLib-1.07/t/analyze-binary.t  2016-04-08 17:54:29.000000000 
+0200
@@ -0,0 +1,54 @@
+use strict;
+# compatible use warnings
+BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
+
+use lib 't/lib';
+use IO::CaptureOutput qw(capture);
+use Config;
+
+use File::Spec;
+use Test::More;
+
+eval "use Devel::CheckLib";
+if($@ =~ /Couldn't find your C compiler/) {
+    plan skip_all => "Couldn't find your C compiler";
+}
+my $libdir;
+eval "use Helper qw(create_testlib)";
+unless($libdir = create_testlib("bazbam")) {
+    plan skip_all => "Couldn't build a library to test against";
+};
+
+my($debug, $stdout, $stderr) = ($ENV{DEVEL_CHECKLIB_DEBUG} || 0);
+
+sub diagout { diag "\tSTDOUT: $stdout\n\tSTDERR: $stderr\n" }
+
+sub analyze_binary {
+    my ($lib, $bin, $expected_rc, @args) = @_;
+    $bin = File::Spec->rel2abs($bin);
+    system $bin, @args;
+    warn "\$?: $?, expected: ".($expected_rc << 8)."\n";
+    return ($? == ($expected_rc << 8));
+}
+
+my %common = ( debug => $debug,
+               incpath => 't/inc',
+               libpath => $libdir,
+               lib => 'bazbam',
+               header => 'headerfile.h',
+               function => 'return (argc - 1);',
+             );
+
+capture
+    sub { eval { assert_lib(%common,
+                            analyze_binary => sub { analyze_binary @_, 3, 
qw(foo  bar doz) } ) } },
+    \$stdout, \$stderr;
+is($@, '', "analyze_binary ok") or diagout;
+
+capture
+    sub { eval { assert_lib(%common,
+                            analyze_binary => sub { analyze_binary @_, 3, 
qw(foo) } ) } },
+    \$stdout, \$stderr;
+like($@, qr/wrong analysis/i, "analyze_binary wrong") or diagout;
+
+done_testing;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/Devel-CheckLib-1.06/t/flags.t 
new/Devel-CheckLib-1.07/t/flags.t
--- old/Devel-CheckLib-1.06/t/flags.t   1970-01-01 01:00:00.000000000 +0100
+++ new/Devel-CheckLib-1.07/t/flags.t   2016-04-08 17:54:29.000000000 +0200
@@ -0,0 +1,51 @@
+use strict;
+# compatible use warnings
+BEGIN{ if (not $] < 5.006) { require warnings; warnings->import } }
+
+use lib 't/lib';
+use IO::CaptureOutput qw(capture);
+use Config;
+
+use File::Spec;
+use Test::More;
+
+eval "use Devel::CheckLib";
+if($@ =~ /Couldn't find your C compiler/) {
+    plan skip_all => "Couldn't find your C compiler";
+}
+my $libdir;
+eval "use Helper qw(create_testlib)";
+unless($libdir = create_testlib("bazbam")) {
+    plan skip_all => "Couldn't build a library to test against";
+};
+
+my($debug, $stdout, $stderr) = ($ENV{DEVEL_CHECKLIB_DEBUG} || 0);
+
+sub diagout { diag "\tSTDOUT: $stdout\n\tSTDERR: $stderr\n" }
+
+my %common = ( debug => $debug,
+               incpath => 't/inc',
+               libpath => $libdir,
+               lib => 'bazbam',
+               header => 'headerfile.h',
+               function => <<EOF);
+
+#ifdef FOO1234
+return 0;
+#else
+return 1;
+#endif
+
+EOF
+
+capture
+    sub { eval { assert_lib(%common, ccflags => '-DFOO1234') } },
+    \$stdout, \$stderr;
+is($@, '', "ccflags ok") or diagout;
+
+capture
+    sub { eval { assert_lib(%common) } },
+    \$stdout, \$stderr;
+like($@, qr/wrong/i, "ccflags wrong") or diagout;
+
+done_testing;


Reply via email to