Extracting buildtree/specific subdirs from the cache should be done directly

Background

For instance when we import the buildtree directory for the bst build shell in elementy.py, we extract the complete artifact when we only actually require the buildtree.

artifact_base, _ = self.__extract() import_dir = os.path.join(artifact_base, 'buildtree')

A new function such as checkout_artifact_subdir() could be added to artifactcache/cascache.py which takes a subdir string and extracts the related digest instead of the top level content digest could be implemented, and used in other places where we wish to extract a specific directory of an artifact

Task description

  • Implement function to checkout artifact subdirs, utlising existing _get_subdir() & _checkout() to extract exact digest
  • Use in existing scenarios, such as the shell buildtree one mentioned above
  • Test behaves as expected

Acceptance Criteria

Remove instances of checking out a complete artifacts content when only requiring a specific directory.