1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-17 04:33:57 +02:00
openwrt/target/sdk/convert-config.pl
Sven Roederer 1e4b191ac8 sdk: unset BINARY_FOLDER and DOWNLOAD_FOLDER in final archives
Using these config-options to customize the folders used at build-time makes these
folder settings appear in generated archive. This causes the SDK to be not
portable, as it's going to use the build-time folders on the new systems.
The errors vary from passing the build, disk out-of-space to permission denied.

The build-time settings of these folders are passed into the archive via Config.build.
The expected behavior is that the SDK acts after unpacking like these settings have
their defaults, using intree folders. So just filter these folders out when running
convert-config.pl to create Config.build.

This addresses the same issue that's fixed in the previous commit for the imagebuilder.

Signed-off-by: Sven Roederer <devel-sven@geroedel.de>
2021-05-08 12:14:04 +02:00

66 lines
1.4 KiB
Perl
Executable File

#!/usr/bin/env perl
use strict;
while (<>) {
my $match;
my $var;
my $val;
my $type;
chomp;
next if /^CONFIG_SIGNED_PACKAGES/;
if (/^CONFIG_((BINARY)|(DOWNLOAD))_FOLDER=(.*)$/) {
# We don't want to preserve the build setting of
# BINARY_FOLDER and DOWNLOAD_FOLDER.
$var = "$1_FOLDER";
$val = '""';
$type = "string";
} elsif (/^CONFIG_([^=]+)=(.*)$/) {
$var = $1;
$val = $2;
next if $var eq 'ALL';
if ($val eq 'y') {
$type = "bool";
} elsif ($val eq 'm') {
$type = "tristate";
} elsif ($val =~ /^".*"$/) {
$type = "string";
} elsif ($val =~ /^\d+$/) {
$type = "int";
} else {
warn "WARNING: no type found for symbol CONFIG_$var=$val\n";
next;
}
} elsif (/^# CONFIG_BUSYBOX_(.*) is not set/) {
$var = "BUSYBOX_$1";
$val = 'n';
$type = "bool";
} else {
# We don't want to preserve a record of deselecting
# packages because we may want build them in the SDK.
# non-package configs however may be important to preserve
# the same compilation settings for packages that get
# recompiled in the SDK.
# Also we want avoid preserving image generation settings
# because we set those while in ImageBuilder
next if /^(# )?CONFIG_PACKAGE/;
next if /^(# )?CONFIG_TARGET/;
if (/^# CONFIG_(.*) is not set/) {
$var = $1;
$val = 'n';
$type = "bool";
}
}
if (($var ne '') && ($type ne '') && ($val ne '')) {
print <<EOF;
config $var
$type
default $val
EOF
}
}