build: add support for declaring package CONFLICTS which only affect selecting built-in packages

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 42770
This commit is contained in:
Felix Fietkau 2014-10-05 16:41:33 +00:00
parent 646dfde826
commit 5e4789671a
4 changed files with 16 additions and 0 deletions

View file

@ -19,6 +19,7 @@ define Package/Default
CATEGORY:=Extra packages CATEGORY:=Extra packages
DEPENDS:= DEPENDS:=
MDEPENDS:= MDEPENDS:=
CONFLICTS:=
PROVIDES:= PROVIDES:=
EXTRA_DEPENDS:= EXTRA_DEPENDS:=
MAINTAINER:=$(PKG_MAINTAINER) MAINTAINER:=$(PKG_MAINTAINER)

View file

@ -31,6 +31,7 @@ $(if $(MENU),Menu: $(MENU)
)$(if $(findstring $(PREREQ_CHECK),1),Prereq-Check: 1 )$(if $(findstring $(PREREQ_CHECK),1),Prereq-Check: 1
)Version: $(VERSION) )Version: $(VERSION)
Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS)) Depends: $(call PKG_FIXUP_DEPENDS,$(1),$(DEPENDS))
Conflicts: $(CONFLICTS)
Menu-Depends: $(MDEPENDS) Menu-Depends: $(MDEPENDS)
Provides: $(PROVIDES) Provides: $(PROVIDES)
$(if $(VARIANT),Build-Variant: $(VARIANT) $(if $(VARIANT),Build-Variant: $(VARIANT)

View file

@ -522,6 +522,18 @@ sub mconf_depends {
return $res; return $res;
} }
sub mconf_conflicts {
my $pkgname = shift;
my $depends = shift;
my $res = "";
foreach my $depend (@$depends) {
next unless $package{$depend};
$res .= "\t\tdepends on m || (PACKAGE_$depend != y)\n";
}
return $res;
}
sub print_package_config_category($) { sub print_package_config_category($) {
my $cat = shift; my $cat = shift;
my %menus; my %menus;
@ -583,6 +595,7 @@ sub print_package_config_category($) {
} }
print mconf_depends($pkg->{name}, $pkg->{depends}, 0); print mconf_depends($pkg->{name}, $pkg->{depends}, 0);
print mconf_depends($pkg->{name}, $pkg->{mdepends}, 0); print mconf_depends($pkg->{name}, $pkg->{mdepends}, 0);
print mconf_conflicts($pkg->{name}, $pkg->{conflicts});
print "\t\thelp\n"; print "\t\thelp\n";
print $pkg->{description}; print $pkg->{description};
print "\n"; print "\n";

View file

@ -113,6 +113,7 @@ sub parse_package_metadata($) {
}; };
/^Menu-Depends: \s*(.+)\s*$/ and $pkg->{mdepends} = [ split /\s+/, $1 ]; /^Menu-Depends: \s*(.+)\s*$/ and $pkg->{mdepends} = [ split /\s+/, $1 ];
/^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ]; /^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
/^Conflicts: \s*(.+)\s*$/ and $pkg->{conflicts} = [ split /\s+/, $1 ];
/^Hidden: \s*(.+)\s*$/ and $pkg->{hidden} = 1; /^Hidden: \s*(.+)\s*$/ and $pkg->{hidden} = 1;
/^Build-Variant: \s*([\w\-]+)\s*/ and $pkg->{variant} = $1; /^Build-Variant: \s*([\w\-]+)\s*/ and $pkg->{variant} = $1;
/^Default-Variant: .*/ and $pkg->{variant_default} = 1; /^Default-Variant: .*/ and $pkg->{variant_default} = 1;