I've run into a situation where that solution does not work.

Specifically:

DEPENDS:=+PACKAGE_TAR_POSIX_ACL:libacl +PACKAGE_TAR_XATTR:libxattr +PACKAGE_TAR_BZIP2:bzip2 +PACKAGE_TAR_XZ:xz
endef

define Package/tar/config
        config PACKAGE_TAR_POSIX_ACL
        bool "tar: Enable POSIX ACL support" if PACKAGE_tar
        default y if USE_FS_ACL_ATTR
        default n

        config PACKAGE_TAR_XATTR
bool "tar: Enable extended attribute (xattr) support" if PACKAGE_tar
        default y if USE_FS_ACL_ATTR
        default n

        config PACKAGE_TAR_GZIP
        bool "tar: Enable seamless gzip support" if PACKAGE_tar
        default y

        config PACKAGE_TAR_BZIP2
        bool "tar: Enable seamless bzip2 support" if PACKAGE_tar
        default y

        config PACKAGE_TAR_XZ
        bool "tar: Enable seamless xz support" if PACKAGE_tar
        select PACKAGE_xz
        default y
endef

That results in a circular dependency.

Using EXTRA_DEPENDS and select in config section is necessary because of the way package dependency parsing mangles the dependencies when using +PACKAGE_TAR_XZ:xz. Specifically xz 'depends on' xz-utils in the xz package definition. When taken in combination with +PACKAGE_TAR_XZ:xz the parsing/mangling results in a recursive dependency where tar depends on PACKAGE_TAR_XZ and vice versa, because the recursive dependency checker does not distinguish between

depends on SYMBOL
vs.
depends on !SYMBOL

and the xz-utils depends results in

PACKAGE_tar depends on !(PACKAGE_TAR_XZ) || PACKAGE_xz-utils

and PACKAGE_TAR_XZ depends on PACKAGE_tar because it makes no sense without tar (and submenu doesn't work without the if PACKAGE_tar or a depends on PACKAGE_tar).


On 22/12/15 06:46 PM, Felix Fietkau wrote:
On 2015-12-23 00:42, Daniel Dickinson wrote:
Hi Felix,

On 22/12/15 09:03 AM, Felix Fietkau wrote:
On 2015-12-22 06:02, Daniel Dickinson wrote:
Hi all,

I just discovered something.  It seems that in a package if you have a
config section that does select PACKAGE_condition_dependency then the
build succeeds but when you do opkg install, opkg does not 'know' about
the dependency.

That means if you have a situation like lldpd where you have a
conditional dependency it is not enough to add selects to same
config section as the conditional compilation flags, but you also need
to add an EXTRA_DEPENDS:=$(if
$(CONFIG_<conditional-compilation-flag>),conditional_dependency) line.

I will be submitting a patch to lldpd with that fix, since my previous
patch fixed compilation, but doesn't solve the opkg problem (although no
one is likely to actually run across it because libjson-c is installed
by default so it's unlikely any failure would actually occur).  (Before
my patch even compilation would fail if json output was disable due to
missing dependency, now you would likely never notice the problem
because libjson-c is installed by default, but I discovered the issue in
reference to package to which I'm adding conditional build logic in the
packages feed for which the conditional dependency is not included
unless the package I'm working on depends on it).
You should just use the normal conditional depends syntax for the
DEPENDS line in the package, instead of duplicating it in Config.in and
EXTRA_DEPENDS.

DEPENDS:=+PACKAGE_conditional_package:selected_package

It's actually used in the context of a Package/<pkg>/config section that
does some condition compilation option that when enabled adds another
dependency.  Hence the unusual method.  Conditional dependency based on
the configure option I had forgotten as an option though:

i.e.

config PACKAGE_LLDPD_JSON
bool "Enable JSON output"
default n

and in depends

DEPENDS:=PACKAGE_LLDPD_JSON:libjson-c
DEPENDS:=+PACKAGE_LLDPD_JSON:libjson-c (the + turns it into a select).
Then you don't need to select libjson-c from the /config section.

- Felix

_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to