From 44cb0466c20f081ccfc9d485311d9f62dc2c7f9f Mon Sep 17 00:00:00 2001 From: ruffsl Date: Tue, 27 Sep 2022 15:39:38 +0200 Subject: [PATCH 01/11] Register BaseHandlerExtensionPoint for colcon_cache to colcon_clean so colcon_clean can clean the cache base path --- colcon_cache/base_handler/__init__.py | 0 colcon_cache/base_handler/cache.py | 31 +++++++++++++++++++++++++++ setup.cfg | 2 ++ 3 files changed, 33 insertions(+) create mode 100644 colcon_cache/base_handler/__init__.py create mode 100644 colcon_cache/base_handler/cache.py diff --git a/colcon_cache/base_handler/__init__.py b/colcon_cache/base_handler/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/colcon_cache/base_handler/cache.py b/colcon_cache/base_handler/cache.py new file mode 100644 index 0000000..329c477 --- /dev/null +++ b/colcon_cache/base_handler/cache.py @@ -0,0 +1,31 @@ +# Copyright 2021 Ruffin White +# Licensed under the Apache License, Version 2.0 + +import os + +from colcon_clean.base_handler import BaseHandlerExtensionPoint +from colcon_core.plugin_system import satisfies_version + +BASE_PATH = 'cache' + + +class CacheBaseHandler(BaseHandlerExtensionPoint): + """Determin how cache paths for the workspace should be cleaned.""" + + def __init__(self): # noqa: D107 + super().__init__(BASE_PATH) + satisfies_version( + BaseHandlerExtensionPoint.EXTENSION_POINT_VERSION, '^1.0') + + def add_arguments(self, *, parser): # noqa: D102 + parser.add_argument( + '--cache-base', + default=self.base_path, + help='The base path for all cache directories ' + '(default: {self.base_path})'.format_map(locals())) + + def get_workspace_paths(self, *, args): # noqa: D102 + return [args.cache_base] + + def get_package_paths(self, *, args, pkg): # noqa: D102 + return [os.path.join(args.cache_base, pkg.name)] diff --git a/setup.cfg b/setup.cfg index 584e3d6..12d42b7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -68,6 +68,8 @@ filterwarnings = junit_suite_name = colcon-cache [options.entry_points] +colcon_clean.base_handler = + cache = colcon_cache.base_handler.cache:CacheBaseHandler colcon_core.event_handler = cache_lockfile = colcon_cache.event_handler.lockfile:LockfileEventHandler colcon_core.extension_point = From 5aa9e07ff8b224ca60f7b1045171125ec1908b58 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Thu, 29 Sep 2022 15:56:10 +0200 Subject: [PATCH 02/11] Extend verb handlers to add arguments for specifying a verb's own base path --- colcon_cache/subverb/lock.py | 7 ++----- colcon_cache/verb_handler/__init__.py | 27 ++++++++++++++++++++++++++- colcon_cache/verb_handler/build.py | 10 +++++++++- colcon_cache/verb_handler/cache.py | 10 +++++++++- colcon_cache/verb_handler/list.py | 27 +++++++++++++++++++++++++++ colcon_cache/verb_handler/test.py | 10 +++++++++- setup.cfg | 2 +- 7 files changed, 83 insertions(+), 10 deletions(-) create mode 100644 colcon_cache/verb_handler/list.py diff --git a/colcon_cache/subverb/lock.py b/colcon_cache/subverb/lock.py index 9682b70..ead6960 100644 --- a/colcon_cache/subverb/lock.py +++ b/colcon_cache/subverb/lock.py @@ -8,6 +8,7 @@ from pathlib import Path from colcon_cache.subverb import CacheSubverbExtensionPoint +from colcon_cache.verb_handler import add_verb_handler_arguments from colcon_core.argument_parser.destination_collector \ import DestinationCollectorDecorator from colcon_core.event.job import JobUnselected @@ -71,17 +72,13 @@ def __init__(self): # noqa: D107 CacheSubverbExtensionPoint.EXTENSION_POINT_VERSION, '^1.0') def add_arguments(self, *, parser): # noqa: D102 - parser.add_argument( - '--build-base', - default='build', - help='The base path for all build directories (default: build)') - parser.add_argument( '--ignore-dependencies', action='store_true', help='Ignore dependencies when capturing caches (default: false)') add_executor_arguments(parser) + add_verb_handler_arguments(parser) add_event_handler_arguments(parser) add_packages_arguments(parser) diff --git a/colcon_cache/verb_handler/__init__.py b/colcon_cache/verb_handler/__init__.py index 24b4482..bca0b99 100644 --- a/colcon_cache/verb_handler/__init__.py +++ b/colcon_cache/verb_handler/__init__.py @@ -21,11 +21,22 @@ class VerbHandlerExtensionPoint: """The version of the package selection extension interface.""" EXTENSION_POINT_VERSION = '1.0' - def __init__(self, verb_name, reference_name): # noqa: D107 + def __init__(self, base_path, verb_name, reference_name): # noqa: D107 # TODO: find better alternative than perhaps using params + self.base_path = base_path self.verb_name = verb_name self.reference_name = reference_name + def add_arguments(self, *, parser): + """ + Add command line arguments specific to the workspace base. + + This method must be overridden in a subclass. + + :param parser: The argument parser + """ + raise NotImplementedError() + def get_current_lockfile(self, package_build_base): """ Get current lockfile for verb. @@ -60,6 +71,20 @@ def get_job_lockfile(self, job): return self.get_reference_lockfile(job.task_context.args.build_base) +def add_verb_handler_arguments(parser): + """ + Add the command line arguments for the verb handler extensions. + + :param parser: The argument parser + """ + group = parser.add_argument_group(title='Verb handler arguments') + extensions = get_verb_handler_extensions() + + for key in sorted(extensions.keys()): + extension = extensions[key] + extension.add_arguments(parser=group) + + def get_verb_handler_extensions(): """ Get the available verb handler extensions. diff --git a/colcon_cache/verb_handler/build.py b/colcon_cache/verb_handler/build.py index b2a0c8d..f2aeaaf 100644 --- a/colcon_cache/verb_handler/build.py +++ b/colcon_cache/verb_handler/build.py @@ -4,6 +4,7 @@ from colcon_cache.verb_handler import VerbHandlerExtensionPoint from colcon_core.plugin_system import satisfies_version +BASE_PATH = 'build' VERB_NAME = 'build' REFERENCE_NAME = 'cache' @@ -12,6 +13,13 @@ class BuildVerbHandler(VerbHandlerExtensionPoint): """Determin how lockfiles for the build verb should be handled.""" def __init__(self): # noqa: D107 - super().__init__(VERB_NAME, REFERENCE_NAME) + super().__init__(BASE_PATH, VERB_NAME, REFERENCE_NAME) satisfies_version( VerbHandlerExtensionPoint.EXTENSION_POINT_VERSION, '^1.0') + + def add_arguments(self, *, parser): # noqa: D102 + parser.add_argument( + '--build-base', + default=self.base_path, + help='The base path for all build directories ' + '(default: {self.base_path})'.format_map(locals())) diff --git a/colcon_cache/verb_handler/cache.py b/colcon_cache/verb_handler/cache.py index f45848e..e3b0f75 100644 --- a/colcon_cache/verb_handler/cache.py +++ b/colcon_cache/verb_handler/cache.py @@ -4,6 +4,7 @@ from colcon_cache.verb_handler import VerbHandlerExtensionPoint from colcon_core.plugin_system import satisfies_version +BASE_PATH = 'cache' VERB_NAME = 'cache' REFERENCE_NAME = None @@ -12,10 +13,17 @@ class CacheVerbHandler(VerbHandlerExtensionPoint): """Determin how lockfiles for the cache verb should be handled.""" def __init__(self): # noqa: D107 - super().__init__(VERB_NAME, REFERENCE_NAME) + super().__init__(BASE_PATH, VERB_NAME, REFERENCE_NAME) satisfies_version( VerbHandlerExtensionPoint.EXTENSION_POINT_VERSION, '^1.0') + def add_arguments(self, *, parser): # noqa: D102 + parser.add_argument( + '--cache-base', + default=self.base_path, + help='The base path for all cache directories ' + '(default: {self.base_path})'.format_map(locals())) + def get_reference_lockfile(self, package_build_base): # noqa: D102 return None diff --git a/colcon_cache/verb_handler/list.py b/colcon_cache/verb_handler/list.py new file mode 100644 index 0000000..0135cf2 --- /dev/null +++ b/colcon_cache/verb_handler/list.py @@ -0,0 +1,27 @@ +# Copyright 2021 Ruffin White +# Licensed under the Apache License, Version 2.0 + +from colcon_cache.verb_handler import VerbHandlerExtensionPoint +from colcon_core.plugin_system import satisfies_version + +BASE_PATH = None +VERB_NAME = None +REFERENCE_NAME = None + + +class ListVerbHandler(VerbHandlerExtensionPoint): + """Determin how lockfiles for the list verb should be handled.""" + + def __init__(self): # noqa: D107 + super().__init__(BASE_PATH, VERB_NAME, REFERENCE_NAME) + satisfies_version( + VerbHandlerExtensionPoint.EXTENSION_POINT_VERSION, '^1.0') + + def add_arguments(self, *, parser): # noqa: D102 + pass + + def get_reference_lockfile(self, package_build_base): # noqa: D102 + return None + + def get_job_lockfile(self, job): # noqa: D102 + return None diff --git a/colcon_cache/verb_handler/test.py b/colcon_cache/verb_handler/test.py index f7afe62..d7bdc03 100644 --- a/colcon_cache/verb_handler/test.py +++ b/colcon_cache/verb_handler/test.py @@ -4,6 +4,7 @@ from colcon_cache.verb_handler import VerbHandlerExtensionPoint from colcon_core.plugin_system import satisfies_version +BASE_PATH = 'build' VERB_NAME = 'test' REFERENCE_NAME = 'build' @@ -12,6 +13,13 @@ class TestVerbHandler(VerbHandlerExtensionPoint): """Determin how lockfiles for the test verb should be handled.""" def __init__(self): # noqa: D107 - super().__init__(VERB_NAME, REFERENCE_NAME) + super().__init__(BASE_PATH, VERB_NAME, REFERENCE_NAME) satisfies_version( VerbHandlerExtensionPoint.EXTENSION_POINT_VERSION, '^1.0') + + def add_arguments(self, *, parser): # noqa: D102 + parser.add_argument( + '--test-result-base', + default=self.base_path, + help='The base path for all test_result directories ' + '(default: {self.base_path})'.format_map(locals())) diff --git a/setup.cfg b/setup.cfg index 12d42b7..a965cb7 100644 --- a/setup.cfg +++ b/setup.cfg @@ -93,7 +93,7 @@ colcon_cache.task.lock = colcon_cache.verb_handler = build = colcon_cache.verb_handler.build:BuildVerbHandler cache = colcon_cache.verb_handler.cache:CacheVerbHandler - list = colcon_cache.verb_handler.cache:CacheVerbHandler + list = colcon_cache.verb_handler.list:ListVerbHandler test = colcon_cache.verb_handler.test:TestVerbHandler [flake8] From 054476cd444832ffc4d53331e8d2da86eb5943d1 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Thu, 29 Sep 2022 16:52:39 +0200 Subject: [PATCH 03/11] Migrate verb lockfiles into verb's base path to simplify provenance, ownership, and cleaning of lockfiles saved to disk, by keeping lockfiles closer to the artifacts they reflect. --- colcon_cache/event_handler/__init__.py | 12 +++++------ colcon_cache/package_selection/valid.py | 9 ++------- colcon_cache/verb_handler/__init__.py | 27 ++++++++++++++++++------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/colcon_cache/event_handler/__init__.py b/colcon_cache/event_handler/__init__.py index 698b14b..6f1949e 100644 --- a/colcon_cache/event_handler/__init__.py +++ b/colcon_cache/event_handler/__init__.py @@ -6,16 +6,16 @@ from colcon_cache.cache import get_lockfile_path -def get_previous_lockfile(package_build_base, verb_name): +def get_previous_lockfile(package_base_path, verb_name): """ Get the lockfile of a verb from the package build directory. - :param str package_build_base: The build directory of a package + :param str package_base_path: The build directory of a package :param str verb_name: The invoked verb name :returns: The previously persisted lockfile, otherwise None :rtype: CacheLockfile """ - path = get_lockfile_path(package_build_base, verb_name) + path = get_lockfile_path(package_base_path, verb_name) if not path.exists(): return None lockfile = CacheLockfile() @@ -23,14 +23,14 @@ def get_previous_lockfile(package_build_base, verb_name): return lockfile -def set_lockfile(package_build_base, verb_name, lockfile): +def set_lockfile(package_base_path, verb_name, lockfile): """ Persist the lockfile of a verb in the package build directory. - :param str package_build_base: The build directory of a package + :param str package_base_path: The build directory of a package :param str verb_name: The invoked verb name :param CacheLockfile lockfile: The lockfile of the invocation """ - path = get_lockfile_path(package_build_base, verb_name) + path = get_lockfile_path(package_base_path, verb_name) path.parent.mkdir(parents=True, exist_ok=True) lockfile.dump(path) diff --git a/colcon_cache/package_selection/valid.py b/colcon_cache/package_selection/valid.py index 1f39a64..a16198e 100644 --- a/colcon_cache/package_selection/valid.py +++ b/colcon_cache/package_selection/valid.py @@ -2,8 +2,6 @@ # Copyright 2021 Ruffin White # Licensed under the Apache License, Version 2.0 -import os - from colcon_cache.verb_handler import get_verb_handler_extensions from colcon_core.package_selection import logger from colcon_core.package_selection import PackageSelectionExtensionPoint @@ -76,13 +74,10 @@ def select_packages(self, args, decorators): # noqa: D102 pkg = decorator.descriptor - package_build_base = os.path.join( - args.build_base, pkg.name) - verb_lockfile = verb_handler_extension\ - .get_current_lockfile(package_build_base) + .get_current_lockfile(args, pkg.name) reference_lockfile = verb_handler_extension\ - .get_reference_lockfile(package_build_base) + .get_reference_lockfile(args, pkg.name) reference_name = verb_handler_extension.reference_name package_kind = None diff --git a/colcon_cache/verb_handler/__init__.py b/colcon_cache/verb_handler/__init__.py index bca0b99..513c367 100644 --- a/colcon_cache/verb_handler/__init__.py +++ b/colcon_cache/verb_handler/__init__.py @@ -2,6 +2,8 @@ # Copyright 2021 Ruffin White # Licensed under the Apache License, Version 2.0 +import os + from colcon_cache.event_handler import get_previous_lockfile from colcon_core.plugin_system import instantiate_extensions from colcon_core.plugin_system import order_extensions_by_name @@ -37,27 +39,35 @@ def add_arguments(self, *, parser): """ raise NotImplementedError() - def get_current_lockfile(self, package_build_base): + def get_current_lockfile(self, args, pkg_name): """ Get current lockfile for verb. This method can be overridden in a subclass. - :param package_build_base: Base build path for package + :param args: Args with respective base path + :param pkg_name: Name for package :returns: A lockfile, or None """ - return get_previous_lockfile(package_build_base, self.verb_name) + reference_base_path = getattr(args, self.reference_name + '_base') + package_reference_base = os.path.join(reference_base_path, pkg_name) + return get_previous_lockfile( + package_reference_base, self.verb_name) - def get_reference_lockfile(self, package_build_base): + def get_reference_lockfile(self, args, pkg_name): """ Get reference lockfile for verb. This method can be overridden in a subclass. - :param package_build_base: Base build path for package + :param args: Args with respective base path + :param pkg_name: Name for package :returns: A lockfile, or None """ - return get_previous_lockfile(package_build_base, self.reference_name) + reference_base_path = getattr(args, self.reference_name + '_base') + package_reference_base = os.path.join(reference_base_path, pkg_name) + return get_previous_lockfile( + package_reference_base, self.reference_name) def get_job_lockfile(self, job): """ @@ -68,7 +78,10 @@ def get_job_lockfile(self, job): :param jobs: The job from `event[1]` :returns: A lockfile, or None """ - return self.get_reference_lockfile(job.task_context.args.build_base) + reference_pkg_base_path = getattr( + job.task_context.args, self.reference_name + '_base') + return get_previous_lockfile( + reference_pkg_base_path, self.reference_name) def add_verb_handler_arguments(parser): From bf91bbc49524e80ceeb40a8812984d7c609a4c14 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Thu, 29 Sep 2022 16:52:51 +0200 Subject: [PATCH 04/11] Fix tests --- test/package_selection/test_valid.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/package_selection/test_valid.py b/test/package_selection/test_valid.py index 92a91c8..6880fef 100644 --- a/test/package_selection/test_valid.py +++ b/test/package_selection/test_valid.py @@ -18,11 +18,13 @@ def test_valid(): # TODO: check event log for warning by mocking logger args = Object() + args.packages_select_cache_key = 'cache' args.packages_select_cache_invalid = True args.packages_skip_cache_valid = False valid_package_selection.select_packages(args, decorators) args = Object() + args.packages_select_cache_key = 'cache' args.packages_select_cache_invalid = False args.packages_skip_cache_valid = True valid_package_selection.select_packages(args, decorators) From 0c1f519d18f8702c1f443ee34611f55c063d1216 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Thu, 29 Sep 2022 16:54:19 +0200 Subject: [PATCH 05/11] Remove unwarranted warning --- colcon_cache/package_selection/valid.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/colcon_cache/package_selection/valid.py b/colcon_cache/package_selection/valid.py index a16198e..c65e7a2 100644 --- a/colcon_cache/package_selection/valid.py +++ b/colcon_cache/package_selection/valid.py @@ -43,14 +43,6 @@ def select_packages(self, args, decorators): # noqa: D102 else: assert False - if not hasattr(args, 'build_base'): - logger.warning( - "Ignoring '{argument}' since the invoked verb doesn't have a " - "'--build-base' argument and therefore can't access " - 'information about the relative state of a package' - .format_map(locals())) - return - verb_name = args.packages_select_cache_key if not verb_name: verb_name = args.verb_name From 55609829c5fdd7091d18fdd24d9130e7cf47f976 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 30 Sep 2022 17:21:44 +0200 Subject: [PATCH 06/11] Update call signature --- colcon_cache/verb_handler/cache.py | 2 +- colcon_cache/verb_handler/list.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/colcon_cache/verb_handler/cache.py b/colcon_cache/verb_handler/cache.py index e3b0f75..3716ebc 100644 --- a/colcon_cache/verb_handler/cache.py +++ b/colcon_cache/verb_handler/cache.py @@ -24,7 +24,7 @@ def add_arguments(self, *, parser): # noqa: D102 help='The base path for all cache directories ' '(default: {self.base_path})'.format_map(locals())) - def get_reference_lockfile(self, package_build_base): # noqa: D102 + def get_reference_lockfile(self, args, pkg_name): # noqa: D102 return None def get_job_lockfile(self, job): # noqa: D102 diff --git a/colcon_cache/verb_handler/list.py b/colcon_cache/verb_handler/list.py index 0135cf2..7dabb2b 100644 --- a/colcon_cache/verb_handler/list.py +++ b/colcon_cache/verb_handler/list.py @@ -20,7 +20,7 @@ def __init__(self): # noqa: D107 def add_arguments(self, *, parser): # noqa: D102 pass - def get_reference_lockfile(self, package_build_base): # noqa: D102 + def get_reference_lockfile(self, args, pkg_name): # noqa: D102 return None def get_job_lockfile(self, job): # noqa: D102 From a9d1fd3b0d567aef15d3ada068b7fc1d577fde5a Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 30 Sep 2022 17:25:55 +0200 Subject: [PATCH 07/11] Update taskts --- colcon_cache/task/lock/dirhash.py | 6 +++--- colcon_cache/task/lock/git.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/colcon_cache/task/lock/dirhash.py b/colcon_cache/task/lock/dirhash.py index 3699287..465c2c2 100644 --- a/colcon_cache/task/lock/dirhash.py +++ b/colcon_cache/task/lock/dirhash.py @@ -171,9 +171,9 @@ async def lock(self, *, additional_hooks=None): # noqa: D102 "Capturing dirhash cache of package in '{args.path}'" .format_map(locals())) - cache_base = Path(args.build_base, 'cache') + cache_base = Path(args.cache_base, 'cache') cache_base.mkdir(parents=True, exist_ok=True) - lockfile = get_previous_lockfile(args.build_base, 'cache') + lockfile = get_previous_lockfile(args.cache_base, 'cache') if lockfile is None: lockfile = CacheLockfile(lock_type=ENTRY_TYPE) assert lockfile.lock_type == ENTRY_TYPE @@ -193,7 +193,7 @@ async def lock(self, *, additional_hooks=None): # noqa: D102 lockfile.checksums.current pkg.metadata['lockfile'] = lockfile - set_lockfile(args.build_base, 'cache', lockfile) + set_lockfile(args.cache_base, 'cache', lockfile) return 0 diff --git a/colcon_cache/task/lock/git.py b/colcon_cache/task/lock/git.py index dc52252..4eca2f0 100644 --- a/colcon_cache/task/lock/git.py +++ b/colcon_cache/task/lock/git.py @@ -78,9 +78,9 @@ async def lock(self, *, additional_hooks=None): # noqa: D102 "Capturing git cache of package in '{args.path}'" .format_map(locals())) - cache_base = Path(args.build_base, 'cache') + cache_base = Path(args.cache_base, 'cache') cache_base.mkdir(parents=True, exist_ok=True) - lockfile = get_previous_lockfile(args.build_base, 'cache') + lockfile = get_previous_lockfile(args.cache_base, 'cache') if lockfile is None: lockfile = CacheLockfile(lock_type=ENTRY_TYPE) assert lockfile.lock_type == ENTRY_TYPE @@ -96,7 +96,7 @@ async def lock(self, *, additional_hooks=None): # noqa: D102 self.compute_current_checksums(args, lockfile) pkg.metadata['lockfile'] = lockfile - set_lockfile(args.build_base, 'cache', lockfile) + set_lockfile(args.cache_base, 'cache', lockfile) return 0 From 862a6eea234936bc2e236c9e54e315efee50b998 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 30 Sep 2022 17:26:13 +0200 Subject: [PATCH 08/11] Update comments --- colcon_cache/event_handler/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/colcon_cache/event_handler/__init__.py b/colcon_cache/event_handler/__init__.py index 6f1949e..a8d1c29 100644 --- a/colcon_cache/event_handler/__init__.py +++ b/colcon_cache/event_handler/__init__.py @@ -8,9 +8,9 @@ def get_previous_lockfile(package_base_path, verb_name): """ - Get the lockfile of a verb from the package build directory. + Get the lockfile of a verb from the package base path. - :param str package_base_path: The build directory of a package + :param str package_base_path: The base path of a package :param str verb_name: The invoked verb name :returns: The previously persisted lockfile, otherwise None :rtype: CacheLockfile From 9399c9cefac227beeb6bf8f868b9fe4c687cac63 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 30 Sep 2022 17:27:52 +0200 Subject: [PATCH 09/11] Update arg call signature --- colcon_cache/task/lock/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colcon_cache/task/lock/__init__.py b/colcon_cache/task/lock/__init__.py index 209e2f6..ed13f81 100644 --- a/colcon_cache/task/lock/__init__.py +++ b/colcon_cache/task/lock/__init__.py @@ -17,7 +17,7 @@ def get_dependencies_lockfiles(args, dependencies): # noqa: D103 lockfile = _cached_lockfiles[dep_path] else: lockfile = get_previous_lockfile( - package_build_base=dep_path, + package_base_path=dep_path, verb_name='cache') _cached_lockfiles[dep_path] = lockfile dependencies_checksums[dep_name] = lockfile From 08f7d0e0fe5f40416ead4c1b0a7516263609c87d Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 30 Sep 2022 17:28:29 +0200 Subject: [PATCH 10/11] Update get_lockfile_path signature --- colcon_cache/cache/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/colcon_cache/cache/__init__.py b/colcon_cache/cache/__init__.py index 8009d3f..8af078d 100644 --- a/colcon_cache/cache/__init__.py +++ b/colcon_cache/cache/__init__.py @@ -98,16 +98,16 @@ def dump(self, path): # noqa: D102 sort_keys=True) -def get_lockfile_path(package_build_base, verb_name): +def get_lockfile_path(package_base_path, verb_name): """ Get the lockfile path of a verb from the package build directory. - :param str package_build_base: The build directory of a package + :param str package_base_path: The base path of a package :param str verb_name: The invoked verb name :returns: The path for the lockfile :rtype: Path """ return pathlib.Path( - package_build_base, + package_base_path, 'cache', LOCKFILE_FILENAME.format_map(locals())) From 2bba32a529efdef1828115a5f05a3874feefd584 Mon Sep 17 00:00:00 2001 From: ruffsl Date: Fri, 30 Sep 2022 17:28:59 +0200 Subject: [PATCH 11/11] Update call signature --- colcon_cache/package_selection/modified.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/colcon_cache/package_selection/modified.py b/colcon_cache/package_selection/modified.py index e9bd149..cfcddf8 100644 --- a/colcon_cache/package_selection/modified.py +++ b/colcon_cache/package_selection/modified.py @@ -76,11 +76,8 @@ def select_packages(self, args, decorators): # noqa: D102 pkg = decorator.descriptor - package_build_base = os.path.join( - args.build_base, pkg.name) - verb_lockfile = verb_handler_extension\ - .get_current_lockfile(package_build_base) + .get_current_lockfile(args, pkg.name) package_kind = None if verb_lockfile is None: