Skip to contentSkip to conversation

support/script/scancpan: remove duplicated dependency

PATCH New Francois Perrad 3 participants 4 messages Dec 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support/script/scancpan: remove duplicated dependency

dependency from metacpan comes as a list of module which is transformed in a list of distribution for BR. different modules could be included in the same distribution, so duplication is possible.

---
 support/scripts/scancpan | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
support/scripts/scancpan +9 -9
index 0eac132..590c215 100755
@@ -558,8 +558,8 @@ sub fetch {
         my $manifest = get_manifest( $result->{author}, $name, $result->{version} );
         $need_dlopen{$name} = is_xs( $manifest );
         $license_files{$name} = find_license_files( $manifest );
-        my @deps_build = ();
-        my @deps_runtime = ();
+        my %build = ();
+        my %runtime = ();
         my $mb;
         foreach my $dep (@{$result->{dependency}}) {
             my $modname = ${$dep}{module};
@@ -578,19 +578,19 @@ sub fetch {
             next if !$recommend && ${$dep}{relationship} ne q{requires};
             my $distname = $mcpan->module( $modname )->{distribution};
             if (${$dep}{phase} eq q{runtime}) {
-                push @deps_runtime, $distname;
+                $runtime{$distname} = 1;
             }
             else { # configure, build
-                push @deps_build, $distname;
+                $build{$distname} = 1;
             }
         }
-        unshift @deps_build, q{Module-Build} if $mb;
-        $deps_build{$name} = \@deps_build;
-        $deps_runtime{$name} = \@deps_runtime;
-        foreach my $distname (@deps_build) {
+        $build{q{Module-Build}} = 1 if $mb;
+        $deps_build{$name} = [keys %build];
+        $deps_runtime{$name} = [keys %runtime];
+        foreach my $distname (@{$deps_build{$name}}) {
             fetch( $distname, 0, 1 );
         }
-        foreach my $distname (@deps_runtime) {
+        foreach my $distname (@{$deps_runtime{$name}}) {
             fetch( $distname, $need_target, $need_host );
             $need_dlopen{$name} ||= $need_dlopen{$distname};
         }
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 support/script/scancpan: remove duplicated dependency

Dear Francois Perrad,

Quoted 6 lines · Francois Perrad

dependency from metacpan comes as a list of module which is transformed in a list of distribution for BR. different modules could be included in the same distribution, so duplication is possible.

Thanks. Could you give an example of a CPAN module which exhibits the issue, so non-Perl people like me can test the effect of your patch?

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 support/script/scancpan: remove duplicated dependency

2014-12-09 20:35 GMT+01:00 Thomas Petazzoni
<[email protected]>:

Quoted 8 lines

Dear Francois Perrad,

Quoted 5 lines · Francois Perrad

dependency from metacpan comes as a list of module which is transformed in a list of distribution for BR. different modules could be included in the same distribution, so duplication is possible.

Quoted 7 lines
Quoted 1 line

Thanks. Could you give an example of a CPAN module which exhibits the issue, so non-Perl people like me can test the effect of your patch?

Thanks!

An example with a CPAN module which is not in BR

   $ support/scripts/scancpan -f HTTP-Daemon

Without the patch, its dependency on HTTP-Message is duplicated.

Fran?ois

Quoted 9 lines

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#3 lore raw

PATCH 1/1 support/script/scancpan: remove duplicated dependency

Dear Fran?ois Perrad,

Quoted 5 lines · Fran?ois Perrad

An example with a CPAN module which is not in BR

   $ support/scripts/scancpan -f HTTP-Daemon

Without the patch, its dependency on HTTP-Message is duplicated.

Thanks for the example. I've amended the commit log with this and applied your patch.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com