2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-09-05 12:37:54 +00:00
Files
xcat-core/docs/source/developers/guides/code/builds.rst
T
Daniel Hilst 5515dfbe3e fix(build): keep build-ubunturepo as an oracle, and fix what running it found
builddebs.pl was written against build-ubunturepo but never run beside it. Keeping
the old script in the tree for one more cycle makes the comparison repeatable, and
running the two on xcat-master-ub found four defects that no unit test would have.

  * builddebs.pl was not executable. github_action_xcat_test.pl runs
    `sudo ./builddebs.pl`, so CI would have failed with Permission denied.

  * .deb files were collected after every ARCHITECTURE. dpkg-genbuildinfo reads
    the sibling artifacts of the source package it is building, so moving the
    amd64 .deb away before ppc64el ran killed the second build with
      dpkg-genbuildinfo: error: cannot fstat file ../xcat_..._amd64.deb
    Collection now happens once a package's last architecture is done.

  * A checkout dirtied by an aborted run poisoned the next one: a leftover
    .changes made dpkg-genbuildinfo name an architecture the run had not reached.
    The dpkg output is now cleared at start.

  * The maintainer was xcat@xcat.org where build-ubunturepo uses
    xcat-build@xcat.org, and a Release file in the tree was ignored.
    buildrpms.pl WRITES Release, so a pipeline building both would have stamped
    its debs with a different release from its rpms. Both corrected.

Equivalence, measured rather than assumed. Both builders were run on
xcat-master-ub from the same tree:

  package set      identical, 14/14, same names
  control metadata identical, 14/14
  payload contents identical, 14/14
  changelog.Debian differs, 2 packages -- deliberately, see below

Byte-identity is NOT the criterion, because neither implementation has it: two
consecutive runs of build-ubunturepo on the same tree agree on 0 of 14 packages.
A .deb records the build wall-clock time in its ar member mtimes and
SOURCE_DATE_EPOCH does not reach dpkg-deb here, so every run differs from every
other. That is a pre-existing property of the Debian build, not a regression, and
worth fixing separately.

The changelog difference is build-ubunturepo being wrong. Its

    sed -i "s/^ -- .*/ -- $DEBFULLNAME <$DEBEMAIL>  $deterministic_date/"

carries no line address, so it rewrites EVERY trailer in debian/changelog:
"OCF xCAT <xcat@ocf.co.uk>  Mon, 25 Oct 2010" ships as "xCAT Build
<xcat-build@xcat.org>  Tue, 01 Sep 2026". It falsifies the authorship and dates of
the 2008 and 2010 releases. builddebs.pl rewrites only the top stanza. Matching
byte-for-byte would mean reproducing the defect, so this difference stays.

(xcat-vlan appeared to differ under `diff -r`; that was diff reporting dangling
symlinks in both trees. Its member listing is identical.)

build-ubunturepo is documented as retained-for-comparison and not to be extended.
It goes once the Ubuntu CD pipelines call builddebs.pl.

Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
2026-09-01 07:08:04 -03:00

113 lines
4.4 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`` is superseded by ``builddebs.pl`` but is **still in the
tree for now**, as a differential oracle: it is the reference the new builder
is checked against, and it is removed once the CD pipelines have been moved
over. Do not add features to 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.
Helpers shared by both builders live in ``BuildUtils.pm``.
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