[CDRIVER-3410] Fix homebrew formula for --HEAD Created: 24/Oct/19  Updated: 28/Oct/23  Resolved: 09/Dec/19

Status: Closed
Project: C Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: 1.16.0

Type: Bug Priority: Major - P3
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-3457 cmake should error if calc_release_ve... Backlog
is related to CDRIVER-3458 cmake should check for VERSION_CURREN... Backlog

 Description   

Installing libmongoc latest (passing --HEAD) from homebrew results in an installation where the reported version is 0.0.0.

Not being able to calculate a build version should be an error in cmake (unless explicitly passing -DBUILD_VERSION). Perhaps something is going awry with calc_release_version.py.



 Comments   
Comment by Kevin Albertson [ 08/Dec/19 ]

After investigating, calc_release_version.py computes a version 0.0.0 because of how homebrew clones the repo when building. This is not an issue for installing the latest release through homebrew, as that fetches our released source which contains a VERSION_CURRENT file.

Homebrew by default does a shallow clone of depth 1 of the latest commit. This can be turned off by passing :shallow => false, but this does not resolve the issue. Even if doing a deep clone, homebrew only copies the git refs heads/master and origin/master (see here) instead of the git clone default heads/* and origin/*.

I submitted a PR to specify the development version using -DBUILD_VERSION if installing from --HEAD. An alternative solution, though more complicated, may be to create a custom download strategy to clone the git history and refs. It's also worth noting, that since homebrew caches the cloned source, the computed VERSION_CURRENT seems to persist in the cache (for me, that directory is /Users/kevinalbertson/Library/Caches/Homebrew/mongo-c-driver--git). So if we were to apply this alternative fix, we'd need to keep in mind that users who may have already attempted installing could still get 0.0.0 from the cached VERSION_CURRENT file unless they first clear the cache.

Comment by Kevin Albertson [ 08/Dec/19 ]

PR to homebrew-core: https://github.com/Homebrew/homebrew-core/pull/47617

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