Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix static builds lacking git info #10693

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,11 @@ jobs:
apk add bash curl sudo jq pkgconfig \
zlib-dev zlib-static binutils-gold curl \
gcc g++ gmp-dev libc-dev libffi-dev make \
musl-dev ncurses-dev perl tar xz
musl-dev ncurses-dev perl tar xz git

# Apparently there's some permissions thing inside vs. outside the container
# that Alpine's git doesn't like. Hack around it.
- run: git config --global --add safe.directory $(pwd)

- uses: actions/checkout@v4

Expand Down
18 changes: 10 additions & 8 deletions Cabal/src/Distribution/Simple/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -311,16 +311,18 @@ cabalVersion = mkVersion [3,0] --used when bootstrapping

-- |
-- `Cabal` Git information. Only filled in if built in a Git tree in
-- developmnent mode and Template Haskell is available.
-- development mode and Template Haskell is available.
cabalGitInfo :: String
#ifdef GIT_REV
cabalGitInfo = concat [ "(commit "
, giHash'
, branchInfo
, ", "
, either (const "") giCommitDate gi'
, ")"
]
cabalGitInfo = if giHash' == ""
then ""
else concat [ "(commit "
, giHash'
, branchInfo
, ", "
, either (const "") giCommitDate gi'
, ")"
]
where
gi' = $$tGitInfoCwdTry
giHash' = take 7 . either (const "") giHash $ gi'
Expand Down
16 changes: 9 additions & 7 deletions cabal-install/src/Distribution/Client/Version.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@ cabalInstallVersion = mkVersion' PackageInfo.version
-- developmnent mode and Template Haskell is available.
cabalInstallGitInfo :: String
#ifdef GIT_REV
cabalInstallGitInfo = concat [ "(commit "
, giHash'
, branchInfo
, ", "
, either (const "") giCommitDate gi'
, ")"
]
cabalInstallGitInfo = if giHash' == ""
then ""
else concat [ "(commit "
, giHash'
, branchInfo
, ", "
, either (const "") giCommitDate gi'
, ")"
]
where
gi' = $$tGitInfoCwdTry
giHash' = take 7 . either (const "") giHash $ gi'
Expand Down
Loading