On Thu, May 23, 2019 at 09:43:18AM +0200, Olivier Matz wrote:
> - As "readlink -e" and "readlink -m" do not exist on freebsd,
>   use "readlink -f", it should not have any impact in these cases.
> - "sed -ri" is invalid on freebsd and should be replaced by
>   "sed -r -i ''"
> - Use gmake instead of make.
> 
> This fixes the following command:
>   SYSDIR=/usr/src/sys ./devtools/test-build.sh \
>     -j4 x86_64-native-freebsd-gcc
> 
> Signed-off-by: Olivier Matz <olivier.m...@6wind.com>
> ---
>  devtools/check-dup-includes.sh |  2 +-
>  devtools/checkpatches.sh       |  8 ++--
>  devtools/get-maintainer.sh     |  2 +-
>  devtools/load-devel-config     |  4 +-
>  devtools/test-build.sh         | 98 
> +++++++++++++++++++++++-------------------
>  devtools/validate-abi.sh       |  2 +-
>  6 files changed, 62 insertions(+), 54 deletions(-)
> 
<snip>
>  
> +sed_ri () {
> +    sed --version >/dev/null 2>&1 && sed -ri "$@" || sed -r -i "" "$@"
> +}

Two comments here:
1. if being kept, this function needs a comment to explain the how and why
of it. I assume, from testing sed on linux and BSD, that you are taking
advantage of the fact that BSD sed doesn't support "--version" flag and
using that to select which path to take?
2. I'm not sure we really need this, or if so, it possibly can be
shortened. My tests show that using the syntax "i=" works on both OS's,
i.e. sed -ri="" "$@". Given that the only change to existing calls to sed
is the addition of '=""', a whole new function may not be needed.

/Bruce

Reply via email to