-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
Proposal
Add a VERSION_CURRENT file to the source, to serve as the default version when a version cannot be computed.
Update the release process to update VERSION_CURRENT when tagging and on the subsequent commits.
Background & Motivation
The version is required to build the C driver. The C driver build attempts to compute the version and stores in a file named VERSION_CURRENT.
The version is computed with calc_release_version.py. calc_release_version_selftest.sh includes expected outputs.
On a tagged commit, calc_release_version.py prints the tag:
% git checkout 1.25.4 --quiet % python ./build/calc_release_version.py 1.25.4
On an untagged commit, calc_release_version.py includes the date and git hash:
% git checkout 38f80af2b97a849f75a79e9f390b385b6bf1cb42 % python ./build/calc_release_version.py 1.26.0-20240104+git38f80af2b9
Running calc_release_version.py requires Python be available and compatible.
CDRIVER-4759andCDRIVER-4603resolved incompatibilities with Python 3.12CDRIVER-4422resolved an incompatibility with older versions of git
Running calc_release_version.py requires the git history be available. The git history is not available if using a shallow clone:
% git clone git@github.com:mongodb/mongo-c-driver.git --depth=1 % cd mongo-c-driver % python ./build/calc_release_version.py 0.0.0
or downloading the release tarball from GitHub:
% wget https://github.com/mongodb/mongo-c-driver/archive/refs/tags/1.25.4.tar.gz
% tar -xf 1.25.4.tar.gz
% cd mongo-c-driver-1.25.4
% python ./build/calc_release_version.py
0.0.0
This comment notes difficulties encountered building after the source archive was removed in favor of a regular Git archive in CDRIVER-4640. The source archive previously contained a VERSION_CURRENT file.
Updating the release process
Adding VERSION_CURRENT to the source contradicts the motivation of CDRIVER-2831 (Migrate to dynamic VERSION_CURRENT). I expect adding a VERSION_CURRENT to the source will require additional release steps. I think that is a worthwhile cost to simplify the build for consumers.
Extra care may be needed to ensure the VERSION_CURRENT is updated on the master branch and a release branch when releasing.
The C driver release process is "branch-then-tag".
Here is a possible set of steps for updating VERSION_CURRENT on a minor release. This example uses 1.26.0 as the minor release:
- Check out the new release branch r1.26. Update VERSION_CURRENT to 1.26.0. Tag the commit with 1.26.0. Make a subsequent commit on r1.26 to set VERSION_CURRENT to 1.26.1-pre (the next patch release).
- Check out the master branch. Update VERSION_CURRENT to 1.27.0-pre (the next minor release).
Here is a possible set of steps for updating VERSION_CURRENT on a patch release. This example uses 1.26.1 as the minor release:
- Check out the existing release branch r1.26. Update VERSION_CURRENT to 1.26.1. Tag the commit with 1.26.1. Make a subsequent commit on r1.26 to set VERSION_CURRENT to 1.26.2-pre (the next patch release).
- Do not update VERSION_CURRENT on the master branch.
- is related to
-
CDRIVER-4767 Please provide a usable archive
- Closed