On Sat, Feb 15, 2025 at 12:10:06PM +0100, Stéphane Glondu wrote:
> > I fixed the elpi package by using something a bit hackish: I added git
> > as dep, and if I don't see a .git in the build directory, I create one!
> > 
> > Here is what the execute_before_dh_auto_build target does:
> >          if test -f .git; then \
> >            @echo "Found .git, ok"; \
> >          else \
> >            touch .false_git; \
> >            git init --initial-branch=main; \
> >            git config user.email "f...@bar.baz"; \
> >            git config user.name "Foo Bar"; \
> >            git add dune; \
> >            git commit -m foo; \
> >            git tag -a v$(DEB_VERSION_UPSTREAM) -m foo; \
> >          fi
> > 
> > and here is what the execute_after_dh_auto_clean does:
> >          if test -f .false_git; then \
> >            rm -rf .false_git .git; \
> >          fi
> 
> This is ugliness to paper over ugliness. Please do not!
> 
> My approach to this specific problem would be to add to dune the possibility
> to use some configuration file (or environment variables) as input for the
> substitutions, instead of directly querying the VCS. This configuration
> could then be set up as part of the Debian packaging.

FYI: If all upstream wants is git metadata I like to introduce them to the
wonderful, but obscure, git `export-subst` feature. See git-attributes(1).

Works with forges, git-archive and everything.

Example:
https://github.com/YosysHQ/yosys/commit/222e7a2da345f01980d9261c40c5d50eced4f9ab
thoug this was later improved by others
https://github.com/YosysHQ/yosys/commit/9d15f1d6ac4a9ff2e1f87cda8c366659027fb76f

If that's not enough can you point us to what this upstream is doing exactly?

--Daniel

Attachment: signature.asc
Description: PGP signature

Reply via email to