mpickering / eventlog2html

Visualise eventlog events as a static webpage
Other
69 stars 16 forks source link

Add -v / --version option to command line #160

Closed BinderDavid closed 1 year ago

BinderDavid commented 1 year ago

Hacking at Munihac I noticed that we embed the version of eventlog2html in the html, but there is no command line option to query eventlog2html for its version.

The --version option also includes the git commit and git branch from which it was built. This presupposes that a .git folder is available at build time. If it isn't (e.g. we are building from hackage), then this information is omitted.

Example output with git information

> cabal run eventlog2html -- --version
eventlog2html Version: 0.9.2
Git Commit:            ce528531cb9342d75a471eeb00d38e34fe43bf0e
Git Branch:            add-version-parser

Example output without git information

> cabal run eventlog2html -- --version
eventlog2html Version: 0.9.2
BinderDavid commented 1 year ago

I guess I still have to fix some .nix file somewhere... I will try to fix it myself first.

BinderDavid commented 1 year ago

Ok, I need some pointer on which files to touch. I can run the nix command from CI locally:

nix-build -A site --arg ci true -o site --option trusted-public-keys "mpickering.cachix.org-1:COxPsDJqqrggZgvKG6JeH9baHPue8/pcpYkmcBPUbeg= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= iohk.cachix.org-1:DpRUyj7h7V830dp/i6Nti+NEO2/nhblbov/8MW7Rqoo= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" --option substituters "https://hydra.iohk.io https://iohk.cachix.org https://cache.nixos.org/ https://mpickering.cachix.org"

And I get the same problem as in CI:

Setup: Encountered missing or private dependencies:
githash >=0.1.6.2 && <0.1.7

error: builder for '/nix/store/5dw4bg4igvwd7jdcax9iy71m3cd5qw94-eventlog2html-exe-eventlog2html-0.9.0.drv' failed with exit code 1;
       last 10 log lines:
       > patching sources
       > configuring
       > Configure flags:
       > --prefix=/nix/store/b6cvzzvi0907jcsxh2lds199z45wjznc-eventlog2html-exe-eventlog2html-0.9.0 exe:eventlog2html --package-db=clear --package-db=/nix/store/68di70d2vz137wizkqw0v5xinypv99d9-eventlog2html-exe-eventlog2html-0.9.0-config/lib/ghc-8.10.2/package.conf.d --exact-configuration --dependency=eventlog2html=eventlog2html-0.9.2-IGyy1GEZQY93capfBPMVt5 --dependency=aeson=aeson-1.5.6.0-HdV32lUxMXZDtcu3YQe3jE --dependency=rts=rts --dependency=ghc-heap=ghc-heap-8.10.2 --dependency=ghc-prim=ghc-prim-0.6.1 --dependency=integer-gmp=integer-gmp-1.0.3.0 --dependency=base=base-4.14.1.0 --dependency=deepseq=deepseq-1.4.4.0 --dependency=array=array-0.5.4.0 --dependency=ghc-boot-th=ghc-boot-th-8.10.2 --dependency=pretty=pretty-1.1.3.6 --dependency=template-haskell=template-haskell-2.16.0.0 --dependency=ghc-boot=ghc-boot-8.10.2 --dependency=ghc=ghc-8.10.2 --dependency=Cabal=Cabal-3.2.0.0 --dependency=array=array-0.5.4.0 --dependency=binary=binary-0.8.8.0 --dependency=bytestring=bytestring-0.10.10.0 --dependency=containers=containers-0.6.2.1 --dependency=directory=directory-1.3.6.0 --dependency=filepath=filepath-1.4.2.1 --dependency=ghc-boot=ghc-boot-8.10.2 --dependency=ghc-compact=ghc-compact-0.1.0.0 --dependency=ghc-prim=ghc-prim-0.6.1 --dependency=hpc=hpc-0.6.1.0 --dependency=mtl=mtl-2.2.2 --dependency=parsec=parsec-3.1.14.0 --dependency=process=process-1.6.9.0 --dependency=text=text-1.2.3.2 --dependency=time=time-1.9.3 --dependency=transformers=transformers-0.5.6.2 --dependency=unix=unix-2.7.2.2 --dependency=xhtml=xhtml-3000.2.2.1 --dependency=terminfo=terminfo-0.4.1.4 --with-ghc=ghc --with-ghc-pkg=ghc-pkg --with-hsc2hs=hsc2hs --with-gcc=cc --with-ld=ld.gold --ghc-option=-optl-fuse-ld=gold --ld-option=-fuse-ld=gold --with-ar=ar --with-strip=strip --disable-executable-stripping --disable-library-stripping --disable-library-profiling --disable-executable-profiling --enable-static --enable-shared --disable-coverage --enable-library-for-ghci --enable-split-sections --ghc-option=-Werror

So I know I need to make the nix configuration aware of the new githash dependency, but I don't know where to add this, i.e. which file to touch.

mpickering commented 1 year ago

Thanks, I merged this and fixed CI.