|
| 1 | +Update a bundled C library submodule to a new version and apply all required changes. |
| 2 | + |
| 3 | +Arguments: `$ARGUMENTS` — `libmongoc <version>` or `libmongocrypt <version>`, e.g. `libmongocrypt 1.17.3` |
| 4 | + |
| 5 | +Current state: |
| 6 | +- libmongoc: !`cat src/libmongoc/VERSION_CURRENT 2>/dev/null || echo "(unknown)"` |
| 7 | +- libmongocrypt: !`cat src/LIBMONGOCRYPT_VERSION_CURRENT 2>/dev/null || echo "(unknown)"` |
| 8 | + |
| 9 | +## Steps to perform |
| 10 | + |
| 11 | +### 1. Update the submodule pointer |
| 12 | + |
| 13 | +Fetch tags and checkout the requested version tag: |
| 14 | + |
| 15 | +```bash |
| 16 | +git -C src/<submodule> fetch --tags |
| 17 | +git -C src/<submodule> checkout <version> |
| 18 | +``` |
| 19 | + |
| 20 | +Verify with `git submodule status src/<submodule>`. |
| 21 | + |
| 22 | +### 2. Regenerate source lists |
| 23 | + |
| 24 | +```bash |
| 25 | +php scripts/update-submodule-sources.php |
| 26 | +``` |
| 27 | + |
| 28 | +This updates `config.m4` and `config.w32` with the current list of C source files. |
| 29 | + |
| 30 | +### 3. Update pkg-config version requirements in config.m4 |
| 31 | + |
| 32 | +Read `config.m4` and update the minimum version in the `PKG_CHECK_MODULES` call(s): |
| 33 | + |
| 34 | +- **libmongoc**: update `bson2 >= X.Y.Z` and `mongoc2 >= X.Y.Z` |
| 35 | +- **libmongocrypt**: update `libmongocrypt >= X.Y.Z` |
| 36 | + |
| 37 | +Also update the corresponding `AC_MSG_ERROR` messages. |
| 38 | + |
| 39 | +### 4. Update LIBMONGOCRYPT_VERSION_CURRENT (libmongocrypt only) |
| 40 | + |
| 41 | +For libmongocrypt updates, update `src/LIBMONGOCRYPT_VERSION_CURRENT` with the new version string. |
| 42 | + |
| 43 | +### 5. Update the SBOM |
| 44 | + |
| 45 | +The SBOM requires Docker. Start colima if not running: |
| 46 | + |
| 47 | +```bash |
| 48 | +colima status 2>/dev/null | grep -q "Running" || colima start |
| 49 | +``` |
| 50 | + |
| 51 | +Then generate the updated SBOM: |
| 52 | + |
| 53 | +```bash |
| 54 | +bash scripts/update-sbom.sh |
| 55 | +``` |
| 56 | + |
| 57 | +This updates `sbom.json` using the versions in `src/libmongoc/VERSION_CURRENT` and `src/LIBMONGOCRYPT_VERSION_CURRENT`. |
| 58 | + |
| 59 | +### 6. Commit |
| 60 | + |
| 61 | +Stage and commit all changed files: |
| 62 | + |
| 63 | +- `src/<submodule>` (submodule pointer) |
| 64 | +- `config.m4` (source lists + version requirements) |
| 65 | +- `config.w32` (source lists, if changed) |
| 66 | +- `src/LIBMONGOCRYPT_VERSION_CURRENT` (libmongocrypt only) |
| 67 | +- `sbom.json` |
| 68 | + |
| 69 | +Commit message: `PHPC-XXXX Upgrade <submodule> to <version>` |
0 commit comments