meta-phosphor: bmcweb: Fix FULL_OPTIMIZATION assignment for bmcweb-src
Currently the bmcweb recipe fails to generate a `bmcweb-src` package.
Instead it produces the following note:
```
log.do_package_write_ipk.422011:NOTE: Not creating empty archive for bmcweb-src-1.0+git0+92527103d9-r0
```
This shouldn't be the case as `bmcweb` generally is built from source
files. It would be strange for nothing to consume 7GiB of my laptop's
RAM while compiling.
Anyway, through a chain of variable assignments involving
`FULL_OPTIMIZATION`, the entirety of `CFLAGS` amounts to `-Os` due to
the fixed assignment currently used in the recipe.
By `bitbake -e bmcweb`:
# $CFLAGS [3 operations]
# exported /home/andrew/src/openbmc/openbmc/meta/conf/bitbake.conf:608
# [export] "1"
# set /home/andrew/src/openbmc/openbmc/meta/conf/bitbake.conf:608
# "${TARGET_CFLAGS}"
# set /home/andrew/src/openbmc/openbmc/meta/conf/documentation.conf:109
# [doc] "Flags passed to the C compiler for the target system. This variable
# evaluates to the same as TARGET_CFLAGS."
# pre-expansion value:
# "${TARGET_CFLAGS}"
export CFLAGS=" -Os "
...
# $TARGET_CFLAGS [2 operations]
# set /home/andrew/src/openbmc/openbmc/meta/conf/bitbake.conf:609
# "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
# set /home/andrew/src/openbmc/openbmc/meta/conf/documentation.conf:419
# [doc] "Flags passed to the C compiler for the target system. This variable evaluates to the same as CFLAGS."
# pre-expansion value:
# "${TARGET_CPPFLAGS} ${SELECTED_OPTIMIZATION}"
TARGET_CFLAGS=" -Os "
...
# $TARGET_CPPFLAGS
# set /home/andrew/src/openbmc/openbmc/meta/conf/bitbake.conf:604
# ""
TARGET_CPPFLAGS=""
...
# $SELECTED_OPTIMIZATION [3 operations]
# set /home/andrew/src/openbmc/openbmc/meta/conf/bitbake.conf:662
# "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
# append /home/andrew/src/openbmc/openbmc/meta/conf/bitbake.conf:663
# [vardeps] "FULL_OPTIMIZATION DEBUG_OPTIMIZATION DEBUG_BUILD"
# set /home/andrew/src/openbmc/openbmc/meta/conf/documentation.conf:378
# [doc] "The variable takes the value of FULL_OPTIMIZATION unless DEBUG_BUILD = '1'. In this case, the value of DEBUG_OPTIMIZATION is used."
# pre-expansion value:
# "${@d.getVar(oe.utils.vartrue('DEBUG_BUILD', 'DEBUG_OPTIMIZATION', 'FULL_OPTIMIZATION', d))}"
SELECTED_OPTIMIZATION="-Os "
# $FULL_OPTIMIZATION [3 operations]
# set /home/andrew/src/openbmc/openbmc/meta/conf/bitbake.conf:660
# "-O2 -pipe ${DEBUG_FLAGS}"
# set /home/andrew/src/openbmc/openbmc/meta/conf/documentation.conf:182
# [doc] "The options to pass in TARGET_CFLAGS and CFLAGS when compiling an optimized system. This variable defaults to '-O2 -pipe ${DEBUG_FLAGS}'."
# set /home/andrew/src/openbmc/openbmc/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb:62
# "-Os "
# pre-expansion value:
# "-Os "
FULL_OPTIMIZATION="-Os "
The fixed assignment to `FULL_OPTIMIZATION` drops `${DEBUG_FLAGS}`,
which defines the debug prefix mappings. After the patch `CFLAGS`
becomes:
```
$ bitbake -e bmcweb > bmcweb.fixed.env
$ ( source <(grep 'export CFLAGS=' bmcweb.fixed.env); echo $CFLAGS | tr ' ' '\n' )
-O2
-pipe
-g
-feliminate-unused-debug-types
-fmacro-prefix-map=/home/andrew/src/openbmc/openbmc/build/p10bmc/tmp/work/armv7ahf-vfpv4d16-openbmc-linux-gnueabi/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0/git=/usr/src/debug/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0
-fdebug-prefix-map=/home/andrew/src/openbmc/openbmc/build/p10bmc/tmp/work/armv7ahf-vfpv4d16-openbmc-linux-gnueabi/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0/git=/usr/src/debug/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0
-fmacro-prefix-map=/home/andrew/src/openbmc/openbmc/build/p10bmc/tmp/work/armv7ahf-vfpv4d16-openbmc-linux-gnueabi/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0/build=/usr/src/debug/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0
-fdebug-prefix-map=/home/andrew/src/openbmc/openbmc/build/p10bmc/tmp/work/armv7ahf-vfpv4d16-openbmc-linux-gnueabi/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0/build=/usr/src/debug/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0
-fdebug-prefix-map=/home/andrew/src/openbmc/openbmc/build/p10bmc/tmp/work/armv7ahf-vfpv4d16-openbmc-linux-gnueabi/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0/recipe-sysroot=
-fmacro-prefix-map=/home/andrew/src/openbmc/openbmc/build/p10bmc/tmp/work/armv7ahf-vfpv4d16-openbmc-linux-gnueabi/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0/recipe-sysroot=
-fdebug-prefix-map=/home/andrew/src/openbmc/openbmc/build/p10bmc/tmp/work/armv7ahf-vfpv4d16-openbmc-linux-gnueabi/bmcweb/1.0+gitAUTOINC+7d243eb7d1-r0/recipe-sysroot-native=
-Os
```
Long story short, this allows the machinery in `copydebugsources()` from
`poky/meta/classes-global/package.bbclass` to do its job of filtering
the debug source file list and copy the results to
`${WORKSPACE}/package-split/bmcweb-src`. With those files in place,
`do_package_write_ipk` has a non-empty source tree to build into the
`bmcweb-src` package.
Fixes: 2c2a1c5ed539 ("Add bmcweb target to S2600Wf")
Change-Id: I5fb42ce70cc1d344b5e61ccde761515a8bab54bd
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb b/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb
index de34f77..35bd5b2 100644
--- a/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb
+++ b/meta-phosphor/recipes-phosphor/interfaces/bmcweb_git.bb
@@ -49,4 +49,4 @@
USERADD_PARAM:${PN} = "-r -s /sbin/nologin bmcweb"
GROUPADD_PARAM:${PN} = "web; redfish"
-FULL_OPTIMIZATION = "-Os "
+FULL_OPTIMIZATION:append = " -Os"