Add edit-cache command to inspect and modify local cache
This edit-cache
command is meant to be used during development to ease and speed up testing and figuring out issues.
The key idea is to have an inspector and modifier of cookbook's status that pickle
serializes/deserializes to/from both for build-tools.cache
and linux_x86_64.cache
(on Linux).
For maintainability it uses introspection to analyze the attributes of the RecipeStatus
class, providing arguments to modify each of its members.
Usage:
usage: cerbero-uninstalled edit-cache [-h] [--bootstrap]
[--steps [STEPS [STEPS ...]]]
[--needs_build NEEDS_BUILD] [--mtime MTIME]
[--file_path FILE_PATH]
[--built_version BUILT_VERSION]
[--file_hash FILE_HASH] [--touch]
[recipe [recipe ...]]
positional arguments:
recipe Recipe to work with
optional arguments:
-h, --help show this help message and exit
--bootstrap Use bootstrap's cache file
--steps [STEPS [STEPS ...]]
Modify steps
--needs_build NEEDS_BUILD
Modify needs_build
--mtime MTIME Modify mtime
--file_path FILE_PATH
Modify file_path
--built_version BUILT_VERSION
Modify built_version
--file_hash FILE_HASH
Modify file_hash
--touch Touch recipe modifying its mtime
e.g. inspecting a recipe's status
./cerbero-uninstalled -t edit-cache libffi
0:00:00.001577 Loading default configuration from /home/pablo/.cerbero/cerbero.cbc
0:00:00.267447 Showing cache values for recipes: libffi
[libffi]
steps: ['fetch', 'extract', 'configure', 'compile', 'install', 'post_install'], needs_build: False, mtime: 1573815322.381322, filepath: '/home/pablo/Fluendo/fluendo-cerbero/cerbero/recipes/libffi.recipe', built_version: '3.2.9999+git~369ef49f71186fc9d6ab15614488ad466fac3fc1', file_hash: '80cd4a1c0feb7da8eab4862c30642b21'
e.g. modifying a recipe's status
./cerbero-uninstalled -t edit-cache libffi --needs_build True --steps fetch extract
0:00:00.001619 Loading default configuration from /home/pablo/.cerbero/cerbero.cbc
0:00:00.253475 Modifying cache values for recipes: libffi
[libffi]
Before
steps: ['fetch', 'extract', 'configure', 'compile', 'install', 'post_install'], needs_build: False, mtime: 1573815322.381322, filepath: '/home/pablo/Fluendo/fluendo-cerbero/cerbero/recipes/libffi.recipe', built_version: '3.2.9999+git~369ef49f71186fc9d6ab15614488ad466fac3fc1', file_hash: '80cd4a1c0feb7da8eab4862c30642b21'
After
steps: ['fetch', 'extract'], needs_build: True, mtime: 1573815322.381322, filepath: '/home/pablo/Fluendo/fluendo-cerbero/cerbero/recipes/libffi.recipe', built_version: '3.2.9999+git~369ef49f71186fc9d6ab15614488ad466fac3fc1', file_hash: '80cd4a1c0feb7da8eab4862c30642b21'
Edited by Pablo Marcos Oltra