I have found a patch we want to apply
Let's pretend we want to add this patch (this can also be seen in github, which is a mirror of opendev.org):
https://opendev.org/openstack/puppet-nova/commit/da99cfcbd531cca42be22765c021bd744e974e8d
into the puppet-module-nova package, in the victoria branch, so we can add the service_type directive in the [keystone_authtoken]/service_type directive of nova.conf with puppet. Here's how to do that.
Searching for the patch in review.opendev.org
First, go to:
https://review.opendev.org/ with your web browser. In the search box, enter the Change-Id as per the commit message of the above patch. This will lead you to this page: https://review.opendev.org/q/I2ed8dfabd6e99c468456cca960996d9adc3b8f9c
In the "Branch" column on the right, one of the 2 patches shows stable/victoria. Click on that patch. This leads to this commit review page: https://review.opendev.org/c/openstack/puppet-nova/+/798768
Downloading the patch and adding it to debian/patches
On the right, there's a "Download" link. Click on it (or press the letter "d" on your keyboard, which does the same). This opens a dialog box for downloading the patch. On the bottom left, there's a link to the base64 version of the patch. Copy this link, and wget the patch:
wget "https://review.opendev.org/changes/openstack%2Fpuppet-nova~798768/revisions/2/patch?download" -O Add_support_for_the_keystone_authtoken_service_type_parameter.patch.base64
un-base64 the patch, and add it to the existing patch queue:
mkdir -p debian/patches base64 -d Add_support_for_the_keystone_authtoken_service_type_parameter.patch.base64 >debian/patches/Add_support_for_the_keystone_authtoken_service_type_parameter.patch echo "Add_support_for_the_keystone_authtoken_service_type_parameter.patch" >>debian/patches/series rm Add_support_for_the_keystone_authtoken_service_type_parameter.patch.base64
Editing the patch header
Edit the patch so that the patch header looks nicer:
Description: Add support for the keystone_authtoken/service_type parameter Author: Takashi Kajinami <tkajinam@redhat.com> Date: Sun, 11 Oct 2020 21:27:59 +0900 Change-Id: I2ed8dfabd6e99c468456cca960996d9adc3b8f9c Origin: upstream, https://review.opendev.org/c/openstack/puppet-nova/+/798768 Last-update: 2023-12-06
the important bit is the Origin: field, so we can go back to the review page if the patch needs an update to a newer version from upstream, but please do all the work and respect the format and rewrite the patch like above.
Checking if the patch applies
Make sure the patch applies:
apt-get install quilt export QUILT_PATCHES=debian/patches quilt push -a quilt pop -a
If the patch doesn't apply, it must be resolved (see below).
Resolving conflicts in patches
Do a quilt push -a, copy a file where the patch cannot be applied. In this example, maybe manifests/keystone/authtoken.pp:
cp manifests/keystone/authtoken.pp ..
Apply the patch in the authtoken.pp file by hand, then do a diff:
diff -u manifests/keystone/authtoken.pp ../authtoken.pp >>debian/patches/Add_support_for_the_keystone_authtoken_service_type_parameter.patch
edit debian/patches/Add_support_for_the_keystone_authtoken_service_type_parameter.patch, remove all the hunks for manifests/keystone/authtoken.pp in the middle of the file, and replace them by the ones we've just added at the end of the file. At this point, the patch should apply correctly. If not, re-iterate with the next files that need fixing.
Commiting your change in the debian/changelog and building the package
Once done and the patch applies, add the patch name to debian/changelog (there's multiple examples in many package, so open a changelog and see how it's done).
git push and you're done!
Note that the package can be uploaded to Debian only if it's on the latest branch of OpenStack. Otherwise, just leave UNRELEASED as target distro, and continue the current debian/changelog entry. If there's no new entry with UNRELEASED, use "dch -i" (apt-get install debscripts if you don't have the dch command available) to create a new entry.
Building the new package with the patch
Once done, open the victoria Jenkins:
https://bullseye-victoria.debian.net/
and build the puppet-module-nova package (click on it, then on the left, there's a "Build now" link).
Note that in this case, the package must also be built for Buster, as victoria is the release of Bookworm (and therefore, we have repositories for both Buster and Bookworm, to allow upgrading the OpenStack release, and THEN the Debian system version from Buster to Bookworm without changing OpenStack):
https://buster-victoria.debian.net/
Note that after Zed, building should be fully automated when someone pushes to a branch. One can check the build result in the #debian-openstack-commits channel (the Jenkins bot display the build status in real time in that channel).
If you do not have access to the Jenkins, please ask zigo for a login in the #debian-openstack channel on IRC.
