Linux packaging: Debian package, AppImage script, release workflow
CI / Linux arm64 (push) Waiting to run
CI / Linux x86_64 (push) Waiting to run
CI / ASan + UBSan (push) Waiting to run

- CPack DEB configuration (cmake/Packaging.cmake): dependencies from
  dpkg-shlibdeps, udisks2 recommended, strip.
- AppStream metadata, installed with the desktop file and the icons;
  tools/release.sh adds each release to it.
- tools/appimage.sh: AppImage of the GTK interface and openpu-cli with
  linuxdeploy and its GTK plugin (x86_64 and aarch64).
- Release workflow: .deb, AppImage and openpu-cli tarball for x86_64 and
  arm64, attached to the release of a vX.Y.Z tag, or kept as artifacts
  on a manual run. tools/release.sh edits the release when the workflow
  created it first.
- The GTK interface finds its translations next to the executable
  (../share/locale), for relocatable installs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WDASLCiN764v685boRVYar
This commit is contained in:
yann64andClaude Opus 5.5 committed 2026-11-29 06:17:50 +01:00
1 parent bbc3bb3896
commit ce7316af29
11 files changed
+261 -8

No files matched your search

+83
View File
@@ -0,0 +1,83 @@
# SPDX-License-Identifier: MIT
# Release binaries for Linux x86_64 and arm64: Debian package, AppImage and a tarball of the
# command-line tool. On a vX.Y.Z tag they are attached to the GitHub release (created here if
# tools/release.sh has not created it yet); a manual run keeps them as workflow artifacts.
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
permissions:
contents: write
jobs:
linux:
name: Linux ${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
include:
- arch: x86_64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0 # tags are needed for the version description
- name: Dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake ninja-build pkg-config gettext file desktop-file-utils \
libcurl4-openssl-dev libarchive-dev nlohmann-json3-dev doctest-dev \
libglib2.0-dev libgtkmm-4.0-dev librsvg2-common
- name: Build and test
run: |
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DOPENPU_WERROR=ON -DOPENPU_UI_GTK=ON
cmake --build build
ctest --test-dir build --output-on-failure
- name: Debian package
run: |
cd build && cpack -G DEB
dpkg-deb -I openpu_*.deb
- name: Command-line tool
run: |
version=$(build/src/cli/openpu-cli --version | awk '{print $2}')
mkdir -p "dist/openpu-cli-$version-linux-${{ matrix.arch }}"
cp build/src/cli/openpu-cli LICENSE README.md "dist/openpu-cli-$version-linux-${{ matrix.arch }}/"
strip "dist/openpu-cli-$version-linux-${{ matrix.arch }}/openpu-cli"
tar -C dist -czf "openpu-cli-$version-linux-${{ matrix.arch }}.tar.gz" "openpu-cli-$version-linux-${{ matrix.arch }}"
- name: AppImage
run: tools/appimage.sh "$PWD/build-appimage"
- name: Collect
run: |
mkdir -p out
mv build/openpu_*.deb openpu-cli-*.tar.gz OpenPU-*.AppImage out/
(cd out && sha256sum * > SHA256SUMS-linux-${{ matrix.arch }}.txt && ls -l)
- uses: actions/upload-artifact@v4
with:
name: openpu-linux-${{ matrix.arch }}
path: out/*
- name: Attach to the release
if: startsWith(github.ref, 'refs/tags/v')
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
run: |
gh release view "$TAG" >/dev/null 2>&1 ||
gh release create "$TAG" --verify-tag --title "OpenPU ${TAG#v}" --notes-from-tag ||
gh release view "$TAG" >/dev/null # the other architecture may have created it meanwhile
gh release upload "$TAG" out/* --clobber
+11
View File
@@ -19,6 +19,17 @@ complete; every release is an annotated git tag `vX.Y.Z` (see `tools/release.sh`
- Application icon: an original shield with a "PU" monogram, as SVG, HVIF (embedded in the Haiku - Application icon: an original shield with a "PU" monogram, as SVG, HVIF (embedded in the Haiku
executable) and PNG from 16 to 512 px (installed in the hicolor icon theme on Linux), generated executable) and PNG from 16 to 512 px (installed in the hicolor icon theme on Linux), generated
by `tools/make_icons.py`. by `tools/make_icons.py`.
- Debian package through CPack (dependencies from `dpkg-shlibdeps`, `udisks2` recommended) and
AppStream metadata (`io.github.openpu.OpenPU.metainfo.xml`).
- `tools/appimage.sh`: AppImage of the GTK interface and `openpu-cli` (linuxdeploy + GTK plugin).
- `Release` GitHub workflow: Debian package, AppImage and `openpu-cli` tarball for Linux x86_64
and arm64, attached to the release of every `vX.Y.Z` tag.
### Changed
- The GTK interface looks for its translations in `../share/locale` next to the executable first,
so that relocatable installs (AppImage) are translated.
- `tools/release.sh` adds the release to the AppStream metadata and updates a GitHub release
that the release workflow created first.
### Fixed ### Fixed
- Translations were installed in `/<language>/LC_MESSAGES` instead of the locale directory. - Translations were installed in `/<language>/LC_MESSAGES` instead of the locale directory.
+4
View File
@@ -55,3 +55,7 @@ if(OPENPU_BUILD_TESTS)
enable_testing() enable_testing()
add_subdirectory(tests) add_subdirectory(tests)
endif() endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Haiku") # Haiku packages are built from a HaikuPorts recipe
include(cmake/Packaging.cmake)
endif()
+17 -2
View File
@@ -25,8 +25,9 @@ It is an alternative to the official "Peugeot Update" application (Windows/macOS
- [x] Haiku: core library, CLI and USB support (Storage Kit), validated in a Haiku R1/beta6 VM - [x] Haiku: core library, CLI and USB support (Storage Kit), validated in a Haiku R1/beta6 VM
- [x] Haiku UI (Interface Kit): complete workflow, preferences, new-version check - [x] Haiku UI (Interface Kit): complete workflow, preferences, new-version check
- [x] GitHub Actions continuous integration (Linux x86_64 + arm64) - [x] GitHub Actions continuous integration (Linux x86_64 + arm64)
- [ ] Linux packages: `.deb`, Flatpak and AppImage; Haiku: `.hpkg` - [x] Debian package (`cpack -G DEB`)
- [ ] x86_64 + arm64 binaries attached to every release (from 1.0.0 on) - [ ] AppImage (`tools/appimage.sh`, not validated yet), Flatpak; Haiku: `.hpkg`
- [ ] x86_64 + arm64 binaries attached to every release (from 1.0.0 on): release workflow ready
## Architecture ## Architecture
``` ```
@@ -54,6 +55,20 @@ tools/e2e-usb.sh ../build-openpu/debug/src/cli/openpu-cli --license X.key update
When running from the build tree, `OPENPU_LOCALEDIR=../build-openpu/debug/locale` lets the When running from the build tree, `OPENPU_LOCALEDIR=../build-openpu/debug/locale` lets the
interface find its translations. interface find its translations.
## Packages (Linux)
```sh
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DOPENPU_UI_GTK=ON
cmake --build build && (cd build && cpack -G DEB) # build/openpu_<version>_<arch>.deb
tools/appimage.sh # ./OpenPU-<version>-<arch>.AppImage
```
The Debian package gets its dependencies from `dpkg-shlibdeps` and recommends `udisks2`, which
formats and mounts the USB stick. `tools/appimage.sh` downloads linuxdeploy and its GTK plugin
into `~/.cache/openpu-appimage`.
The `Release` GitHub workflow builds the Debian package, the AppImage and a `openpu-cli` tarball
for x86_64 and arm64. On a `vX.Y.Z` tag it attaches them to the release, and a manual run keeps
them as workflow artifacts.
## Building (Haiku) ## Building (Haiku)
```sh ```sh
pkgman install cmake ninja curl_devel libarchive_devel nlohmann_json gettext gettext_libintl_devel pkgman install cmake ninja curl_devel libarchive_devel nlohmann_json gettext gettext_libintl_devel
+28
View File
@@ -0,0 +1,28 @@
# SPDX-License-Identifier: MIT
# Debian package (cpack -G DEB). Dependencies are computed by dpkg-shlibdeps from the binaries,
# so the package matches the distribution it was built on.
set(CPACK_PACKAGE_NAME openpu)
set(CPACK_PACKAGE_VENDOR "OpenPU contributors")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Download Peugeot head unit updates and prepare the USB stick")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/yann64/openpu")
set(CPACK_RESOURCE_FILE_LICENSE ${PROJECT_SOURCE_DIR}/LICENSE)
set(CPACK_PACKAGE_INSTALL_DIRECTORY openpu)
set(CPACK_STRIP_FILES ON)
set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) # openpu_<version>_<arch>.deb
set(CPACK_DEBIAN_PACKAGE_SECTION utils)
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "OpenPU contributors <https://github.com/yann64/openpu>")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION
"Download Peugeot head unit updates and prepare the USB stick\n\
OpenPU downloads the firmware and navigation map updates of Peugeot head units\n\
(NAC, RCC, AIO, Crony) and prepares the installation USB stick: FAT32\n\
formatting, license and update files. Graphical interface (GTK 4) and\n\
command-line tool. Independent project, not affiliated with Stellantis or Peugeot.")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
# UDisks2 formats and mounts the stick; without it only `openpu-cli write-dir` works.
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "udisks2")
set(CPACK_SOURCE_GENERATOR TGZ)
set(CPACK_SOURCE_IGNORE_FILES "/\\\\.git/" "/build/" "\\\\.swp$")
include(CPack)
+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-License-Identifier: MIT -->
<component type="desktop-application">
<id>io.github.openpu.OpenPU</id>
<metadata_license>MIT</metadata_license>
<project_license>MIT</project_license>
<name>OpenPU</name>
<summary>Download head unit updates and prepare the USB stick</summary>
<summary xml:lang="fr">Télécharger les mises à jour de l'autoradio et préparer la clé USB</summary>
<description>
<p>
OpenPU downloads the firmware and navigation map updates of Peugeot head units (NAC, RCC,
AIO, Crony) and prepares the installation USB stick: FAT32 formatting, license and update
files. Downloads resume where they stopped.
</p>
<p>
Independent project, not affiliated with Stellantis or Peugeot.
</p>
</description>
<launchable type="desktop-id">io.github.openpu.OpenPU.desktop</launchable>
<url type="homepage">https://github.com/yann64/openpu</url>
<url type="bugtracker">https://github.com/yann64/openpu/issues</url>
<developer id="io.github.yann64">
<name>yann64 and the OpenPU contributors</name>
</developer>
<content_rating type="oars-1.1"/>
<categories>
<category>Utility</category>
</categories>
<requires>
<internet>always</internet>
</requires>
<releases>
<release version="0.2.0" date="2026-11-28"/>
<release version="0.1.0" date="2026-11-28"/>
</releases>
</component>
+2 -1
View File
@@ -1,3 +1,4 @@
add_executable(openpu-cli main.cpp) add_executable(openpu-cli main.cpp)
target_link_libraries(openpu-cli PRIVATE openpu_core openpu_warnings) target_link_libraries(openpu-cli PRIVATE openpu_core openpu_warnings)
install(TARGETS openpu-cli RUNTIME DESTINATION bin) include(GNUInstallDirs)
install(TARGETS openpu-cli RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+2
View File
@@ -16,6 +16,8 @@ target_compile_options(openpu PRIVATE -Wno-shadow -Wno-conversion)
install(TARGETS openpu RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS openpu RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES io.github.openpu.OpenPU.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) install(FILES io.github.openpu.OpenPU.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
install(FILES ${PROJECT_SOURCE_DIR}/data/io.github.openpu.OpenPU.metainfo.xml
DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
# Application icon (data/icons, generated by tools/make_icons.py), installed in the hicolor theme # Application icon (data/icons, generated by tools/make_icons.py), installed in the hicolor theme
# and mirrored in the build tree so that an uninstalled binary finds it too. # and mirrored in the build tree so that an uninstalled binary finds it too.
+24 -3
View File
@@ -5,9 +5,32 @@
#include <clocale> #include <clocale>
#include <cstdlib> #include <cstdlib>
#include <filesystem>
#include <string>
#include <system_error>
#include <glibmm/i18n.h> #include <glibmm/i18n.h>
#include <gtkmm/application.h> #include <gtkmm/application.h>
namespace {
/// Translations directory: OPENPU_LOCALEDIR (build tree), else <prefix>/share/locale next to the
/// executable when it exists (relocatable installs such as the AppImage), else the configured one.
std::string localeDir()
{
if (const char* dir = std::getenv("OPENPU_LOCALEDIR")) // NOLINT(concurrency-mt-unsafe): no thread yet
return dir;
std::error_code ec;
const auto exe = std::filesystem::read_symlink("/proc/self/exe", ec);
if (!ec) {
const auto dir = exe.parent_path().parent_path() / "share" / "locale";
if (std::filesystem::is_directory(dir, ec))
return dir.string();
}
return OPENPU_LOCALEDIR;
}
} // namespace
int main(int argc, char* argv[]) int main(int argc, char* argv[])
{ {
// A language chosen in the settings overrides the session language (gettext reads LANGUAGE). // A language chosen in the settings overrides the session language (gettext reads LANGUAGE).
@@ -19,9 +42,7 @@ int main(int argc, char* argv[])
// dismissed: the window reports unreadable settings itself // dismissed: the window reports unreadable settings itself
} }
(void)std::setlocale(LC_ALL, ""); // NOLINT(concurrency-mt-unsafe): no thread yet (void)std::setlocale(LC_ALL, ""); // NOLINT(concurrency-mt-unsafe): no thread yet
// OPENPU_LOCALEDIR lets a build-tree binary find its translations. bindtextdomain(GETTEXT_PACKAGE, localeDir().c_str());
const char* localeDir = std::getenv("OPENPU_LOCALEDIR"); // NOLINT(concurrency-mt-unsafe)
bindtextdomain(GETTEXT_PACKAGE, localeDir != nullptr ? localeDir : OPENPU_LOCALEDIR);
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
textdomain(GETTEXT_PACKAGE); textdomain(GETTEXT_PACKAGE);
+42
View File
@@ -0,0 +1,42 @@
#!/bin/sh
# SPDX-License-Identifier: MIT
# Builds OpenPU-<version>-<arch>.AppImage (GTK interface + openpu-cli) with linuxdeploy and its GTK
# plugin, in the current directory. Runs on x86_64 and aarch64; no FUSE needed.
#
# usage: tools/appimage.sh [build-dir]
# The linuxdeploy tools are downloaded once into $OPENPU_APPIMAGE_TOOLS (default ~/.cache/openpu-appimage).
set -eu
SRC=$(cd "$(dirname "$0")/.." && pwd)
BUILD=${1:-$SRC/../build-openpu/appimage}
OUT=$(pwd)
ARCH=$(uname -m)
TOOLS=${OPENPU_APPIMAGE_TOOLS:-$HOME/.cache/openpu-appimage}
LINUXDEPLOY=$TOOLS/linuxdeploy-$ARCH.AppImage
GTK_PLUGIN=$TOOLS/linuxdeploy-plugin-gtk.sh
mkdir -p "$TOOLS"
fetch() { # url file
[ -s "$2" ] || { curl -fsSL -o "$2.part" "$1" && mv "$2.part" "$2"; }
chmod +x "$2"
}
fetch "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$ARCH.AppImage" "$LINUXDEPLOY"
fetch "https://raw.githubusercontent.com/linuxdeploy/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh" "$GTK_PLUGIN"
cmake -S "$SRC" -B "$BUILD" -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr \
-DOPENPU_UI_GTK=ON -DOPENPU_BUILD_TESTS=OFF
cmake --build "$BUILD"
APPDIR=$BUILD/AppDir
rm -rf "$APPDIR"
DESTDIR=$APPDIR cmake --install "$BUILD" --strip
VERSION=$("$APPDIR/usr/bin/openpu-cli" --version | awk '{print $2}')
ID=io.github.openpu.OpenPU
cd "$OUT"
# linuxdeploy finds its plugins next to itself or in PATH.
PATH=$TOOLS:$PATH APPIMAGE_EXTRACT_AND_RUN=1 DEPLOY_GTK_VERSION=4 LINUXDEPLOY_OUTPUT_VERSION=$VERSION \
"$LINUXDEPLOY" --appdir "$APPDIR" --plugin gtk --output appimage \
--executable "$APPDIR/usr/bin/openpu" --executable "$APPDIR/usr/bin/openpu-cli" \
--desktop-file "$APPDIR/usr/share/applications/$ID.desktop" \
--icon-file "$APPDIR/usr/share/icons/hicolor/256x256/apps/$ID.png"
ls -l "$OUT"/OpenPU-*.AppImage
+11 -2
View File
@@ -25,7 +25,11 @@ grep -q "^project(openpu VERSION $VERSION " CMakeLists.txt || { echo "cannot upd
sed -i "s/^## \[Unreleased\]$/## [Unreleased]\n\n## [$VERSION] - $TODAY/" CHANGELOG.md sed -i "s/^## \[Unreleased\]$/## [Unreleased]\n\n## [$VERSION] - $TODAY/" CHANGELOG.md
sed -i "s|^\[Unreleased\]: \(.*\)/compare/v[0-9.]*\.\.\.HEAD$|[Unreleased]: \1/compare/v$VERSION...HEAD\n[$VERSION]: \1/releases/tag/v$VERSION|" CHANGELOG.md sed -i "s|^\[Unreleased\]: \(.*\)/compare/v[0-9.]*\.\.\.HEAD$|[Unreleased]: \1/compare/v$VERSION...HEAD\n[$VERSION]: \1/releases/tag/v$VERSION|" CHANGELOG.md
git add CMakeLists.txt CHANGELOG.md # AppStream metadata lists the releases, newest first.
sed -i "s|^ <releases>$| <releases>\n <release version=\"$VERSION\" date=\"$TODAY\"/>|" data/io.github.openpu.OpenPU.metainfo.xml
grep -q "<release version=\"$VERSION\"" data/io.github.openpu.OpenPU.metainfo.xml || { echo "cannot update the metainfo" >&2; exit 1; }
git add CMakeLists.txt CHANGELOG.md data/io.github.openpu.OpenPU.metainfo.xml
# RELEASE_TRAILER: optional trailer lines appended to the release commit message (e.g. co-authors). # RELEASE_TRAILER: optional trailer lines appended to the release commit message (e.g. co-authors).
git commit -q -m "release: v$VERSION" ${RELEASE_TRAILER:+-m "$RELEASE_TRAILER"} git commit -q -m "release: v$VERSION" ${RELEASE_TRAILER:+-m "$RELEASE_TRAILER"}
# Plain string comparison (not a regex: "[" and "." in the heading would be special). # Plain string comparison (not a regex: "[" and "." in the heading would be special).
@@ -43,7 +47,12 @@ done
GH=$(command -v gh || command -v gh.exe || true) GH=$(command -v gh || command -v gh.exe || true)
[ -z "$GH" ] && [ -x "/c/Program Files/GitHub CLI/gh.exe" ] && GH="/c/Program Files/GitHub CLI/gh.exe" [ -z "$GH" ] && [ -x "/c/Program Files/GitHub CLI/gh.exe" ] && GH="/c/Program Files/GitHub CLI/gh.exe"
if [ -n "$GH" ]; then if [ -n "$GH" ]; then
printf '%s\n' "$NOTES" | "$GH" release create "v$VERSION" --verify-tag --title "OpenPU $VERSION" --notes-file - # The release workflow may have created the release already (to attach the binaries).
if "$GH" release view "v$VERSION" >/dev/null 2>&1; then
printf '%s\n' "$NOTES" | "$GH" release edit "v$VERSION" --title "OpenPU $VERSION" --notes-file -
else
printf '%s\n' "$NOTES" | "$GH" release create "v$VERSION" --verify-tag --title "OpenPU $VERSION" --notes-file -
fi
else else
echo "gh not found: create the GitHub release for v$VERSION by hand" >&2 echo "gh not found: create the GitHub release for v$VERSION by hand" >&2
fi fi