Commit Graph

27 Commits

Author SHA1 Message Date
Ulf Magnusson 0d8495c756 zephyr_env.sh: Remove semicolons at ends of lines
Not needed in sh.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-10 14:34:46 -08:00
Ulf Magnusson 0194d04c49 zephyr-env.sh: Use lowercase for internal vars
ci: run_ci: Use lowercase for internal variables

This makes it possible to tell at a glance which variables are internal
to the script and which ones are parameters to it, which is very
helpful.

This convention is pretty common. See e.g. Google's shell style guide at
https://google.github.io/styleguide/shell.xml#Naming_Conventions, and
https://github.com/icy/bash-coding-style#naming-and-styles. It's older
than those though.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-12-10 14:34:46 -08:00
Hosun Zhu b479e914f8 zephyr-env.sh: reduce posixargzero side effects.
For example, when using zsh p9k theme will cause
some problems that affect the experience.

Fixes #20284.

Signed-off-by: Hosun Zhu <hosun@linux.com>
2019-11-11 10:31:19 +01:00
Christopher Métrailler 46da745ed8 env: ignore unset var
This will substitute the ZSH_VERSION in case it was unset or null. No
more error message will be printed when unset variables are treat as an
error.

Signed-off-by: Christopher Métrailler <christopher.metrailler@nordicsemi.no>
2019-05-20 09:26:31 -04:00
Linden Krouse 7ab2827035 shell: Piped output of cd to /dev/null when setting ZEPHYR_BASE.
Solves an issue where any output from the user's shell's cd command
would be prepended to ZEPHYR_BASE when sourcing zephyr_env.sh.
Fixes #11894.

Signed-off-by: Linden Krouse <ztaticnull@gmail.com>
2018-12-06 19:14:50 -05:00
Carles Cufi 4e5757d2cc env: Remove usage of -P in grep
Since -P is not supported in non-GNU versions of grep, avoid using it
now that it is no longer required (no "|" operator anymore inside the
regex).

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-07-15 11:12:35 -07:00
Carles Cufi d464929d2d build: Treat MSYS2 build as a UNIX build
Since MSYS2 provides a UNIX-like environment, treating it as a Windows
build caused issues with the paths.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-05-19 16:12:05 -04:00
Marti Bolivar 5f95120779 zephyr-env.sh: only reset scripts_path on Windows
The pipeline that converts scripts_path from "C:\" style to "/c/"
style is only needed on Windows. Further, on Linux, it prepends an
extra "/" to what gets added to PATH, since the pwd output already has
a leading "/".

Fix that by only making the change when we're building on Windows.

Change-Id: Ied7e4491f171d82e8dee4c3a4dfdcf64adf46efd
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-31 15:42:31 -04:00
Marti Bolivar bfda8a966a zephyr-env.sh: unset PWD_OPT after using it
Change-Id: I9d78983233097c725869c4467a20189e2b859bab
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-31 15:19:07 -04:00
Marti Bolivar e3a31263ce zephyr-env.sh: fix stale comment
s/zephyr-env_install.bash/.zephyrrc/

Change-Id: I88d4a5d44b6fb97d52b8244cb3d1bcb8679b49ef
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-31 15:08:33 -04:00
Carles Cufi 1436e44aa6 build: Add support for MSYS2
MSYS2 is a modern fork of Cygwin that is widely supported
and provides frequent releases and good support. It is
also the framework used by the official Windows Git port.
This patch adds MSYS2 support so that builds on Windows using
MSYS2 work properly.

Change-Id: Ia5743a410d1cff983a7aab37f8e3d8228cb8ae8e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-03-17 17:34:56 +01:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Inaky Perez-Gonzalez 62ebe7200e zephyr-env: don't fail unnecesarily when 'set -e'
The way the PATH modification bit was set was failing unnecesarily
when the shell is being ran with -e (fail on error), which is leading
to unnecessary (and dangerous) workarounds in integration scripts.

So wrap it in an if sentence, so the shell doesn't bail out when the
grep fails to find the scripts_path in PATH.

Change-Id: Ia88a5f430e08ef4c186d11834f4cd840ccd29f7f
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-01-07 02:40:04 +00:00
Sonia Leon Bautista e4db6c7af5 win-build: corrects scripts_path for windows build.
Corrects the format for scripts_path from C:/ to /c/ to be added to
PATH correctly.

Change-Id: I2668dff2b9b6f20a25651f629c7a134e9426ee97
Signed-off-by: Sonia Leon Bautista <sonia.leon.bautista@intel.com>
2016-10-15 15:09:54 +00:00
Andrew Boie 5cc0322c45 zephyr-env.sh: prepend to PATH
Currently, if you source this in one Zephyr tree and then
source it again in a second copy, the PATH will still
prefer tools and scripts the first Zephyr tree.

Change-Id: I658231025b155d19a2bffa25b8062be7ccd06da4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-08-05 20:38:08 +00:00
d0u9 6cd159674a zephyr-env.sh: Add a note to indicate the required version of zsh
For zsh users, to successfully source this environment set up script,
the version of zsh need to be 5.0.6 or above. Users can download the
newest zsh at http://zsh.sourceforge.net/Arc/source.html, and then
install it manually.

Change-Id: I1877b4030cf8688bce6b2483c302f957f4a5506f
Signed-off-by: d0u9 <d0u9.su@outlook.com>
2016-03-18 22:01:19 +00:00
Yannis Damigos ea3b5d356c zephyr-env.sh: Set correctly $ZEPHYR_BASE in zsh
Sourcing project environment file failed to set correctly
$ZEPHYR_BASE in zsh if it was sourced from another directory
(e.g. home directory). This patch fixes this issue.

It was tested on zsh, bash and sh on Linux.
It needs to be tested on OS X.

Change-Id: Idfb11c6a3109042a9f578f38b3849d9cf9c31f95
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-03 14:53:40 +00:00
Yannis Damigos 3e3e297719 zephyr-env.sh: Fixed sourcing the project environment file
In zsh the value of $0 depends on the FUNCTION_ARGZERO option
which is set by default. FUNCTION_ARGZERO, when it is set, sets
$0 temporarily to the name of the function/script when executing
a shell function or sourcing a script. POSIX_ARGZERO option,
when it is set, exposes the original value of $0 in spite of the
current FUNCTION_ARGZERO setting.

This patch allows to source the project environment file from
both zsh and bash. It also removes the -z option from the
basename command which is missing in OS X.

Change-Id: I5a32404784d9064bf749fa58b4d73d4b56c908c2
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-03-02 12:32:58 +00:00
Benjamin Walsh fb61bd4d5d add missing license to zephyr-env.sh
Change-Id: I0a43e634534ee1cb43c6ad2dc966d9ee20e0b9e5
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-03-01 16:52:57 +00:00
Yannis Damigos 72d498c3a4 zephyr-env.sh: Fixed sourcing the project environment file from zsh
It will possible to source the project environment file from
both zsh and bash.

Change-Id: Ib6cbf4259378433bcf28a042898b69bb4b6b2a82
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-02-27 10:15:14 +00:00
Anas Nashif 3096b54257 Use .zephyrrc for initializing common variables
The file can be used to define variables used by the SDK to avoid
having to define them everytime a session is started.

The old file names ~/zephyr-env_install.bash will still work but
it will warn about the file being renamed. We do not want to break
users who have ~/zephyr-env_install.bash in their home and depend on
it.

Change-Id: I04fcaa76854bda3dcfc1cabe75e00e95c511b10d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-17 13:42:25 +00:00
Juan Manuel Cruz 8dad8eeffa build: changes order in which paths are added to $PATH
MinGW expects to have new program locations added to
the end of the PATH variable.

Change-Id: Ifd31b63c9ef39a7f2b416ffef39461290c822dd7
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-12 03:04:13 +00:00
Louise Mendoza c1510f53dc mingw: Use windows path style when building with MinGW
When building with MinGW the base path has to be with the windows style
format path.

Change-Id: I67c116c424e6ad70cc0e1a4fc1620361eaabbb82
Signed-off-by: Louise Mendoza <yonattan.a.louise.mendoza@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:16 -05:00
Matthew Braun 2ae5784f9e Make zephyr-env.sh work when cd is aliased
Force the zephyr-env.sh script to invoke the builtin 'cd' command so
that the script correctly assigns ZEPHYR_BASE, even for users who
alias the 'cd' command.

Aliasing 'cd' to emit a string before changing the directory is one
way of putting the current working directory in the title of a
terminal window. If the user's alias is executed in zephyr-env.sh, the
output of 'cd' pollutes ZEPHYR_BASE, resulting in value which won't
build.

Signed-off-by: Matt Braun <matthew.braun@intel.com>
Change-Id: I8d7810d1a44ec14102d07bf35610b47d06ac1015
2016-02-05 20:24:36 -05:00
Anas Nashif ac47c45ca0 Rename Zephyr OS into Zephyr Kernel
We are a kernel, not an OS.

Change-Id: Ib987e3e511e1bdbed6293ab5e15e598bff00b09b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:26 -05:00
Benjamin Walsh d7b4bb6235 env: fix check for sourcing vs running zephyr-env.sh
File name had wrong extension.

Change-Id: I9b8f57d21b2a497bf53e159a62dfee24a4c5de21
Reported-by: Rick Demers <richard.demers@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:14:22 -05:00
Anas Nashif e2ae670982 Rename timo-env.sh to zephyr-env.sh
Change-Id: I50dfa427f87c1f2a90facf54ef3b58cd4c47a0ec
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:16 -05:00