diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c493575..046d35f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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: @@ -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 diff --git a/README.md b/README.md index c8f023d..743d403 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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 diff --git a/ci/build_debs.sh b/ci/build_debs.sh new file mode 100755 index 0000000..d74ac6e --- /dev/null +++ b/ci/build_debs.sh @@ -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 ./ diff --git a/cmake/project.cmake b/cmake/project.cmake index 8c4c7a6..1839559 100644 --- a/cmake/project.cmake +++ b/cmake/project.cmake @@ -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 diff --git a/debian.native/.gitignore b/debian.native/.gitignore new file mode 100644 index 0000000..ba8edb5 --- /dev/null +++ b/debian.native/.gitignore @@ -0,0 +1,10 @@ +/*.substvars +/files +/debhelper-build-stamp +/libsafu0/ +/libsafu-dev/ +/libmock-safu0/ +/safu-doc/ +/.debhelper/ +/tmp/ +/*.debhelper.log diff --git a/debian.native/README.md b/debian.native/README.md new file mode 100644 index 0000000..be4ecf9 --- /dev/null +++ b/debian.native/README.md @@ -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) diff --git a/debian.native/changelog b/debian.native/changelog new file mode 100644 index 0000000..de93a9e --- /dev/null +++ b/debian.native/changelog @@ -0,0 +1,5 @@ +safu (0.0.1) unstable; urgency=medium + + * Dummy release. + + -- Isaac True Mon, 10 Jun 2024 16:53:43 +0200 diff --git a/debian.native/control b/debian.native/control new file mode 100644 index 0000000..0848b22 --- /dev/null +++ b/debian.native/control @@ -0,0 +1,63 @@ +Source: safu +Section: admin +Priority: optional +Maintainer: Isaac True +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. diff --git a/debian.native/copyright b/debian.native/copyright new file mode 100644 index 0000000..5fd2db6 --- /dev/null +++ b/debian.native/copyright @@ -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. diff --git a/debian.native/devdoc-index.md b/debian.native/devdoc-index.md new file mode 100644 index 0000000..78308a5 --- /dev/null +++ b/debian.native/devdoc-index.md @@ -0,0 +1,9 @@ +Developer documentation +========================== + +.. toctree:: + :maxdepth: 1 + :caption: Contents: + + DeveloperManual + documentation diff --git a/debian.native/libmock-safu0.install b/debian.native/libmock-safu0.install new file mode 100644 index 0000000..96dc7cd --- /dev/null +++ b/debian.native/libmock-safu0.install @@ -0,0 +1 @@ +usr/lib/*/libmock_safu.so.* diff --git a/debian.native/libsafu-dev.install b/debian.native/libsafu-dev.install new file mode 100644 index 0000000..368e228 --- /dev/null +++ b/debian.native/libsafu-dev.install @@ -0,0 +1,5 @@ +usr/include/safu +usr/lib/*/cmake +usr/lib/*/pkgconfig +usr/lib/*/libmock_safu.so +usr/lib/*/libsafu.so diff --git a/debian.native/libsafu0.install b/debian.native/libsafu0.install new file mode 100644 index 0000000..fec6e34 --- /dev/null +++ b/debian.native/libsafu0.install @@ -0,0 +1 @@ +usr/lib/*/libsafu.so.* diff --git a/debian.native/not-installed b/debian.native/not-installed new file mode 100644 index 0000000..f37d233 --- /dev/null +++ b/debian.native/not-installed @@ -0,0 +1 @@ +usr/lib/*/test diff --git a/debian.native/rules b/debian.native/rules new file mode 100755 index 0000000..b59a8bb --- /dev/null +++ b/debian.native/rules @@ -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 diff --git a/debian.native/safu-doc.install b/debian.native/safu-doc.install new file mode 100644 index 0000000..1105926 --- /dev/null +++ b/debian.native/safu-doc.install @@ -0,0 +1 @@ +documentation/* /usr/share/doc/safu/ diff --git a/debian.native/safu-doc.lintian-overrides b/debian.native/safu-doc.lintian-overrides new file mode 100644 index 0000000..3286941 --- /dev/null +++ b/debian.native/safu-doc.lintian-overrides @@ -0,0 +1 @@ +safu-doc: zero-byte-file-in-doc-directory [usr/share/doc/safu/style.css] diff --git a/debian.native/source/format b/debian.native/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian.native/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/debian.native/watch b/debian.native/watch new file mode 100644 index 0000000..b9e7f91 --- /dev/null +++ b/debian.native/watch @@ -0,0 +1,2 @@ +version=4 +https://github.com/Elektrobit/safu/tags .*/safu-(\d+).(\d+).(\d+).tar.gz diff --git a/debian/changelog b/debian/changelog index 462e10f..13979b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +safu (0.54.1-1) UNRELEASED; urgency=medium + + * New upstream tag 0.54.1 + + -- Isaac True Thu, 27 Jun 2024 13:47:51 +0000 + safu (0.53.0-8) unstable; urgency=medium * Add safu-doc.lintian-overrides. diff --git a/debian/control b/debian/control index ffe6599..0848b22 100644 --- a/debian/control +++ b/debian/control @@ -18,6 +18,7 @@ Vcs-Browser: https://github.com/Elektrobit/safu Vcs-Git: https://github.com/Elektrobit/safu Package: libsafu0 +Section: libs Architecture: any Depends: ${misc:Depends}, @@ -28,6 +29,7 @@ Description: Common utility API's used in elos and samconf Runtime library package. Package: libmock-safu0 +Section: libs Architecture: any Depends: ${misc:Depends}, @@ -38,6 +40,7 @@ Description: Library of common utility API's used in elos and samconf (mocks) Mock library package. Package: libsafu-dev +Section: libdevel Architecture: any Depends: ${misc:Depends}, @@ -50,6 +53,7 @@ Description: Library of common utility API's used in elos and samconf (developme Development package. Package: safu-doc +Section: doc Architecture: all Depends: ${misc:Depends}, diff --git a/debian/copyright b/debian/copyright index 7440d66..5fd2db6 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1,11 +1,11 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: cmocka_extensions -Upstream-Contact: https://github.com/Elektrobit/cmocka_extensions/issues -Source: https://github.com/Elektrobit/cmocka_extensions +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 + 2023, emlix GmbH License: MIT License: MIT diff --git a/debian/source/format b/debian/source/format index 46ebe02..163aaf8 100644 --- a/debian/source/format +++ b/debian/source/format @@ -1 +1 @@ -3.0 (quilt) \ No newline at end of file +3.0 (quilt)