-
Notifications
You must be signed in to change notification settings - Fork 2
Walkthrough
This is an example walkthrough of creating an IUS package.
Clone the Fedora package source to a directory named with the intended IUS package name.
git clone https://src.fedoraproject.org/rpms/foo.git foo3
cd foo3
Delete the Fedora remote.
git remote remove origin
Create a main
branch and remove the Fedora default rawhide
branch.
git checkout -b main
git branch -d rawhide
Remove unnecessary files.
git rm .gitignore sources
Rename the spec file.
git mv foo.spec foo3.spec
Add a Cirrus configuration file as detailed here.
vim .cirrus.yml
git add .cirrus.yml
Change the package name.
-Name: foo
+Name: foo3
Provide and conflict with the stock package name.
+Provides: foo = %{version}-%{release}
+Provides: foo%{?_isa} = %{version}-%{release}
+Conflicts: foo < %{version}-%{release}
Check for any instances of Obsoletes
. A Fedora package might obsolete a previous Fedora package name that is still used in RHEL. An IUS package should never obsolete a stock RHEL package.
-Obsoletes: foo-common
Modify the %setup
arguments to account for the tarball top level directory not matching %{name}-%{version}
(the default).
%prep
-%setup -q
+%setup -q -n foo-%{version}
Check for other instances of the %{name}
macro, and changes those back to the original name if necessary.
%files
-%{_bindir}/%{name}
+%{_bindir}/foo
Commit these changes.
git add foo3.spec
git commit -m 'Port from Fedora to IUS'
At this point you should try to build the package. RPM building basics are outside the scope of this tutorial. Read the RPM Packaging Guide instead. Attempting to build the package for RHEL (such as in an epel-7 mock root) might work right away, or it might take additional work to sort out build requirements or macro differences between Fedora and RHEL. During this process it may be useful to compare your working spec file with the equivalent spec file from RHEL, which can be found on https://git.centos.org.
Once the packaging details are complete, create a new empty repository on GitHub, and add it as a remote for your local repository.
git remote add origin git@github.com:iusrepo/foo3.git
Push your main
branch to the new remote with a tracking reference.
git push -u origin main
Set the repository description to match the summary from the spec file.
About gear ➡️ Description
Set up a branch protection rule in the GitHub settings.
Settings ➡️ Branches ➡️ Add rule
Branch name pattern: main
- Require pull request reviews before merging
- Dismiss stale pull request approvals when new commits are pushed
If everything builds as expected in the CI, add a tag and push it to GitHub. Note that this will not trigger another CI build with the configuration we added earlier.
tag=$(rpmspec --srpm --query --queryformat '%{version}-%{release}\n' --undefine dist foo3.spec 2> /dev/null)
git tag $tag
git push origin $tag