scripts/package-metadata.pl: fix handling transitive conditional dependencies
authorFelix Fietkau <nbd@nbd.name>
Fri, 1 Sep 2023 10:14:26 +0000 (12:14 +0200)
committerFelix Fietkau <nbd@nbd.name>
Fri, 1 Sep 2023 10:18:13 +0000 (12:18 +0200)
When a package foo depends on PACKAGE_foo:bar (in order to make build
dependencies conditional), tracking transitive dependencies can fail because
the internal seen flag is checked/set before eliminating the fake conditional
dependency. This can show up as a depends on not properly turned into a
select further down in the dependency chain

Signed-off-by: Felix Fietkau <nbd@nbd.name>
scripts/package-metadata.pl

index 6288584d65f58890bcdfa3f5d359c42672712ee6..11f1bc4bcd4b54fbe7df4c68f6f429256511525a 100755 (executable)
@@ -161,9 +161,6 @@ sub mconf_depends {
                my $condition = $parent_condition;
 
                next if $condition eq $depend;
-               next if $seen->{"$parent_condition:$depend"};
-               next if $seen->{":$depend"};
-               $seen->{"$parent_condition:$depend"} = 1;
                if ($depend =~ /^(.+):(.+)$/) {
                        if ($1 ne "PACKAGE_$pkgname") {
                                if ($condition) {
@@ -174,6 +171,9 @@ sub mconf_depends {
                        }
                        $depend = $2;
                }
+               next if $seen->{"$parent_condition:$depend"};
+               next if $seen->{":$depend"};
+               $seen->{"$parent_condition:$depend"} = 1;
                if ($flags =~ /\+/) {
                        my $vdep = $vpackage{$depend};
                        if ($vdep) {