Skip to content

Commit

Permalink
Merge branch 'task/#23464-Prepare_debian_release_safu' into 'debian/m…
Browse files Browse the repository at this point in the history
…ain'

task/#23464-Prepare_debian_release_safu

See merge request elektrobit/base-os/safu!24
  • Loading branch information
gehwolf committed Jun 28, 2024
2 parents 645be29 + 51cb6c5 commit ff7c3bd
Show file tree
Hide file tree
Showing 23 changed files with 309 additions and 11 deletions.
30 changes: 26 additions & 4 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
---
variables:
DOCKER_HOST: "tcp://docker:2375"

stages:
- build
- test

default:
image: docker:24-dind
image: ubuntu:jammy
services:
- name: docker:24-dind
alias: docker
variables:
DOCKER_TLS_CERTDIR: ""
tags:
- "shell"
- "docker"

before_script:
- 'command -v ssh-agent >/dev/null || ( apt-get update -y && apt-get install openssh-client -y )'
- apt-get update
- apt-get install -y curl bash jq docker.io
- docker info
- ip a
- ss -antup
- env | sort

build-dependencies:
Expand Down Expand Up @@ -119,3 +124,20 @@ documentation:
artifacts:
paths:
- build/doc/

build-deb-packages:
parallel:
matrix:
- OS: ubuntu
CODENAME: jammy
- OS: ubuntu
CODENAME: noble
# Override default before_script
before_script: ""
stage: build
image: ${OS}:${CODENAME}
script:
- ci/build_debs.sh ${CODENAME}
artifacts:
paths:
- ./*.deb
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,18 @@ or use the CI hooks

Scripts to be used by CI pipelines to build , run various tests and checks.

### debian.native

Contains Debian packaging scripts for building the current source tree as .deb
packages. This is primarily for CI pipelines to automatically verify if the
packages are buildable or if anything needs to be changed.

See `debian.native/README.md` for more information.

### documentation

More detailed documentation on the event logging and management system.


### src

Contains the actual productive sources.
Expand Down Expand Up @@ -98,6 +105,7 @@ elos is an integrated part of EB corbos Linux – built on Ubuntu is an open-so
* Daniel Glöckner
* Fabian Godehardt
* Friedrich Schwedler
* Isaac True
* Joerg Vehlow
* Maryniuk Bogdan
* Rainer Müller
Expand Down
43 changes: 43 additions & 0 deletions ci/build_debs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash -eu

export DEBIAN_FRONTEND="noninteractive"
export DEBEMAIL="noreply@test.com"

CODENAME="${1:-jammy}"

echo "Building .deb packages for series ${CODENAME}"
echo "---"
echo "NOTICE: make sure to clean up before running this! Debhelper will complain otherwise"

# Install dependencies
apt-get update
apt-get install -y git debhelper devscripts equivs software-properties-common fakeroot
add-apt-repository -y ppa:elos-team/ppa

# Use the native packaging folder for building the .debs
rm -rf debian
cp -rv debian.native debian

# parse the version from the project.cmake file
VERSION="$(sed -n "s/^.*VERSION\s\+\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$/\1/p" cmake/project.cmake)~test"

# Add a new changelog entry
git config --global --add safe.directory "$(pwd)"
dch --newversion="${VERSION}" \
--distribution "${CODENAME}" "Test build"

# Install dependencies
yes | mk-build-deps -ir || true

# Ignore Lintian errors from the native packaging
mkdir -p debian/source
echo "malformed-debian-changelog-version" >> debian/source/lintian-overrides
echo "root-in-contact" >> debian/source/lintian-overrides
echo "debian-watch-file-in-native-package" >> debian/source/lintian-overrides
echo "odd-historical-debian-changelog-version" >> debian/source/lintian-overrides

# Build the unsigned .debs
fakeroot debuild --no-tgz-check -uc -us

# Need to move the files into the project directory
mv ../*.deb ./
2 changes: 1 addition & 1 deletion cmake/project.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SPDX-License-Identifier: MIT
set(SAFU_VERSION 0.53.0)
set(SAFU_VERSION 0.54.1)

# Attention: Aside from the version, as many things as possible in this file
# should be put into functions, as this solves potential issues with commands
Expand Down
10 changes: 10 additions & 0 deletions debian.native/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*.substvars
/files
/debhelper-build-stamp
/libsafu0/
/libsafu-dev/
/libmock-safu0/
/safu-doc/
/.debhelper/
/tmp/
/*.debhelper.log
50 changes: 50 additions & 0 deletions debian.native/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# safu Debian Packaging Scripts

## Overview

This directory contains Debian packaging scripts for building the current source
tree as .deb packages. This is primarily for CI pipelines to automatically
verify if the packages are buildable or if anything needs to be changed. This is
not intended to be used directly for building .deb packages for new releases.

## Building

The .deb packages are constructed in the standard Debian way using `debhelper`.
The easiest way to build the packages is to just call the `ci/build_debs.sh`
script from the top-level directory from inside a Docker/Podman container, which
will automatically install all of the necessary dependencies, set the package
version, and build the packages using `debhelper`.

It's possible to do this all in one line to verify if the packages are buildable
on various Debian-based distributions and series. E.g., to build it on Ubuntu
Jammy:

```bash
podman run --rm -v $(pwd):/build -w /build ubuntu:jammy ci/build_debs.sh
```

Please note that there are some dependencies which are not (yet) in the Debian
or Ubuntu archives. These have been built and published for Ubuntu in the
[elos PPA](https://launchpad.net/~elos-team/+archive/ubuntu/ppa), which is
automatically added by the `ci/build_debs.sh` script. This currently restricts
builds using the script to Ubuntu systems, as PPAs are not available on other
distributions.

## Extending

The Debian packaging scripts leverage the existing CMake build system used by
safu to build everything, meaning that very little, if anything, generally
needs to be changed inside the packaging scripts when a code change is made to
safu. The major exception to this is when new libraries or files need to be
installed.

In most cases, new files and/or folders can be added to the `.install` file
corresponding to the package name that the new files and/or folders should
belong to.

New packages must be added to the `control` file, and their respective files
should be added to a new `.install` file matching the name of the new package.

## Packaging Script Maintainer

* Isaac True isaac.true@emlix.com [@IsaacJT](https://github.com/IsaacJT)
5 changes: 5 additions & 0 deletions debian.native/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
safu (0.0.1) unstable; urgency=medium

* Dummy release.

-- Isaac True <isaac.true@emlix.com> Mon, 10 Jun 2024 16:53:43 +0200
63 changes: 63 additions & 0 deletions debian.native/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
Source: safu
Section: admin
Priority: optional
Maintainer: Isaac True <isaac.true@emlix.com>
Build-Depends:
debhelper-compat (= 13),
cmake,
git,
libcmocka-mocks-dev,
pkg-config,
pandoc,
pandoc-plantuml-filter,
graphviz,
Rules-Requires-Root: no
Standards-Version: 4.6.0.1
Homepage: https://github.com/Elektrobit/safu
Vcs-Browser: https://github.com/Elektrobit/safu
Vcs-Git: https://github.com/Elektrobit/safu

Package: libsafu0
Section: libs
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
Description: Common utility API's used in elos and samconf
Library of common utility API's used in elos and samconf.
.
Runtime library package.

Package: libmock-safu0
Section: libs
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
Description: Library of common utility API's used in elos and samconf (mocks)
Library of common utility API's used in elos and samconf.
.
Mock library package.

Package: libsafu-dev
Section: libdevel
Architecture: any
Depends:
${misc:Depends},
libsafu0 (= ${binary:Version}),
libmock-safu0 (= ${binary:Version}),
libcmocka-mocks-dev,
Description: Library of common utility API's used in elos and samconf (development)
Library of common utility API's used in elos and samconf.
.
Development package.

Package: safu-doc
Section: doc
Architecture: all
Depends:
${misc:Depends},
Description: Library of common utility API's used in elos and samconf (documentation)
Library of common utility API's used in elos and samconf.
.
Documentation package.
28 changes: 28 additions & 0 deletions debian.native/copyright
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: safu
Upstream-Contact: https://github.com/Elektrobit/safu/issues
Source: https://github.com/Elektrobit/safu

Files: *
Copyright: 2023, Elektrobit GmbH
2023, emlix GmbH
License: MIT

License: MIT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions debian.native/devdoc-index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Developer documentation
==========================

.. toctree::
:maxdepth: 1
:caption: Contents:

DeveloperManual
documentation
1 change: 1 addition & 0 deletions debian.native/libmock-safu0.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libmock_safu.so.*
5 changes: 5 additions & 0 deletions debian.native/libsafu-dev.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
usr/include/safu
usr/lib/*/cmake
usr/lib/*/pkgconfig
usr/lib/*/libmock_safu.so
usr/lib/*/libsafu.so
1 change: 1 addition & 0 deletions debian.native/libsafu0.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/libsafu.so.*
1 change: 1 addition & 0 deletions debian.native/not-installed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
usr/lib/*/test
37 changes: 37 additions & 0 deletions debian.native/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto

%:
dh $@ --buildsystem=cmake --builddirectory=debian/build

override_dh_auto_build:
dh_auto_build -- all safu_doc

mkdir -p debian/build/documentation/developer

pandoc --from gfm --to rst \
-o debian/build/documentation/developer/DeveloperManual.rst \
documentation/developer.md

pandoc --from gfm --to rst \
-o debian/build/documentation/developer/documentation.rst \
documentation/documentation.md

pandoc --from gfm --to rst \
-o debian/build/documentation/developer/index.rst \
debian/devdoc-index.md

override_dh_install:
dh_install
# Do not ship plantuml source files
find debian/ -name \*.plantuml -delete

override_dh_compress:
# Do not compress .md files
dh_compress --exclude=.md

override_dh_clean:
dh_clean

rm -f documentation/images/*.png
1 change: 1 addition & 0 deletions debian.native/safu-doc.install
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
documentation/* /usr/share/doc/safu/
1 change: 1 addition & 0 deletions debian.native/safu-doc.lintian-overrides
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
safu-doc: zero-byte-file-in-doc-directory [usr/share/doc/safu/style.css]
1 change: 1 addition & 0 deletions debian.native/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (native)
2 changes: 2 additions & 0 deletions debian.native/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
version=4
https://github.com/Elektrobit/safu/tags .*/safu-(\d+).(\d+).(\d+).tar.gz
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
safu (0.54.1-1) UNRELEASED; urgency=medium

* New upstream tag 0.54.1

-- Isaac True <isaac.true@emlix.com> Thu, 27 Jun 2024 13:47:51 +0000

safu (0.53.0-8) unstable; urgency=medium

* Add safu-doc.lintian-overrides.
Expand Down
Loading

0 comments on commit ff7c3bd

Please sign in to comment.