metadata: ensure one dependency provider to be y if a package is y
authorJonas Gorski <jonas.gorski@gmail.com>
Sat, 15 Jun 2019 13:04:53 +0000 (15:04 +0200)
committerJo-Philipp Wich <jo@mein.io>
Wed, 4 Sep 2019 11:15:53 +0000 (13:15 +0200)
When there are multiple packages providing a meta-package, it is
possible to to create a config where a package is selected as =y, but
all of its dependency providers are just selected as =m. This is due to
the selection statement being just

  config PACKAGE_foo
    select PACKAGE_bar if !PACKAGE_baz

which is already fulfilled by PACKAGE_bar=m. Fix this by properly
comparing the selection states:

  config PACKAGE_foo
    select PACKAGE_bar if PACKAGE_baz<PACKAGE_foo

Also invert the select conditions to improve readability.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
[slightly reword commit message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 1fd50531cac9c41334d8f57e2dbc1f50c3572445)

scripts/package-metadata.pl

index 76b09a56ebfedbeb3634880ff505a5220c7acd4d..27215f5e5722e530fa3efbbff030c3cd44043b7b 100755 (executable)
@@ -191,9 +191,9 @@ sub mconf_depends {
                                $depend = shift @vdeps;
 
                                if (@vdeps > 1) {
                                $depend = shift @vdeps;
 
                                if (@vdeps > 1) {
-                                       $condition = ($condition ? "$condition && " : '') . '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')';
+                                       $condition = ($condition ? "$condition && " : '') . join("&&", map { "PACKAGE_$_<PACKAGE_$pkgname" } @vdeps);
                                } elsif (@vdeps > 0) {
                                } elsif (@vdeps > 0) {
-                                       $condition = ($condition ? "$condition && " : '') . '!PACKAGE_'.$vdeps[0];
+                                       $condition = ($condition ? "$condition && " : '') . "PACKAGE_${vdeps[0]}<PACKAGE_$pkgname";
                                }
                        }
 
                                }
                        }