Include git commit hash in version information for builds in local workspace

Aperta Adatta ai principianti
#4,753 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #4754 di @sebastien-rosset — chiusa senza merge

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
70/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
c, cmake
Ambito
build-system

Direzione di ricerca

Inizia da CMakeLists.txt e individua la condizione OCPN_CI_BUILD che racchiude la chiamata COMMIT. Sposta l’invocazione COMMIT fuori da questa condizione, in modo che l’hash del commit Git sia incluso in VERSION_FULL per tutte le build. Compila localmente e conferma che il log di avvio visualizzi una stringa di versione come 5.13.0+d540994ec.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

Is your feature request related to a problem? Please describe.
When working with local workspace builds of OpenCPN, the startup log only shows the base version number (e.g., "5.13.0"), making it difficult to identify which specific commit was used to build the binary. This is especially problematic when debugging issues or comparing different builds, as the version alone is ambiguous.

In this context, "Local workspace build" means following the build instructions at https://opencpn-manuals.github.io/main/opencpn-dev/linux.html, https://opencpn-manuals.github.io/main/opencpn-dev/windows.html, etc.

Describe the solution you'd like
Include the git commit hash in the VERSION_FULL macro for all builds, not just CI builds. The startup log should display something like "OpenCPN version 5.13.0+d540994ec restarted at [date]" instead of just "OpenCPN version 5.13.0 restarted at [date]". This would provide clear identification of the exact source code used for any build.

Describe alternatives you've considered
When other people test a build in a specific fork or branch, ask them to run the "git log -1 --format=%h" command to double check they have the right commit (current workaround, but relies on manual verification)

Additional context
The current CMakeLists.txt only includes the git commit hash when OCPN_CI_BUILD is enabled. The proposed change would move the commit_id (COMMIT) call outside the CI build conditional, ensuring all builds include this information while maintaining backward compatibility with existing CI build logic.

Lingua principale
C
Stelle
1.5k
Fork
627
Merge medio
1g 9m
PR unite (30g)
9

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di OpenCPN/OpenCPN

Tutte le issue di OpenCPN/OpenCPN

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.