[CDRIVER-4809] Add a default VERSION_CURRENT file to source Created: 04/Jan/24  Updated: 25/Jan/24  Resolved: 25/Jan/24

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.26.0, 1.25.5

Type: Improvement Priority: Unknown
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CDRIVER-4767 Please provide a usable archive Investigating

 Description   

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.

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.


 Comments   
Comment by Githook User [ 25/Jan/24 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CDRIVER-4809 add a `VERSION_CURRENT` file (#1521)
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/880241c8f4c2e3134ba5bfffbc141ee3757a1c8d

Generated at Wed Feb 07 21:22:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.