From d662f2c4c1ec80df628d716168da8e7aa07e701a Mon Sep 17 00:00:00 2001 From: Felix Moessbauer Date: Wed, 15 Jan 2025 13:05:52 +0100 Subject: [PATCH] load external lockfiles also on checkout --update When running the checkout plugin (or any derived plugin) with --update, lockfiles were not considered. This logic ensures that the repos can be updated and later-on be pinned to the new revisions (by updating the lockfiles). However, any external lockfile (from an external repo) should always be loaded, as these are not under our control and we cannot update them. By that, it also makes no sense to move the externally-pinned repos forward as the next kas invocation without --update will bring them back to the pinned state. To fix this, we now always load the lockfiles of external repos (by that, also on --update). Note: This introduces a slight behavior change, but only on executions with --update. Signed-off-by: Felix Moessbauer --- docs/userguide/project-configuration.rst | 5 +++++ kas/includehandler.py | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/userguide/project-configuration.rst b/docs/userguide/project-configuration.rst index f238bab1..55aee86e 100644 --- a/docs/userguide/project-configuration.rst +++ b/docs/userguide/project-configuration.rst @@ -180,6 +180,11 @@ If this is found, kas loads this file right after processing the current one. Note, that this applies to both files on the kas cmdline, as well as included files. +When performing any kas operation with ``--update``, kas will not load the +lockfiles of the local repository. By that, the repos can be checked out to +the latest version and later the lockfiles can be regenerated (e.g. by the +``lock`` plugin). + The following example shows this mechanism for a file ``kas/kas-isar.yml`` and its corresponding lockfile ``kas/kas-isar.lock.yml``. diff --git a/kas/includehandler.py b/kas/includehandler.py index b07b0f76..0ebdd358 100644 --- a/kas/includehandler.py +++ b/kas/includehandler.py @@ -347,7 +347,10 @@ def _internal_dict_merge(dest, upd): config_files = self.config_files if not self.use_lock: - config_files = [x for x in config_files if not x.is_lockfile] + # remove all local lockfiles from the list. + # remote locks cannot be updated, hence keep them + config_files = [x for x in config_files + if x.is_external or not x.is_lockfile] config = functools.reduce(_internal_dict_merge, map(lambda x: x.config, config_files))