On 16/04/2020 16:22, Mike Kelsey wrote:
Kenneth Hoste writes:
The git_config mechanism is not really intended to be accessed directly
from easyblocks, but I see no problem in doing so (it's a stable
feature, and the API from the point of view of an easyblock won't be
changed imho).
In the EasyBlock class, the git_config dict is only used to obtain the
source tarball, but the "parsed" data in it is not retained in the
EasyBlock class itself.
You can still access it from an easyblock though, just like you can any
easyconfig parameter, in this case via "self.cfg['sources']", which will
give you the (raw) contents of the 'sources' easyconfig parameter (a
list, where one of the items is a dict that has 'git_config' as a key).
Ah, ha! self.cfg is where all the entries from the EasyConfig get stored?
Okay, that makes it easy...
So, assuming there's only one source: self.cfg['sources'][0]['git_config'] .
Got it. For a package-specific EasyBlock, this is a reasonable assumption
... and I just tried it; thank you!
The problem I'm trying to solve is that we have several packages in our
collaboration's software that make use of "git describe" during the build.
This is so that we can collect provenance information during the data
processing, and keep track of which versions of which packages were used, as
part of the data store.
As near as I can tell, when "build from Git sources" is used, the actual
cloned repository is never available, just the tarball created from it. Is
that true? Or is there a way to specify the git-clone directory as being
the Source directory, instead of creating then expanding a tarball?
In EasyBuild v4.2.0 we added support to retain the .git subdirectory, by
enabling 'keep_git_dir' in the git_config dict.
We've updated the documentation to mention that just now, see
https://easybuild.readthedocs.io/en/latest/Writing_easyconfig_files.html#common-easyconfig-param-sources-git-config
.
regards,
Kenneth
-- Mike