From 512e0a74993b9a5c58e11513725d1c96a7063f37 Mon Sep 17 00:00:00 2001 From: Clément Bénier Date: Mon, 1 Oct 2018 17:18:39 +0200 Subject: fix sdks list bug: move rgx into db-dump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SPEC-1777 only match what defines a variable remove set because it adds simple quote with special characters Change-Id: Ib7c13869c9d965c0c0dae1ae69eeeaf446b1ce58 Signed-off-by: Clément Bénier --- scripts/sdks/agl/_env-init.sh | 2 +- scripts/sdks/agl/db-dump | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/sdks/agl/_env-init.sh b/scripts/sdks/agl/_env-init.sh index 9b92d56..9d4b398 100755 --- a/scripts/sdks/agl/_env-init.sh +++ b/scripts/sdks/agl/_env-init.sh @@ -29,4 +29,4 @@ export SDK_ROOT_DIR="$XDT_SDK" export SDK_ENV_SETUP_FILENAME="environment-setup-*" export SDK_DATABASE="http://iot.bzh/download/public/XDS/sdk/sdks_latest.json" -[ "$1" = "-print" ] && ( set -o posix; set | grep '[A-Za-z0-9_]\{1,\}='; ) +[ "$1" = "-print" ] && { env; } \ No newline at end of file diff --git a/scripts/sdks/agl/db-dump b/scripts/sdks/agl/db-dump index ab6cfd4..e7538d7 100755 --- a/scripts/sdks/agl/db-dump +++ b/scripts/sdks/agl/db-dump @@ -25,6 +25,7 @@ import inspect import fnmatch import argparse import subprocess +import re PARSER = argparse.ArgumentParser( description='Lists available and installed SDKs') @@ -48,11 +49,15 @@ ENV = subprocess.check_output( SDK_ROOT_DIR = None for elt in ENV: - k, v = elt.decode().split('=', 1) - if k == 'SDK_ROOT_DIR': - SDK_ROOT_DIR = v.rstrip('/') - elif k == 'SDK_ENV_SETUP_FILENAME': - SDK_ENV_SETUP_FILENAME = v + #only match what defines a variable + z = re.match(r"^(\w+)=([^']*)$", elt.decode()) + if z: + k = z.group(1) + v = z.group(2) + if k == 'SDK_ROOT_DIR': + SDK_ROOT_DIR = v.rstrip('/') + elif k == 'SDK_ENV_SETUP_FILENAME': + SDK_ENV_SETUP_FILENAME = v if SDK_ROOT_DIR is None: logging.error('No SDK_ROOT_DIR environment variable found.') -- cgit 1.2.3-korg