Allow building multiple RPM packages#837
Conversation
| %if "%{unstable}" == "false" | ||
| Name: tanzu-cli | ||
| Provides: tanzu-cli | ||
| Obsoletes: tanzu-cli < %{rpm_package_version} |
There was a problem hiding this comment.
It turns out that we were using Provides and Obsoletes wrongly. Those fields are meant to be used when we rename a package (e.g., tanzu-cli -> newname-cli) so that the new package can indicate it replaces the old package. We were not using it correctly. Ref: https://docs.fedoraproject.org/en-US/packaging-guidelines/#renaming-or-replacing-existing-packages
Those fields do not support using a variable, so removing them allowed me to inject the name of the package.
As a separate change, we could use those fields to allow the tanzu-cli package to replace an already installed tanzu-cli-unstable package; I tried it and couldn't get it to work quickly, so I left it for later, since it is not relevant to the Centos9 issue.
This allows to have different packages signed with different keys. To achieve this, the building of RPM packages is now done by hack/rpm/build_package.sh while building the final repository is now done by hack/rpm/build_package_repo.sh. This approach allows to call hack/rpm/build_package.sh more than once with different RPM_PACKAGE_NAME and then build the repo with all the new packages as a last step. Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
97ad194 to
59a80d1
Compare
anujc25
left a comment
There was a problem hiding this comment.
LGTM. Thanks for all the investigation and reaching to a solution to support centos usecase. 👏
This allows to have different packages signed with different keys. To achieve this, the building of RPM packages is now done by hack/rpm/build_package.sh while building the final repository is now done by hack/rpm/build_package_repo.sh. This approach allows to call hack/rpm/build_package.sh more than once with different RPM_PACKAGE_NAME and then build the repo with all the new packages as a last step. Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
This allows to have different packages signed with different keys. To achieve this, the building of RPM packages is now done by hack/rpm/build_package.sh while building the final repository is now done by hack/rpm/build_package_repo.sh. This approach allows to call hack/rpm/build_package.sh more than once with different RPM_PACKAGE_NAME and then build the repo with all the new packages as a last step. Signed-off-by: Marc Khouzam <marc.khouzam@broadcom.com>
What this PR does / why we need it
This PR splits the RPM package-building script into two scripts:
The first script can be called more than once by specifying the new
RPM_PACKAGE_NAMEwith a different name. This allows to build the same RPM package but with a different name, The value in doing this is that a different signer can be used for the different package; for example, a different signing key could be used for a second package.This will allow to build a package specific to Centos8/9 which will be signed with a special key that works on those OS:s.
Which issue(s) this PR fixes
Fixes # N/A
Describe testing done for PR
I have built the package and repo locally using the same make target as before and confirms it builds like before and is installable. This is not a signed package. Notice I fake a version to build a
tanzu-clipackage instead of atanzu-cli-unstablepackageI have build the unstable package ONLY and then built a second unstable package ONLY by overriding the name, which is what we will do for Centos8/9, then built a repo containing both:
I have testing that both packages can be installed using docker.
I've also ran the above tests with the
rpm-*-in-dockermake targets to confirm they work as expected.Release note
Additional information
Special notes for your reviewer