Text Blame History Raw

About building cephadm

This is a dist-git like repo for cephadm

The master brach is unused: use an existing branch instead.

Branch names follow convention like c<VERSION>-sig-storage-ceph-VERSION> as described

on Naming and Patterns for Mapping Git Branches to Koji Tags

c8-sig-storage-ceph-octopus: CentOS-8
c8-sig-storage-ceph-pacific: CentOS-8
...

Instructions for building the ceph package for the CentOS Storage SIG can be found in the following places:

Comunity Build System Storage SIG landing page

Before starting, choose the branch containing the maintained spec for the cephadm package:

git checkout -t origin/c8-sig-storage-ceph-<VERSION>

You can find the sha1 for the "patches_base" comment and "Source0" with "git ls-remote", e.g.

$ git ls-remote https://github.com/ceph/ceph pacific
ca0faa0a628c041f5b5313060344006830812e25 refs/heads/pacific

The source code can be downloaded using the 'spectool' tool , which uses the Source0 entry in the SPEC:

$ spectool -g SPECS/cephadm.spec
$ mv cephadm SOURCES/cephadm

Create a src.rpm with:

$ rpmbuild -bs \ --define "_sourcedir $PWD/SOURCES" --define "_srcrpmdir $PWD" \ --define "dist .el8" SPECS/cephadm.spec

and finally we can build it running:

$ cbs build [--scratch] storage8-ceph-pacific-el8 cephadm.el8.src.rpm

Build cephadm using the Makefile

A Makefile is provided with the purpose of automating the steps described before. It provides an helper function and can be used to build the srpm, as well as obtaining additional information on the current build. The act of running the 'cbs build' command is not automated on the Makefile since it's out of scope: feel free to refer to the last step of the previous section to run the cbs build after the Makefile execution ends.

Executing the Makefile without parameters

If no parameters are provided, the Makefile computes the branch name, the version and the release from the current spec file. The Release field is increased by 1 but the version remains the same: this is because we're building the package against a newer hash instead of bumping the cephadm version according to the provided tags (the ceph-ansible approach).

If you want to produce a new srpm for an existing cephadm version, just run:

make

and you will see an output like this:

[fmount@buildbot cephadm]$ make
sed SPECS/cephadm.spec.in \
  -e "s/89ceb19fd8609fd4c99d10dd63f42e6786e37c86/dcf77bd9ff89dfef682c4a2dda05ac5c8651dbe5/" \
  -e 's/@VERSION@/16.1.0/' \
  -e 's/@RELEASE@/2/' \
 > SPECS/cephadm.spec
cp SPECS/cephadm.spec SPECS/cephadm.spec.in
/usr/bin/spectool -g SPECS/cephadm.spec -C SOURCES -f
Getting https://github.com/ceph/ceph/raw/dcf77bd9ff89dfef682c4a2dda05ac5c8651dbe5/src/cephadm/cephadm to SOURCES/cephadm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   170  100   170    0     0     32      0  0:00:05  0:00:05 --:--:--    40
100  214k  100  214k    0     0  20886      0  0:00:10  0:00:10 --:--:-- 47630
rpmbuild -bs /home/fmount/cephadm/SPECS/cephadm.spec \
  --define "_sourcedir /home/fmount/cephadm/SOURCES" \
  --define "_srcrpmdir /home/fmount/cephadm" \
  --define "dist .el8"
Wrote: /home/fmount/cephadm/cephadm-16.1.0-2.el8.src.rpm

In addition, a cephadm.spec file is generated from the input SPECS/cephadm.spec.in and it can be found under the SPECS directory.

At the end of this process, as described in the previous section, you can run the cbs build:

$ cbs build [--scratch] storage8-ceph-pacific-el8 cephadm-16.1.0-2.el8.src.rpm

Executing the Makefile overriding some input parameters

If you want to bump to a newer released version, the hash computation remains unchanged, but you might want to patch the spec input file properly. For this reason a few parameters, exposed via the cephadm.spec.in file can be overrided:

  • RELEASE
  • DIST = el8 by default
  • VERSION

For instance, assuming you have the following data in the current spec:

[fmount@buildbot cephadm]$ cat SPECS/cephadm.spec | grep -iE "(Release|Version)"
Version: 16.1.0
Release: 2%{?dist}

you can patch (and bump to a newer NVR) the current (existing) spec file by running:

DIST=el8 RELEASE=1 VERSION=16.1.0 make

Then, running the regular cbs build command a new cephadm rpm can be built:

$ cbs build [--scratch] storage8-ceph-pacific-el8 cephadm-16.1.0-2.el8.src.rpm