2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-25 17:24:07 +00:00
Files
xcat-core/docs/source/developers/guides/code/builds.rst
T
Daniel Hilst 646b57c123 Merge master into fix/ubuntu-genesis-native-sbuild
master changed the same three files this branch changes, so the pull request could not
merge. Conflicts and how each was resolved:

xCAT-genesis-builder/builddeb-genesis-base. Both sides teach the build root to cope with
a package whose name moved between releases. master added optional_packages(), which
keeps a package only where apt has a candidate, and called it for util-linux-extra. This
branch added add_first_available(), which takes the first name apt carries and fails when
it carries none, and calls it for bind9-dnsutils/dnsutils and util-linux-extra/util-linux,
plus add_if_available() for tzdata-legacy. The branch covers master's case and two more,
so its helpers are kept and optional_packages() goes with its only caller. Every other
master change to this file, including the DHCP client fix, is preserved.

xCAT-test/unit/genesis_payload_verification.t. master has four assertions this branch does
not: two payloads missing an absolute path. Its version is kept. The branch replaced
plan skip_all with a fail(), because skipping covers nothing when the file under test is
the gate itself, and that change is applied to master's version.

xCAT-test/unit/genesis_ubuntu_build_root.t. master's added assertions drive
optional_packages() directly, which the resolved builder no longer has. This branch's
version matches the implementation that survives, and it already dies rather than skipping
when the builder is missing, so it is kept whole.

prove -j4 -r xCAT-test/unit passes: 212 files, 5892 tests.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-18 07:56:24 -03:00

134 lines
5.8 KiB
ReStructuredText

Building Source Code
====================
xcat-core
---------
Clone the xCAT project from `GitHub <https://github.com/xcat2/xcat-core>`_ and
build the rpms with ``buildrpms.pl``::
cd xcat-core
./buildrpms.pl --target alma+epel-9-x86_64
Each package is built in its own ``mock`` chroot, so the build does not depend on
what happens to be installed on the build host. Pass ``--target`` once per target
to build several; the default is every supported EL target. ``./buildrpms.pl
--help`` lists the rest.
To build the source rpms and no binary rpms, pass ``--source-only``::
cd xcat-core
./buildrpms.pl --target alma+epel-9-x86_64 --source-only
A source rpm is the input that a build service such as mock, koji, COPR or OBS
takes, and it lets one machine make the source rpms while another makes the
binary rpms for each architecture. ``rpmbuild`` does not need the packages named
in ``BuildRequires`` to make a source rpm, so this also builds on a machine that
cannot complete a full build.
The source rpms land in ``dist/<target>/rpms/SRPMS/``. The binary repository
metadata is left as the last full build wrote it, and no ``.repo`` file is
emitted, because a source-only run has no binary packages to advertise.
.. note::
``buildcore.sh``, ``makerpm`` and ``buildlocal.sh`` were removed in 2.19;
``buildrpms.pl`` replaces all three, and its ``--source-only`` replaces the
old ``SRCONLY=1``.
``build-ubunturepo`` was removed in 2.19. ``builddebs.pl`` replaces it, and the
CD pipelines build every Ubuntu target with it.
Debian and Ubuntu packages
--------------------------
Build the ``.deb`` packages and an apt repository with ``builddebs.pl``::
cd xcat-core
./builddebs.pl
The packages land in ``dist/debs/debs/`` and the repository in
``dist/debs/xcat-core/``. Pass ``--dest`` to write them elsewhere, ``--dist`` to
limit which Ubuntu releases the repository serves, and ``--gpg-sign`` (with
``--gpg-home``) to sign it. ``./builddebs.pl --help`` lists the rest.
xcat-core packages are Perl, so one build serves every Ubuntu release: the
packages are built **once** and the same files are published into every codename
the repository declares. Only ``xCAT``, ``xCATsn`` and ``xCAT-genesis-scripts``
carry an architecture, and there the difference is packaging metadata rather than
compiled output. That is why this build needs no ``sbuild`` and no per-codename
chroot -- unlike xcat-deps, whose packages are compiled and genuinely differ per
release. ``xCAT`` and ``xCATsn`` are built for riscv64 as well as amd64 and
ppc64el, and every release the repository serves declares the architecture;
``xCAT-genesis-scripts`` keeps the two architectures it has control files for,
because riscv64 Genesis ships as an OpenEmbedded package instead.
The Genesis image is the exception, and it is off unless it is asked for::
./builddebs.pl --genesis-only --genesis-dist jammy --genesis-dist noble
``dracut`` copies the kernel, the kernel modules and every command out of the root
it runs in, so the image belongs to the release that built it. ``--genesis`` builds
one image per ``--genesis-dist`` codename inside that codename's
``<codename>-<arch>-sbuild`` schroot -- the chroots xcat-dep's ``sbuild-all.pl``
creates on the Ubuntu build host -- for the architecture of the build host. It
refuses to run in a root of another release, it fails the build on an error in the
log even when the exit status is 0, and it checks the extracted payload against the
commands the dracut module installs. ``--genesis-only`` builds the images and
nothing else, which is what xcat-dep consumes with ``--genesis-deb``.
Helpers shared by both builders live in ``build-utils/lib/XCAT/BuildUtils.pm``.
``buildcore.sh`` builds the architecture specific packages (``xCAT``, ``xCATsn``,
``xCAT-genesis-scripts``) for every supported architecture, riscv64 included, with
``rpmbuild --target``. The build host therefore needs an rpm that knows the riscv64
architecture and the ``Recommends:`` tag (EL8 or later); an older host fails the riscv64
builds and, as the script only publishes when every architecture built, produces no rpms.
xcat-deps
---------
The ``xcat-deps`` package is currently owned and maintained by the core development on our internal servers. Use the packages created at: http://xcat.org/download.html#xcat-dep
man pages
---------
The xCAT man pages are written in Perl POD files and automatically get built into the xCAT rpms. The content in the .pod files are always the master.
In the past, the man pages were converted into html files and uploaded to SourceForge. In moving to `ReadTheDocs <http://xcat-docs.readthedocs.org>`_ we want to also provide the man pages as references in the documentation. To convert the ``pods`` to ``rst``, we are using The Perl module: `pod2rst <http://search.cpan.org/~dowens/Pod-POM-View-Restructured-0.02/bin/pod2rst>`_.
The following steps will help configure ``pod2rst`` and be able to generate the changes .rst files to push to GitHub.
#. Download the following Perl modules:
- `Pod-POM-View-Restructured-0.02 <http://search.cpan.org/~dowens/Pod-POM-View-Restructured-0.02/lib/Pod/POM/View/Restructured.pm>`_
- `Pod-POM-2.00 <http://search.cpan.org/~neilb/Pod-POM-2.00/lib/Pod/POM.pm>`_
#. For each of the above Perl modules:
* **[as root]** Extract and build the Perl module ::
perl Makefile.PL
make
make install
* **[as non-root]** Extract and build the Perl module using PREFIX to specify a directory that you have write permission ::
mkdir ~/perllib
perl Makefile.PL PREFIX=~/perllib
make
make install
#. Execute the script ``create_man_pages.py`` to generate the .rst files into ``xcat-core/docs`` :
* **[as root]** ::
cd xcat-core
./create_man_pages.py
* **[as non root]** ::
cd xcat-core
./create_man_pages.py --prefix=~/perllib