From 20b1be36e8ec7f83b14a1720ab16dd6d68fb8e27 Mon Sep 17 00:00:00 2001 From: Ghost <166657596+vr-ski@users.noreply.github.com> Date: Thu, 26 Nov 2026 02:40:03 +0200 Subject: [PATCH] add deb package workflow; refactor workflows --- .github/actions/build-and-publish/action.yml | 61 --------- .github/workflows/actions.lock | 25 +++- .github/workflows/cd-release.yml | 30 ----- .github/workflows/main-workflow.yml | 49 ++++++- .github/workflows/release.yml | 123 ++++++++++++++++++ .github/workflows/reusable-cd-dev.yml | 53 -------- .github/workflows/reusable-ci.yml | 12 +- .github/workflows/reusable-deb-build.yml | 59 +++++++++ .github/workflows/reusable-github-release.yml | 83 ++++++++++++ .github/workflows/reusable-pypi-publish.yml | 47 +++++++ .github/workflows/reusable-security.yml | 4 +- .gitignore | 4 + debian/changelog.in | 5 + debian/control | 23 ++++ debian/rules | 16 +++ debian/source/format | 1 + 16 files changed, 436 insertions(+), 159 deletions(-) delete mode 100644 .github/actions/build-and-publish/action.yml delete mode 100644 .github/workflows/cd-release.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/reusable-cd-dev.yml create mode 100644 .github/workflows/reusable-deb-build.yml create mode 100644 .github/workflows/reusable-github-release.yml create mode 100644 .github/workflows/reusable-pypi-publish.yml create mode 100644 debian/changelog.in create mode 100644 debian/control create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/.github/actions/build-and-publish/action.yml b/.github/actions/build-and-publish/action.yml deleted file mode 100644 index aea30f0..0000000 --- a/.github/actions/build-and-publish/action.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: 'Build and Publish Python Package' -description: 'Builds and publishes Python package to specified PyPI repository' - -inputs: - pypi-upload-url: - description: 'Upload repository URL' - required: true - default: 'https://upload.pypi.org/legacy/' - pypi-install-url: - description: 'Install repository URL' - required: true - default: 'https://pypi.org/simple/' - version-override: - description: 'Override version (for dev builds)' - required: false - default: '' - pypi-token: - description: 'PyPI API token' - required: true - -runs: - using: composite - steps: - - name: Checkout - uses: actions/checkout@v7.0.1 - with: - fetch-depth: 0 # Full history for setuptools-scm - - - uses: ./.github/actions/setup-python - with: - python-version: '3.11' - requirements: '.[build]' - - - name: Configure version for dev builds - if: inputs.version-override != '' - shell: bash - run: | - echo "Setting version override: ${{ inputs.version-override }}" - echo "SETUPTOOLS_SCM_PRETEND_VERSION=${{ inputs.version-override }}" >> $GITHUB_ENV - - - name: Build package - shell: bash - run: python -m build - - - name: Verify package - shell: bash - run: twine check dist/* - - - name: Upload to PyPI - shell: bash - run: | - twine upload --repository-url ${{ inputs.pypi-upload-url }} dist/* --verbose - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ inputs.pypi-token }} - - - name: Verify installation - shell: bash - run: | - PACKAGE_NAME=$(python -c "import tomli; print(tomli.load(open('pyproject.toml', 'rb'))['project']['name'])") - pip install --index-url "${{ inputs.pypi-install-url }}" "$PACKAGE_NAME" diff --git a/.github/workflows/actions.lock b/.github/workflows/actions.lock index 4cddb85..80758e8 100644 --- a/.github/workflows/actions.lock +++ b/.github/workflows/actions.lock @@ -3,21 +3,28 @@ # Docs: https://gh.io/actions-lockfile version: 'v0.0.2' workflows: - '.github/workflows/cd-release.yml': + '.github/workflows/main-workflow.yml': - 'actions/checkout@v7.0.1' - - 'actions/setup-python@v7.0.0' - '.github/workflows/reusable-cd-dev.yml': + '.github/workflows/release.yml': - 'actions/checkout@v7.0.1' - - 'actions/setup-python@v7.0.0' '.github/workflows/reusable-ci.yml': - 'actions/checkout@v5.1.0' - 'actions/checkout@v6.1.0' - 'actions/checkout@v7.0.1' - 'actions/setup-python@v7.0.0' - 'codecov/codecov-action@v7.1.1' + '.github/workflows/reusable-deb-build.yml': + - 'actions/checkout@v7.0.1' + - 'actions/upload-artifact@v7.0.2' '.github/workflows/reusable-docs.yml': - 'actions/checkout@v7.0.1' - 'actions/setup-python@v7.0.0' + '.github/workflows/reusable-github-release.yml': + - 'actions/checkout@v7.0.1' + - 'actions/download-artifact@v8.0.2' + '.github/workflows/reusable-pypi-publish.yml': + - 'actions/checkout@v7.0.1' + - 'actions/setup-python@v7.0.0' '.github/workflows/reusable-security.yml': - 'actions/checkout@v7.0.1' - 'actions/setup-python@v7.0.0' @@ -39,6 +46,11 @@ dependencies: commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1' owner_id: 44036562 repo_id: 197814629 + 'actions/download-artifact@v8.0.2': + ref: 'v8.0.2' + commit: 'sha1-9000827ccba6bdab643e8b6fd33ac0654aef8333' + owner_id: 44036562 + repo_id: 192626254 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd': ref: 'v8.0.0' commit: 'sha1-ed597411d8f924073f98dfc5c65a23a2325f34cd' @@ -49,6 +61,11 @@ dependencies: commit: 'sha1-5fda3b95a4ea91299a34e894583c3862153e4b97' owner_id: 44036562 repo_id: 192625525 + 'actions/upload-artifact@v7.0.2': + ref: 'v7.0.2' + commit: 'sha1-cf430e030ddbb5b0abf93d22962f4752f3646cd9' + owner_id: 44036562 + repo_id: 192625955 'codecov/codecov-action@v7.1.1': ref: 'v7.1.1' commit: 'sha1-303a32d7a59b442fa8d48b6a1cc6825c09c847a5' diff --git a/.github/workflows/cd-release.yml b/.github/workflows/cd-release.yml deleted file mode 100644 index 24b82f2..0000000 --- a/.github/workflows/cd-release.yml +++ /dev/null @@ -1,30 +0,0 @@ -# This workflow is managed by gh actions-lock. - -name: CD - Production Release - -on: - push: - tags: - - 'v*' - -jobs: - publish-release: - runs-on: ubuntu-latest - environment: pypi - - steps: - - name: Checkout code - uses: actions/checkout@v7.0.1 - - - name: Extract version from tag - id: version - run: | - VERSION="${GITHUB_REF#refs/tags/v}" - echo "version=$VERSION" - - - name: Build and publish to PyPI - uses: ./.github/actions/build-and-publish - with: - pypi-upload-url: 'https://upload.pypi.org/legacy/' - pypi-install-url: 'https://pypi.org/simple/' - pypi-token: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/main-workflow.yml b/.github/workflows/main-workflow.yml index 2471d8c..e519a4b 100644 --- a/.github/workflows/main-workflow.yml +++ b/.github/workflows/main-workflow.yml @@ -36,9 +36,52 @@ jobs: contains(github.event.head_commit.modified, 'mkdocs.yml') uses: ./.github/workflows/reusable-docs.yml + calculate-version: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checkout code + uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 + + - name: Calculate dev version + id: version + shell: bash + run: | + # Get latest tag or default to 0.0.0 + LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") + printf "Latest tag: ${LATEST_TAG}\n" + + # Remove 'v' prefix if present + LATEST_TAG=${LATEST_TAG#v} + + # Parse version components + IFS='.' read -r MAJOR MINOR PATCH <<< "${LATEST_TAG}" + + # If no tags found, default to 0.0.0 + if [ -z "${MAJOR}" ]; then + MAJOR=0 + MINOR=0 + PATCH=0 + fi + + TIMESTAMP=$(date +%Y%m%d%H%M%S) + DEV_VERSION="${MAJOR}.${MINOR}.${PATCH}.dev${TIMESTAMP}" + + printf "Dev version: ${DEV_VERSION}\n" + printf "version=${DEV_VERSION}" >> "${GITHUB_OUTPUT}" + cd-dev: name: CD Dev Publishing - needs: [ci, security, docs] + needs: [ci, security, docs, calculate-version] if: ${{ !cancelled() }} - uses: ./.github/workflows/reusable-cd-dev.yml - secrets: inherit + uses: $/.github/workflows/reusable-pypi-publish.yml + with: + version: ${{ needs.calculate-version.outputs.version }} + repository-url: https://test.pypi.org/legacy/ + install-url: https://test.pypi.org/simple/ + environment-name: test-pypi + secrets: + PYPI_API_TOKEN: ${{ secrets.TEST_PYPI_API_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bb96db4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,123 @@ +# This workflow is managed by gh actions-lock. + +name: Release + +on: + workflow_dispatch: + inputs: + version: + description: 'Tag name to release (e.g. v1.2.3). Must already exist.' + required: true + type: string + pypi_target: + description: 'PyPI target (none = skip PyPI)' + required: true + default: 'none' + type: choice + options: [none, test, production] + build_deb: + description: 'Build Debian package?' + required: true + default: true + type: boolean + draft_release: + description: 'Create GitHub Release as draft?' + required: true + default: false + type: boolean + +jobs: + prepare: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.split.outputs.version }} + tag: ${{ steps.split.outputs.tag }} + pypi_enabled: ${{ steps.split.outputs.pypi_enabled }} + pypi_repo_url: ${{ steps.split.outputs.pypi_repo_url }} + pypi_install_url: ${{ steps.split.outputs.pypi_install_url }} + steps: + - uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 + + - name: Verify tag and compute routing + id: split + shell: bash + run: | + TAG="${{ inputs.version }}" + + if ! git rev-parse --verify "refs/tags/${TAG}" >/dev/null 2>&1; then + echo "::error::Tag '${TAG}' does not exist. Push it first, then re-run." + exit 1 + fi + + VERSION="${TAG#v}" + TARGET="${{ inputs.pypi_target }}" + + case "$TARGET" in + none) + PYPI_ENABLED=false + REPO_URL="" + INSTALL_URL="" + ;; + test) + PYPI_ENABLED=true + REPO_URL="https://test.pypi.org/legacy/" + INSTALL_URL="https://test.pypi.org/simple/" + ;; + production) + PYPI_ENABLED=true + REPO_URL="https://upload.pypi.org/legacy/" + INSTALL_URL="https://pypi.org/simple/" + ;; + *) + echo "::error::Unknown pypi_target '${TARGET}'" + exit 1 + ;; + esac + + { + echo "tag=${TAG}" + echo "version=${VERSION}" + echo "pypi_enabled=${PYPI_ENABLED}" + echo "pypi_repo_url=${REPO_URL}" + echo "pypi_install_url=${INSTALL_URL}" + } >> "$GITHUB_OUTPUT" + + pypi: + needs: prepare + if: needs.prepare.outputs.pypi_enabled == 'true' + uses: $/.github/workflows/reusable-pypi-publish.yml + with: + version: ${{ needs.prepare.outputs.version }} + repository-url: ${{ needs.prepare.outputs.pypi_repo_url }} + install-url: ${{ needs.prepare.outputs.pypi_install_url }} + environment-name: ${{ inputs.pypi_target == 'test' && 'test-pypi' || 'pypi' }} + secrets: + PYPI_API_TOKEN: ${{ inputs.pypi_target == 'test' && secrets.TEST_PYPI_API_TOKEN || secrets.PYPI_API_TOKEN }} + + deb: + needs: prepare + if: inputs.build_deb + uses: $/.github/workflows/reusable-deb-build.yml + with: + version: ${{ needs.prepare.outputs.version }} + + release: + needs: [prepare, pypi, deb] + if: | + always() && !cancelled() && + needs.prepare.result == 'success' && + (needs.prepare.outputs.pypi_enabled == 'false' || needs.pypi.result == 'success') && + (inputs.build_deb == false || needs.deb.result == 'success') + permissions: + contents: write + uses: $/.github/workflows/reusable-github-release.yml + with: + version: ${{ needs.prepare.outputs.version }} + tag: ${{ needs.prepare.outputs.tag }} + draft: ${{ inputs.draft_release }} + pypi_published: ${{ needs.prepare.outputs.pypi_enabled == 'true' }} + deb_attached: ${{ inputs.build_deb && needs.deb.result == 'success' }} + package_name: tftp_router_flasher + secrets: inherit diff --git a/.github/workflows/reusable-cd-dev.yml b/.github/workflows/reusable-cd-dev.yml deleted file mode 100644 index a1e12b6..0000000 --- a/.github/workflows/reusable-cd-dev.yml +++ /dev/null @@ -1,53 +0,0 @@ -# This workflow is managed by gh actions-lock. - -name: CD - Dev Publishing - -on: - workflow_call: - -env: - TEST_PYPI_UPLOAD_URL: "https://test.pypi.org/legacy/" - TEST_PYPI_INSTALL_URL: "https://test.pypi.org/simple/" - -jobs: - publish-dev: - runs-on: ubuntu-latest - environment: test-pypi - steps: - - name: Checkout code - uses: actions/checkout@v7.0.1 - - - name: Calculate dev version - id: version - shell: bash - run: | - # Get latest tag or default to 0.0.0 - LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") - echo "Latest tag: $LATEST_TAG" - - # Remove 'v' prefix if present - LATEST_TAG=${LATEST_TAG#v} - - # Parse version components - IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_TAG" - - # If no tags found, default to 0.0.0 - if [ -z "$MAJOR" ]; then - MAJOR=0 - MINOR=0 - PATCH=0 - fi - - TIMESTAMP=$(date +%Y%m%d%H%M%S) - DEV_VERSION="${MAJOR}.${MINOR}.${PATCH}.dev${TIMESTAMP}" - - echo "Dev version: $DEV_VERSION" - echo "version=$DEV_VERSION" >> $GITHUB_OUTPUT - - - name: Build and publish to TestPyPI - uses: ./.github/actions/build-and-publish - with: - pypi-upload-url: ${{ env.TEST_PYPI_UPLOAD_URL }} - pypi-install-url: ${{ env.TEST_PYPI_INSTALL_URL }} - version-override: ${{ steps.version.outputs.version }} - pypi-token: ${{ secrets.TEST_PYPI_API_TOKEN }} diff --git a/.github/workflows/reusable-ci.yml b/.github/workflows/reusable-ci.yml index d4e0649..84f0cdb 100644 --- a/.github/workflows/reusable-ci.yml +++ b/.github/workflows/reusable-ci.yml @@ -16,7 +16,7 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - - uses: ./.github/actions/setup-python + - uses: $/.github/actions/setup-python with: python-version: "3.11" # minimum supported version @@ -29,7 +29,7 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - - uses: ./.github/actions/setup-python + - uses: $/.github/actions/setup-python with: python-version: "3.11" # minimum supported version @@ -45,7 +45,7 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - - uses: ./.github/actions/setup-python + - uses: $/.github/actions/setup-python with: python-version: ${{ matrix.python-version }} @@ -63,7 +63,7 @@ jobs: - name: Checkout code uses: actions/checkout@v6.1.0 - - uses: ./.github/actions/setup-python + - uses: $/.github/actions/setup-python with: python-version: ${{ matrix.python-version }} @@ -77,7 +77,7 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - - uses: ./.github/actions/setup-python + - uses: $/.github/actions/setup-python with: python-version: "3.11" @@ -99,7 +99,7 @@ jobs: - name: Checkout code uses: actions/checkout@v5.1.0 - - uses: ./.github/actions/setup-python + - uses: $/.github/actions/setup-python with: python-version: ${{ matrix.python-version }} - name: Build package diff --git a/.github/workflows/reusable-deb-build.yml b/.github/workflows/reusable-deb-build.yml new file mode 100644 index 0000000..d0ed0c1 --- /dev/null +++ b/.github/workflows/reusable-deb-build.yml @@ -0,0 +1,59 @@ +# This workflow is managed by gh actions-lock. + +name: Debian Package + +on: + workflow_call: + inputs: + version: + description: 'PEP 440 version (no v prefix)' + required: true + type: string + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 + + - name: Install Debian build tools + run: | + sudo apt update + sudo apt install -y \ + build-essential fakeroot devscripts debhelper \ + dh-python pybuild-plugin-pyproject python3-pytest python3-pytest-cov \ + python3-all python3-setuptools python3-setuptools-scm python3-psutil + + - name: Render changelog from template + env: + VERSION: ${{ inputs.version }} + MAINTAINER: ${{ vars.DEB_MAINTAINER_EMAIL }} + run: | + DATE=$(date -R) + sed -e "s|@VERSION@|${VERSION}|g" \ + -e "s|@DATE@|${DATE}|g" \ + -e "s|@MAINTAINER@|<${MAINTAINER}>|g" \ + debian/changelog.in > debian/changelog + echo "───────── debian/changelog ─────────" + cat debian/changelog + echo "────────────────────────────────────" + + - name: Build .deb + env: + SETUPTOOLS_SCM_PRETEND_VERSION: ${{ inputs.version }} + run: dpkg-buildpackage -us -uc -b + + - name: Collect artifacts + run: | + mkdir -p "${GITHUB_WORKSPACE}/artifacts" + mv ../*.deb "${GITHUB_WORKSPACE}/artifacts/" + + - name: Upload .deb + uses: actions/upload-artifact@v7.0.2 + with: + name: deb-package + path: artifacts/*.deb + if-no-files-found: error + retention-days: 7 diff --git a/.github/workflows/reusable-github-release.yml b/.github/workflows/reusable-github-release.yml new file mode 100644 index 0000000..91fb9dd --- /dev/null +++ b/.github/workflows/reusable-github-release.yml @@ -0,0 +1,83 @@ +# This workflow is managed by gh actions-lock. + +name: GitHub Release + +on: + workflow_call: + inputs: + version: + description: 'PEP 440 version (no v prefix)' + required: true + type: string + tag: + description: 'Git tag name (e.g. v1.2.3)' + required: true + type: string + draft: + required: true + type: boolean + pypi_published: + required: true + type: boolean + deb_attached: + required: true + type: boolean + package_name: + required: true + type: string + +env: + PACKAGE_NAME: ${{ inputs.package_name }} + +jobs: + create: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v7.0.1 + + - name: Download Debian artifact + if: inputs.deb_attached + uses: actions/download-artifact@v8.0.2 + with: + name: deb-package + path: artifacts + + - name: Assemble release notes + run: | + VERSION="${{ inputs.version }}" + REPO="https://github.com/${{ github.repository }}" + + { + if [[ "${{ inputs.pypi_published }}" == "true" ]]; then + printf "### PyPI" + printf "Published: https://pypi.org/project/${PACKAGE_NAME}/${VERSION}/\n\n" + fi + if [[ "${{ inputs.deb_attached }}" == "true" ]]; then + printf "### Debian Package\n" + for f in artifacts/*.deb; do + [[ -e "${f}" ]] || continue + echo "- [\`$(basename "${f}")\`](${REPO}/releases/download/${{ inputs.tag }}/$(basename "${f}"))" + done + printf "\n" + fi + printf "---\n_Built from commit ${{ github.sha }}_\n" + } | tee release-notes.md + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + DRAFT_FLAG="" + [[ "${{ inputs.draft }}" == "true" ]] && DRAFT_FLAG="--draft" + + ASSETS=() + while IFS= read -r -d '' f; do + ASSETS+=("${f}") + done < <(find artifacts -name '*.deb' -print0 2>/dev/null) + + gh release create "${{ inputs.tag }}" \ + ${DRAFT_FLAG} \ + --target "${{ github.sha }}" \ + --title "${{ github.event.repository.name }} ${{ inputs.tag }}" \ + --notes-file release-notes.md \ + "${ASSETS[@]}" diff --git a/.github/workflows/reusable-pypi-publish.yml b/.github/workflows/reusable-pypi-publish.yml new file mode 100644 index 0000000..702f2b8 --- /dev/null +++ b/.github/workflows/reusable-pypi-publish.yml @@ -0,0 +1,47 @@ +# This workflow is managed by gh actions-lock. + +name: PyPI Publish + +on: + workflow_call: + inputs: + version: { required: true, type: string } + repository-url: { required: true, type: string } + install-url: { required: true, type: string } + environment-name: { required: true, type: string } + secrets: + PYPI_API_TOKEN: { required: true } + +env: + PACKAGE_NAME: tftp_router_flasher + +jobs: + publish: + runs-on: ubuntu-latest + environment: ${{ inputs.environment-name }} + steps: + - uses: actions/checkout@v7.0.1 + with: + fetch-depth: 0 + + - uses: $/.github/actions/setup-python + with: + python-version: '3.11' + requirements: '.[build]' + + - name: Build package + env: + SETUPTOOLS_SCM_PRETEND_VERSION: ${{ inputs.version }} + run: python -m build + + - name: Verify package + run: twine check dist/* + + - name: Upload to PyPI + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: twine upload --repository-url "${{ inputs.repository-url }}" dist/* --verbose + + - name: Verify installation + run: pip install --index-url "${{ inputs.install-url }}" "${PACKAGE_NAME}" diff --git a/.github/workflows/reusable-security.yml b/.github/workflows/reusable-security.yml index 5f367b3..ee63826 100644 --- a/.github/workflows/reusable-security.yml +++ b/.github/workflows/reusable-security.yml @@ -16,7 +16,7 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - - uses: ./.github/actions/setup-python + - uses: $/.github/actions/setup-python with: python-version: "3.11" requirements: ".[security]" @@ -30,7 +30,7 @@ jobs: - name: Checkout code uses: actions/checkout@v7.0.1 - - uses: ./.github/actions/setup-python + - uses: $/.github/actions/setup-python with: python-version: "3.11" requirements: ".[security]" diff --git a/.gitignore b/.gitignore index bf48d42..272889d 100644 --- a/.gitignore +++ b/.gitignore @@ -208,3 +208,7 @@ __marimo__/ # setuptools_scm generated version file src/*/_version.py + +# Debian packaging +# ignore changelog since using template debian/changelog.in +debian/changelog diff --git a/debian/changelog.in b/debian/changelog.in new file mode 100644 index 0000000..367fef5 --- /dev/null +++ b/debian/changelog.in @@ -0,0 +1,5 @@ +tftp-router-flasher (@VERSION@) unstable; urgency=medium + + * Automated release @VERSION@. + + -- TFTP Router Flasher Maintainer @MAINTAINER@ @DATE@ diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..b4ca6ab --- /dev/null +++ b/debian/control @@ -0,0 +1,23 @@ +Source: tftp-router-flasher +Section: python +Priority: optional +Maintainer: vr-ski +Build-Depends: + debhelper-compat (= 13), + dh-python, + pybuild-plugin-pyproject, + python3-all, + python3-setuptools, + python3-setuptools-scm, + python3-pytest, + python3-psutil, +Rules-Requires-Root: no +Standards-Version: 4.7.4.1 +Homepage: https://github.com/vr-ski/TFTPRouterFlasher + +Package: tftp-router-flasher +Architecture: all +Depends: ${python3:Depends}, ${misc:Depends}, python3-psutil +X-Python3-Version: >= 3.8 +Description: TFTP router firmware flasher + Command-line tool for flashing router firmware via TFTP. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..c75e264 --- /dev/null +++ b/debian/rules @@ -0,0 +1,16 @@ +#!/usr/bin/make -f + +%: + dh $@ --with python3 --buildsystem=pybuild + +# Tests are run in reusable-ci.yml; not in the .deb build. +override_dh_auto_test: + true + +# tftpy is not packaged for Python 3 in Debian. Bundle it. +override_dh_auto_install: + dh_auto_install + mkdir -p debian/tftp-router-flasher/usr/lib/python3/dist-packages + pip3 install --no-deps --no-cache-dir --target \ + debian/tftp-router-flasher/usr/lib/python3/dist-packages \ + 'tftpy==0.8.6' diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native)