Working with CBS
Working with CBS¶
The following variables are used in this guide:
$sig = kmods
$release = 8 or 8s
$project = packages
$version = main or rebuild
$disttag = el$release
$mirror-release = 8 or 8-stream
$basearch = aarch64, ppc64le, or x86_64
$user = Your CentOS account (https://accounts.centos.org/)
$package = The package you are working on
Some of these variables are SIG specific, i.e. some might need to be changed in case you are not working on the Kmods SIG.
Requirements¶
First you need to install required tools:
dnf install centos-packager
For authentication it is required to generate a TLS certificate:
centos-cert -u $user
In addition it is required to have a local copy of centos-git-common
git clone https://git.centos.org/centos-git-common
To ease using these tools, add your local copy of centos-git-common to PATH
.
New packages have to be added to the SIG's tags:
for tag in $sig$release-$project-$version-{candidate,testing,release}
do
cbs add-pkg --owner=$user $tag $package
done
Request a repository to be created for your package on git.centos.org by opening an issue with centos-infra.
Upload package sources¶
Assuming you already have the repository on pagure.io/centos-sig-kmods, we only need to add a new remote:
git remote add git.centos.org ssh://git@git.centos.org/rpms/$package.git
Push the dist-git to git.centos.org
git push git.centos.org c$release-sig-$sig
Upload source files to lookaside cache:
git checkout c$release-sig-$sig
while read -r HASH FILE
do
if [[ $HASH != $(sha1sum $FILE | awk '{print $1}') ]]
then
echo "Hash values do not match." 1>&2
else
echo "Hash for comparison: $HASH"
lookaside_upload -f $FILE -n $package -b c$release-sig-$sig
fi
done < .$package.metadata
Building a package¶
(Optional) Scratch Build:¶
git checkout c$release-sig-$sig
rpmbuild --define "%_topdir `pwd`" -bs SPECS/$package.spec
cbs build --scratch $sig$release-$project-$version-$disttag SRPMS/$package-*.src.rpm
Scratch builds will show up in the CBS web interface, and the built RPMS will be downloadable from there, but the package will not be included in any of the CBS tags (or the repos generated from the tags). Scratch builds are used to test functionality before doing a proper tagged build.
Tagged Build:¶
cbs build $sig$release-$project-$version-$disttag git+https://git.centos.org/rpms/$package.git#$(git rev-parse c$release-sig-$sig)
Tagged builds will end up in the -candidate tag after it's finished building, and will be available in the buildroot in case other packages depend on it.
Releasing a package¶
There are 2 points in the process where packages can be promoted for wider consumption. Testing content can be distributed to the buildlogs.centos.org content delivery network for developers and CI systems to consume. Release-ready content can be promoted to a SIG-specific directory on mirror.centos.org for consumption by end-users. A push of packages to these can be triggered by tag-build packages.
Pushing test content to buildlogs.centos.org¶
cbs tag-build $sig$release-$project-$version-testing $package-$(rpm -q --specfile --define 'dist %{nil}' --qf="%|epoch?{%{epoch}:}:{}|%{version}-%{release}\n" SPECS/$package.spec).$disttag
Packages will be pushed to:
https://buildlogs.centos.org/centos/$mirror-release/$sig/$basearch/$project-$version/
Releasing content to mirror.centos.org¶
cbs tag-build $sig$release-$project-$version-release $package-$(rpm -q --specfile --define 'dist %{nil}' --qf="%|epoch?{%{epoch}:}:{}|%{version}-%{release}\n" SPECS/$package.spec).$disttag
RPMs will be pushed to:
http://mirror.centos.org/centos/$mirror-release/$sig/$basearch/$project-$version/
SRPMs will be pushed to:
https://vault.centos.org/$mirror-release/$sig/Source/$project-$version/
Debuginfo will be pushed to:
http://debuginfo.centos.org/centos/$mirror-release/$sig/$basearch/