IntersectMBO / cardano-base

Code used throughout the Cardano eco-system
Apache License 2.0
95 stars 41 forks source link

Fix gitRev TH splice #467

Closed erikd closed 7 months ago

erikd commented 7 months ago

Previously we had a TH quotation calling a TH splce, but that meant that the TH splice was, under certain circumstances, being cached in the object file in ~/.cabal/store.

Solution is to only use one level of TH, so the splice is only evaluated once.

erikd commented 7 months ago

Not correct yet, so converting to a draft.

As an SRP in cardano-cli:

> cabal run -- cardano-cli --version
cardano-cli 8.20.3.0 - linux-x86_64 - ghc-9.8
git rev d0438e30ef79ec32649ba2399e900bc28f42bedd

> find . -type f -name cardano-cli
./dist-newstyle/build/x86_64-linux/ghc-9.8.2/cardano-cli-8.20.3.0/x/cardano-cli/build/cardano-cli/cardano-cli

> cd ..

> cardano-cli/./dist-newstyle/build/x86_64-linux/ghc-9.8.2/cardano-cli-8.20.3.0/x/cardano-cli/build/cardano-cli/cardano-cli --version
WARNING: fatal: Needed a single revision

cardano-cli 8.20.3.0 - linux-x86_64 - ghc-9.8
git rev 0000000000000000000000000000000000000000

This means the runGitRevParse is being run when the cardano-cli executable is being run, rather than when it is being compiled.

erikd commented 7 months ago

Just tested this in the cardano-cli repo and it works correctly.