8000 Packaging guide · cobbler/cobbler Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Packaging guide

Enno Gotthold edited this page Apr 4, 2023 · 11 revisions

General

The preferred way of developing the packaging of cobbler is the Open Build Service - OBS in short.

For versions smaller or equal to 3.3.3 we have used debbuild for generating .deb packages.

Distros we want to successfully create packages for:

  • CentOS (or a derivative of it)
  • Fedora
  • openSUSE/SUSE Linux Enterprise Server
  • Debian
  • Ubuntu

Example Project setup for the OBS

The offical reference setup can be found here: https://build.opensuse.org/project/show/home:cobbler-project

The setup evolved during the lifetime of Cobbler 3.x.x.

You need to have installed on your machine to build this locally:

  • osc
  • obs-service-tar

Projects

  • home:cobbler-project - Empty project
    • ci: CI builds that are automatically submitted
    • containers: contains container images to run the applications
    • github-ci: contains container images that are aggregated from the subprojects
      • main: contains the container images that are needed to speed up the GitHub CI testing
      • releaseXX: where XX are each standing for a digit that are describing major and minor version of Cobbler
    • releaseXX: where XX are each standing for a digit that are describing major and minor version of Cobbler

CI setup

Project config:

%if 0%{?fedora_version}
Prefer: glibc-all-langpacks
%endif

Cobbler 3.0.x

The specfile is not working out of the box. You need to apply a diff that will fix the build.

Click to expand diff
diff --git a/cobbler.spec b/cobbler/cobbler.spec
index 8b920b5..89e15a4 100644
--- a/cobbler.spec
+++ b/cobbler/cobbler.spec
@@ -39,8 +39,8 @@
 Summary: Boot server configurator
 Name: cobbler
 License: GPLv2+
-Version: v3.0.1
-Release: 0%{?dist}
+Version: 2.9.0
+Release: 1%{?dist}
 Source0: https://github.com/cobbler/cobbler/releases/cobbler-%{version}.tar.gz
 BuildArch: noarch
 Url: https://cobbler.github.io
@@ -50,14 +50,8 @@ BuildRequires: openssl
 
 %if 0%{?rhel}
 BuildRequires: python36-devel
-BuildRequires: python36-future
-BuildRequires: python36-distro
-BuildRequires: python36-coverage
 %else
 BuildRequires: python3-devel
-BuildRequires: python3-future
-BuildRequires: python3-distro
-BuildRequires: python3-coverage
 %endif
 
 %if 0%{?rhel}
@@ -307,7 +301,7 @@ fi
 %{_var}/log/cobbler
 
 # documentation
-%doc COPYING README.md 
+%doc AUTHORS COPYING README docs/README.suse
 %{_mandir}/man1/cobbler.1.gz
 
 
@@ -348,7 +342,7 @@ sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = \'$RAND_SECRET\'/" /usr/share/cobbler/
 
 
 %files -n cobbler-web
-%doc COPYING README.md
+%doc AUTHORS COPYING README
 
 %{python3_sitelib}/cobbler/web/
 %exclude %{python3_sitelib}/cobbler/web/settings.py
@@ -399,7 +393,7 @@ Cobbler module providing secure dynamic dns updates
 %config(noreplace) %{_sysconfdir}/cobbler/settings.d/nsupdate.settings
 %{python3_sitelib}/cobbler/modules/nsupdate*
 
-%doc COPYING README.md
+%doc AUTHORS COPYING README
 
 
 %changelog

Example _service

Click to expand _service file
<services>
  <service mode="disabled" name="obs_scm">
    <param name="url">https://github.com/cobbler/cobbler.git</param>
    <param name="scm">git</param>
    <param name="revision">v3.0.1</param>
    <param name="versionformat">@PARENT_TAG@</param>
    <param name="versionrewrite-pattern">v(.*)</param>
    <param name="extract">cobbler.spec</param>
  </service>
  <service mode="disabled" name="set_version"/>
  <service name="tar" mode="disabled"/>
  <service name="recompress" mode="disabled">
    <param name="compression">gz</param>
    <param name="file">*.tar</param>
  </service>
</services>

Example project meta

Click to expand project meta
<project name="home:cobbler-project:release30">
  <title>Cobbler 3.0.x release project</title>
  <description/>
  <person userid="cobbler-project" role="maintainer"/>
  <repository name="standard">
    <path project="Fedora:29" repository="standard"/>
    <arch>i586</arch>
    <arch>x86_64</arch>
    <arch>ppc</arch>
    <arch>ppc64</arch>
    <arch>s390x</arch>
    <arch>local</arch>
    <arch>armv6l</arch>
    <arch>armv7l</arch>
    <arch>aarch64</arch>
    <arch>ppc64le</arch>
    <arch>aarch64_ilp32</arch>
    <arch>riscv64</arch>
  </repository>
</project>

Cobbler 3.1.x

Rewrite with debbuild

Example _service

In the following you will see the _service-file which we recommend:

Click to expand _service file
<services>
  <service mode="disabled" name="obs_scm">
    <param name="url">https://github.com/cobbler/cobbler.git</param>
    <param name="scm">git</param>
    <param name="revision">master</param>
    <param name="extract">cobbler.spec</param>
    <param name="extract">cobbler.rpmlintrc</param>
    <param name="extract">patches/debian/0001-cobbler-completition-adjust-bash-shebang.patch</param>
  </service>
  <service mode="disabled" name="set_version"/>
  <service name="tar" mode="buildtime"/>
  <service name="recompress" mode="buildtime">
    <param name="compression">gz</param>
    <param name="file">*.tar</param>
  </service>
</services>

Example project meta

Click to expand project meta
<project name="home:SchoolGuy">
  <title/>
  <description/>
  <person userid="SchoolGuy" role="maintainer"/>
  <repository name="xUbuntu_19.10">
    <path project="Ubuntu:debbuild" repository="Ubuntu_19.10"/>
    <path project="openSUSE:Tools" repository="xUbuntu_19.10"/>
    <path project="Ubuntu:19.10" repository="universe"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="xUbuntu_19.04">
    <path project="Ubuntu:debbuild" repository="Ubuntu_19.04"/>
    <path project="openSUSE:Tools" repository="xUbuntu_19.04"/>
    <path project="Ubuntu:19.04" repository="universe"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="xUbuntu_18.04">
    <path project="Ubuntu:debbuild" repository="Ubuntu_18.04"/>
    <path project="openSUSE:Tools" repository="xUbuntu_18.04"/>
    <path project="Ubuntu:18.04" repository="universe"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="openSUSE_Tumbleweed">
    <path project="openSUSE:Tools" repository="openSUSE_Tumbleweed"/>
    <path project="openSUSE:Factory" repository="snapshot"/>
    <arch>i586</arch>
    <arch>x86_64</arch>
  </repository>
  <repository name="openSUSE_Leap_15.1">
    <path project="openSUSE:Tools" repository="openSUSE_15.1"/>
    <path project="openSUSE:Leap:15.1" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="openSUSE_Leap_15.0">
    <path project="openSUSE:Tools" repository="openSUSE_15.0"/>
    <path project="openSUSE:Leap:15.0" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="SUSE_SLE-15-SP1_GA_standard">
    <path project="openSUSE:Tools" repository="SLE_15_SP1"/>
    <path project="SUSE:SLE-15-SP1:GA" repository="standard"/>
    <arch>i586</arch>
    <arch>x86_64</arch>
    <arch>ppc</arch>
    <arch>ppc64</arch>
    <arch>s390x</arch>
    <arch>aarch64</arch>
    <arch>ppc64le</arch>
  </repository>
  <repository name="SLE_15">
    <path project="openSUSE:Tools" repository="SLE_15"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="SLE_12_SP4">
    <path project="openSUSE:Tools" repository="SLE_12_SP4"/>
    <path project="SUSE:SLE-12-SP4:GA" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="RHEL_7">
    <path project="openSUSE:Tools" repository="RHEL_7"/>
    <arch>x86_64</arch>
    <arch>ppc64</arch>
  </repository>
  <repository name="Fedora_31">
    <path project="openSUSE:Tools" repository="Fedora_31"/>
    <arch>x86_64</arch>
    <arch>armv7l</arch>
    <arch>aarch64</arch>
    <arch>ppc64le</arch>
  </repository>
  <repository name="Fedora_30">
    <path project="openSUSE:Tools" repository="Fedora_30"/>
    <arch>x86_64</arch>
    <arch>i586</arch>
    <arch>armv7l</arch>
    <arch>aarch64</arch>
    <arch>ppc64le</arch>
  </repository>
  <repository name="Fedora_29">
    <path project="openSUSE:Tools" repository="Fedora_29"/>
    <arch>x86_64</arch>
    <arch>i586</arch>
    <arch>armv7l</arch>
    <arch>aarch64</arch>
    <arch>ppc64le</arch>
  </repository>
  <repository name="Debian_10">
    <path project="Debian:debbuild" repository="Debian_10"/>
    <path project="openSUSE:Tools" repository="Debian_10"/>
    <arch>i586</arch>
    <arch>x86_64</arch>
  </repository>
</project>

Cobbler 3.2.x

No changes except versions in the configuration files in comparison to 3.1.x.

Cobbler 3.3.x

Example _service: If you are packaging version 3.3.3 or later you may commit the <param name="extract"> that mentions the patch and rpmlintrc. Otherwise no changes from 3.1.x.

Example project config: Please take the one from the CI configuration.

Click to expand project meta
<project name="home:cobbler-project:release33">
  <title>Cobbler 3.3.x release project</title>
  <description/>
  <person userid="cobbler-project" role="maintainer"/>
  <repository name="openSUSE_Tumbleweed">
    <path project="openSUSE:Factory" repository="snapshot"/>
    <arch>i586</arch>
    <arch>x86_64</arch>
  </repository>
  <repository name="Fedora_34">
    <path project="Fedora:34" repository="standard"/>
    <arch>aarch64</arch>
    <arch>armv7l</arch>
    <arch>ppc64le</arch>
    <arch>x86_64</arch>
  </repository>
  <repository name="CentOS_8">
    <path project="CentOS:CentOS-8" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="15.4">
    <path project="openSUSE:Leap:15.4" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
  <repository name="15.3">
    <path project="openSUSE:Leap:15.3" repository="standard"/>
    <arch>x86_64</arch>
  </repository>
</project>

Detailed instructions for the OBS (working onwards)

The following commands are only valid for submitting a new revision to the development project of openSUSE. This guide doesn't apply if you work on the official home:cobbler-project setup.

  1. Setup your build environment for the OBS (https://openbuildservice.org/help/manuals/obs-user-guide/art.obs.bg.html).
  2. osc bco systemsmanagement cobbler
  3. osc service runall
  4. Remove the old sources (look at the date where the files were last modified).
  5. Now work on whatever you want.
  6. osc ar: To apply changes.
  7. osc vc
  8. osc ci
  9. Wait until the build succeeds for all distros and platforms.
  10. Submit the package against systemsmanagement:cobbler

Detailed instructions for the OBS (creating from scratch)

  1. Setup your build environment for the OBS (https://openbuildservice.org/help/manuals/obs-user-guide/art.obs.bg.html).
  2. Create your home project (if you haven't done this already).
  3. Use my project config from above and possibly adjust it to your special needs.
  4. Create a package (you can name it however you want) in your home project.
  5. Create and Check the created package out on your local system.
  6. Create in the empty directory a file called _service and put the content from above in there. (Maybe you want to use your own Github Fork, so adjust it to your needs).
  7. osc service runall: This downloads the sources and unpacks the needed files.
  8. osc ar: This adds and removes all files which are changed and adds them to the obs source control.
  9. osc vc: Create a stub version entry for the OBS.
  10. osc ci: Save the entry and exit the editor. If needed press c) for "Continue" if the buildservice complains that you didn't change the message.
  11. Now the package should build on the server.

Create a patch & submit it

If you submit a patch your changes are considered urgent. If you changes are not urgent please submit a normal PR which just adjusts the python code. We have automated the build so pre-releases are quickly available. Stable releases are available depending on the distribution.

  1. Fork the Cobbler Repository
  2. Create a branch for your fix
  3. In the spec file add the line PatchN: 000N-patchname.patch, where N is the next number which is available.
  4. Add in the setup section the patch with the snippet from below.
  5. Add the patch itself in the patches/ folder and put it into one of the following folders debian for deb based installations or suse for rpm based installations.
  6. Submit a PR for the according release branch(es) and submit a separate PR to master for the changes if this is needed.

Snippet for patching debbuild:

# Apply debian patches
%if %{_vendor} == "debbuild"
%patch -P 0  -p1
%endif

Build RPMs/DEBs using Docker

  1. Make sure docker and docker-compose are installed
  2. Use docker-compose to build rpms for the various distros
    make clean
    docker-compose build --parallel
    docker-compose up
    
  3. RPMs are in rpm-build/

Creating a new PyPi release

This can only be performed by @brejoc and @SchoolGuy due to permissions on PyPi side.

This is as easy as executing the following three commands:

  1. docker build -f release.dockerfile -t cobbler-release:latest .
  2. docker run -v <PATH_TO_PROJECT>/cobbler:/build --name cobbler-release cobbler-release:latest
  3. python3 -m twine upload dist/*

Newer versions of Cobbler don't have the mentioned Dockerfile anymore. However one can use the development Dockerfile.

Currently we have 2 GitHub actions for automatic releases to Pypi.

BABF
Clone this wiki locally
0