install-buildtools: fail if an error occurs
PATCH 1/3 install-buildtools: fail if an error occurs
From: Ross Burton <[email protected]>
Several failure paths were displaying an error message but not returning, so the install process continued and failed further.
Signed-off-by Ross Burton <[email protected]>
--- scripts/install-buildtools | 2 ++ 1 file changed, 2 insertions(+)
scripts/install-buildtools +2 -0
@@ -258,6 +258,7 @@ def main(): else: logger.error("Checksum %s expected. Actual checksum is %s." % (checksum, checksum_value)) + return 1 # Make installer executable logger.info("Making installer executable")
@@ -273,6 +274,7 @@ def main(): ret = subprocess.call("%s -y" % tmpbuildtools, shell=True) if ret != 0: logger.error("Could not run buildtools installer") + return ret # Setup the environment logger.info("Setting up the environment")
Signature · 1 line
2.26.2
PATCH 2/3 install-buildtools: remove hardcoded x86-64 architecture
From: Ross Burton <[email protected]>
Remove all instances of the hardcoded 'x86_64' and replace with the current host platform.
Signed-off-by Ross Burton <[email protected]>
--- scripts/install-buildtools | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
scripts/install-buildtools +10 -8
@@ -35,6 +35,7 @@ import argparse import logging import os +import platform import re import shutil import shlex
@@ -112,6 +113,7 @@ def main(): release = "" buildtools_url = "" install_dir = "" + arch = platform.machine() parser = argparse.ArgumentParser( description="Buildtools installation helper",
@@ -194,19 +196,19 @@ def main(): logger.error("Milestone installers require --build-date") else: if args.with_extended_buildtools: - filename = "x86_64-buildtools-extended-nativesdk-standalone-%s-%s.sh" % ( - args.installer_version, args.build_date) + filename = "%s-buildtools-extended-nativesdk-standalone-%s-%s.sh" % ( + arch, args.installer_version, args.build_date) else: - filename = "x86_64-buildtools-nativesdk-standalone-%s-%s.sh" % ( - args.installer_version, args.build_date) + filename = "%s-buildtools-nativesdk-standalone-%s-%s.sh" % ( + arch, args.installer_version, args.build_date) safe_filename = quote(filename) buildtools_url = "%s/milestones/%s/buildtools/%s" % (base_url, args.release, safe_filename) # regular release SDK else: if args.with_extended_buildtools: - filename = "x86_64-buildtools-extended-nativesdk-standalone-%s.sh" % args.installer_version + filename = "%s-buildtools-extended-nativesdk-standalone-%s.sh" % (arch, args.installer_version) else: - filename = "x86_64-buildtools-nativesdk-standalone-%s.sh" % args.installer_version + filename = "%s-buildtools-nativesdk-standalone-%s.sh" % (arch, args.installer_version) safe_filename = quote(filename) buildtools_url = "%s/%s/buildtools/%s" % (base_url, args.release, safe_filename)
@@ -279,8 +281,8 @@ def main(): # Setup the environment logger.info("Setting up the environment") regex = re.compile(r'^(?P<export>export )?(?P<env_var>[A-Z_]+)=(?P<env_val>.+)$') - with open("%s/environment-setup-x86_64-pokysdk-linux" % - install_dir, 'rb') as f: + with open("%s/environment-setup-%s-pokysdk-linux" % + (install_dir, arch), 'rb') as f: for line in f: match = regex.search(line.decode('utf-8')) logger.debug("export regex: %s" % match)
Signature · 1 line
2.26.2
PATCH 3/3 install-buildtools: add option to disable checksum validation
In reply to Ross BurtonFrom: Ross Burton <[email protected]>
The --check option turns on checksum validation, but it defaults to 'on' so is pointless. Add a corresponding --no-check option to turn off validation.
Signed-off-by Ross Burton <[email protected]>
--- scripts/install-buildtools | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
scripts/install-buildtools +5 -3
@@ -154,9 +154,11 @@ def main(): group.add_argument('--without-extended-buildtools', action='store_false', dest='with_extended_buildtools', help='disable extended buildtools (traditional buildtools tarball)') - parser.add_argument('-c', '--check', help='enable md5 checksum checking', - default=True, - action='store_true') + group = parser.add_mutually_exclusive_group() + group.add_argument('-c', '--check', help='enable checksum validation', + default=True, action='store_true') + group.add_argument('-n', '--no-check', help='disable checksum validation', + dest="check", action='store_false') parser.add_argument('-D', '--debug', help='enable debug output', action='store_true') parser.add_argument('-q', '--quiet', help='print only errors',
Signature · 1 line
2.26.2