config: fix broken backwards compatibility hack

80aa5ab611 implemented a hack to handle
replacement of LB_LINUX_FLAVOURS with LB_LINUX_FLAVOURS_WITH_ARCH in
config files, but implemented it in the wrong place.

adding a conditional conversion within the config file meant that the old
value would only be read from **new** config files that are created
obviously without it, including re-saved configs if `lb config` were
re-run with additional options (not recommended). any existing value in an
existing config file would actually be ignored.

the right place to read the old value was in the Set_defaults() function
(since renamed).

a second issue also existed with the hack, it failed to excape the `$`
and thus printed the existing value of $LB_LINUX_FLAVOURS into the
conditional check being constructed in the config file, instead of
printing the name of the variable. the check embedded into the config
file thus became this on an amd64 machine:
```
if [ -n "amd64" ]
then
	LB_LINUX_FLAVOURS_WITH_ARCH="amd64"
fi
```
which is clearly not what was intended.

Gbp-Dch: Short
This commit is contained in:
Lyndon Brown 2020-03-28 10:55:25 +00:00 committed by Raphaël Hertzog
parent 3645719f22
commit c57b8679a4
2 changed files with 4 additions and 7 deletions

View File

@ -234,6 +234,10 @@ Prepare_config ()
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES:-debian-archive-keyring}"
# first, handle existing LB_LINUX_FLAVOURS for backwards compatibility
if [ -n "${LB_LINUX_FLAVOURS}" ]; then
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS}"
fi
case "${LB_ARCHITECTURES}" in
arm64)
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH:-arm64}"

View File

@ -1171,13 +1171,6 @@ LB_INTERACTIVE="${LB_INTERACTIVE}"
# \$LB_KEYRING_PACKAGES: set keyring packages
LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES}"
# \$LB_LINUX_FLAVOURS: set kernel flavour to use
# This is kept for backwards compatibility
if [ -n "${LB_LINUX_FLAVOURS}" ]
then
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS}"
fi
# \$LB_LINUX_FLAVOURS_WITH_ARCH: set kernel flavour to use (with arch)
LB_LINUX_FLAVOURS_WITH_ARCH="${LB_LINUX_FLAVOURS_WITH_ARCH}"