From b618ab60e6f487f29f588bb71896f2b67dc65690 Mon Sep 17 00:00:00 2001 From: Martin Schwan Date: Wed, 3 Dec 2025 11:52:40 +0100 Subject: [PATCH 1/4] Add debian package sources Add files for creating a debian package for partup. Signed-off-by: Martin Schwan --- debian/changelog | 5 +++++ debian/control | 31 +++++++++++++++++++++++++++++++ debian/copyright | 8 ++++++++ debian/dirs | 1 + debian/install | 0 debian/rules | 19 +++++++++++++++++++ debian/source/format | 1 + 7 files changed, 65 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/dirs create mode 100644 debian/install create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..7c325ce1 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +partup (3.0.0-1) unstable; urgency=medium + + * Initial packaging + + -- Martin Schwan Wed, 29 Oct 2025 14:07:15 +0100 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..a6baf3fc --- /dev/null +++ b/debian/control @@ -0,0 +1,31 @@ +Source: partup +Section: utils +Priority: optional +Maintainer: Martin Schwan +Build-Depends: + debhelper-compat (=13), + libglib2.0-dev, + libyaml-dev, + libparted-dev, + util-linux, + meson +Standards-Version: 4.7.2 +Homepage: https://github.com/phytec/partup +Vcs-Git: https://github.com/phytec/partup.git +Vcs-Browser: https://github.com/phytec/partup + +Package: partup +Architecture: any +Depends: + libglib2.0-0t64, + libyaml-0-2, + libparted, + util-linux, + udev, + squashfs-tools, + dosfstools, + e2fsprogs, + mtd-utils +Description: partup -- System initialization program + partup is a program used for initializing flash memory on a target device + using a predefined layout. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..116b031d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,8 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0 +Upstream-Name: partup +Upstream-Contact: https://github.com/phytec/partup +Source: https://github.com/phytec/partup + +Files: * +Copyright: Copyright 2025 PHYTEC Messtechnik GmbH +License: GPL-3+ diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 00000000..e7724817 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +usr/bin diff --git a/debian/install b/debian/install new file mode 100644 index 00000000..e69de29b diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..71a79be6 --- /dev/null +++ b/debian/rules @@ -0,0 +1,19 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=1 + +%: + dh $@ + +override_dh_auto_configure: + rm -rf build + meson setup build --prefix=/usr --buildtype=release + +override_dh_auto_build: + meson compile -C build + +override_dh_auto_install: + meson install -C build --destdir=$(shell pwd)/debian/partup + +override_dh_strip: + dh_strip diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) From 5a0242933dcf73a2efdb618b22c0abe400a29551 Mon Sep 17 00:00:00 2001 From: Martin Schwan Date: Wed, 3 Dec 2025 11:54:10 +0100 Subject: [PATCH 2/4] tools: Add script building debian package Add a script and container building a debian package for partup. Signed-off-by: Martin Schwan --- tools/debian-package/.gitignore | 1 + tools/debian-package/Containerfile | 17 ++++++ tools/debian-package/build-debian-package | 68 +++++++++++++++++++++++ 3 files changed, 86 insertions(+) create mode 100644 tools/debian-package/.gitignore create mode 100644 tools/debian-package/Containerfile create mode 100755 tools/debian-package/build-debian-package diff --git a/tools/debian-package/.gitignore b/tools/debian-package/.gitignore new file mode 100644 index 00000000..e316863f --- /dev/null +++ b/tools/debian-package/.gitignore @@ -0,0 +1 @@ +partup_*.deb diff --git a/tools/debian-package/Containerfile b/tools/debian-package/Containerfile new file mode 100644 index 00000000..8a819c1b --- /dev/null +++ b/tools/debian-package/Containerfile @@ -0,0 +1,17 @@ +FROM ubuntu:24.04 + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && \ + apt-get install --yes \ + debhelper \ + git \ + meson \ + libglib2.0-dev \ + libyaml-dev \ + libparted-dev && \ + rm -rf /var/lib/apt/lists/* + +RUN git clone --branch $PARTUP_BRANCH $PARTUP_REPO && \ + cd partup && \ + tar -czf ../partup_$(git describe --tags --abbrev=0 | cut -c 2-).orig.tar.gz . && \ + dpkg-buildpackage -us -uc diff --git a/tools/debian-package/build-debian-package b/tools/debian-package/build-debian-package new file mode 100755 index 00000000..561858f4 --- /dev/null +++ b/tools/debian-package/build-debian-package @@ -0,0 +1,68 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (c) 2025 PHYTEC Messtechnik GmbH +# Author: Martin Schwan + +BRANCH=main +PLATFORM=linux/amd64,linux/arm64 +REPO=https://github.com/phytec/partup + +usage() { + printf "\ +Usage: + $(basename $0) [OPTION…] + +Build partup Debian package for multiple Ubuntu platforms using podman +containers. + +Options: + -b, --branch An optional tag or branch name to use from partup's remote + repository (default \"$BRANCH\") + -p, --platform A comma separated list of platforms to build for + (default \"$PLATFORM\") + -r, --repo The remote URL to clone partup from + (default \"$REPO\") + -h, --help Show help options +" +} + +ARGS=$(getopt -n $(basename $0) -o b:p:r:h -l branch:,platform:,repo:,help -- "$@") +VALID_ARGS=$? +if [ "$VALID_ARGS" != "0" ]; then + usage + exit 2 +fi + +eval set -- "$ARGS" +while : +do + case "$1" in + -b | --branch) BRANCH="$2"; shift 2;; + -p | --platform) PLATFORM="$2"; shift 2;; + -r | --repo) REPO="$2"; shift 2;; + -h | --help) usage; exit 0;; + --) shift; break;; + *) printf "ERROR: Invalid option \"$1\"\n"; usage; exit 2;; + esac +done + +podman build \ + --env PARTUP_BRANCH=$BRANCH \ + --env PARTUP_REPO=$REPO \ + --jobs $(nproc) \ + --manifest partup-deb \ + -t partup-deb:$BRANCH \ + --platform $PLATFORM \ + . + +for P in $(printf "$PLATFORM" | tr ',' ' '); do + ARCH=$(printf "$P" | cut -f2 -d '/') + LATEST_TAG=$(git describe --tags --abbrev=0 | cut -c 2-) + podman run -td --rm --name partup-deb-$ARCH --arch $ARCH partup-deb /bin/sh + DEB_FILE=$(podman exec partup-deb-$ARCH bash -c "ls /*.deb" | head -n 1) + podman cp partup-deb-$ARCH:$DEB_FILE . + podman stop --time 0 partup-deb-$ARCH +done + +podman image rm -f partup-deb +podman manifest rm partup-deb From a41ddd5d48cee283bbaadaacd24236b608059513 Mon Sep 17 00:00:00 2001 From: Martin Schwan Date: Wed, 14 Jan 2026 14:55:57 +0100 Subject: [PATCH 3/4] github: Containerfile: Add debhelper Add debhelper, which is required for building Debian packages. Signed-off-by: Martin Schwan --- .github/Containerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/Containerfile b/.github/Containerfile index cb9cdeea..9aa1daff 100644 --- a/.github/Containerfile +++ b/.github/Containerfile @@ -4,6 +4,7 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && \ apt-get install --yes \ build-essential \ + debhelper \ git \ meson \ libglib2.0-dev \ From 1f291fee7b399cd749bddc593293e543a1b3c52a Mon Sep 17 00:00:00 2001 From: Martin Schwan Date: Wed, 14 Jan 2026 14:56:41 +0100 Subject: [PATCH 4/4] github: workflows: release: Build Debian package Automatically build a Debian package and publish it for every release. Signed-off-by: Martin Schwan --- .github/workflows/release.yml | 49 ++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc606ebd..47af5bc8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -69,11 +69,56 @@ jobs: path: partup-${{ github.ref_name }}-${{ env.ARCH }} if-no-files-found: error + debian-package: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: + - 'linux/amd64' + - 'linux/arm64/v8' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install qemu-user-static + - name: Get architecture + run: | + ARCH=$(echo "${{ matrix.platform }}" | cut -d / -f 2- | tr -d /) + echo "ARCH=$ARCH" >> $GITHUB_ENV + - name: Log in to ghcr.io + uses: redhat-actions/podman-login@v1 + with: + username: ${{ github.actor }} + password: ${{ github.token }} + registry: ghcr.io + - name: Prepare container for ${{ matrix.platform }} + run: | + podman run --name partupci -di --platform ${{ matrix.platform }} -v "$PWD":/partup -w /partup ghcr.io/phytec/partup/partup-ci:latest bash + podman logs partupci + podman exec -i partupci uname -a + - name: Build + run: | + podman exec -i partupci sh -c 'tar -czf ../partup_$(git describe --tags --abbrev=0 | cut -c 2-).orig.tar.gz .' + podman exec -i partupci dpkg-buildpackage -us -uc + DEB_FILE=$(podman exec partupci sh -c "ls /*.deb" | head -n 1) + podman cp partupci:$DEB_FILE . + echo "DEB_FILE=$(basename $DEB_FILE)" >> $GITHUB_ENV + - name: Upload binary + uses: actions/upload-artifact@v4 + with: + name: partup-debian-package-${{ github.ref_name }}-${{ env.ARCH }} + path: ${{ env.DEB_FILE }} + if-no-files-found: error + create-release: runs-on: ubuntu-latest needs: - sources - static-build + - debian-package steps: - name: Checkout repository uses: actions/checkout@v4 @@ -94,7 +139,8 @@ jobs: run: | mv partup-sources-${{ github.ref_name }}/* . mv partup-static-build-${{ github.ref_name }}-*/* . - sha256sum partup-${{ env.VERSION_NUMBER }}.tar.gz partup-${{ github.ref_name }}-* > sha256sum.txt + mv partup-debian-package-${{ github.ref_name }}-*/* . + sha256sum partup-${{ env.VERSION_NUMBER }}.tar.gz partup-${{ github.ref_name }}-* partup_*.deb > sha256sum.txt cat sha256sum.txt - name: Construct changelog for this release run: | @@ -114,4 +160,5 @@ jobs: files: | partup-${{ env.VERSION_NUMBER }}.tar.gz partup-${{ github.ref_name }}-* + partup_*.deb sha256sum.txt