Perl-Toolchain-Gang / CPAN-Meta

Specifications for CPAN distribution META files
37 stars 40 forks source link

x_ field for source git commit #133

Open haarg opened 5 years ago

haarg commented 5 years ago

I'd like to start recording the git commit that was used to build a release in an x_ field. I started prototyping this with the field x_built_from_commit. The same field could be used by other SCMs. It might also make sense to record a tag name rather than (or in addition to?) a commit. An example of a use for this would be MetaCPAN being able to link directly to the state of the repo for a given release.

This wouldn't be part of the spec, but does anyone have any thoughts on it?

mohawk2 commented 5 years ago

I like the idea, though I wonder if the name ought to be more like x_vcs_label so it's not git-specific.

karenetheridge commented 5 years ago

I've been marking my releases with the git tag + commit sha via Dist::Zilla::Plugin::Git::Describe for quite some time (it uses git describe --always --long). Including this data into meta doesn't sound bad, but I would (also) want to keep the commit sha right in the code, as that's very helpful later when looking at an installed source tree (when the meta data might no longer be present).

mohawk2 commented 5 years ago

Should the metadata itself get installed? Perhaps in a .meta.json, similar to a .packlist?

Leont commented 5 years ago

Should the metadata itself get installed? Perhaps in a .meta.json, similar to a .packlist?

Actually cpanm already does that (in $archdir/.meta/$full_distname/). It's not standardized though.

haarg commented 5 years ago

I'm currently thinking I'll use x_vcs_commit (from git rev-parse HEAD) and x_vcs_tag (from git describe).