metadata for from-git builds
Open, WishlistPublic


It would be handy to somehow build metadata of from-git builds

  • blocks of each contributing source
    • where they were put in the source tree
    • which VCS type they are from
    • VCS url
    • VCS branch (if applicable?)
    • what the VCS revision was (git hash)

Putting a file into the actual source tarball would be tricky to do architecturally. Putting it in debian/ might be a possibility though.

After some musing and discussion this is the proposed course of action:

  • ECM to get a new module which encapsulates retrieval of git metadata
    • iff git is installed and .git is present the data is fetched through the git cli
    • else if .scm_metadata (or somesuch) is present the data is read from there. this specifically allows a build/distribution scope to resolve the metadata ahead of time and not have to shovel around git. this would also allow tarballs to contain this sort of information, at this time it's unclear if there is a use case for it and it is worth the added complexity of detaching a git tag with the metadata (IOW the file would need to be in the tag, but not actually the running branch)

The module allows developers to pick up the git sha and embed it in the binary somewhere such that it may be used for debugging / bug reporting.

For the purposes of simplicity we'd ignore submodules and the like for the time being. Ultimately source composition through submodules (or in terms of deb packages the packaging+source) are not all that useful in the grand scheme of things. Knowing that a given build was made from git sha 1123abc however is invaluable information when dealing with bug reports on development versions.

With a standardized way of handling data retrieval we are then also able to more conveniently consume the data. Notably KAboutData could be extended to automatically pick up the new metadata. All KDE Software would then get git metadata injected into its about data without any additional work.

Related Objects

sitter created this task.Sep 22 2016, 11:58 AM
johanneszarl added a subscriber: johanneszarl.EditedSep 22 2016, 12:30 PM

Putting it into debian/, and having debian/rules make it available to the actual build system in a suitable form would certainly work for my usecase (version information for the kphotoalbum build system).

The last (annotated) tag would also be handy information to have (git describe --abbrev=0).

Edit: The format should be easily consumable from a shell script or makefile, so better not too fancy...

Considering T3719 it may be best to simply --depth=1 and retain the .git directory altogether. Otherwise to implement that task we'd have to do client-side cloning.

@johanneszarl do you really need the tag or could you simply use a shortref of HEAD?

Tag would be nice, but implementing a fallback to the shortref is ok for me. The important part is to identify the exact commit to branch master...

sitter triaged this task as Wishlist priority.Apr 24 2019, 3:18 PM
sitter updated the task description. (Show Details)
sitter moved this task from Backlog to Discussing on the Neon board.