diff options
author | Ben Gamari <ben@smart-cactus.org> | 2023-01-25 16:31:40 -0500 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2023-02-01 13:18:47 +0000 |
commit | fc117e3d0d5c0d8ccd22ea36aeb7a0af774e49d4 (patch) | |
tree | 1eab40902b514938c48466d2135d761cc83fda7a | |
parent | 2efb886cdedb44f05e2854aafd24808d199d7ff1 (diff) | |
download | haskell-fc117e3d0d5c0d8ccd22ea36aeb7a0af774e49d4.tar.gz |
configure: Always create the VERSION file
Teach the `configure` script to create the `VERSION` file.
This will serve as the stable interface to allow the user to determine
the version number of a working tree.
Fixes #22322.
(cherry picked from commit a2d814dc84dbdcdb6c1e274b8bd7c212cc98c39e)
-rw-r--r-- | .gitlab-ci.yml | 4 | ||||
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | hadrian/src/Rules/SourceDist.hs | 4 |
3 files changed, 4 insertions, 7 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ad56fc123..ba338a8ff2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -948,9 +948,6 @@ pages: ############################################################# -# TODO: MP: This way of determining the project version is sadly very slow. -# It seems overkill to have to setup a complete environment, and build hadrian to get -# it to generate a single file containing the version information. project-version: stage: packaging image: "registry.gitlab.haskell.org/ghc/ci-images/x86_64-linux-deb10:$DOCKER_REV" @@ -963,7 +960,6 @@ project-version: - sudo chown ghc:ghc -R . - .gitlab/ci.sh setup - .gitlab/ci.sh configure - - .gitlab/ci.sh run_hadrian VERSION - echo "ProjectVersion=$(cat VERSION)" > version.sh needs: [] diff --git a/configure.ac b/configure.ac index 5fce0924a0..d6a3dba531 100644 --- a/configure.ac +++ b/configure.ac @@ -1214,6 +1214,9 @@ AC_CONFIG_FILES( distrib/configure.ac ]) +dnl Create the VERSION file, satisfying #22322. +printf "$ProjectVersion" > VERSION + AC_OUTPUT [ if test "$print_make_warning" = "true"; then diff --git a/hadrian/src/Rules/SourceDist.hs b/hadrian/src/Rules/SourceDist.hs index 598b6fdcc9..c1edb2b1e0 100644 --- a/hadrian/src/Rules/SourceDist.hs +++ b/hadrian/src/Rules/SourceDist.hs @@ -29,8 +29,6 @@ sourceDistRules = alternatives $ do archiveSourceTree prepareTree "GIT_COMMIT_ID" %> \fname -> writeFileChanged fname =<< setting ProjectGitCommitId - "VERSION" %> \fname -> - writeFileChanged fname =<< setting ProjectVersion -- Rules to download mingw tarballs let mingw_tarballs_stamp = "ghc-tarballs/mingw-w64/.mingw-w64.download.stamp" @@ -120,7 +118,7 @@ prepareTree dest = do out <- askWithResources [] (target (vanillaContext Stage1 compiler) (Git ListFiles) [] []) top <- topDirectory let files = ["GIT_COMMIT_ID", "VERSION"] ++ getFiles out - need ["GIT_COMMIT_ID", "VERSION"] + need ["GIT_COMMIT_ID"] forM_ files $ \source -> do let target = dest -/- source copyFileSourceDist (top -/- source) target |