[riot-notifications] [RIOT-OS/RIOT] dist/tools/buildsystem_sanity_check: add an export variable check (#11484)

Juan I Carrano notifications at github.com
Fri May 3 15:19:02 CEST 2019


jcarrano requested changes on this pull request.



> @@ -41,11 +41,39 @@ check_not_parsing_features() {
     git -C "${RIOTBASE}" grep "${patterns[@]}" -- "${pathspec[@]}"
 }
 
+# Some variables do not need to be exported and even cause issues when being
+# exported because they are evaluated even when not needed.
+#
+# Currently this blacklists exported variables instead of whitelisting or
+# providing a mechanism for handling it.
+# It just keep things not exported anymore in the future.
+UNEXPORTED_VARIABLES=()
+UNEXPORTED_VARIABLES+=('FLASHFILE')
+UNEXPORTED_VARIABLES+=('TERMPROG' 'TERMFLAGS')
+check_not_exporting_variables() {
+    local patterns=()
+    local pathspec=()
+
+    for variable in "${UNEXPORTED_VARIABLES[@]}"; do
+        patterns+=(-e "export ${variable}")

```suggestion
        patterns+=(-e "export[[:blank:]]\+${variable}")
```

> +UNEXPORTED_VARIABLES+=('TERMPROG' 'TERMFLAGS')
+check_not_exporting_variables() {
+    local patterns=()
+    local pathspec=()
+
+    for variable in "${UNEXPORTED_VARIABLES[@]}"; do
+        patterns+=(-e "export ${variable}")
+    done
+
+    pathspec+=('*')
+
+    # Ignore `makefiles/vars.inc.mk` as it currently is the only place that
+    # should export common variables.
+    pathspec+=(':!makefiles/vars.inc.mk')
+
+    git -C "${RIOTBASE}" grep "${patterns[@]}" -- "${pathspec[@]}"

```suggestion
    (set -x; git -C "${RIOTBASE}" grep "${patterns[@]}" -- "${pathspec[@]}")
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11484#pullrequestreview-233461204
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190503/c986185c/attachment-0001.html>


More information about the notifications mailing list