mirror of https://github.com/hak5/openwrt-owl.git
build: propagate override information to .config file
With this change, override information is now parsed from the metadata and put in the %packages hash. A new hash - %overrides - is created and exported, to be used during the .config-package.in generation. If an override is detected, a new option CONFIG_OVERRIDE_PKGS will be created in the .config, and will contain a space-separated list of all the overridden packages. Signed-off-by: Mathieu Olivari <mathieu@qca.qualcomm.com> SVN-Revision: 44336owl
parent
b7cf4cc613
commit
e2684c218d
|
@ -679,6 +679,13 @@ EOF
|
||||||
print "endmenu\n\n";
|
print "endmenu\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub print_package_overrides() {
|
||||||
|
keys %overrides > 0 or return;
|
||||||
|
print "\tconfig OVERRIDE_PKGS\n";
|
||||||
|
print "\t\tstring\n";
|
||||||
|
print "\t\tdefault \"".join(" ", keys %overrides)."\"\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
sub gen_package_config() {
|
sub gen_package_config() {
|
||||||
parse_package_metadata($ARGV[0]) or exit 1;
|
parse_package_metadata($ARGV[0]) or exit 1;
|
||||||
print "menuconfig IMAGEOPT\n\tbool \"Image configuration\"\n\tdefault n\n";
|
print "menuconfig IMAGEOPT\n\tbool \"Image configuration\"\n\tdefault n\n";
|
||||||
|
@ -704,6 +711,7 @@ EOF
|
||||||
foreach my $cat (sort {uc($a) cmp uc($b)} keys %category) {
|
foreach my $cat (sort {uc($a) cmp uc($b)} keys %category) {
|
||||||
print_package_config_category $cat;
|
print_package_config_category $cat;
|
||||||
}
|
}
|
||||||
|
print_package_overrides();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub get_conditional_dep($$) {
|
sub get_conditional_dep($$) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ package metadata;
|
||||||
use base 'Exporter';
|
use base 'Exporter';
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
our @EXPORT = qw(%package %srcpackage %category %subdir %preconfig %features clear_packages parse_package_metadata get_multiline);
|
our @EXPORT = qw(%package %srcpackage %category %subdir %preconfig %features %overrides clear_packages parse_package_metadata get_multiline);
|
||||||
|
|
||||||
our %package;
|
our %package;
|
||||||
our %preconfig;
|
our %preconfig;
|
||||||
|
@ -10,6 +10,7 @@ our %srcpackage;
|
||||||
our %category;
|
our %category;
|
||||||
our %subdir;
|
our %subdir;
|
||||||
our %features;
|
our %features;
|
||||||
|
our %overrides;
|
||||||
|
|
||||||
sub get_multiline {
|
sub get_multiline {
|
||||||
my $fh = shift;
|
my $fh = shift;
|
||||||
|
@ -30,6 +31,7 @@ sub clear_packages() {
|
||||||
%srcpackage = ();
|
%srcpackage = ();
|
||||||
%category = ();
|
%category = ();
|
||||||
%features = ();
|
%features = ();
|
||||||
|
%overrides = ();
|
||||||
}
|
}
|
||||||
|
|
||||||
sub parse_package_metadata($) {
|
sub parse_package_metadata($) {
|
||||||
|
@ -40,6 +42,7 @@ sub parse_package_metadata($) {
|
||||||
my $preconfig;
|
my $preconfig;
|
||||||
my $subdir;
|
my $subdir;
|
||||||
my $src;
|
my $src;
|
||||||
|
my $override;
|
||||||
|
|
||||||
open FILE, "<$file" or do {
|
open FILE, "<$file" or do {
|
||||||
warn "Cannot open '$file': $!\n";
|
warn "Cannot open '$file': $!\n";
|
||||||
|
@ -54,8 +57,13 @@ sub parse_package_metadata($) {
|
||||||
$subdir =~ s/^package\///;
|
$subdir =~ s/^package\///;
|
||||||
$subdir{$src} = $subdir;
|
$subdir{$src} = $subdir;
|
||||||
$srcpackage{$src} = [];
|
$srcpackage{$src} = [];
|
||||||
|
$override = "";
|
||||||
undef $pkg;
|
undef $pkg;
|
||||||
};
|
};
|
||||||
|
/^Override: \s*(.+?)\s*$/ and do {
|
||||||
|
$override = $1;
|
||||||
|
$overrides{$src} = 1;
|
||||||
|
};
|
||||||
next unless $src;
|
next unless $src;
|
||||||
/^Package:\s*(.+?)\s*$/ and do {
|
/^Package:\s*(.+?)\s*$/ and do {
|
||||||
undef $feature;
|
undef $feature;
|
||||||
|
@ -70,6 +78,7 @@ sub parse_package_metadata($) {
|
||||||
$pkg->{buildtypes} = [];
|
$pkg->{buildtypes} = [];
|
||||||
$pkg->{subdir} = $subdir;
|
$pkg->{subdir} = $subdir;
|
||||||
$pkg->{tristate} = 1;
|
$pkg->{tristate} = 1;
|
||||||
|
$pkg->{override} = $override;
|
||||||
$package{$1} = $pkg;
|
$package{$1} = $pkg;
|
||||||
push @{$srcpackage{$src}}, $pkg;
|
push @{$srcpackage{$src}}, $pkg;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue