openthread / ot-br-posix

OpenThread Border Router, a Thread border router for POSIX-based platforms.
https://openthread.io/
BSD 3-Clause "New" or "Revised" License
420 stars 235 forks source link

New with() implementation breaks .deb cross compilation #303

Closed pszkotak closed 5 years ago

pszkotak commented 5 years ago

Current ot-br-posix is not generating a correct .deb package in our build environment. We have noticed that it happens because some files (e.g. for dhcpcd and tayga) are not present or available only in a default version. It seems that flags used with the with() or without() functions (e.g.with NAT64) are not interpreted correctly. We have observed that the following change effectively reverting the change made in #270 fixes the build for us:

index 59995ce..35a64d3 100644
--- a/script/_initrc
+++ b/script/_initrc
@@ -63,9 +63,7 @@ with()

     VALUE=$(printenv "$1")
     if test -z "$VALUE"; then
-        if test -f examples/platforms/$PLATFORM/default; then
-            VALUE="$(. examples/platforms/$PLATFORM/default && eval echo "\$$1")"
-        fi
+        eval VALUE="\$$1"
     fi

     test "$VALUE" = 1

Did anyone else encountered any issues with it?

Expected behavior Proper dhcpcd config is installed when the DHCPV6_PD is set.

bukepo commented 5 years ago

The intention of with() or without() is to allow environment variables override the default values. For example, the default value on ubuntu DHCPV6_PD=0, user can enable this by:

export DHCPV6_PD=1

How do you set DHCPV6_PD?

pszkotak commented 5 years ago

Thank you for a quick response. This can be an issue. We do not export it. The check-scripts approach has been taken instead. So we add appropriate flags in some places, like raspbian/default. Same flags are also added in _initrc during the build as a patch.

All of it worked fine till the change of the with() implementation mentioned above. I agree that going with the export is cleaner. We will try to switch to this method before the next image generation. If you do not have anything else to add here, I'm OK to close this issue.

jwhui commented 5 years ago

Closing stale issue.