diff mbox

scancpan: fix detection of native module

Message ID 1441528370-13335-1-git-send-email-francois.perrad@gadz.org
State Accepted
Headers show

Commit Message

Francois Perrad Sept. 6, 2015, 8:32 a.m. UTC
In MANIFEST, each line contains a filename
which could be followed by an optional comment.

When a module is native or depends of a native module,
it must be disabled for static builds via its Config.in

Currently, 4 modules (generated by scancpan) need to be fixed.

For an example of failed build of perl-html-parser,
see http://autobuild.buildroot.net/results/128/128671dfa23d843698a63220c2fac1f44e1d5845/

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
 package/perl-html-parser/Config.in | 4 ++++
 package/perl-libwww-perl/Config.in | 4 ++++
 package/perl-mime-base64/Config.in | 4 ++++
 package/perl-time-hires/Config.in  | 4 ++++
 support/scripts/scancpan           | 2 +-
 5 files changed, 17 insertions(+), 1 deletion(-)

Comments

Yann E. MORIN Sept. 6, 2015, 8:47 p.m. UTC | #1
François, All,

On 2015-09-06 10:32 +0200, Francois Perrad spake thusly:
> In MANIFEST, each line contains a filename
> which could be followed by an optional comment.
> 
> When a module is native or depends of a native module,
> it must be disabled for static builds via its Config.in
> 
> Currently, 4 modules (generated by scancpan) need to be fixed.

Sorry, I fail to understand how all this is related, especially the part
about the comments which I found misleading. So I had to go see the link
referenced in scancpan to fulle understand.

What about this commit log:

    When a module is native or depends of a native module, it must be
    disabled for static builds via its Config.in

    We detect native modules by looking at the filenames listed in the
    MANIFEST. If there is a file which looks like it contains code that
    much be compiled (e.g. .c, .h and so on...), then we exclude that
    module (and its dependencies) from static builds.

    That's what we tried to do so far, but failed when there was a
    comment on the same line as the filename in the manifest, like so:
        foo-bar.c # Bla bla bla

    Fix that by detecting either endof-line (as currently done) or
    end-of-string.

Regards,
Yann E. MORIN.

> For an example of failed build of perl-html-parser,
> see http://autobuild.buildroot.net/results/128/128671dfa23d843698a63220c2fac1f44e1d5845/
> 
> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
> ---
>  package/perl-html-parser/Config.in | 4 ++++
>  package/perl-libwww-perl/Config.in | 4 ++++
>  package/perl-mime-base64/Config.in | 4 ++++
>  package/perl-time-hires/Config.in  | 4 ++++
>  support/scripts/scancpan           | 2 +-
>  5 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/package/perl-html-parser/Config.in b/package/perl-html-parser/Config.in
> index afdd523..8a725f1 100644
> --- a/package/perl-html-parser/Config.in
> +++ b/package/perl-html-parser/Config.in
> @@ -1,8 +1,12 @@
>  config BR2_PACKAGE_PERL_HTML_PARSER
>  	bool "perl-html-parser"
> +	depends on !BR2_STATIC_LIBS
>  	select BR2_PACKAGE_PERL_HTML_TAGSET
>  	help
>  	  The HTML-Parser distribution is is a collection of modules that parse
>  	  and extract information from HTML documents
>  
>  	  http://github.com/gisle/html-parser
> +
> +comment "perl-html-parser needs a toolchain w/ dynamic library"
> +	depends on BR2_STATIC_LIBS
> diff --git a/package/perl-libwww-perl/Config.in b/package/perl-libwww-perl/Config.in
> index 3db0070..fc46bf1 100644
> --- a/package/perl-libwww-perl/Config.in
> +++ b/package/perl-libwww-perl/Config.in
> @@ -1,5 +1,6 @@
>  config BR2_PACKAGE_PERL_LIBWWW_PERL
>  	bool "perl-libwww-perl"
> +	depends on !BR2_STATIC_LIBS
>  	select BR2_PACKAGE_PERL_ENCODE_LOCALE
>  	select BR2_PACKAGE_PERL_FILE_LISTING
>  	select BR2_PACKAGE_PERL_HTML_PARSER
> @@ -16,3 +17,6 @@ config BR2_PACKAGE_PERL_LIBWWW_PERL
>  	  The World-Wide Web library for Perl
>  
>  	  https://metacpan.org/release/libwww-perl
> +
> +comment "perl-libwww-perl needs a toolchain w/ dynamic library"
> +	depends on BR2_STATIC_LIBS
> diff --git a/package/perl-mime-base64/Config.in b/package/perl-mime-base64/Config.in
> index 7e4858f..22563dd 100644
> --- a/package/perl-mime-base64/Config.in
> +++ b/package/perl-mime-base64/Config.in
> @@ -1,7 +1,11 @@
>  config BR2_PACKAGE_PERL_MIME_BASE64
>  	bool "perl-mime-base64"
> +	depends on !BR2_STATIC_LIBS
>  	help
>  	  This package contains a base64 encoder/decoder and a quoted-printable
>  	  encoder/decoder.
>  
>  	  http://github.com/gisle/mime-base64
> +
> +comment "perl-mime-base64 needs a toolchain w/ dynamic library"
> +	depends on BR2_STATIC_LIBS
> diff --git a/package/perl-time-hires/Config.in b/package/perl-time-hires/Config.in
> index e10c18a..37bad71 100644
> --- a/package/perl-time-hires/Config.in
> +++ b/package/perl-time-hires/Config.in
> @@ -1,6 +1,10 @@
>  config BR2_PACKAGE_PERL_TIME_HIRES
>  	bool "perl-time-hires"
> +	depends on !BR2_STATIC_LIBS
>  	help
>  	  High resolution alarm, sleep, gettimeofday, interval timers
>  
>  	  http://search.cpan.org/dist/Time-HiRes/HiRes.pm
> +
> +comment "perl-time-hires needs a toolchain w/ dynamic library"
> +	depends on BR2_STATIC_LIBS
> diff --git a/support/scripts/scancpan b/support/scripts/scancpan
> index 94983b4..b0cd492 100755
> --- a/support/scripts/scancpan
> +++ b/support/scripts/scancpan
> @@ -534,7 +534,7 @@ sub is_xs {
>      # This heuristic determines if a module is a native extension, by searching
>      # some file extension types in the MANIFEST of the distribution.
>      # It was inspired by http://deps.cpantesters.org/static/purity.html
> -    return $manifest =~ m/\.(swg|xs|c|h|i)\n/;
> +    return $manifest =~ m/\.(swg|xs|c|h|i)[\n\s]/;
>  }
>  
>  sub find_license_files {
> -- 
> 2.1.4
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Sept. 20, 2015, 1:14 p.m. UTC | #2
Dear Francois Perrad,

On Sun,  6 Sep 2015 10:32:50 +0200, Francois Perrad wrote:
> In MANIFEST, each line contains a filename
> which could be followed by an optional comment.
> 
> When a module is native or depends of a native module,
> it must be disabled for static builds via its Config.in
> 
> Currently, 4 modules (generated by scancpan) need to be fixed.
> 
> For an example of failed build of perl-html-parser,
> see http://autobuild.buildroot.net/results/128/128671dfa23d843698a63220c2fac1f44e1d5845/
> 
> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
> ---
>  package/perl-html-parser/Config.in | 4 ++++
>  package/perl-libwww-perl/Config.in | 4 ++++
>  package/perl-mime-base64/Config.in | 4 ++++
>  package/perl-time-hires/Config.in  | 4 ++++
>  support/scripts/scancpan           | 2 +-
>  5 files changed, 17 insertions(+), 1 deletion(-)

I have changed the commit message to use the one proposed by Yann, and
applied. Thanks!

Thomas
diff mbox

Patch

diff --git a/package/perl-html-parser/Config.in b/package/perl-html-parser/Config.in
index afdd523..8a725f1 100644
--- a/package/perl-html-parser/Config.in
+++ b/package/perl-html-parser/Config.in
@@ -1,8 +1,12 @@ 
 config BR2_PACKAGE_PERL_HTML_PARSER
 	bool "perl-html-parser"
+	depends on !BR2_STATIC_LIBS
 	select BR2_PACKAGE_PERL_HTML_TAGSET
 	help
 	  The HTML-Parser distribution is is a collection of modules that parse
 	  and extract information from HTML documents
 
 	  http://github.com/gisle/html-parser
+
+comment "perl-html-parser needs a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS
diff --git a/package/perl-libwww-perl/Config.in b/package/perl-libwww-perl/Config.in
index 3db0070..fc46bf1 100644
--- a/package/perl-libwww-perl/Config.in
+++ b/package/perl-libwww-perl/Config.in
@@ -1,5 +1,6 @@ 
 config BR2_PACKAGE_PERL_LIBWWW_PERL
 	bool "perl-libwww-perl"
+	depends on !BR2_STATIC_LIBS
 	select BR2_PACKAGE_PERL_ENCODE_LOCALE
 	select BR2_PACKAGE_PERL_FILE_LISTING
 	select BR2_PACKAGE_PERL_HTML_PARSER
@@ -16,3 +17,6 @@  config BR2_PACKAGE_PERL_LIBWWW_PERL
 	  The World-Wide Web library for Perl
 
 	  https://metacpan.org/release/libwww-perl
+
+comment "perl-libwww-perl needs a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS
diff --git a/package/perl-mime-base64/Config.in b/package/perl-mime-base64/Config.in
index 7e4858f..22563dd 100644
--- a/package/perl-mime-base64/Config.in
+++ b/package/perl-mime-base64/Config.in
@@ -1,7 +1,11 @@ 
 config BR2_PACKAGE_PERL_MIME_BASE64
 	bool "perl-mime-base64"
+	depends on !BR2_STATIC_LIBS
 	help
 	  This package contains a base64 encoder/decoder and a quoted-printable
 	  encoder/decoder.
 
 	  http://github.com/gisle/mime-base64
+
+comment "perl-mime-base64 needs a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS
diff --git a/package/perl-time-hires/Config.in b/package/perl-time-hires/Config.in
index e10c18a..37bad71 100644
--- a/package/perl-time-hires/Config.in
+++ b/package/perl-time-hires/Config.in
@@ -1,6 +1,10 @@ 
 config BR2_PACKAGE_PERL_TIME_HIRES
 	bool "perl-time-hires"
+	depends on !BR2_STATIC_LIBS
 	help
 	  High resolution alarm, sleep, gettimeofday, interval timers
 
 	  http://search.cpan.org/dist/Time-HiRes/HiRes.pm
+
+comment "perl-time-hires needs a toolchain w/ dynamic library"
+	depends on BR2_STATIC_LIBS
diff --git a/support/scripts/scancpan b/support/scripts/scancpan
index 94983b4..b0cd492 100755
--- a/support/scripts/scancpan
+++ b/support/scripts/scancpan
@@ -534,7 +534,7 @@  sub is_xs {
     # This heuristic determines if a module is a native extension, by searching
     # some file extension types in the MANIFEST of the distribution.
     # It was inspired by http://deps.cpantesters.org/static/purity.html
-    return $manifest =~ m/\.(swg|xs|c|h|i)\n/;
+    return $manifest =~ m/\.(swg|xs|c|h|i)[\n\s]/;
 }
 
 sub find_license_files {