From fc5e4538361f1c7c2b773be2103db322fdf9c35b Mon Sep 17 00:00:00 2001 From: vidplace7 Date: Sun, 5 Jan 2025 06:31:16 -0500 Subject: [PATCH] meshtasticd debian: split libs for PPA --- .github/workflows/build_debian_src.yml | 43 +++++++++++++++++ .github/workflows/main_matrix.yml | 3 ++ .github/workflows/package_ppa.yml | 46 +++++++++++++++++++ .gitignore | 1 + .../{update_changelog.sh => ci_changelog.sh} | 1 + debian/ci_pack_sdeb.sh | 10 ++++ debian/control | 5 +- debian/rules | 14 +++--- debian/source/include-binaries | 1 + debian/source/options | 1 + 10 files changed, 116 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/build_debian_src.yml create mode 100644 .github/workflows/package_ppa.yml rename debian/{update_changelog.sh => ci_changelog.sh} (99%) create mode 100644 debian/ci_pack_sdeb.sh create mode 100644 debian/source/include-binaries create mode 100644 debian/source/options diff --git a/.github/workflows/build_debian_src.yml b/.github/workflows/build_debian_src.yml new file mode 100644 index 0000000000..64caefcc27 --- /dev/null +++ b/.github/workflows/build_debian_src.yml @@ -0,0 +1,43 @@ +name: Build Debian Source Package + +on: workflow_call + +permissions: + contents: write + packages: write + +jobs: + build-debian-src: + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Install deps + shell: bash + run: | + sudo apt-get update -y --fix-missing + sudo apt-get install -y devscripts equivs + + - name: Fetch libdeps, package debian source + run: debian/ci_pack_sdeb.sh + + - name: Get long version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: long_version + + - name: Get short version string + run: echo "version=$(./bin/buildinfo.py short)" >> $GITHUB_OUTPUT + id: short_version + + - name: Store binaries as an artifact + uses: actions/upload-artifact@v4 + with: + name: firmware-debian-${{ steps.long_version.outputs.version }}-src.zip + overwrite: true + path: | + ../meshtasticd_${{ steps.short_version.outputs.version }}* diff --git a/.github/workflows/main_matrix.yml b/.github/workflows/main_matrix.yml index a437411b54..2be58f9d20 100644 --- a/.github/workflows/main_matrix.yml +++ b/.github/workflows/main_matrix.yml @@ -128,6 +128,9 @@ jobs: with: board: ${{ matrix.board }} + package-ppa: + uses: ./.github/workflows/package_ppa.yml + package-raspbian: uses: ./.github/workflows/package_raspbian.yml diff --git a/.github/workflows/package_ppa.yml b/.github/workflows/package_ppa.yml new file mode 100644 index 0000000000..804f2f53d6 --- /dev/null +++ b/.github/workflows/package_ppa.yml @@ -0,0 +1,46 @@ +name: Package Launchpad PPA + +on: + workflow_call: + workflow_dispatch: + +permissions: + contents: write + packages: write + +jobs: + build-debian-src: + uses: ./.github/workflows/build_debian_src.yml + + package-ppa: + runs-on: ubuntu-24.04 + needs: build-debian-src + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: recursive + ref: ${{github.event.pull_request.head.ref}} + repository: ${{github.event.pull_request.head.repo.full_name}} + + - name: Get release version string + run: echo "version=$(./bin/buildinfo.py long)" >> $GITHUB_OUTPUT + id: version + + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + name: firmware-debian-${{ steps.version.outputs.version }}-src.zip + merge-multiple: true + + - name: Install deps + shell: bash + run: | + sudo apt-get update -y --fix-missing + sudo apt-get install -y dput + + - name: Display structure of downloaded files + run: ls -R + + # - name: dput to Launchpad PPA + # run: dput ppa:meshtastic/meshtastic something.changes diff --git a/.gitignore b/.gitignore index 28f9a24cc9..1dc82f9c7f 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ __pycache__ *.swo *~ +libdeps/ venv/ release/ .vscode/extensions.json diff --git a/debian/update_changelog.sh b/debian/ci_changelog.sh similarity index 99% rename from debian/update_changelog.sh rename to debian/ci_changelog.sh index 60af345112..56688f99bd 100644 --- a/debian/update_changelog.sh +++ b/debian/ci_changelog.sh @@ -1,5 +1,6 @@ #!/usr/bin/bash export DEBEMAIL="github-actions[bot]@users.noreply.github.com" + dch --newversion "$(python3 bin/buildinfo.py short)-1" \ --distribution unstable \ "GitHub Actions Automatic version bump" diff --git a/debian/ci_pack_sdeb.sh b/debian/ci_pack_sdeb.sh new file mode 100644 index 0000000000..a21a9583f0 --- /dev/null +++ b/debian/ci_pack_sdeb.sh @@ -0,0 +1,10 @@ +#!/usr/bin/bash +export PLATFORMIO_LIBDEPS_DIR=libdeps + +# Download libraries to `libdeps` +platformio pkg install -e native + +# Build the source deb +debuild -S + +# dput ppa:meshtastic/meshtastic-daily ../meshtastic_${VERSION}_source.changes diff --git a/debian/control b/debian/control index b00c6d78ea..9814933e37 100644 --- a/debian/control +++ b/debian/control @@ -3,8 +3,9 @@ Section: misc Priority: optional Maintainer: Austin Lane Build-Depends: debhelper-compat (= 13), - python3-pip, - python3-venv, + platformio, + python3-protobuf, + python3-grpcio, git, g++, pkg-config, diff --git a/debian/rules b/debian/rules index c60d611a42..48c9cc0963 100755 --- a/debian/rules +++ b/debian/rules @@ -1,17 +1,17 @@ #!/usr/bin/make -f +# export DH_VERBOSE = 1 # Use the "dh" sequencer %: dh $@ +# https://docs.platformio.org/en/latest/envvars.html +PIO_ENV:=\ + PLATFORMIO_LIBDEPS_DIR=libdeps + override_dh_auto_build: - # Terrible hack to use modern platformio to build the native version - # python3 -m venv venv - # . venv/bin/activate - pip install platformio --break-system-packages - platformio run -e native - # deactivate - # rm -rf venv + # Build with platformio + $(PIO_ENV) platformio run -e native # Move the binary and default config to the correct name mv .pio/build/native/program .pio/build/native/meshtasticd cp bin/config-dist.yaml bin/config.yaml diff --git a/debian/source/include-binaries b/debian/source/include-binaries new file mode 100644 index 0000000000..bd350efca6 --- /dev/null +++ b/debian/source/include-binaries @@ -0,0 +1 @@ +libdeps \ No newline at end of file diff --git a/debian/source/options b/debian/source/options new file mode 100644 index 0000000000..0553b485d0 --- /dev/null +++ b/debian/source/options @@ -0,0 +1 @@ +extend-diff-ignore = "\.pio" \ No newline at end of file