* [PATCH 1/3] install-buildtools: remove md5 checksum validation
2024-06-11 9:25 [PATCH 0/3] Improve the install-buildtools script Aleksandar Nikolic
@ 2024-06-11 9:25 ` Aleksandar Nikolic
2024-06-11 9:25 ` [PATCH 2/3] install-buildtools: fix "test installation" step Aleksandar Nikolic
2024-06-11 9:25 ` [PATCH 3/3] install-buildtools: update base-url, release and installer version Aleksandar Nikolic
2 siblings, 0 replies; 4+ messages in thread
From: Aleksandar Nikolic @ 2024-06-11 9:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Aleksandar Nikolic
From: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
No need to validate with the md5 checksum, as the file is not even
uploaded to the Yocto release webpage (the download never failed due
to a wrong indentation of an else statement). For validation purposes,
use the sha256 checksum only.
Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
---
scripts/install-buildtools | 27 ++++++++++-----------------
1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/scripts/install-buildtools b/scripts/install-buildtools
index 2218f3ffac..a34474ea84 100755
--- a/scripts/install-buildtools
+++ b/scripts/install-buildtools
@@ -238,19 +238,15 @@ def main():
# Verify checksum
if args.check:
logger.info("Fetching buildtools installer checksum")
- checksum_type = ""
- for checksum_type in ["md5sum", "sha256sum"]:
- check_url = "{}.{}".format(buildtools_url, checksum_type)
- checksum_filename = "{}.{}".format(filename, checksum_type)
- tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename)
- ret = subprocess.call("wget -q -O %s %s" %
- (tmpbuildtools_checksum, check_url), shell=True)
- if ret == 0:
- break
- else:
- if ret != 0:
- logger.error("Could not download file from %s" % check_url)
- return ret
+ checksum_type = "sha256sum"
+ check_url = "{}.{}".format(buildtools_url, checksum_type)
+ checksum_filename = "{}.{}".format(filename, checksum_type)
+ tmpbuildtools_checksum = os.path.join(tmpsdk_dir, checksum_filename)
+ ret = subprocess.call("wget -q -O %s %s" %
+ (tmpbuildtools_checksum, check_url), shell=True)
+ if ret != 0:
+ logger.error("Could not download file from %s" % check_url)
+ return ret
regex = re.compile(r"^(?P<checksum>[0-9a-f]+)\s+(?P<path>.*/)?(?P<filename>.*)$")
with open(tmpbuildtools_checksum, 'rb') as f:
original = f.read()
@@ -263,10 +259,7 @@ def main():
logger.error("Filename does not match name in checksum")
return 1
checksum = m.group('checksum')
- if checksum_type == "md5sum":
- checksum_value = md5_file(tmpbuildtools)
- else:
- checksum_value = sha256_file(tmpbuildtools)
+ checksum_value = sha256_file(tmpbuildtools)
if checksum == checksum_value:
logger.info("Checksum success")
else:
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 2/3] install-buildtools: fix "test installation" step
2024-06-11 9:25 [PATCH 0/3] Improve the install-buildtools script Aleksandar Nikolic
2024-06-11 9:25 ` [PATCH 1/3] install-buildtools: remove md5 checksum validation Aleksandar Nikolic
@ 2024-06-11 9:25 ` Aleksandar Nikolic
2024-06-11 9:25 ` [PATCH 3/3] install-buildtools: update base-url, release and installer version Aleksandar Nikolic
2 siblings, 0 replies; 4+ messages in thread
From: Aleksandar Nikolic @ 2024-06-11 9:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Aleksandar Nikolic
From: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
The "Test installation" step fails with some harmless error messages
(see [1]). This can however make a user think that the buildtools
have not been installed correctly.
Two reasons for the error messages:
- some envvars in the environment-setup-<arch>-pokysdk-linux file
start and end with double quotes (e.g., PATH) and are as such
written into python os.environ. This leads that their usage is
not valid later when testing the installation. This patch removes
the double quotes before writing, if they are present.
- if installation directory (install_dir), given through the option
--directory, is given as a relative path, checking if the path to
a tool (e.g., gcc) in buildtools starts it will always fail. This
patch converts the install_dir variable to an absolute path.
[1]
ERROR: Something went wrong: tar not found in ./build-tools
ERROR: Something went wrong: installation failed
Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
---
scripts/install-buildtools | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/scripts/install-buildtools b/scripts/install-buildtools
index a34474ea84..4f85fe87d4 100755
--- a/scripts/install-buildtools
+++ b/scripts/install-buildtools
@@ -102,6 +102,16 @@ def sha256_file(filename):
import hashlib
return _hasher(hashlib.sha256(), filename)
+def remove_quotes(var):
+ """
+ If a variable starts and ends with double quotes, remove them.
+ Assumption: if a variable starts with double quotes, it must also
+ end with them.
+ """
+ if var[0] == '"':
+ var = var[1:-1]
+ return var
+
def main():
global DEFAULT_INSTALL_DIR
@@ -273,7 +283,7 @@ def main():
os.chmod(tmpbuildtools, st.st_mode | stat.S_IEXEC)
logger.debug(os.stat(tmpbuildtools))
if args.directory:
- install_dir = args.directory
+ install_dir = os.path.abspath(args.directory)
ret = subprocess.call("%s -d %s -y" %
(tmpbuildtools, install_dir), shell=True)
else:
@@ -294,7 +304,7 @@ def main():
if match:
env_var = match.group('env_var')
logger.debug("env_var: %s" % env_var)
- env_val = match.group('env_val')
+ env_val = remove_quotes(match.group('env_val'))
logger.debug("env_val: %s" % env_val)
os.environ[env_var] = env_val
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH 3/3] install-buildtools: update base-url, release and installer version
2024-06-11 9:25 [PATCH 0/3] Improve the install-buildtools script Aleksandar Nikolic
2024-06-11 9:25 ` [PATCH 1/3] install-buildtools: remove md5 checksum validation Aleksandar Nikolic
2024-06-11 9:25 ` [PATCH 2/3] install-buildtools: fix "test installation" step Aleksandar Nikolic
@ 2024-06-11 9:25 ` Aleksandar Nikolic
2 siblings, 0 replies; 4+ messages in thread
From: Aleksandar Nikolic @ 2024-06-11 9:25 UTC (permalink / raw)
To: openembedded-core; +Cc: Aleksandar Nikolic
From: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
Update the following default values:
- DEFAULT_BASE_URL (https instead of http)
- DEFAULT_RELEASE (5.0.1)
- DEFAULT_INSTALLER_VERSION (5.0.1)
Signed-off-by: Aleksandar Nikolic <aleksandar.nikolic@zeiss.com>
---
scripts/install-buildtools | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/install-buildtools b/scripts/install-buildtools
index 4f85fe87d4..5b86c13077 100755
--- a/scripts/install-buildtools
+++ b/scripts/install-buildtools
@@ -56,9 +56,9 @@ PROGNAME = 'install-buildtools'
logger = scriptutils.logger_create(PROGNAME, stream=sys.stdout)
DEFAULT_INSTALL_DIR = os.path.join(os.path.split(scripts_path)[0],'buildtools')
-DEFAULT_BASE_URL = 'http://downloads.yoctoproject.org/releases/yocto'
-DEFAULT_RELEASE = 'yocto-4.1'
-DEFAULT_INSTALLER_VERSION = '4.1'
+DEFAULT_BASE_URL = 'https://downloads.yoctoproject.org/releases/yocto'
+DEFAULT_RELEASE = 'yocto-5.0.1'
+DEFAULT_INSTALLER_VERSION = '5.0.1'
DEFAULT_BUILDDATE = '202110XX'
# Python version sanity check
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread