@@ -182,63 +182,72 @@ a 1.23.1 tag also existed at the time. The bump to libmongoc 1.23.1 was left to
182182another PHPC ticket in the 1.15.0 milestone, which actually depended on the
183183libmongoc changes therein.
184184
185- ### Updating libmongoc and libbson
185+ ### Updating bundled libraries
186186
187- #### Update libmongoc submodule
187+ The following steps are the same for libmongoc and libmongocrypt. When updating
188+ libmongocrypt, follow the same steps but replace ` libmongoc ` with
189+ ` libmongocrypt ` , retaining the same capitalization. The following examples
190+ always refer to libmongoc.
188191
189- ```
190- $ cd src/libmongoc
191- $ git fetch
192- $ git checkout 1.20.0
192+ #### Update submodule
193+
194+ ``` shell
195+ cd src/libmongoc
196+ git fetch
197+ git checkout 1.20.0
193198```
194199
195- During development, it may be necessary to temporarily point the libmongoc
196- submodule to a commit on the developer's fork of libmongoc. For instance, the
197- developer may be working on a PHP driver feature that depends on an unmerged
198- pull request to libmongoc. In this case, ` git remote add ` can be used to add
199- the fork before fetching and checking out the target commit. Additionally, the
200- submodule path in
201- [ ` .gitmodules ` ] ( https://github.com/mongodb/mongo-php-driver/blob/master/.gitmodules )
202- must also be updated to refer to the fork.
200+ During development, it may be necessary to temporarily point the submodule to a
201+ commit on the developer's fork. For instance, the developer may be working on a
202+ PHP driver feature that depends on unmerged or unreleased changes. In this case,
203+ the submodule path can be updated using the ` git submodules set-url ` command can
204+ be used to change the URL, and ` git submodules set-branch ` can be used to point
205+ the submodule to a development branch:
203206
204- #### Ensure libmongoc version information is correct
207+ ``` shell
208+ git submodules set-url src/libmongoc https://github.com/< owner> /< repo> .git
209+ git submodules set-branch -b < branch> src/libmongoc
210+ ```
205211
206- The build process for Autotools and Windows rely on
207- ` src/LIBMONGOC_VERSION_CURRENT ` to infer version information for libmongoc and
208- libbson. This file can be regenerated using the following Makefile target:
212+ #### Ensure version information is correct
209213
210- ```
211- $ make libmongoc-version-current
214+ Various build processes and tools rely on the version files to infer version
215+ information. This file can be regenerated using Makefile targets:
216+
217+ ``` shell
218+ make libmongoc-version-current
212219```
213220
214- Alternatively, the ` build/calc_release_version.py ` script in libmongoc can be
215- executed directly.
221+ Alternatively, the ` build/calc_release_version.py ` script in the submodule can
222+ be executed directly.
216223
217- Note: If the libmongoc submodule points to a non-release, non-master branch, the
218- script may fail to correctly detect the version. This issue is being tracked in
219- [ CDRIVER-3315] ( https://jira.mongodb.org/browse/CDRIVER-3315 ) and can be safely
220- ignored since this should only happen during development (any PHP driver release
221- should point to a tagged libmongoc release ).
224+ Note: If the submodule points to a non-release, non-master branch, the script
225+ may fail to correctly detect the version. This issue is being tracked in
226+ [ CDRIVER-3315] ( https://jira.mongodb.org/browse/CDRIVER-3315 ) and can be safely ignored since this should only happen
227+ during development (any PHP driver release should point to a tagged submodule
228+ version ).
222229
223230#### Update sources in build configurations
224231
225232The Autotools and Windows build configurations (` config.m4 ` and ` config.w32 ` ,
226233respectively) define several variables (e.g. ` PHP_MONGODB_MONGOC_SOURCES ` ) that
227- collectively enumerate all of the the sources within the libmongoc submodule to
228- include in a bundled build.
234+ collectively enumerate all of the sources within the submodules to include in a
235+ bundled build.
229236
230237These variables should each have a shell command in a preceding comment, which
231238should be run to regenerate that particular list of source files. Each command
232239may be run manually or ` scripts/update-submodule-sources.php ` may be used to
233- update all variables. In the event that either libmongoc or libbson introduce a
234- new source directory, that will need to be manually added (follow prior art) .
240+ update all variables. In the event that a new source directory is introduced,
241+ this directory will need to be manually added following prior art.
235242
236243#### Update package dependencies
237244
238245The Autotools configuration additionally includes some ` pkg-config ` commands for
239- using libmongoc and libbson as system libraries (in lieu of a bundled build).
240- When bumping the libmongoc version, be sure to update the version check _ and_
241- error message in the ` pkg-config ` blocks for both libmongoc and libbson.
246+ using libmongoc, libbson, and libmongocrypt as system libraries (in lieu of a
247+ bundled build). When bumping the bundled version, be sure to update the version
248+ check _ and_ error message in the ` pkg-config ` blocks for the submodule being
249+ updated. When updating libmongoc, be sure to update both version checks for
250+ libmongoc and libbson.
242251
243252For example, the following lines might be updated for libmongoc:
244253
@@ -250,7 +259,7 @@ if $PKG_CONFIG libmongoc-1.0 --atleast-version 1.20.0; then
250259AC_MSG_ERROR(system libmongoc must be upgraded to version >= 1.20.0)
251260```
252261
253- #### Update tested versions in Evergreen configuration
262+ #### Update tested versions in Evergreen configuration (libmongoc only)
254263
255264Evergreen tests against multiple versions of libmongoc. When updating to a newer
256265libmongoc version, make sure to update the libmongoc build tasks in ` .evergreen/config/templates/build/build-libmongoc.yml `
@@ -264,32 +273,30 @@ against two additional versions of libmongoc:
264273
265274#### Update sources in PECL package generation script
266275
267- If either libmongoc or libbson introduce a new source directory, that may also
276+ If a new version of a submodule introduces a new source directory, that may also
268277require updating the glob patterns in the ` bin/prep-release.php ` script to
269278ensure new source files will be included in any generated PECL package.
270279
271- #### Test and commit your changes
280+ #### Update SBOM file
272281
273- Verify that the upgrade was successful by ensuring that the driver can compile
274- using both the bundled sources and system libraries for libmongoc and libbson,
275- and by ensuring that the test suite passes. Once done, commit the changes to all
276- of the above files/paths. For example:
282+ After updating dependencies, the SBOM file needs to be updated. There is a
283+ script to automate this process:
277284
278- ```
279- $ git commit -m "Bump libmongoc to 1.20.0" config.m4 config.w32 src/libmongoc src/LIBMONGOC_VERSION_CURRENT
285+ ``` shell
286+ ./scripts/update-sbom.sh
280287```
281288
282- ### Updating libmongocrypt
289+ This script will generate a temporary purl file with our dependencies, then run
290+ the internal silkbomb tool to update the SBOM. Note that you need to have docker
291+ installed in order to run this.
283292
284- To update libmongocrypt, the steps are similar to the above:
293+ #### Test and commit your changes
285294
286- ```
287- $ cd src/libmongocrypt
288- $ git fetch
289- $ git checkout 1.3.0
290- $ make libmongocrypt-version-current
291- ```
295+ Verify that the upgrade was successful by ensuring that the driver can compile
296+ using both the bundled sources and system libraries, and by ensuring that the
297+ test suite passes. Once done, commit the changes to all of the above
298+ files/paths. For example:
292299
293- Package dependencies in ` config.m4 ` must also be updated (either manually or
294- with ` scripts/update-submodule-sources.php ` ), as do the sources in the PECL
295- generation script.
300+ ``` shell
301+ git commit -m " Bump libmongoc to 1.20.0 " config.m4 config.w32 src/libmongoc src/LIBMONGOC_VERSION_CURRENT sbom.json
302+ ```
0 commit comments