diff mbox

[OpenWrt-Devel,1/2] scripts: fix recursive dependencies that might be caused by using conditional dependencies.

Message ID 1419244149-12187-1-git-send-email-yszhou4tech@gmail.com
State Changes Requested
Headers show

Commit Message

Yousong Zhou Dec. 22, 2014, 10:29 a.m. UTC
`kmod-ipt-ipset' has a `DEPENDS' value of `@(!(TARGET_ps3||TARGET_pxcab)||BROKEN)'.
Recursive dependency will occur if another package conditionally depends
on it with something like `+PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset'
which will produce the following kconfig content.

	config PACKAGE_dnsmasq-full
		...
		depends on !(PACKAGE_dnsmasq_full_ipset) || (!(TARGET_ps3||TARGET_pxcab)||BROKEN)

		if PACKAGE_dnsmasq-full
		...
		config PACKAGE_dnsmasq_full_ipset
			bool "Build with ipset support."
			default y
		...
		endif

And mconf will complain with

	tmp/.config-package.in:127:error: recursive dependency detected!
	tmp/.config-package.in:127:     symbol PACKAGE_dnsmasq-full depends on PACKAGE_dnsmasq_full_ipset
	tmp/.config-package.in:157:     symbol PACKAGE_dnsmasq_full_ipset depends on PACKAGE_dnsmasq-full

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
 scripts/metadata.pl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Felix Fietkau Dec. 22, 2014, 2:42 p.m. UTC | #1
On 2014-12-22 11:29, Yousong Zhou wrote:
> `kmod-ipt-ipset' has a `DEPENDS' value of `@(!(TARGET_ps3||TARGET_pxcab)||BROKEN)'.
> Recursive dependency will occur if another package conditionally depends
> on it with something like `+PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset'
> which will produce the following kconfig content.
> 
> 	config PACKAGE_dnsmasq-full
> 		...
> 		depends on !(PACKAGE_dnsmasq_full_ipset) || (!(TARGET_ps3||TARGET_pxcab)||BROKEN)
> 
> 		if PACKAGE_dnsmasq-full
> 		...
> 		config PACKAGE_dnsmasq_full_ipset
> 			bool "Build with ipset support."
> 			default y
> 		...
> 		endif
> 
> And mconf will complain with
> 
> 	tmp/.config-package.in:127:error: recursive dependency detected!
> 	tmp/.config-package.in:127:     symbol PACKAGE_dnsmasq-full depends on PACKAGE_dnsmasq_full_ipset
> 	tmp/.config-package.in:157:     symbol PACKAGE_dnsmasq_full_ipset depends on PACKAGE_dnsmasq-full
> 
> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
> ---
>  scripts/metadata.pl |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/metadata.pl b/scripts/metadata.pl
> index f3d04db..a2465d1 100755
> --- a/scripts/metadata.pl
> +++ b/scripts/metadata.pl
> @@ -500,7 +500,7 @@ sub mconf_depends {
>  			};
>  			$flags =~ /@/ or $depend = "PACKAGE_$depend";
>  			if ($condition) {
> -				if ($m =~ /select/) {
> +				if ($m =~ /select/ or $condition = $depend) {
This doesn't look right to me. It seems to be overwriting $condition.
Did you mean eq instead of =?

- Felix
Yousong Zhou Dec. 23, 2014, 1:38 a.m. UTC | #2
On 22 December 2014 at 22:42, Felix Fietkau <nbd@openwrt.org> wrote:
> This doesn't look right to me. It seems to be overwriting $condition.
> Did you mean eq instead of =?

Should be `=` in this case.  But the patch now looks wrong anyway.  I
will try digging through it.

               yousong
Yousong Zhou Dec. 23, 2014, 1:38 a.m. UTC | #3
On 23 December 2014 at 09:38, Yousong Zhou <yszhou4tech@gmail.com> wrote:
> Should be `=` in this case.  But the patch now looks wrong anyway.  I

Should be `eq' !  Dizzy in the morning, sorry.

> will try digging through it.
Yousong Zhou Dec. 23, 2014, 1:16 p.m. UTC | #4
On 22 December 2014 at 18:29, Yousong Zhou <yszhou4tech@gmail.com> wrote:
> `kmod-ipt-ipset' has a `DEPENDS' value of `@(!(TARGET_ps3||TARGET_pxcab)||BROKEN)'.
> Recursive dependency will occur if another package conditionally depends
> on it with something like `+PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset'
> which will produce the following kconfig content.
>
>         config PACKAGE_dnsmasq-full
>                 ...
>                 depends on !(PACKAGE_dnsmasq_full_ipset) || (!(TARGET_ps3||TARGET_pxcab)||BROKEN)
>
>                 if PACKAGE_dnsmasq-full
>                 ...
>                 config PACKAGE_dnsmasq_full_ipset
>                         bool "Build with ipset support."
>                         default y
>                 ...
>                 endif
>
> And mconf will complain with
>
>         tmp/.config-package.in:127:error: recursive dependency detected!
>         tmp/.config-package.in:127:     symbol PACKAGE_dnsmasq-full depends on PACKAGE_dnsmasq_full_ipset
>         tmp/.config-package.in:157:     symbol PACKAGE_dnsmasq_full_ipset depends on PACKAGE_dnsmasq-full
>

Hmm, I think the generated Kconfig and complaints emitted by mconf are fine.

I tried to move the selection of libnettle to
Package/dnsmasq-full/config, but that made the build system Error'ed
with the following.

    Package dnsmasq-full is missing dependencies for the following libraries:
    libgmp.so.10
    libhogweed.so.2
    libnettle.so.4
    make[2]: ***
[/home/yousong/trunk-openwrt/bin/ar71xx/packages/base/dnsmasq-full_2.72-2_ar71xx.ipk]
Error 1

The build system may need some change to accommodate such conditions.
But we can work around the problem for now by removing ipset's
dependency on TARGET_{ps3,pxcab} as they were obsolete for quite a
while.

Regards

               yousong
diff mbox

Patch

diff --git a/scripts/metadata.pl b/scripts/metadata.pl
index f3d04db..a2465d1 100755
--- a/scripts/metadata.pl
+++ b/scripts/metadata.pl
@@ -500,7 +500,7 @@  sub mconf_depends {
 			};
 			$flags =~ /@/ or $depend = "PACKAGE_$depend";
 			if ($condition) {
-				if ($m =~ /select/) {
+				if ($m =~ /select/ or $condition = $depend) {
 					next if $depend eq $condition;
 					$depend = "$depend if $condition";
 				} else {