From 8aa680066f46af423f8ba81fe8dec248828d9d74 Mon Sep 17 00:00:00 2001 From: Iuliu Antoniu-Popovici Date: Tue, 10 Nov 2026 13:59:15 +0200 Subject: [PATCH 1/6] ci: refactor debian build Refactor CI for debian build. Now using the shared action instead of local script. Restructure folders to follow the shared action convention. Adding workflow dispatch event for validaiton purpose. Signed-off-by: Lewluu --- .github/workflows/build_gt.yml | 118 ++++++++++-------- CI/gt_deb_scripts/README.md | 87 ------------- CI/gt_deb_scripts/build-gt-deb.sh | 64 ---------- CI/gt_deb_scripts/debian/changelog.template | 5 - packaging/debian/changelog | 5 + .../debian/control | 8 +- .../debian/copyright | 0 {CI/gt_deb_scripts => packaging}/debian/rules | 4 +- .../debian/source/format | 0 9 files changed, 79 insertions(+), 212 deletions(-) delete mode 100644 CI/gt_deb_scripts/README.md delete mode 100755 CI/gt_deb_scripts/build-gt-deb.sh delete mode 100644 CI/gt_deb_scripts/debian/changelog.template create mode 100644 packaging/debian/changelog rename CI/gt_deb_scripts/debian/control.template => packaging/debian/control (77%) rename {CI/gt_deb_scripts => packaging}/debian/copyright (100%) rename {CI/gt_deb_scripts => packaging}/debian/rules (82%) rename {CI/gt_deb_scripts => packaging}/debian/source/format (100%) diff --git a/.github/workflows/build_gt.yml b/.github/workflows/build_gt.yml index 9cde9de..623a6b5 100644 --- a/.github/workflows/build_gt.yml +++ b/.github/workflows/build_gt.yml @@ -1,6 +1,9 @@ name: Build GT on: + pull_request: + branches: + - main workflow_dispatch: inputs: version: @@ -15,8 +18,10 @@ on: env: PACKAGE_NAME: gt - APP_NAME: gt-${{ github.event.inputs.version }} - DEB_SCRIPT_LOCATION: repo-scripts + APP_NAME: gt-${{ github.event_name == 'pull_request' && '1.0.0' || inputs.version }} + VERSION: ${{ github.event_name == 'pull_request' && '1.0.0' || inputs.version }} + CLOUDSMITH_UPLOAD: ${{ github.event_name == 'pull_request' && 'true' || inputs.cloudsmith_upload }} + CLOUDSMITH_REPO: ${{ github.event_name == 'pull_request' && secrets.CLOUDSMITH_TEST_REPO || 'adi/kuiper-internal' }} permissions: id-token: write @@ -28,59 +33,76 @@ jobs: fail-fast: false matrix: include: - - docker_image: arm64v8/debian:trixie - distro: debian13 - architecture: arm64 - platform_flag: "" - - docker_image: arm32v7/debian:trixie - distro: debian13 - architecture: armhf + - architecture: arm64 + container: docker.cloudsmith.io/adi/containers/kuiper_basic_64:latest + - architecture: armhf + container: docker.cloudsmith.io/adi/containers/kuiper_basic_32:latest platform_flag: "--platform linux/arm/v7" - + - architecture: arm64 + container: debian:latest + - architecture: armhf + container: debian:latest + platform_flag: "--platform linux/arm/v7" + container: ${{ matrix.architecture == 'arm64' && matrix.container || '' }} steps: - name: Download GT source code - uses: actions/checkout@v6 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: repository: linux-usb-gadgets/gt path: ${{env.APP_NAME}} - - - name: Checkout gt scripts - uses: actions/checkout@v6 + - name: Checkout packaging files + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: - sparse-checkout: CI/gt_deb_scripts + sparse-checkout: packaging sparse-checkout-cone-mode: false path: repo-scripts - - - name: Move gt_deb_scripts to workspace root + - name: Add packaging/ to GT source tree + # Upstream gt already ships a packaging/ dir with only the RPM files + # (gt.spec, gt.manifest), so merge our packaging/debian into it + # instead of copying the dir over it. run: | - mv repo-scripts/CI/gt_deb_scripts $GITHUB_WORKSPACE/gt_deb_scripts - rm -rf repo-scripts - - - name: Start persistent container + mkdir -p "${{env.APP_NAME}}/packaging" + cp -r repo-scripts/packaging/. "${{env.APP_NAME}}/packaging/" + ls "${{env.APP_NAME}}/packaging/debian" + # debug: show what the deb build will see + ls -la "${{env.APP_NAME}}" + ls "${{env.APP_NAME}}/source" | head + - name: Install bootstrap dependencies - arm64 + if: ${{ matrix.architecture == 'arm64' }} + run: apt-get update && apt-get install -y curl ca-certificates sudo + # The shared-action is compatible only with amd64/arm64 - armhf runs the + # same build-deb.sh manually inside an emulated container. + - name: Build GT deb - arm64 + if: ${{ matrix.architecture == 'arm64' }} + uses: analogdevicesinc/shared-actions/deb-generator-action@main + with: + working-directory: ${{env.APP_NAME}} + ignore-path: | + packaging + control-path: packaging/debian + version: ${{ env.VERSION }} + - name: Build GT deb - armhf + if: ${{ matrix.architecture == 'armhf' }} + env: + VERSION: ${{ env.VERSION }} run: | - docker run -d \ + docker run --rm \ ${{matrix.platform_flag}} \ - --name ${{matrix.distro}}-${{matrix.architecture}} \ - -v "$GITHUB_WORKSPACE/${{env.APP_NAME}}:/workspace/${{env.APP_NAME}}" \ - -v "$GITHUB_WORKSPACE/gt_deb_scripts:/workspace/gt_deb_scripts" \ - -w /workspace \ - ${{matrix.docker_image}} tail -f /dev/null - - - name: Install dependencies - run: | - docker exec ${{matrix.distro}}-${{matrix.architecture}} sh -c "apt-get update && apt-get install -y debhelper devscripts build-essential wget cmake libusbgx-dev libconfig-dev libglib2.0-dev gettext-base" - - - name: Build GT - run: | - docker exec ${{matrix.distro}}-${{matrix.architecture}} sh -c "gt_deb_scripts/build-gt-deb.sh ${{env.PACKAGE_NAME}} ${{github.event.inputs.version}} ${{matrix.architecture}}" - - - name: Copy debian artifacts from container to host - run: | - docker cp ${{matrix.distro}}-${{matrix.architecture}}:/workspace/. ./artifacts/ - ls -la ./artifacts/ - + -e VERSION \ + -e GITHUB_WORKSPACE=/workspace \ + -e WORKING_DIRECTORY="/workspace/${{env.APP_NAME}}" \ + -e CONTROL_PATH=packaging/debian \ + -e IGNORE_PATH=packaging \ + -v "$GITHUB_WORKSPACE:/workspace" \ + -w "/workspace/${{env.APP_NAME}}" \ + ${{matrix.container}} /bin/bash -c " + set -e + apt-get update && apt-get install -y git curl ca-certificates sudo + git clone https://github.com/analogdevicesinc/shared-actions /tmp/shared-actions + /tmp/shared-actions/deb-generator-action/build-deb.sh + " - name: Upload GT debian package - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 with: name: ${{ env.APP_NAME }}-${{ matrix.architecture }} path: | @@ -89,21 +111,19 @@ jobs: artifacts/${{ env.PACKAGE_NAME }}*.debian.tar.xz artifacts/${{ env.PACKAGE_NAME }}*.orig.tar.gz if-no-files-found: error - - name: Authenticate with Cloudsmith via OIDC - if: success() && github.event.inputs.cloudsmith_upload == 'true' - uses: cloudsmith-io/cloudsmith-cli-action@v2.0.2 + if: success() && env.CLOUDSMITH_UPLOAD == 'true' + uses: cloudsmith-io/cloudsmith-cli-action@92b1383b22bbd36d804b858f273abcdf4d349f6b # v3 with: oidc-namespace: adi oidc-service-slug: ${{ secrets.CLOUDSMITH_SERVICE_SLUG }} - - name: Upload debian package to Cloudsmith - if: success() && github.event.inputs.cloudsmith_upload == 'true' && env.CLOUDSMITH_API_KEY != '' + if: success() && env.CLOUDSMITH_UPLOAD == 'true' && env.CLOUDSMITH_API_KEY != '' working-directory: ./artifacts run: | pip install --break-system-packages cloudsmith-cli for f in ${{env.PACKAGE_NAME}}*.dsc ${{env.PACKAGE_NAME}}*.orig.tar.gz ${{env.PACKAGE_NAME}}*.debian.tar.xz; do [ -f "$f" ] || continue - cloudsmith push raw -SW --republish adi/kuiper-internal "$f" + cloudsmith push raw -SW --republish ${{ env.CLOUDSMITH_REPO }} "$f" done - cloudsmith push deb -SW --republish "adi/kuiper-internal/debian/trixie" ${{env.PACKAGE_NAME}}_*.deb + cloudsmith push deb -SW --republish "${{ env.CLOUDSMITH_REPO }}/debian/trixie" ${{env.PACKAGE_NAME}}_*.deb diff --git a/CI/gt_deb_scripts/README.md b/CI/gt_deb_scripts/README.md deleted file mode 100644 index 07a5cdd..0000000 --- a/CI/gt_deb_scripts/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# GT Debian Package Builder - -This directory contains the infrastructure to build Debian packages for [gt (USB Gadget Tool)](https://github.com/linux-usb-gadgets/gt) using debhelper. - -## Overview - -The build system: -1. Builds gt using cmake -2. Creates a `.deb` package with debhelper -3. Generates source package files (`.orig.tar.gz`, `.debian.tar.xz`, `.dsc`) - -## Prerequisites - -```bash -sudo apt-get install debhelper devscripts build-essential wget cmake libusbgx-dev libconfig-dev libglib2.0-dev gettext-base -``` - -Download/checkout the `gt_deb_scripts` directory. - -## Usage - -### Building the Package - -```bash -./build-gt-deb.sh [package_name] [version] [architecture] -``` - -Parameters: -- `package_name`: Name of the package (default: `gt`) -- `version`: Package version (default: `1.0.0`) - - Follow semantic versioning (e.g., `1.0.0`, `2.1.3`) -- `architecture`: Target architecture (default: `any` for host arch) - - Common values: `amd64` (64-bit), `i386` (32-bit x86), `arm64` (64-bit ARM), `armhf` (32-bit ARM) - -Note: Always builds from the master branch. - -### Examples - -```bash -# Build with default version for host architecture -./build-gt-deb.sh - -# Build version 1.0.0 for 64-bit -./build-gt-deb.sh gt 1.0.0 amd64 - -# Build version 1.0.0 for 32-bit x86 -./build-gt-deb.sh gt 1.0.0 i386 - -# Build version 2.0.0 for 64-bit ARM -./build-gt-deb.sh gt 2.0.0 arm64 - -# Build version 1.0.0 for 32-bit ARM -./build-gt-deb.sh gt 1.0.0 armhf -``` - -## Output Files - -The build process generates: -- `gt_.orig.tar.gz` - Upstream source tarball -- `gt_-1.debian.tar.xz` - Debian packaging files -- `gt_-1.dsc` - Debian source package descriptor -- `gt_-1_amd64.deb` - Binary package -- `gt_-1_amd64.buildinfo` - Build information -- `gt_-1_amd64.changes` - Changes file for upload - -## Package Contents - -The package installs: -- `/usr/bin/gt` - The gt command-line tool -- `/etc/gt/gt.conf` - Default configuration file -- `/usr/share/bash-completion/completions/gt` - Bash completion script - -## Dependencies - -The gt package runtime dependencies are automatically resolved via `${shlibs:Depends}` during the build process. Key libraries include: -- `libusbgx` - USB gadget configuration library -- `libconfig` - Configuration file library -- `libglib2.0` - GLib library - -## Usage with adi-scripts - -The `adi-scripts` package should depend on this `gt` package to ensure the USB gadget functionality works properly. - -Add to adi-scripts debian/control: -``` -Depends: gt (>= 1.0.0), ... -``` diff --git a/CI/gt_deb_scripts/build-gt-deb.sh b/CI/gt_deb_scripts/build-gt-deb.sh deleted file mode 100755 index 731c5ec..0000000 --- a/CI/gt_deb_scripts/build-gt-deb.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -e - -# Script that generates gt .deb package and source files using debhelper - -PACKAGE=${1:-gt} # Default to gt, or specify package name as first argument -VERSION=${2:-1.0.0} # Default to version 1.0.0 -ARCHITECTURE=${3:-any} # Default to any (host architecture), or specify: amd64, arm64, armhf, i386 - -WORK_DIR="${PACKAGE}-${VERSION}" -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" - -if [ ! -d "${WORK_DIR}" ]; then - echo "Error: Source directory '${WORK_DIR}' not found." - echo "Please ensure the gt source code is checked out to '${WORK_DIR}'." - exit 1 -fi - -# Create the orig tarball with exclusions -echo "Creating source tarball with exclusions..." -tar czf ${PACKAGE}_${VERSION}.orig.tar.gz \ - --exclude='.git' \ - --exclude='debian' \ - ${WORK_DIR} - - -# Copy debian directory into the extracted source tree -cp -r ${SCRIPT_DIR}/debian ${WORK_DIR}/ - -# Substitute variables in templates -cd ${WORK_DIR} - -# Export all variables for envsubst and debian/rules -export VERSION ARCHITECTURE PACKAGE -export DATE=$(date -R) - -# Create changelog entry -CHANGELOG_ENTRY="Build from master branch " -export CHANGELOG_ENTRY - -# Substitute templates -envsubst < debian/control.template > debian/control -envsubst < debian/changelog.template > debian/changelog - -# Remove template files -rm debian/*.template - -# Build package using debhelper (builds both binary and source packages) -echo "Building packages for architecture: ${ARCHITECTURE}..." -if [ "${ARCHITECTURE}" = "any" ]; then - # Build for host architecture - dpkg-buildpackage -us -uc -else - # Build for specific architecture - dpkg-buildpackage -us -uc -a ${ARCHITECTURE} -fi - -cd .. - -echo "" -echo "Build complete! Generated files:" -echo " - ${PACKAGE}_${VERSION}.orig.tar.gz (upstream source)" -echo " - ${PACKAGE}_${VERSION}-1.debian.tar.xz (debian files)" -echo " - ${PACKAGE}_${VERSION}-1.dsc (source descriptor)" -echo " - ${PACKAGE}_${VERSION}-1_${ARCHITECTURE}.deb (binary package)" diff --git a/CI/gt_deb_scripts/debian/changelog.template b/CI/gt_deb_scripts/debian/changelog.template deleted file mode 100644 index 1fa7bbc..0000000 --- a/CI/gt_deb_scripts/debian/changelog.template +++ /dev/null @@ -1,5 +0,0 @@ -${PACKAGE} (${VERSION}-1) stable; urgency=medium - - * ${CHANGELOG_ENTRY} - - -- Engineerzone ${DATE} diff --git a/packaging/debian/changelog b/packaging/debian/changelog new file mode 100644 index 0000000..4718bbf --- /dev/null +++ b/packaging/debian/changelog @@ -0,0 +1,5 @@ +gt (@VERSION@) UNRELEASED; urgency=low + + * Automated package build. + + -- EngineerZone @DATE@ diff --git a/CI/gt_deb_scripts/debian/control.template b/packaging/debian/control similarity index 77% rename from CI/gt_deb_scripts/debian/control.template rename to packaging/debian/control index 0308621..5616b41 100644 --- a/CI/gt_deb_scripts/debian/control.template +++ b/packaging/debian/control @@ -1,13 +1,13 @@ -Source: ${PACKAGE} +Source: gt Section: utils Priority: optional -Maintainer: Engineerzone +Maintainer: EngineerZone Build-Depends: debhelper-compat (= 13), cmake, libusbgx-dev, libconfig-dev, libglib2.0-dev Standards-Version: 4.6.2 Homepage: https://github.com/linux-usb-gadgets/gt -Package: ${PACKAGE} -Architecture: ${ARCHITECTURE} +Package: gt +Architecture: @ARCHITECTURE@ Depends: ${shlibs:Depends}, ${misc:Depends} Description: USB Gadget Tool - command-line configuration tool Command-line tool for configuring USB gadgets on Linux systems using the configFS interface. diff --git a/CI/gt_deb_scripts/debian/copyright b/packaging/debian/copyright similarity index 100% rename from CI/gt_deb_scripts/debian/copyright rename to packaging/debian/copyright diff --git a/CI/gt_deb_scripts/debian/rules b/packaging/debian/rules similarity index 82% rename from CI/gt_deb_scripts/debian/rules rename to packaging/debian/rules index 7f3b802..6815dcd 100755 --- a/CI/gt_deb_scripts/debian/rules +++ b/packaging/debian/rules @@ -1,7 +1,5 @@ #!/usr/bin/make -f -PACKAGE ?= gt - export DH_VERBOSE = 1 %: @@ -17,7 +15,7 @@ override_dh_auto_build: override_dh_auto_install: # Install using upstream cmake with DESTDIR - cd source && $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PACKAGE) + cd source && $(MAKE) install DESTDIR=$(CURDIR)/debian/gt override_dh_auto_test: # Skip tests diff --git a/CI/gt_deb_scripts/debian/source/format b/packaging/debian/source/format similarity index 100% rename from CI/gt_deb_scripts/debian/source/format rename to packaging/debian/source/format From e9834829cd97c53f9cc1272d466e58b1c24d3161 Mon Sep 17 00:00:00 2001 From: Lewluu Date: Mon, 23 Nov 2026 17:31:53 +0200 Subject: [PATCH 2/6] ci: add repo debian creation Re-add linux-adi-image-scripts debian creation, based on existing solution on kuiper2.0 branch, using newly added debian features and conventions Signed-off-by: Lewluu --- .../build-linux-image-adi-scripts.yaml | 106 ++++ packaging/README.md | 76 +++ packaging/VERSION | 1 + packaging/debian/changelog.template | 5 + packaging/debian/control.template | 13 + packaging/debian/copyright | 491 ++---------------- packaging/debian/postinst | 19 + packaging/debian/postrm | 29 ++ packaging/debian/rules | 19 +- 9 files changed, 301 insertions(+), 458 deletions(-) create mode 100644 .github/workflows/build-linux-image-adi-scripts.yaml create mode 100644 packaging/README.md create mode 100644 packaging/VERSION create mode 100644 packaging/debian/changelog.template create mode 100644 packaging/debian/control.template create mode 100644 packaging/debian/postinst create mode 100644 packaging/debian/postrm diff --git a/.github/workflows/build-linux-image-adi-scripts.yaml b/.github/workflows/build-linux-image-adi-scripts.yaml new file mode 100644 index 0000000..f75468e --- /dev/null +++ b/.github/workflows/build-linux-image-adi-scripts.yaml @@ -0,0 +1,106 @@ +name: Build debian package for Linux ADI-scripts + +on: + push: + branches: + - main + - kuiper2.0 + - '20[1-9][0-9]_R[1-9]' + pull_request: + branches: + - main + - kuiper2.0 + - '20[1-9][0-9]_R[1-9]' + +permissions: + id-token: write + +jobs: + identify-version: + runs-on: ubuntu-latest + outputs: + ci-version: ${{ steps.set_version.outputs.ci-version }} + cloudsmith-version: ${{ steps.set_version.outputs.cloudsmith-version }} + steps: + - name: Checkout code repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - name: Set app version + id: set_version + shell: bash + run: | + .github/scripts/identify-version.sh + build-debian-package: + strategy: + fail-fast: false + matrix: + include: + - architecture: amd64 + runs-on: ubuntu-24.04 + version-suffix: +Ubuntu24.04 + - architecture: amd64 + runs-on: ubuntu-26.04 + version-suffix: +Ubuntu26.04 + runs-on: ${{ matrix.runs-on }} + needs: identify-version + env: + ARCHITECTURE: ${{ matrix.architecture }} + CI_VERSION: ${{ needs.identify-version.outputs.ci-version }} + CLOUDSMITH_VERSION: ${{ needs.identify-version.outputs.cloudsmith-version }} + CLOUDSMITH_ORG: ${{ secrets.CLOUDSMITH_ORG }} + CLOUDSMITH_REPO: ${{ secrets.CLOUDSMITH_REPO }} + VERSION_SUFFIX: ${{ matrix.version-suffix }} + PACKAGE_NAME: adi-scripts + APP_NAME: linux_image_ADI-scripts + steps: + - name: Checkout code repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + path: ${{env.APP_NAME}} + - name: Install dependencies + run: | + sudo apt update + sudo apt install -y build-essential devscripts debhelper gettext + - name: Create debian package + id: build_deb + uses: analogdevicesinc/shared-actions/deb-generator-action@deb-generator-action-v1.0.0 + with: + working-directory: . + ignore-path: | + packaging + control-path: 'packaging/debian' + version: ${{ env.CI_VERSION }} + version-suffix: ${{ env.VERSION_SUFFIX }} + - name: Install and verify application + shell: sh + run: | + sudo apt-get install -y "${{ env.ARTIFACTS_DIR }}/${PACKAGE_NAME}_${CI_VERSION}-1${VERSION_SUFFIX}_${ARCHITECTURE}.deb" + version_id=$(grep "^VERSION_ID" /etc/os-release | cut -d "=" -f2 | tr -d '"' || true) + echo "ADI_SCRIPTS_DEBIAN=${PACKAGE_NAME}-deb-${ARCHITECTURE}-${distro_tag}-${version_id}" >> $GITHUB_ENV + env: + ARTIFACTS_DIR: ${{ steps.build_deb.outputs.artifact-dir }} + - name: Upload debian artifacts to github + if: success() && env.PACKAGE_NAME != '' + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7 + with: + name: ${{ env.ADI_SCRIPTS_DEBIAN }} + path: | + ${{ env.ARTIFACTS_DIR }}/${{env.PACKAGE_NAME}}_*.deb + ${{ env.ARTIFACTS_DIR }}/${{env.PACKAGE_NAME}}*.dsc + ${{ env.ARTIFACTS_DIR }}/${{env.PACKAGE_NAME}}*.debian.tar.xz + ${{ env.ARTIFACTS_DIR }}/${{env.PACKAGE_NAME}}*.orig.tar.gz + if-no-files-found: error + - name: Authenticate with Cloudsmith via OIDC + if: success() && env.CLOUDSMITH_UPLOAD == 'true' + uses: cloudsmith-io/cloudsmith-cli-action@92b1383b22bbd36d804b858f273abcdf4d349f6b # v3 + with: + oidc-namespace: adi + oidc-service-slug: ${{ secrets.CLOUDSMITH_SERVICE_SLUG }} + - name: Upload debian package to Cloudsmith + if: success() && env.CLOUDSMITH_UPLOAD == 'true' && env.CLOUDSMITH_API_KEY != '' + working-directory: ${{ env.ARTIFACTS_DIR }}/ + run: | + for f in ${{ env.PACKAGE_NAME }}*.dsc ${{ env.PACKAGE_NAME }}*.orig.tar.gz ${{ env.PACKAGE_NAME }}*.debian.tar.xz; do + [ -f "$f" ] || continue + cloudsmith push raw -SW --republish ${{ env.CLOUDSMITH_REPO }} "$f" + done + cloudsmith push deb -SW --republish "${{ env.CLOUDSMITH_REPO }}/debian/trixie" ${{env.PACKAGE_NAME}}_*.deb \ No newline at end of file diff --git a/packaging/README.md b/packaging/README.md new file mode 100644 index 0000000..275f2f3 --- /dev/null +++ b/packaging/README.md @@ -0,0 +1,76 @@ +# ADI Scripts Debian Package Builder + +This directory contains the infrastructure to build Debian packages for the [linux_image_ADI-scripts](https://github.com/analogdevicesinc/linux_image_ADI-scripts) repository using debhelper. + +## Overview + +The build system: +1. Builds it using `make` +2. Creates a `.deb` package with debhelper +3. Generates source package files (`.orig.tar.gz`, `.debian.tar.xz`, `.dsc`) + +## Prerequisites + +```bash +sudo apt-get install debhelper devscripts build-essential wget gettext +git clone https://github.com/analogdevicesinc/linux_image_ADI-scripts.git +git checkout kuiper2.0 +``` + +**Note:** This package depends on the `gt` (USB Gadget Tool) package. You should build and install the gt package separately before using the USB gadget functionality. + +## Usage + +### Building the Package + +The script should be run from the parent folder of the entire git repository and call the script + +```bash +linux_image_ADI-scripts/packaging/build-adi-scripts-deb.sh [branch] [version] [clone_dir] +``` + +Parameters: +- `branch`: Branch or tag name (default: `kuiper2.0`) (used for changelog only) +- `version`: Package version (default: `1.0.0`) +- `clone_dir`: Directory where the repository is cloned (default: `linux_image_ADI-scripts`) + +### Example + +```bash +# Build from kuiper2.0 branch with default version +./build-adi-scripts-deb.sh + +# Build from specific branch with custom version +./build-adi-scripts-deb.sh main 1.5 + +# Build from specific branch with custom version and clone directory +./build-adi-scripts-deb.sh main 1.5 /path/to/linux_image_ADI-scripts +``` + +## Output Files + +The build process generates: +- `adi-scripts_.orig.tar.gz` - Upstream source tarball +- `adi-scripts_-1.debian.tar.xz` - Debian packaging files +- `adi-scripts_-1.dsc` - Debian source package descriptor +- `adi-scripts_-1_all.deb` - Binary package (architecture-independent) + +## Package Contents + +The package installs: +- Shell scripts to `/usr/bin/` +- Systemd service files to `/etc/systemd/system/` +- Python scripts to `/usr/share/systemd/` +- Configuration files for lightdm, USB gadget, etc. + +The following systemd services are enabled on installation: +- `adi-power.service` - Power management service +- `fan-control.service` - Fan control service +- `fix-display-port.service` - DisplayPort fix service + +## Notes + +- The package is architecture-independent (`all`) as it contains only shell scripts +- Uses upstream Makefile with `make install DESTDIR=... PREFIX=/usr` +- Systemd services are enabled during package installation via postinst script +- The build process creates both binary and source packages automatically diff --git a/packaging/VERSION b/packaging/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/packaging/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/packaging/debian/changelog.template b/packaging/debian/changelog.template new file mode 100644 index 0000000..a4356a4 --- /dev/null +++ b/packaging/debian/changelog.template @@ -0,0 +1,5 @@ +${PACKAGE} (${VERSION}-1) stable; urgency=medium + + * ${CHANGELOG_ENTRY} + + -- EngineerZone ${DATE} diff --git a/packaging/debian/control.template b/packaging/debian/control.template new file mode 100644 index 0000000..10f0ba6 --- /dev/null +++ b/packaging/debian/control.template @@ -0,0 +1,13 @@ +Source: ${PACKAGE} +Section: utils +Priority: optional +Maintainer: EngineerZone +Build-Depends: debhelper-compat (= 13) +Standards-Version: 4.6.2 +Homepage: https://github.com/analogdevicesinc/linux_image_ADI-scripts + +Package: ${PACKAGE} +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, bash, wget, systemd, gt (>= 1.0) +Description: ADI Linux system configuration and test scripts + This package contains shell scripts for configuring and testing Analog Devices hardware on Linux systems, including power management, USB gadget configuration, and various device test scripts. diff --git a/packaging/debian/copyright b/packaging/debian/copyright index 7c0b0f7..c07e33a 100644 --- a/packaging/debian/copyright +++ b/packaging/debian/copyright @@ -1,463 +1,49 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ -Upstream-Name: gt -Upstream-Contact: https://github.com/linux-usb-gadgets/gt/issues -Source: https://github.com/linux-usb-gadgets/gt +Upstream-Name: linux_image_ADI-scripts +Upstream-Contact: EngineerZone +Source: https://github.com/analogdevicesinc/linux_image_ADI-scripts Files: * -Copyright: 2012-2015, Samsung Electronics Co., Ltd. -License: Apache-2.0 +Copyright: 2018, 2021, 2024, Analog Devices Inc. +License: BSD-3-clause -Files: examples/cross-compile/README.rst examples/systemd/README.rst -Copyright: 2019, Collabora Ltd -License: CC-BY-SA-4.0 +Files: usb-gadget-service/systemd/* +Copyright: 2021, Analog Devices Inc. +License: LGPL-2.1+ -Files: examples/systemd/99-udc.rules - examples/systemd/gt.target - examples/systemd/gt@.service +Files: usb-gadget-service/udev/* Copyright: 2019, Collabora Ltd License: Expat or LGPL-2.1+ -License: Apache-2.0 - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - On Debian systems, the complete text of the Apache License, - Version 2.0 can be found in '/usr/share/common-licenses/Apache-2.0'. - -License: CC-BY-SA-4.0 - Attribution-ShareAlike 4.0 International - . - ======================================================================= - . - Creative Commons Corporation ("Creative Commons") is not a law firm and - does not provide legal services or legal advice. Distribution of - Creative Commons public licenses does not create a lawyer-client or - other relationship. Creative Commons makes its licenses and related - information available on an "as-is" basis. Creative Commons gives no - warranties regarding its licenses, any material licensed under their - terms and conditions, or any related information. Creative Commons - disclaims all liability for damages resulting from their use to the - fullest extent possible. - . - Using Creative Commons Public Licenses - . - Creative Commons public licenses provide a standard set of terms and - conditions that creators and other rights holders may use to share - original works of authorship and other material subject to copyright - and certain other rights specified in the public license below. The - following considerations are for informational purposes only, are not - exhaustive, and do not form part of our licenses. - . - Considerations for licensors: Our public licenses are - intended for use by those authorized to give the public - permission to use material in ways otherwise restricted by - copyright and certain other rights. Our licenses are - irrevocable. Licensors should read and understand the terms - and conditions of the license they choose before applying it. - Licensors should also secure all rights necessary before - applying our licenses so that the public can reuse the - material as expected. Licensors should clearly mark any - material not subject to the license. This includes other CC- - licensed material, or material used under an exception or - limitation to copyright. More considerations for licensors: - wiki.creativecommons.org/Considerations_for_licensors - . - Considerations for the public: By using one of our public - licenses, a licensor grants the public permission to use the - licensed material under specified terms and conditions. If - the licensor's permission is not necessary for any reason--for - example, because of any applicable exception or limitation to - copyright--then that use is not regulated by the license. Our - licenses grant only permissions under copyright and certain - other rights that a licensor has authority to grant. Use of - the licensed material may still be restricted for other - reasons, including because others have copyright or other - rights in the material. A licensor may make special requests, - such as asking that all changes be marked or described. - Although not required by our licenses, you are encouraged to - respect those requests where reasonable. More considerations - for the public: - wiki.creativecommons.org/Considerations_for_licensees - . - ======================================================================= - . - Creative Commons Attribution-ShareAlike 4.0 International Public - License - . - By exercising the Licensed Rights (defined below), You accept and agree - to be bound by the terms and conditions of this Creative Commons - Attribution-ShareAlike 4.0 International Public License ("Public - License"). To the extent this Public License may be interpreted as a - contract, You are granted the Licensed Rights in consideration of Your - acceptance of these terms and conditions, and the Licensor grants You - such rights in consideration of benefits the Licensor receives from - making the Licensed Material available under these terms and - conditions. - . - . - Section 1 -- Definitions. - . - a. Adapted Material means material subject to Copyright and Similar - Rights that is derived from or based upon the Licensed Material - and in which the Licensed Material is translated, altered, - arranged, transformed, or otherwise modified in a manner requiring - permission under the Copyright and Similar Rights held by the - Licensor. For purposes of this Public License, where the Licensed - Material is a musical work, performance, or sound recording, - Adapted Material is always produced where the Licensed Material is - synched in timed relation with a moving image. - . - b. Adapter's License means the license You apply to Your Copyright - and Similar Rights in Your contributions to Adapted Material in - accordance with the terms and conditions of this Public License. - . - c. BY-SA Compatible License means a license listed at - creativecommons.org/compatiblelicenses, approved by Creative - Commons as essentially the equivalent of this Public License. - . - d. Copyright and Similar Rights means copyright and/or similar rights - closely related to copyright including, without limitation, - performance, broadcast, sound recording, and Sui Generis Database - Rights, without regard to how the rights are labeled or - categorized. For purposes of this Public License, the rights - specified in Section 2(b)(1)-(2) are not Copyright and Similar - Rights. - . - e. Effective Technological Measures means those measures that, in the - absence of proper authority, may not be circumvented under laws - fulfilling obligations under Article 11 of the WIPO Copyright - Treaty adopted on December 20, 1996, and/or similar international - agreements. - . - f. Exceptions and Limitations means fair use, fair dealing, and/or - any other exception or limitation to Copyright and Similar Rights - that applies to Your use of the Licensed Material. - . - g. License Elements means the license attributes listed in the name - of a Creative Commons Public License. The License Elements of this - Public License are Attribution and ShareAlike. - . - h. Licensed Material means the artistic or literary work, database, - or other material to which the Licensor applied this Public - License. - . - i. Licensed Rights means the rights granted to You subject to the - terms and conditions of this Public License, which are limited to - all Copyright and Similar Rights that apply to Your use of the - Licensed Material and that the Licensor has authority to license. - . - j. Licensor means the individual(s) or entity(ies) granting rights - under this Public License. - . - k. Share means to provide material to the public by any means or - process that requires permission under the Licensed Rights, such - as reproduction, public display, public performance, distribution, - dissemination, communication, or importation, and to make material - available to the public including in ways that members of the - public may access the material from a place and at a time - individually chosen by them. - . - l. Sui Generis Database Rights means rights other than copyright - resulting from Directive 96/9/EC of the European Parliament and of - the Council of 11 March 1996 on the legal protection of databases, - as amended and/or succeeded, as well as other essentially - equivalent rights anywhere in the world. - . - m. You means the individual or entity exercising the Licensed Rights - under this Public License. Your has a corresponding meaning. - . - . - Section 2 -- Scope. - . - a. License grant. - . - 1. Subject to the terms and conditions of this Public License, - the Licensor hereby grants You a worldwide, royalty-free, - non-sublicensable, non-exclusive, irrevocable license to - exercise the Licensed Rights in the Licensed Material to: - . - a. reproduce and Share the Licensed Material, in whole or - in part; and - . - b. produce, reproduce, and Share Adapted Material. - . - 2. Exceptions and Limitations. For the avoidance of doubt, where - Exceptions and Limitations apply to Your use, this Public - License does not apply, and You do not need to comply with - its terms and conditions. - . - 3. Term. The term of this Public License is specified in Section - 6(a). - . - 4. Media and formats; technical modifications allowed. The - Licensor authorizes You to exercise the Licensed Rights in - all media and formats whether now known or hereafter created, - and to make technical modifications necessary to do so. The - Licensor waives and/or agrees not to assert any right or - authority to forbid You from making technical modifications - necessary to exercise the Licensed Rights, including - technical modifications necessary to circumvent Effective - Technological Measures. For purposes of this Public License, - simply making modifications authorized by this Section 2(a) - (4) never produces Adapted Material. - . - 5. Downstream recipients. - . - a. Offer from the Licensor -- Licensed Material. Every - recipient of the Licensed Material automatically - receives an offer from the Licensor to exercise the - Licensed Rights under the terms and conditions of this - Public License. - . - b. Additional offer from the Licensor -- Adapted Material. - Every recipient of Adapted Material from You - automatically receives an offer from the Licensor to - exercise the Licensed Rights in the Adapted Material - under the conditions of the Adapter's License You apply. - . - c. No downstream restrictions. You may not offer or impose - any additional or different terms or conditions on, or - apply any Effective Technological Measures to, the - Licensed Material if doing so restricts exercise of the - Licensed Rights by any recipient of the Licensed - Material. - . - 6. No endorsement. Nothing in this Public License constitutes or - may be construed as permission to assert or imply that You - are, or that Your use of the Licensed Material is, connected - with, or sponsored, endorsed, or granted official status by, - the Licensor or others designated to receive attribution as - provided in Section 3(a)(1)(A)(i). - . - b. Other rights. - . - 1. Moral rights, such as the right of integrity, are not - licensed under this Public License, nor are publicity, - privacy, and/or other similar personality rights; however, to - the extent possible, the Licensor waives and/or agrees not to - assert any such rights held by the Licensor to the limited - extent necessary to allow You to exercise the Licensed - Rights, but not otherwise. - . - 2. Patent and trademark rights are not licensed under this - Public License. - . - 3. To the extent possible, the Licensor waives any right to - collect royalties from You for the exercise of the Licensed - Rights, whether directly or through a collecting society - under any voluntary or waivable statutory or compulsory - licensing scheme. In all other cases the Licensor expressly - reserves any right to collect such royalties. - . - . - Section 3 -- License Conditions. - . - Your exercise of the Licensed Rights is expressly made subject to the - following conditions. - . - a. Attribution. - . - 1. If You Share the Licensed Material (including in modified - form), You must: - . - a. retain the following if it is supplied by the Licensor - with the Licensed Material: - . - i. identification of the creator(s) of the Licensed - Material and any others designated to receive - attribution, in any reasonable manner requested by - the Licensor (including by pseudonym if - designated); - . - ii. a copyright notice; - . - iii. a notice that refers to this Public License; - . - iv. a notice that refers to the disclaimer of - warranties; - . - v. a URI or hyperlink to the Licensed Material to the - extent reasonably practicable; - . - b. indicate if You modified the Licensed Material and - retain an indication of any previous modifications; and - . - c. indicate the Licensed Material is licensed under this - Public License, and include the text of, or the URI or - hyperlink to, this Public License. - . - 2. You may satisfy the conditions in Section 3(a)(1) in any - reasonable manner based on the medium, means, and context in - which You Share the Licensed Material. For example, it may be - reasonable to satisfy the conditions by providing a URI or - hyperlink to a resource that includes the required - information. - . - 3. If requested by the Licensor, You must remove any of the - information required by Section 3(a)(1)(A) to the extent - reasonably practicable. - . - b. ShareAlike. - . - In addition to the conditions in Section 3(a), if You Share - Adapted Material You produce, the following conditions also apply. - . - 1. The Adapter's License You apply must be a Creative Commons - license with the same License Elements, this version or - later, or a BY-SA Compatible License. - . - 2. You must include the text of, or the URI or hyperlink to, the - Adapter's License You apply. You may satisfy this condition - in any reasonable manner based on the medium, means, and - context in which You Share Adapted Material. - . - 3. You may not offer or impose any additional or different terms - or conditions on, or apply any Effective Technological - Measures to, Adapted Material that restrict exercise of the - rights granted under the Adapter's License You apply. - . - . - Section 4 -- Sui Generis Database Rights. - . - Where the Licensed Rights include Sui Generis Database Rights that - apply to Your use of the Licensed Material: - . - a. for the avoidance of doubt, Section 2(a)(1) grants You the right - to extract, reuse, reproduce, and Share all or a substantial - portion of the contents of the database; - . - b. if You include all or a substantial portion of the database - contents in a database in which You have Sui Generis Database - Rights, then the database in which You have Sui Generis Database - Rights (but not its individual contents) is Adapted Material, - . - including for purposes of Section 3(b); and - c. You must comply with the conditions in Section 3(a) if You Share - all or a substantial portion of the contents of the database. - . - For the avoidance of doubt, this Section 4 supplements and does not - replace Your obligations under this Public License where the Licensed - Rights include other Copyright and Similar Rights. - . - . - Section 5 -- Disclaimer of Warranties and Limitation of Liability. - . - a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE - EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS - AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF - ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, - IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, - WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, - ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT - KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT - ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. - . - b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE - TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, - NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, - INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, - COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR - USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN - ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR - DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR - IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. - . - c. The disclaimer of warranties and limitation of liability provided - above shall be interpreted in a manner that, to the extent - possible, most closely approximates an absolute disclaimer and - waiver of all liability. - . - . - Section 6 -- Term and Termination. - . - a. This Public License applies for the term of the Copyright and - Similar Rights licensed here. However, if You fail to comply with - this Public License, then Your rights under this Public License - terminate automatically. - . - b. Where Your right to use the Licensed Material has terminated under - Section 6(a), it reinstates: - . - 1. automatically as of the date the violation is cured, provided - it is cured within 30 days of Your discovery of the - violation; or - . - 2. upon express reinstatement by the Licensor. - . - For the avoidance of doubt, this Section 6(b) does not affect any - right the Licensor may have to seek remedies for Your violations - of this Public License. - . - c. For the avoidance of doubt, the Licensor may also offer the - Licensed Material under separate terms or conditions or stop - distributing the Licensed Material at any time; however, doing so - will not terminate this Public License. - . - d. Sections 1, 5, 6, 7, and 8 survive termination of this Public - License. - . - . - Section 7 -- Other Terms and Conditions. - . - a. The Licensor shall not be bound by any additional or different - terms or conditions communicated by You unless expressly agreed. - . - b. Any arrangements, understandings, or agreements regarding the - Licensed Material not stated herein are separate from and - independent of the terms and conditions of this Public License. - . - . - Section 8 -- Interpretation. - . - a. For the avoidance of doubt, this Public License does not, and - shall not be interpreted to, reduce, limit, restrict, or impose - conditions on any use of the Licensed Material that could lawfully - be made without permission under this Public License. - . - b. To the extent possible, if any provision of this Public License is - deemed unenforceable, it shall be automatically reformed to the - minimum extent necessary to make it enforceable. If the provision - cannot be reformed, it shall be severed from this Public License - without affecting the enforceability of the remaining terms and - conditions. - . - c. No term or condition of this Public License will be waived and no - failure to comply consented to unless expressly agreed to by the - Licensor. - . - d. Nothing in this Public License constitutes or may be interpreted - as a limitation upon, or waiver of, any privileges and immunities - that apply to the Licensor or You, including from the legal - processes of any jurisdiction or authority. - . - . - ======================================================================= - . - Creative Commons is not a party to its public - licenses. Notwithstanding, Creative Commons may elect to apply one of - its public licenses to material it publishes and in those instances - will be considered the “Licensor.” The text of the Creative Commons - public licenses is dedicated to the public domain under the CC0 Public - Domain Dedication. Except for the limited purpose of indicating that - material is shared under a Creative Commons public license or as - otherwise permitted by the Creative Commons policies published at - creativecommons.org/policies, Creative Commons does not authorize the - use of the trademark "Creative Commons" or any other trademark or logo - of Creative Commons without its prior written consent including, - without limitation, in connection with any unauthorized modifications - to any of its public licenses or any other arrangements, - understandings, or agreements concerning use of licensed material. For - the avoidance of doubt, this paragraph does not form part of the - public licenses. - . - Creative Commons may be contacted at creativecommons.org. +License: BSD-3-clause + The BSD License + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + . + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. License: Expat The MIT License @@ -494,3 +80,4 @@ License: LGPL-2.1+ your option) any later version. On Debian systems, the complete text of version 2.1 of the GNU Lesser General Public License can be found in '/usr/share/common-licenses/LGPL-2.1'. + diff --git a/packaging/debian/postinst b/packaging/debian/postinst new file mode 100644 index 0000000..bfda64a --- /dev/null +++ b/packaging/debian/postinst @@ -0,0 +1,19 @@ +#!/bin/bash -e + +if [ "$1" = "configure" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl enable adi-power.service || true + systemctl enable fan-control.service || true + systemctl enable fix-display-port.service || true + systemctl enable gt.service || true + systemctl enable gt-start.service || true + systemctl enable gt.target || true + systemctl enable iiod_ffs.service || true + systemctl enable iiod_context_attr.service || true + systemctl enable dev-iio_ffs.mount || true + + systemctl daemon-reload || true + fi +fi + +exit 0 diff --git a/packaging/debian/postrm b/packaging/debian/postrm new file mode 100644 index 0000000..621aa7a --- /dev/null +++ b/packaging/debian/postrm @@ -0,0 +1,29 @@ +#!/bin/bash -e + +if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then + if command -v systemctl >/dev/null 2>&1; then + systemctl disable adi-power.service 2>/dev/null || true + systemctl disable fan-control.service 2>/dev/null || true + systemctl disable fix-display-port.service 2>/dev/null || true + systemctl disable gt.service 2>/dev/null || true + systemctl disable gt-start.service 2>/dev/null || true + systemctl disable gt.target 2>/dev/null || true + systemctl disable iiod_ffs.service 2>/dev/null || true + systemctl disable iiod_context_attr.service 2>/dev/null || true + systemctl disable dev-iio_ffs.mount 2>/dev/null || true + + systemctl stop adi-power.service 2>/dev/null || true + systemctl stop fan-control.service 2>/dev/null || true + systemctl stop fix-display-port.service 2>/dev/null || true + systemctl stop gt.service 2>/dev/null || true + systemctl stop gt-start.service 2>/dev/null || true + systemctl stop gt.target 2>/dev/null || true + systemctl stop iiod_ffs.service 2>/dev/null || true + systemctl stop iiod_context_attr.service 2>/dev/null || true + systemctl stop dev-iio_ffs.mount 2>/dev/null || true + + systemctl daemon-reload || true + fi +fi + +exit 0 diff --git a/packaging/debian/rules b/packaging/debian/rules index 6815dcd..6c2388f 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -1,21 +1,28 @@ #!/usr/bin/make -f +PACKAGE ?= adi-scripts + export DH_VERBOSE = 1 %: dh $@ +override_dh_auto_clean: + # Nothing to clean - no build artifacts + : + override_dh_auto_configure: - # Configure with cmake, install to /usr - cd source && cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_MANUAL_PAGE=off . + # No configuration needed + : override_dh_auto_build: - # Build gt - cd source && $(MAKE) + # Nothing to build - shell scripts only + : override_dh_auto_install: - # Install using upstream cmake with DESTDIR - cd source && $(MAKE) install DESTDIR=$(CURDIR)/debian/gt + # Use upstream Makefile with DESTDIR and PREFIX support + # Makefile installs all files: scripts, services, USB gadget files, configs + $(MAKE) install DESTDIR=$(CURDIR)/debian/$(PACKAGE) PREFIX=/usr override_dh_auto_test: # Skip tests From 0cda07efb00cf4e484bc517fe39c22e294794505 Mon Sep 17 00:00:00 2001 From: Lewluu Date: Mon, 23 Nov 2026 17:48:00 +0200 Subject: [PATCH 3/6] ci: refactor gt debian creation Re-ad gt repository debian creation using newly features and conventions, now having two separate workflows. Signed-off-by: Lewluu --- .../workflows/build-linux-usb-gadgets-gt.yaml | 109 ++++++++++++++++++ .../{build_gt.yml => build-to-be-removed.yml} | 0 2 files changed, 109 insertions(+) create mode 100644 .github/workflows/build-linux-usb-gadgets-gt.yaml rename .github/workflows/{build_gt.yml => build-to-be-removed.yml} (100%) diff --git a/.github/workflows/build-linux-usb-gadgets-gt.yaml b/.github/workflows/build-linux-usb-gadgets-gt.yaml new file mode 100644 index 0000000..9cde9de --- /dev/null +++ b/.github/workflows/build-linux-usb-gadgets-gt.yaml @@ -0,0 +1,109 @@ +name: Build GT + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to build debian' + required: true + default: '1.0.0' + cloudsmith_upload: + description: 'Upload the built debian package to Cloudsmith' + required: true + type: boolean + default: false + +env: + PACKAGE_NAME: gt + APP_NAME: gt-${{ github.event.inputs.version }} + DEB_SCRIPT_LOCATION: repo-scripts + +permissions: + id-token: write + +jobs: + build: + runs-on: ubuntu-24.04-arm + strategy: + fail-fast: false + matrix: + include: + - docker_image: arm64v8/debian:trixie + distro: debian13 + architecture: arm64 + platform_flag: "" + - docker_image: arm32v7/debian:trixie + distro: debian13 + architecture: armhf + platform_flag: "--platform linux/arm/v7" + + steps: + - name: Download GT source code + uses: actions/checkout@v6 + with: + repository: linux-usb-gadgets/gt + path: ${{env.APP_NAME}} + + - name: Checkout gt scripts + uses: actions/checkout@v6 + with: + sparse-checkout: CI/gt_deb_scripts + sparse-checkout-cone-mode: false + path: repo-scripts + + - name: Move gt_deb_scripts to workspace root + run: | + mv repo-scripts/CI/gt_deb_scripts $GITHUB_WORKSPACE/gt_deb_scripts + rm -rf repo-scripts + + - name: Start persistent container + run: | + docker run -d \ + ${{matrix.platform_flag}} \ + --name ${{matrix.distro}}-${{matrix.architecture}} \ + -v "$GITHUB_WORKSPACE/${{env.APP_NAME}}:/workspace/${{env.APP_NAME}}" \ + -v "$GITHUB_WORKSPACE/gt_deb_scripts:/workspace/gt_deb_scripts" \ + -w /workspace \ + ${{matrix.docker_image}} tail -f /dev/null + + - name: Install dependencies + run: | + docker exec ${{matrix.distro}}-${{matrix.architecture}} sh -c "apt-get update && apt-get install -y debhelper devscripts build-essential wget cmake libusbgx-dev libconfig-dev libglib2.0-dev gettext-base" + + - name: Build GT + run: | + docker exec ${{matrix.distro}}-${{matrix.architecture}} sh -c "gt_deb_scripts/build-gt-deb.sh ${{env.PACKAGE_NAME}} ${{github.event.inputs.version}} ${{matrix.architecture}}" + + - name: Copy debian artifacts from container to host + run: | + docker cp ${{matrix.distro}}-${{matrix.architecture}}:/workspace/. ./artifacts/ + ls -la ./artifacts/ + + - name: Upload GT debian package + uses: actions/upload-artifact@v7 + with: + name: ${{ env.APP_NAME }}-${{ matrix.architecture }} + path: | + artifacts/${{ env.PACKAGE_NAME }}*.deb + artifacts/${{ env.PACKAGE_NAME }}*.dsc + artifacts/${{ env.PACKAGE_NAME }}*.debian.tar.xz + artifacts/${{ env.PACKAGE_NAME }}*.orig.tar.gz + if-no-files-found: error + + - name: Authenticate with Cloudsmith via OIDC + if: success() && github.event.inputs.cloudsmith_upload == 'true' + uses: cloudsmith-io/cloudsmith-cli-action@v2.0.2 + with: + oidc-namespace: adi + oidc-service-slug: ${{ secrets.CLOUDSMITH_SERVICE_SLUG }} + + - name: Upload debian package to Cloudsmith + if: success() && github.event.inputs.cloudsmith_upload == 'true' && env.CLOUDSMITH_API_KEY != '' + working-directory: ./artifacts + run: | + pip install --break-system-packages cloudsmith-cli + for f in ${{env.PACKAGE_NAME}}*.dsc ${{env.PACKAGE_NAME}}*.orig.tar.gz ${{env.PACKAGE_NAME}}*.debian.tar.xz; do + [ -f "$f" ] || continue + cloudsmith push raw -SW --republish adi/kuiper-internal "$f" + done + cloudsmith push deb -SW --republish "adi/kuiper-internal/debian/trixie" ${{env.PACKAGE_NAME}}_*.deb diff --git a/.github/workflows/build_gt.yml b/.github/workflows/build-to-be-removed.yml similarity index 100% rename from .github/workflows/build_gt.yml rename to .github/workflows/build-to-be-removed.yml From e468fba2d4b58c11f854c77711d2cd37b17f91fb Mon Sep 17 00:00:00 2001 From: Lewluu Date: Tue, 24 Nov 2026 12:25:38 +0200 Subject: [PATCH 4/6] ci: refactore workflow structure Refactor workflow structure and logic in separate scripts for some steps. Now keeping the worfklows cleaner. Signed-off-by: Lewluu --- .github/scripts/identify-version.sh | 34 ++ .github/scripts/install-app.sh | 64 +++ .github/scripts/install-deps-linux.sh | 31 ++ .github/scripts/upload-to-cloudsmith.sh | 30 ++ .../build-linux-image-adi-scripts.yaml | 78 +-- .../workflows/build-linux-usb-gadgets-gt.yaml | 200 ++++--- .github/workflows/build-to-be-removed.yml | 129 ----- packaging/VERSION_GT | 1 + packaging/debian/changelog | 4 +- packaging/debian/changelog.template | 5 - packaging/debian/control | 19 +- packaging/debian/control.template | 13 - packaging/debian/rules | 2 +- packaging/debian_gt/changelog | 5 + packaging/debian_gt/control | 14 + packaging/debian_gt/copyright | 496 ++++++++++++++++++ packaging/debian_gt/rules | 22 + packaging/debian_gt/source/format | 1 + 18 files changed, 868 insertions(+), 280 deletions(-) create mode 100755 .github/scripts/identify-version.sh create mode 100755 .github/scripts/install-app.sh create mode 100755 .github/scripts/install-deps-linux.sh create mode 100755 .github/scripts/upload-to-cloudsmith.sh delete mode 100644 .github/workflows/build-to-be-removed.yml create mode 100644 packaging/VERSION_GT delete mode 100644 packaging/debian/changelog.template delete mode 100644 packaging/debian/control.template create mode 100644 packaging/debian_gt/changelog create mode 100644 packaging/debian_gt/control create mode 100644 packaging/debian_gt/copyright create mode 100755 packaging/debian_gt/rules create mode 100644 packaging/debian_gt/source/format diff --git a/.github/scripts/identify-version.sh b/.github/scripts/identify-version.sh new file mode 100755 index 0000000..fb4ae60 --- /dev/null +++ b/.github/scripts/identify-version.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +set -eo pipefail + +# Env (all optional): +# VERSION_FILE file holding the package version (default: packaging/VERSION) +# CLOUDSMITH_PREFIX prefix of the cloudsmith version label (default: adi-scripts) +VERSION_FILE="${VERSION_FILE:-packaging/VERSION}" +CLOUDSMITH_PREFIX="${CLOUDSMITH_PREFIX:-adi-scripts}" + +ci_version="" +[[ -f "$VERSION_FILE" ]] && ci_version=$(tr -d '[:space:]' < "$VERSION_FILE") + +if [[ -z "$ci_version" ]]; then + echo "Failed to read version from ${VERSION_FILE}, using default" + ci_version="0.0.1+${GITHUB_SHA}" +fi + +echo "CI Version to use: $ci_version" +echo "ci-version=$ci_version" >> "$GITHUB_OUTPUT" + +# Extract version from ref for the CLOUDSMITH_VERSION +cloudsmith_version="" +if [[ "${GITHUB_REF}" == *"refs/tags/v"* ]]; then + cloudsmith_version="${CLOUDSMITH_PREFIX}-${GITHUB_REF#refs/tags/}" +elif [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then + cloudsmith_version="${CLOUDSMITH_PREFIX}-main~latest" +elif [[ "${GITHUB_REF}" == *"refs/pull/"* ]]; then + pr_number=$(echo "$GITHUB_REF" | sed -e "s#refs/##g" -e "s#/merge##g" -e "s#/#-#g") + cloudsmith_version="${CLOUDSMITH_PREFIX}-${pr_number}" +fi + +echo "Cloudsmith version to use: $cloudsmith_version" +echo "cloudsmith-version=$cloudsmith_version" >> "${GITHUB_OUTPUT}" diff --git a/.github/scripts/install-app.sh b/.github/scripts/install-app.sh new file mode 100755 index 0000000..cf32d3e --- /dev/null +++ b/.github/scripts/install-app.sh @@ -0,0 +1,64 @@ +#!/bin/bash + +set -eo pipefail + +# Env: ARCHITECTURE, CONTAINER, CI_VERSION, VERSION_SUFFIX, PACKAGE_NAME, +# CONTROL_PATH (default packaging/debian), ARTIFACTS_DIR (amd64/arm64: +# output of the deb action), +# OUTPUT_PREFIX (default PACKAGE_NAME), GITHUB_ENV +CONTROL_PATH="${CONTROL_PATH:-packaging/debian}" +OUTPUT_PREFIX="${OUTPUT_PREFIX:-$PACKAGE_NAME}" +# Packages may be Architecture: all, so match any architecture in the filename +DEB_GLOB="${PACKAGE_NAME}_${CI_VERSION}-1${VERSION_SUFFIX}_*.deb" + +if [[ "$ARCHITECTURE" == 'armhf' ]]; then + echo "Building debian package for armhf ..." + docker exec \ + -e VERSION="$CI_VERSION" \ + -e WORKING_DIRECTORY="/workspace" \ + -e GITHUB_WORKSPACE="/workspace" \ + -e IGNORE_PATH="packaging" \ + -e CONTROL_PATH="$CONTROL_PATH" \ + -e VERSION_SUFFIX="$VERSION_SUFFIX" \ + -w /workspace \ + debian-armhf \ + /bin/bash -c " + set -e + git clone https://github.com/analogdevicesinc/shared-actions /tmp/shared-actions + /tmp/shared-actions/deb-generator-action/build-deb.sh + " + + # Installation and verification of package + docker exec -w /workspace/artifacts debian-armhf \ + /bin/bash -c "set -e; apt-get install -y ./${DEB_GLOB}" + + # Artifacts are already on the host through the workspace mount + ARTIFACTS_DIR="${GITHUB_WORKSPACE}/artifacts" +else + [[ "$ARCHITECTURE" == "arm64" ]] && SUDO="" || SUDO="sudo" + ${SUDO} apt-get install -y ${ARTIFACTS_DIR}/${DEB_GLOB} +fi + +# Orig tarball is only needed for the source package +rm -rf "${ARTIFACTS_DIR}/${PACKAGE_NAME}_${CI_VERSION}.orig.tar" 2>/dev/null || true + +# Create debian output name - differentiate by distro +if [[ "${CONTAINER}" == *"kuiper"* ]]; then + distro_tag="kuiper" +elif [[ "${CONTAINER}" == "debian:latest" || "${CONTAINER}" == "debian:forky" ]]; then + distro_tag="debian" +else + distro_tag="ubuntu" +fi + +# On armhf the os-release has to be read from inside the container +if [[ "$ARCHITECTURE" == 'armhf' ]]; then + os_release=$(docker exec debian-armhf cat /etc/os-release) +else + os_release=$(cat /etc/os-release) +fi +version_id=$(echo "$os_release" | grep "^VERSION_ID" | cut -d "=" -f2 | tr -d '"' || true) +# Debian testing (forky) has no VERSION_ID - fall back to the codename +[[ -z "$version_id" ]] && version_id=$(echo "$os_release" | grep "^VERSION_CODENAME" | cut -d "=" -f2 | tr -d '"') + +echo "DEBIAN_ARTIFACT=${OUTPUT_PREFIX}-deb-${ARCHITECTURE}-${distro_tag}-${version_id}" >> "$GITHUB_ENV" diff --git a/.github/scripts/install-deps-linux.sh b/.github/scripts/install-deps-linux.sh new file mode 100755 index 0000000..b8692a1 --- /dev/null +++ b/.github/scripts/install-deps-linux.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -eo pipefail + +# Env: ARCHITECTURE, CONTAINER, PLATFORM (armhf only) +# The armhf build runs in a persistent emulated container (debian-armhf) with +# the workspace mounted at /workspace. amd64/arm64 build directly on the runner +# (arm64 inside the job container). + +DEPS="build-essential devscripts debhelper gettext git curl ca-certificates rsync" + +if [[ "$ARCHITECTURE" == "armhf" ]]; then + docker run --platform "${PLATFORM}" \ + --name debian-armhf \ + -v "${GITHUB_WORKSPACE}:/workspace" \ + -dit "${CONTAINER}" + + echo "::group::Installing dependencies" + docker exec debian-armhf /bin/bash -c " + set -e + apt-get update && apt-get install -y ${DEPS} sudo + " + echo "::endgroup::" +else + [[ "$ARCHITECTURE" == "arm64" ]] && SUDO="" || SUDO="sudo" + + echo "::group::Installing dependencies" + ${SUDO} apt-get update + DEBIAN_FRONTEND=noninteractive ${SUDO} apt-get install -y ${DEPS} sudo + echo "::endgroup::" +fi diff --git a/.github/scripts/upload-to-cloudsmith.sh b/.github/scripts/upload-to-cloudsmith.sh new file mode 100755 index 0000000..55dc3c3 --- /dev/null +++ b/.github/scripts/upload-to-cloudsmith.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -eo pipefail + +# Env: WORKSPACE, PACKAGE_NAME, CONTAINER, CLOUDSMITH_ORG, CLOUDSMITH_REPO, CLOUDSMITH_VERSION +cd "${WORKSPACE}/artifacts" + +# Determine distro tag from container +if [[ "${CONTAINER}" == *"kuiper"* ]]; then + DISTRO_TAG="-kuiper" +elif [[ "${CONTAINER}" == "debian:latest" || "${CONTAINER}" == "debian:forky" ]]; then + DISTRO_TAG="-debian" +else + DISTRO_TAG="" +fi + +# Source package files go to the raw repository +for f in "${PACKAGE_NAME}"*.dsc "${PACKAGE_NAME}"*.orig.tar.gz "${PACKAGE_NAME}"*.debian.tar.xz; do + [[ -f "$f" ]] || continue + cloudsmith push raw -SW --republish --no-wait-for-sync \ + --name "${f}" --tags "${f%%_*}${DISTRO_TAG}" --version "${CLOUDSMITH_VERSION}" \ + "${CLOUDSMITH_ORG}/${CLOUDSMITH_REPO}" "$f" +done + +# Binary packages go to the debian repository +for f in "${PACKAGE_NAME}"_*.deb; do + [[ -f "$f" ]] || continue + cloudsmith push deb -SW --republish --no-wait-for-sync \ + "${CLOUDSMITH_ORG}/${CLOUDSMITH_REPO}/debian/trixie" "$f" +done diff --git a/.github/workflows/build-linux-image-adi-scripts.yaml b/.github/workflows/build-linux-image-adi-scripts.yaml index f75468e..dde0f66 100644 --- a/.github/workflows/build-linux-image-adi-scripts.yaml +++ b/.github/workflows/build-linux-image-adi-scripts.yaml @@ -1,19 +1,27 @@ name: Build debian package for Linux ADI-scripts +permissions: + contents: read + id-token: write + on: + workflow_dispatch: push: branches: - main - kuiper2.0 - '20[1-9][0-9]_R[1-9]' + tags: + - 'v*' pull_request: branches: - main - kuiper2.0 - '20[1-9][0-9]_R[1-9]' -permissions: - id-token: write +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: identify-version: @@ -29,7 +37,10 @@ jobs: shell: bash run: | .github/scripts/identify-version.sh - build-debian-package: + env: + VERSION_FILE: packaging/VERSION + CLOUDSMITH_PREFIX: adi-scripts + build-linux: strategy: fail-fast: false matrix: @@ -42,65 +53,62 @@ jobs: version-suffix: +Ubuntu26.04 runs-on: ${{ matrix.runs-on }} needs: identify-version + container: ${{ matrix.architecture == 'arm64' && matrix.container || '' }} env: ARCHITECTURE: ${{ matrix.architecture }} + CONTAINER: ${{ matrix.container }} + PLATFORM: ${{ matrix.platform }} CI_VERSION: ${{ needs.identify-version.outputs.ci-version }} CLOUDSMITH_VERSION: ${{ needs.identify-version.outputs.cloudsmith-version }} CLOUDSMITH_ORG: ${{ secrets.CLOUDSMITH_ORG }} CLOUDSMITH_REPO: ${{ secrets.CLOUDSMITH_REPO }} VERSION_SUFFIX: ${{ matrix.version-suffix }} PACKAGE_NAME: adi-scripts - APP_NAME: linux_image_ADI-scripts + CONTROL_PATH: packaging/debian + OUTPUT_PREFIX: adi-scripts steps: - - name: Checkout code repository + - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - with: - path: ${{env.APP_NAME}} - - name: Install dependencies + - name: Install deps + shell: sh run: | - sudo apt update - sudo apt install -y build-essential devscripts debhelper gettext - - name: Create debian package + .github/scripts/install-deps-linux.sh + # This shared-action is compatible only with amd64/arm64 - armhf is built in install-app.sh + - name: Create debian package - amd64/arm64 + if: ${{ matrix.architecture == 'amd64' || matrix.architecture == 'arm64' }} id: build_deb - uses: analogdevicesinc/shared-actions/deb-generator-action@deb-generator-action-v1.0.0 + uses: analogdevicesinc/shared-actions/deb-generator-action@main with: working-directory: . ignore-path: | packaging - control-path: 'packaging/debian' + control-path: packaging/debian version: ${{ env.CI_VERSION }} version-suffix: ${{ env.VERSION_SUFFIX }} + # Also debian creation for armhf architecture - name: Install and verify application shell: sh run: | - sudo apt-get install -y "${{ env.ARTIFACTS_DIR }}/${PACKAGE_NAME}_${CI_VERSION}-1${VERSION_SUFFIX}_${ARCHITECTURE}.deb" - version_id=$(grep "^VERSION_ID" /etc/os-release | cut -d "=" -f2 | tr -d '"' || true) - echo "ADI_SCRIPTS_DEBIAN=${PACKAGE_NAME}-deb-${ARCHITECTURE}-${distro_tag}-${version_id}" >> $GITHUB_ENV + .github/scripts/install-app.sh env: - ARTIFACTS_DIR: ${{ steps.build_deb.outputs.artifact-dir }} + ARTIFACTS_DIR: ${{ steps.build_deb.outputs.artifact-dir || '' }} - name: Upload debian artifacts to github - if: success() && env.PACKAGE_NAME != '' uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7 with: - name: ${{ env.ADI_SCRIPTS_DEBIAN }} + name: ${{ env.DEBIAN_ARTIFACT }} path: | - ${{ env.ARTIFACTS_DIR }}/${{env.PACKAGE_NAME}}_*.deb - ${{ env.ARTIFACTS_DIR }}/${{env.PACKAGE_NAME}}*.dsc - ${{ env.ARTIFACTS_DIR }}/${{env.PACKAGE_NAME}}*.debian.tar.xz - ${{ env.ARTIFACTS_DIR }}/${{env.PACKAGE_NAME}}*.orig.tar.gz + artifacts/ if-no-files-found: error - - name: Authenticate with Cloudsmith via OIDC - if: success() && env.CLOUDSMITH_UPLOAD == 'true' + - name: Setup cloudsmith + if: ${{ env.CLOUDSMITH_VERSION != '' }} uses: cloudsmith-io/cloudsmith-cli-action@92b1383b22bbd36d804b858f273abcdf4d349f6b # v3 with: - oidc-namespace: adi - oidc-service-slug: ${{ secrets.CLOUDSMITH_SERVICE_SLUG }} - - name: Upload debian package to Cloudsmith - if: success() && env.CLOUDSMITH_UPLOAD == 'true' && env.CLOUDSMITH_API_KEY != '' - working-directory: ${{ env.ARTIFACTS_DIR }}/ + oidc-namespace: ${{ secrets.CLOUDSMITH_ORG }} + oidc-service-slug: ${{ secrets.CLOUDSMITH_SVC }} + - name: Push to cloudsmith + if: ${{ env.CLOUDSMITH_VERSION != '' }} + shell: bash run: | - for f in ${{ env.PACKAGE_NAME }}*.dsc ${{ env.PACKAGE_NAME }}*.orig.tar.gz ${{ env.PACKAGE_NAME }}*.debian.tar.xz; do - [ -f "$f" ] || continue - cloudsmith push raw -SW --republish ${{ env.CLOUDSMITH_REPO }} "$f" - done - cloudsmith push deb -SW --republish "${{ env.CLOUDSMITH_REPO }}/debian/trixie" ${{env.PACKAGE_NAME}}_*.deb \ No newline at end of file + .github/scripts/upload-to-cloudsmith.sh + env: + WORKSPACE: ${{ github.workspace }} diff --git a/.github/workflows/build-linux-usb-gadgets-gt.yaml b/.github/workflows/build-linux-usb-gadgets-gt.yaml index 9cde9de..4353490 100644 --- a/.github/workflows/build-linux-usb-gadgets-gt.yaml +++ b/.github/workflows/build-linux-usb-gadgets-gt.yaml @@ -1,109 +1,139 @@ -name: Build GT +name: Build debian package for GT (linux-usb-gadgets) + +permissions: + contents: read + id-token: write on: workflow_dispatch: - inputs: - version: - description: 'Version to build debian' - required: true - default: '1.0.0' - cloudsmith_upload: - description: 'Upload the built debian package to Cloudsmith' - required: true - type: boolean - default: false + push: + branches: + - main + - kuiper2.0 + - '20[1-9][0-9]_R[1-9]' + tags: + - 'v*' + pull_request: + branches: + - main + - kuiper2.0 + - '20[1-9][0-9]_R[1-9]' -env: - PACKAGE_NAME: gt - APP_NAME: gt-${{ github.event.inputs.version }} - DEB_SCRIPT_LOCATION: repo-scripts - -permissions: - id-token: write +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: - build: - runs-on: ubuntu-24.04-arm + identify-version: + runs-on: ubuntu-latest + outputs: + ci-version: ${{ steps.set_version.outputs.ci-version }} + cloudsmith-version: ${{ steps.set_version.outputs.cloudsmith-version }} + steps: + - name: Checkout code repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + - name: Set app version + id: set_version + shell: bash + run: | + .github/scripts/identify-version.sh + env: + VERSION_FILE: packaging/VERSION_GT + CLOUDSMITH_PREFIX: gt + build-linux: strategy: fail-fast: false matrix: include: - - docker_image: arm64v8/debian:trixie - distro: debian13 - architecture: arm64 - platform_flag: "" - - docker_image: arm32v7/debian:trixie - distro: debian13 - architecture: armhf - platform_flag: "--platform linux/arm/v7" - + - architecture: arm64 + runs-on: ubuntu-26.04-arm + container: docker.cloudsmith.io/adi/containers/kuiper_basic_64:latest + version-suffix: +Debian13 + - architecture: armhf + runs-on: ubuntu-26.04-arm + container: docker.cloudsmith.io/adi/containers/kuiper_basic_32:latest + platform: linux/arm/v7 + version-suffix: +Debian13 + - architecture: arm64 + runs-on: ubuntu-26.04-arm + container: debian:forky + version-suffix: +Debian14 + - architecture: armhf + runs-on: ubuntu-26.04-arm + container: debian:forky + platform: linux/arm/v7 + version-suffix: +Debian14 + runs-on: ${{ matrix.runs-on }} + needs: identify-version + container: ${{ matrix.architecture == 'arm64' && matrix.container || '' }} + env: + ARCHITECTURE: ${{ matrix.architecture }} + CONTAINER: ${{ matrix.container }} + PLATFORM: ${{ matrix.platform }} + CI_VERSION: ${{ needs.identify-version.outputs.ci-version }} + CLOUDSMITH_VERSION: ${{ needs.identify-version.outputs.cloudsmith-version }} + CLOUDSMITH_ORG: ${{ secrets.CLOUDSMITH_ORG }} + CLOUDSMITH_REPO: ${{ secrets.CLOUDSMITH_REPO }} + VERSION_SUFFIX: ${{ matrix.version-suffix }} + PACKAGE_NAME: gt + CONTROL_PATH: packaging/debian + OUTPUT_PREFIX: gt steps: - name: Download GT source code - uses: actions/checkout@v6 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: repository: linux-usb-gadgets/gt - path: ${{env.APP_NAME}} - - - name: Checkout gt scripts - uses: actions/checkout@v6 + - name: Checkout packaging and CI scripts + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: - sparse-checkout: CI/gt_deb_scripts - sparse-checkout-cone-mode: false path: repo-scripts - - - name: Move gt_deb_scripts to workspace root - run: | - mv repo-scripts/CI/gt_deb_scripts $GITHUB_WORKSPACE/gt_deb_scripts - rm -rf repo-scripts - - - name: Start persistent container - run: | - docker run -d \ - ${{matrix.platform_flag}} \ - --name ${{matrix.distro}}-${{matrix.architecture}} \ - -v "$GITHUB_WORKSPACE/${{env.APP_NAME}}:/workspace/${{env.APP_NAME}}" \ - -v "$GITHUB_WORKSPACE/gt_deb_scripts:/workspace/gt_deb_scripts" \ - -w /workspace \ - ${{matrix.docker_image}} tail -f /dev/null - - - name: Install dependencies + - name: Add debian packaging to GT source tree + # Upstream gt ships a packaging/ dir with only the RPM files, so merge + # our debian files into it instead of replacing it. + shell: bash run: | - docker exec ${{matrix.distro}}-${{matrix.architecture}} sh -c "apt-get update && apt-get install -y debhelper devscripts build-essential wget cmake libusbgx-dev libconfig-dev libglib2.0-dev gettext-base" - - - name: Build GT + mkdir -p packaging + cp -r repo-scripts/packaging/debian_gt packaging/debian + - name: Install deps + shell: sh run: | - docker exec ${{matrix.distro}}-${{matrix.architecture}} sh -c "gt_deb_scripts/build-gt-deb.sh ${{env.PACKAGE_NAME}} ${{github.event.inputs.version}} ${{matrix.architecture}}" - - - name: Copy debian artifacts from container to host + repo-scripts/.github/scripts/install-deps-linux.sh + # This shared-action is compatible only with amd64/arm64 - armhf is built in install-app.sh + - name: Create debian package - amd64/arm64 + if: ${{ matrix.architecture == 'amd64' || matrix.architecture == 'arm64' }} + id: build_deb + uses: analogdevicesinc/shared-actions/deb-generator-action@main + with: + working-directory: . + ignore-path: | + packaging + control-path: packaging/debian + version: ${{ env.CI_VERSION }} + version-suffix: ${{ env.VERSION_SUFFIX }} + # Also debian creation for armhf architecture + - name: Install and verify application + shell: sh run: | - docker cp ${{matrix.distro}}-${{matrix.architecture}}:/workspace/. ./artifacts/ - ls -la ./artifacts/ - - - name: Upload GT debian package - uses: actions/upload-artifact@v7 + repo-scripts/.github/scripts/install-app.sh + env: + ARTIFACTS_DIR: ${{ steps.build_deb.outputs.artifact-dir || '' }} + - name: Upload debian artifacts to github + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 #v7 with: - name: ${{ env.APP_NAME }}-${{ matrix.architecture }} + name: ${{ env.DEBIAN_ARTIFACT }} path: | - artifacts/${{ env.PACKAGE_NAME }}*.deb - artifacts/${{ env.PACKAGE_NAME }}*.dsc - artifacts/${{ env.PACKAGE_NAME }}*.debian.tar.xz - artifacts/${{ env.PACKAGE_NAME }}*.orig.tar.gz + artifacts/ if-no-files-found: error - - - name: Authenticate with Cloudsmith via OIDC - if: success() && github.event.inputs.cloudsmith_upload == 'true' - uses: cloudsmith-io/cloudsmith-cli-action@v2.0.2 + - name: Setup cloudsmith + if: ${{ env.CLOUDSMITH_VERSION != '' }} + uses: cloudsmith-io/cloudsmith-cli-action@92b1383b22bbd36d804b858f273abcdf4d349f6b # v3 with: - oidc-namespace: adi - oidc-service-slug: ${{ secrets.CLOUDSMITH_SERVICE_SLUG }} - - - name: Upload debian package to Cloudsmith - if: success() && github.event.inputs.cloudsmith_upload == 'true' && env.CLOUDSMITH_API_KEY != '' - working-directory: ./artifacts + oidc-namespace: ${{ secrets.CLOUDSMITH_ORG }} + oidc-service-slug: ${{ secrets.CLOUDSMITH_SVC }} + - name: Push to cloudsmith + if: ${{ env.CLOUDSMITH_VERSION != '' }} + shell: bash run: | - pip install --break-system-packages cloudsmith-cli - for f in ${{env.PACKAGE_NAME}}*.dsc ${{env.PACKAGE_NAME}}*.orig.tar.gz ${{env.PACKAGE_NAME}}*.debian.tar.xz; do - [ -f "$f" ] || continue - cloudsmith push raw -SW --republish adi/kuiper-internal "$f" - done - cloudsmith push deb -SW --republish "adi/kuiper-internal/debian/trixie" ${{env.PACKAGE_NAME}}_*.deb + repo-scripts/.github/scripts/upload-to-cloudsmith.sh + env: + WORKSPACE: ${{ github.workspace }} diff --git a/.github/workflows/build-to-be-removed.yml b/.github/workflows/build-to-be-removed.yml deleted file mode 100644 index 623a6b5..0000000 --- a/.github/workflows/build-to-be-removed.yml +++ /dev/null @@ -1,129 +0,0 @@ -name: Build GT - -on: - pull_request: - branches: - - main - workflow_dispatch: - inputs: - version: - description: 'Version to build debian' - required: true - default: '1.0.0' - cloudsmith_upload: - description: 'Upload the built debian package to Cloudsmith' - required: true - type: boolean - default: false - -env: - PACKAGE_NAME: gt - APP_NAME: gt-${{ github.event_name == 'pull_request' && '1.0.0' || inputs.version }} - VERSION: ${{ github.event_name == 'pull_request' && '1.0.0' || inputs.version }} - CLOUDSMITH_UPLOAD: ${{ github.event_name == 'pull_request' && 'true' || inputs.cloudsmith_upload }} - CLOUDSMITH_REPO: ${{ github.event_name == 'pull_request' && secrets.CLOUDSMITH_TEST_REPO || 'adi/kuiper-internal' }} - -permissions: - id-token: write - -jobs: - build: - runs-on: ubuntu-24.04-arm - strategy: - fail-fast: false - matrix: - include: - - architecture: arm64 - container: docker.cloudsmith.io/adi/containers/kuiper_basic_64:latest - - architecture: armhf - container: docker.cloudsmith.io/adi/containers/kuiper_basic_32:latest - platform_flag: "--platform linux/arm/v7" - - architecture: arm64 - container: debian:latest - - architecture: armhf - container: debian:latest - platform_flag: "--platform linux/arm/v7" - container: ${{ matrix.architecture == 'arm64' && matrix.container || '' }} - steps: - - name: Download GT source code - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - with: - repository: linux-usb-gadgets/gt - path: ${{env.APP_NAME}} - - name: Checkout packaging files - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - with: - sparse-checkout: packaging - sparse-checkout-cone-mode: false - path: repo-scripts - - name: Add packaging/ to GT source tree - # Upstream gt already ships a packaging/ dir with only the RPM files - # (gt.spec, gt.manifest), so merge our packaging/debian into it - # instead of copying the dir over it. - run: | - mkdir -p "${{env.APP_NAME}}/packaging" - cp -r repo-scripts/packaging/. "${{env.APP_NAME}}/packaging/" - ls "${{env.APP_NAME}}/packaging/debian" - # debug: show what the deb build will see - ls -la "${{env.APP_NAME}}" - ls "${{env.APP_NAME}}/source" | head - - name: Install bootstrap dependencies - arm64 - if: ${{ matrix.architecture == 'arm64' }} - run: apt-get update && apt-get install -y curl ca-certificates sudo - # The shared-action is compatible only with amd64/arm64 - armhf runs the - # same build-deb.sh manually inside an emulated container. - - name: Build GT deb - arm64 - if: ${{ matrix.architecture == 'arm64' }} - uses: analogdevicesinc/shared-actions/deb-generator-action@main - with: - working-directory: ${{env.APP_NAME}} - ignore-path: | - packaging - control-path: packaging/debian - version: ${{ env.VERSION }} - - name: Build GT deb - armhf - if: ${{ matrix.architecture == 'armhf' }} - env: - VERSION: ${{ env.VERSION }} - run: | - docker run --rm \ - ${{matrix.platform_flag}} \ - -e VERSION \ - -e GITHUB_WORKSPACE=/workspace \ - -e WORKING_DIRECTORY="/workspace/${{env.APP_NAME}}" \ - -e CONTROL_PATH=packaging/debian \ - -e IGNORE_PATH=packaging \ - -v "$GITHUB_WORKSPACE:/workspace" \ - -w "/workspace/${{env.APP_NAME}}" \ - ${{matrix.container}} /bin/bash -c " - set -e - apt-get update && apt-get install -y git curl ca-certificates sudo - git clone https://github.com/analogdevicesinc/shared-actions /tmp/shared-actions - /tmp/shared-actions/deb-generator-action/build-deb.sh - " - - name: Upload GT debian package - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7 - with: - name: ${{ env.APP_NAME }}-${{ matrix.architecture }} - path: | - artifacts/${{ env.PACKAGE_NAME }}*.deb - artifacts/${{ env.PACKAGE_NAME }}*.dsc - artifacts/${{ env.PACKAGE_NAME }}*.debian.tar.xz - artifacts/${{ env.PACKAGE_NAME }}*.orig.tar.gz - if-no-files-found: error - - name: Authenticate with Cloudsmith via OIDC - if: success() && env.CLOUDSMITH_UPLOAD == 'true' - uses: cloudsmith-io/cloudsmith-cli-action@92b1383b22bbd36d804b858f273abcdf4d349f6b # v3 - with: - oidc-namespace: adi - oidc-service-slug: ${{ secrets.CLOUDSMITH_SERVICE_SLUG }} - - name: Upload debian package to Cloudsmith - if: success() && env.CLOUDSMITH_UPLOAD == 'true' && env.CLOUDSMITH_API_KEY != '' - working-directory: ./artifacts - run: | - pip install --break-system-packages cloudsmith-cli - for f in ${{env.PACKAGE_NAME}}*.dsc ${{env.PACKAGE_NAME}}*.orig.tar.gz ${{env.PACKAGE_NAME}}*.debian.tar.xz; do - [ -f "$f" ] || continue - cloudsmith push raw -SW --republish ${{ env.CLOUDSMITH_REPO }} "$f" - done - cloudsmith push deb -SW --republish "${{ env.CLOUDSMITH_REPO }}/debian/trixie" ${{env.PACKAGE_NAME}}_*.deb diff --git a/packaging/VERSION_GT b/packaging/VERSION_GT new file mode 100644 index 0000000..3eefcb9 --- /dev/null +++ b/packaging/VERSION_GT @@ -0,0 +1 @@ +1.0.0 diff --git a/packaging/debian/changelog b/packaging/debian/changelog index 4718bbf..b1d304f 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,5 +1,5 @@ -gt (@VERSION@) UNRELEASED; urgency=low +adi-scripts (@VERSION@) UNRELEASED; urgency=medium * Automated package build. - -- EngineerZone @DATE@ + -- EngineerZone @DATE@ diff --git a/packaging/debian/changelog.template b/packaging/debian/changelog.template deleted file mode 100644 index a4356a4..0000000 --- a/packaging/debian/changelog.template +++ /dev/null @@ -1,5 +0,0 @@ -${PACKAGE} (${VERSION}-1) stable; urgency=medium - - * ${CHANGELOG_ENTRY} - - -- EngineerZone ${DATE} diff --git a/packaging/debian/control b/packaging/debian/control index 5616b41..d0109a0 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -1,14 +1,13 @@ -Source: gt +Source: adi-scripts Section: utils Priority: optional -Maintainer: EngineerZone -Build-Depends: debhelper-compat (= 13), cmake, libusbgx-dev, libconfig-dev, libglib2.0-dev +Maintainer: EngineerZone +Build-Depends: debhelper-compat (= 13) Standards-Version: 4.6.2 -Homepage: https://github.com/linux-usb-gadgets/gt +Homepage: https://github.com/analogdevicesinc/linux_image_ADI-scripts -Package: gt -Architecture: @ARCHITECTURE@ -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: USB Gadget Tool - command-line configuration tool - Command-line tool for configuring USB gadgets on Linux systems using the configFS interface. - Provides an easy way to create and manage USB gadget configurations. +Package: adi-scripts +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, bash, wget, systemd, gt (>= 1.0) +Description: ADI Linux system configuration and test scripts + This package contains shell scripts for configuring and testing Analog Devices hardware on Linux systems, including power management, USB gadget configuration, and various device test scripts. diff --git a/packaging/debian/control.template b/packaging/debian/control.template deleted file mode 100644 index 10f0ba6..0000000 --- a/packaging/debian/control.template +++ /dev/null @@ -1,13 +0,0 @@ -Source: ${PACKAGE} -Section: utils -Priority: optional -Maintainer: EngineerZone -Build-Depends: debhelper-compat (= 13) -Standards-Version: 4.6.2 -Homepage: https://github.com/analogdevicesinc/linux_image_ADI-scripts - -Package: ${PACKAGE} -Architecture: all -Depends: ${shlibs:Depends}, ${misc:Depends}, bash, wget, systemd, gt (>= 1.0) -Description: ADI Linux system configuration and test scripts - This package contains shell scripts for configuring and testing Analog Devices hardware on Linux systems, including power management, USB gadget configuration, and various device test scripts. diff --git a/packaging/debian/rules b/packaging/debian/rules index 6c2388f..e73bcbc 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -1,6 +1,6 @@ #!/usr/bin/make -f -PACKAGE ?= adi-scripts +PACKAGE = adi-scripts export DH_VERBOSE = 1 diff --git a/packaging/debian_gt/changelog b/packaging/debian_gt/changelog new file mode 100644 index 0000000..4718bbf --- /dev/null +++ b/packaging/debian_gt/changelog @@ -0,0 +1,5 @@ +gt (@VERSION@) UNRELEASED; urgency=low + + * Automated package build. + + -- EngineerZone @DATE@ diff --git a/packaging/debian_gt/control b/packaging/debian_gt/control new file mode 100644 index 0000000..5616b41 --- /dev/null +++ b/packaging/debian_gt/control @@ -0,0 +1,14 @@ +Source: gt +Section: utils +Priority: optional +Maintainer: EngineerZone +Build-Depends: debhelper-compat (= 13), cmake, libusbgx-dev, libconfig-dev, libglib2.0-dev +Standards-Version: 4.6.2 +Homepage: https://github.com/linux-usb-gadgets/gt + +Package: gt +Architecture: @ARCHITECTURE@ +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: USB Gadget Tool - command-line configuration tool + Command-line tool for configuring USB gadgets on Linux systems using the configFS interface. + Provides an easy way to create and manage USB gadget configurations. diff --git a/packaging/debian_gt/copyright b/packaging/debian_gt/copyright new file mode 100644 index 0000000..7c0b0f7 --- /dev/null +++ b/packaging/debian_gt/copyright @@ -0,0 +1,496 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: gt +Upstream-Contact: https://github.com/linux-usb-gadgets/gt/issues +Source: https://github.com/linux-usb-gadgets/gt + +Files: * +Copyright: 2012-2015, Samsung Electronics Co., Ltd. +License: Apache-2.0 + +Files: examples/cross-compile/README.rst examples/systemd/README.rst +Copyright: 2019, Collabora Ltd +License: CC-BY-SA-4.0 + +Files: examples/systemd/99-udc.rules + examples/systemd/gt.target + examples/systemd/gt@.service +Copyright: 2019, Collabora Ltd +License: Expat or LGPL-2.1+ + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + On Debian systems, the complete text of the Apache License, + Version 2.0 can be found in '/usr/share/common-licenses/Apache-2.0'. + +License: CC-BY-SA-4.0 + Attribution-ShareAlike 4.0 International + . + ======================================================================= + . + Creative Commons Corporation ("Creative Commons") is not a law firm and + does not provide legal services or legal advice. Distribution of + Creative Commons public licenses does not create a lawyer-client or + other relationship. Creative Commons makes its licenses and related + information available on an "as-is" basis. Creative Commons gives no + warranties regarding its licenses, any material licensed under their + terms and conditions, or any related information. Creative Commons + disclaims all liability for damages resulting from their use to the + fullest extent possible. + . + Using Creative Commons Public Licenses + . + Creative Commons public licenses provide a standard set of terms and + conditions that creators and other rights holders may use to share + original works of authorship and other material subject to copyright + and certain other rights specified in the public license below. The + following considerations are for informational purposes only, are not + exhaustive, and do not form part of our licenses. + . + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + . + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + . + ======================================================================= + . + Creative Commons Attribution-ShareAlike 4.0 International Public + License + . + By exercising the Licensed Rights (defined below), You accept and agree + to be bound by the terms and conditions of this Creative Commons + Attribution-ShareAlike 4.0 International Public License ("Public + License"). To the extent this Public License may be interpreted as a + contract, You are granted the Licensed Rights in consideration of Your + acceptance of these terms and conditions, and the Licensor grants You + such rights in consideration of benefits the Licensor receives from + making the Licensed Material available under these terms and + conditions. + . + . + Section 1 -- Definitions. + . + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + . + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + . + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + . + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + . + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + . + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + . + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + . + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + . + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + . + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + . + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + . + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + . + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + . + . + Section 2 -- Scope. + . + a. License grant. + . + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + . + a. reproduce and Share the Licensed Material, in whole or + in part; and + . + b. produce, reproduce, and Share Adapted Material. + . + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + . + 3. Term. The term of this Public License is specified in Section + 6(a). + . + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + . + 5. Downstream recipients. + . + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + . + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + . + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + . + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + . + b. Other rights. + . + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + . + 2. Patent and trademark rights are not licensed under this + Public License. + . + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + . + . + Section 3 -- License Conditions. + . + Your exercise of the Licensed Rights is expressly made subject to the + following conditions. + . + a. Attribution. + . + 1. If You Share the Licensed Material (including in modified + form), You must: + . + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + . + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + . + ii. a copyright notice; + . + iii. a notice that refers to this Public License; + . + iv. a notice that refers to the disclaimer of + warranties; + . + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + . + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + . + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + . + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + . + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + . + b. ShareAlike. + . + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + . + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + . + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + . + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + . + . + Section 4 -- Sui Generis Database Rights. + . + Where the Licensed Rights include Sui Generis Database Rights that + apply to Your use of the Licensed Material: + . + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + . + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + . + including for purposes of Section 3(b); and + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + . + For the avoidance of doubt, this Section 4 supplements and does not + replace Your obligations under this Public License where the Licensed + Rights include other Copyright and Similar Rights. + . + . + Section 5 -- Disclaimer of Warranties and Limitation of Liability. + . + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + . + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + . + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + . + . + Section 6 -- Term and Termination. + . + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + . + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + . + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + . + 2. upon express reinstatement by the Licensor. + . + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + . + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + . + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + . + . + Section 7 -- Other Terms and Conditions. + . + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + . + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + . + . + Section 8 -- Interpretation. + . + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + . + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + . + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + . + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + . + . + ======================================================================= + . + Creative Commons is not a party to its public + licenses. Notwithstanding, Creative Commons may elect to apply one of + its public licenses to material it publishes and in those instances + will be considered the “Licensor.” The text of the Creative Commons + public licenses is dedicated to the public domain under the CC0 Public + Domain Dedication. Except for the limited purpose of indicating that + material is shared under a Creative Commons public license or as + otherwise permitted by the Creative Commons policies published at + creativecommons.org/policies, Creative Commons does not authorize the + use of the trademark "Creative Commons" or any other trademark or logo + of Creative Commons without its prior written consent including, + without limitation, in connection with any unauthorized modifications + to any of its public licenses or any other arrangements, + understandings, or agreements concerning use of licensed material. For + the avoidance of doubt, this paragraph does not form part of the + public licenses. + . + Creative Commons may be contacted at creativecommons.org. + +License: Expat + The MIT License + . + 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. + +License: LGPL-2.1+ + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; version 2.1 of the License, or (at + your option) any later version. + On Debian systems, the complete text of version 2.1 of the GNU Lesser + General Public License can be found in '/usr/share/common-licenses/LGPL-2.1'. diff --git a/packaging/debian_gt/rules b/packaging/debian_gt/rules new file mode 100755 index 0000000..a489a26 --- /dev/null +++ b/packaging/debian_gt/rules @@ -0,0 +1,22 @@ +#!/usr/bin/make -f + +export DH_VERBOSE = 1 + +%: + dh $@ + +override_dh_auto_configure: + # Configure with cmake, install to /usr + cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_MANUAL_PAGE=off . + +override_dh_auto_build: + # Build gt + $(MAKE) + +override_dh_auto_install: + # Install using upstream cmake with DESTDIR + $(MAKE) install DESTDIR=$(CURDIR)/debian/gt + +override_dh_auto_test: + # Skip tests + : diff --git a/packaging/debian_gt/source/format b/packaging/debian_gt/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/packaging/debian_gt/source/format @@ -0,0 +1 @@ +3.0 (quilt) From 0e07407202917fdf6a23da00e935fd9722dd4b53 Mon Sep 17 00:00:00 2001 From: Lewluu Date: Tue, 24 Nov 2026 13:20:23 +0200 Subject: [PATCH 5/6] ci: fix make install dir Signed-off-by: Lewluu --- Makefile | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 370a709..432dab5 100644 --- a/Makefile +++ b/Makefile @@ -1,23 +1,43 @@ -DESTDIR=/usr/local +DESTDIR ?= +PREFIX ?= /usr/local +SYSTEMD_DIR ?= /etc/systemd/system +# Pure file installation (no systemctl, no network): safe for packaging install: - install -d $(DESTDIR)/bin - install ./*.sh $(DESTDIR)/bin/ + install -d $(DESTDIR)$(PREFIX)/bin + install ./*.sh $(DESTDIR)$(PREFIX)/bin/ - install -D -m 0644 ./power-service/adi-power.service /etc/systemd/system/ - install -D -m 0644 ./power-service/adi_power.py /usr/share/systemd/ - install -D -m 0644 ./power-service/stingray_power.py /usr/share/systemd/ + install -D -m 0644 ./power-service/adi-power.service $(DESTDIR)$(SYSTEMD_DIR)/adi-power.service + install -D -m 0644 ./power-service/adi_power.py $(DESTDIR)/usr/share/systemd/adi_power.py + install -D -m 0644 ./power-service/stingray_power.py $(DESTDIR)/usr/share/systemd/stingray_power.py - install -D -m 0644 ./lightdm_timeout.conf /etc/systemd/system/lightdm.service.d/timeout.conf + install -D -m 0644 ./lightdm_timeout.conf $(DESTDIR)$(SYSTEMD_DIR)/lightdm.service.d/timeout.conf - install -D -m 0644 ./jupiter_scripts/fan-control.service /etc/systemd/system/fan-control.service - install -D -m 0744 ./jupiter_scripts/fan-control /usr/bin/fan-control + install -D -m 0644 ./jupiter_scripts/fan-control.service $(DESTDIR)$(SYSTEMD_DIR)/fan-control.service + install -D -m 0744 ./jupiter_scripts/fan-control $(DESTDIR)/usr/bin/fan-control - install -D -m 0644 ./fix-display-port.service /etc/systemd/system/fix-display-port.service + install -D -m 0644 ./fix-display-port.service $(DESTDIR)$(SYSTEMD_DIR)/fix-display-port.service + # USB gadget service files (gt itself comes from the gt package) + for f in gt.service gt-start.service gt.target iiod_ffs.service dev-iio_ffs.mount iiod_context_attr.service; do \ + install -D -m 0644 usb-gadget-service/systemd/$$f $(DESTDIR)$(SYSTEMD_DIR)/$$f; \ + done + install -D -m 0644 usb-gadget-service/defaults/usb_gadget $(DESTDIR)/etc/default/usb_gadget + install -D -m 0644 usb-gadget-service/defaults/iiod $(DESTDIR)/etc/default/iiod + for f in usb-gadget-service/schemes/*.scheme; do \ + install -D -m 0644 $$f $(DESTDIR)$(PREFIX)/etc/gt/adi/$$(basename $$f); \ + done + install -D -m 0744 usb-gadget-service/scripts/iiod_context.sh $(DESTDIR)$(PREFIX)/bin/iiod_context.sh + install -D -m 0744 usb-gadget-service/scripts/usb_gadget.sh $(DESTDIR)$(PREFIX)/bin/usb_gadget.sh + install -D -m 0644 usb-gadget-service/udev/99-udc.rules $(DESTDIR)/etc/udev/rules.d/99-udc.rules + +# On-device setup (previous behaviour of "make install"): enable services and build gt +enable: systemctl daemon-reload systemctl enable adi-power.service systemctl enable fan-control.service systemctl enable fix-display-port.service /bin/sh usb-gadget-service/install_gt.sh + +.PHONY: install enable From ca58633638f5303d78fb6803e24c6632da0be489 Mon Sep 17 00:00:00 2001 From: Lewluu Date: Tue, 24 Nov 2026 17:28:14 +0200 Subject: [PATCH 6/6] ci: sync debian workflows Syncing gt and adi-scirpts debian workflows. Adi-scripts needs gt debian package for installing and testing its debian first. Using cloudsmith debian setup for solving this and installing the gt debian package directly from repository. Signed-off-by: Lewluu --- .github/scripts/install-app.sh | 13 ++-- .github/scripts/install-deps-linux.sh | 33 ++++++++- .github/scripts/setup-cloudsmith-apt.sh | 43 ++++++++++++ .github/scripts/upload-to-cloudsmith.sh | 23 +------ .../build-linux-image-adi-scripts.yaml | 67 +++++++++++++------ .../workflows/build-linux-usb-gadgets-gt.yaml | 23 +++++-- packaging/debian/changelog | 2 +- packaging/debian/control | 4 +- packaging/debian/copyright | 2 +- packaging/debian_gt/changelog | 2 +- packaging/debian_gt/control | 2 +- packaging/debian_gt/rules | 6 +- 12 files changed, 159 insertions(+), 61 deletions(-) create mode 100755 .github/scripts/setup-cloudsmith-apt.sh diff --git a/.github/scripts/install-app.sh b/.github/scripts/install-app.sh index cf32d3e..74d566e 100755 --- a/.github/scripts/install-app.sh +++ b/.github/scripts/install-app.sh @@ -5,9 +5,8 @@ set -eo pipefail # Env: ARCHITECTURE, CONTAINER, CI_VERSION, VERSION_SUFFIX, PACKAGE_NAME, # CONTROL_PATH (default packaging/debian), ARTIFACTS_DIR (amd64/arm64: # output of the deb action), -# OUTPUT_PREFIX (default PACKAGE_NAME), GITHUB_ENV +# GITHUB_ENV CONTROL_PATH="${CONTROL_PATH:-packaging/debian}" -OUTPUT_PREFIX="${OUTPUT_PREFIX:-$PACKAGE_NAME}" # Packages may be Architecture: all, so match any architecture in the filename DEB_GLOB="${PACKAGE_NAME}_${CI_VERSION}-1${VERSION_SUFFIX}_*.deb" @@ -57,8 +56,14 @@ if [[ "$ARCHITECTURE" == 'armhf' ]]; then else os_release=$(cat /etc/os-release) fi + version_id=$(echo "$os_release" | grep "^VERSION_ID" | cut -d "=" -f2 | tr -d '"' || true) + +# Cloudsmith distribution (e.g. debian/trixie, ubuntu/noble) comes from the os-release of the build system +distribution_id=$(echo "$os_release" | grep "^ID=" | cut -d "=" -f2 | tr -d '"' || true) +distribution_codename=$(echo "$os_release" | grep "^VERSION_CODENAME" | cut -d "=" -f2 | tr -d '"' || true) # Debian testing (forky) has no VERSION_ID - fall back to the codename -[[ -z "$version_id" ]] && version_id=$(echo "$os_release" | grep "^VERSION_CODENAME" | cut -d "=" -f2 | tr -d '"') +[[ -z "$version_id" ]] && version_id=$(echo "$os_release" | grep "^VERSION_CODENAME" | cut -d "=" -f2 | tr -d '"') || true -echo "DEBIAN_ARTIFACT=${OUTPUT_PREFIX}-deb-${ARCHITECTURE}-${distro_tag}-${version_id}" >> "$GITHUB_ENV" +echo "DEBIAN_ARTIFACT=${PACKAGE_NAME}-deb-${ARCHITECTURE}-${distro_tag}-${version_id}" >> "$GITHUB_ENV" +echo "DISTRIBUTION_NAME=${distribution_id}/${distribution_codename}" >> "$GITHUB_ENV" diff --git a/.github/scripts/install-deps-linux.sh b/.github/scripts/install-deps-linux.sh index b8692a1..b960a8b 100755 --- a/.github/scripts/install-deps-linux.sh +++ b/.github/scripts/install-deps-linux.sh @@ -16,9 +16,25 @@ if [[ "$ARCHITECTURE" == "armhf" ]]; then -dit "${CONTAINER}" echo "::group::Installing dependencies" - docker exec debian-armhf /bin/bash -c " - set -e + docker exec \ + -e PACKAGE_NAME=${PACKAGE_NAME} \ + -e CLOUDSMITH_ORG=${CLOUDSMITH_ORG} \ + -e CLOUDSMITH_USERNAME=${CLOUDSMITH_USERNAME} \ + -e CLOUDSMITH_REPO=${CLOUDSMITH_REPO} \ + -e CLOUDSMITH_API_KEY=${CLOUDSMITH_API_KEY} \ + -e GT_DEBIAN_VERSION=${GT_DEBIAN_VERSION} \ + -w /workspace \ + debian-armhf \ + /bin/bash -c " + set -eo pipefail apt-get update && apt-get install -y ${DEPS} sudo + + # Install downloaded gt artifact + if [[ \"\$PACKAGE_NAME\" == \"adi-scripts\" ]]; then + /workspace/.github/scripts/setup-cloudsmith-apt.sh + apt-cache policy gt || true + apt-get install -y gt=\${GT_DEBIAN_VERSION} + fi " echo "::endgroup::" else @@ -27,5 +43,18 @@ else echo "::group::Installing dependencies" ${SUDO} apt-get update DEBIAN_FRONTEND=noninteractive ${SUDO} apt-get install -y ${DEPS} sudo + + # Install downloaded gt artifact + if [[ "$PACKAGE_NAME" == "adi-scripts" ]]; then + [[ -n "${CLOUDSMITH_API_KEY}" ]] || { echo "::error::CLOUDSMITH_API_KEY is empty (Setup cloudsmith step did not export it)"; exit 1; } + [[ -n "${CLOUDSMITH_USERNAME}" && -n "${CLOUDSMITH_ORG}" && -n "${CLOUDSMITH_REPO}" ]] || { echo "::error::CLOUDSMITH_USERNAME/ORG/REPO is empty"; exit 1; } + # sudo-rs (Ubuntu 26.04) ignores -E, so pass the variables explicitly + ${SUDO} env CLOUDSMITH_ORG="${CLOUDSMITH_ORG}" CLOUDSMITH_REPO="${CLOUDSMITH_REPO}" \ + CLOUDSMITH_USERNAME="${CLOUDSMITH_USERNAME}" CLOUDSMITH_API_KEY="${CLOUDSMITH_API_KEY}" \ + bash .github/scripts/setup-cloudsmith-apt.sh + apt-cache policy gt || true + ${SUDO} apt-get install -y "gt=${GT_DEBIAN_VERSION}" + fi + echo "::endgroup::" fi diff --git a/.github/scripts/setup-cloudsmith-apt.sh b/.github/scripts/setup-cloudsmith-apt.sh new file mode 100755 index 0000000..1f06366 --- /dev/null +++ b/.github/scripts/setup-cloudsmith-apt.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +set -eo pipefail + +# Configure the private Cloudsmith apt repository manually (must run as root). +# The generated setup.deb.sh does not forward basic-auth credentials to its own +# requests (GPG key / config), so it fails on private repos - do it by hand. +# Env: CLOUDSMITH_ORG, CLOUDSMITH_REPO, CLOUDSMITH_USERNAME, CLOUDSMITH_API_KEY +# Optional: CLOUDSMITH_GPG_KEY_ID (repo signing key id), CLOUDSMITH_DISTRO, CLOUDSMITH_CODENAME +# The repo is flat, so a supported distro is forced - Ubuntu 24.04/26.04 and Debian +# testing (forky) are not reliably auto-detected. + +: "${CLOUDSMITH_ORG:?}" "${CLOUDSMITH_REPO:?}" "${CLOUDSMITH_USERNAME:?}" "${CLOUDSMITH_API_KEY:?}" +KEY_ID="${CLOUDSMITH_GPG_KEY_ID:-85421AD6CC87F02A}" +DISTRO="${CLOUDSMITH_DISTRO:-debian}" +CODENAME="${CLOUDSMITH_CODENAME:-trixie}" + +BASE="https://dl.cloudsmith.io/basic/${CLOUDSMITH_ORG}/${CLOUDSMITH_REPO}" +NAME="${CLOUDSMITH_ORG}-${CLOUDSMITH_REPO}" +KEYRING="/usr/share/keyrings/${NAME}-archive-keyring.gpg" +LIST="/etc/apt/sources.list.d/${NAME}.list" +AUTH="/etc/apt/auth.conf.d/${NAME}.conf" + +export DEBIAN_FRONTEND=noninteractive +apt-get update +apt-get install -y apt-transport-https ca-certificates curl gnupg + +CURL=(curl -u "${CLOUDSMITH_USERNAME}:${CLOUDSMITH_API_KEY}" -1sSL --fail-with-body) + +rm -f "${KEYRING}" +"${CURL[@]}" "${BASE}/gpg.${KEY_ID}.key" | gpg --dearmor > "${KEYRING}" +"${CURL[@]}" "${BASE}/config.deb.txt?distro=${DISTRO}&codename=${CODENAME}&component=main" > "${LIST}" + +# apt authentication for the private repo +mkdir -p /etc/apt/auth.conf.d +printf 'machine dl.cloudsmith.io login %s password %s\n' "${CLOUDSMITH_USERNAME}" "${CLOUDSMITH_API_KEY}" > "${AUTH}" +chmod 600 "${AUTH}" +chmod 644 "${KEYRING}" "${LIST}" + +# Make sure the key path used by the list matches the one we installed +grep -q "signed-by" "${LIST}" && sed -i "s#signed-by=[^] ]*#signed-by=${KEYRING}#" "${LIST}" + +apt-get update diff --git a/.github/scripts/upload-to-cloudsmith.sh b/.github/scripts/upload-to-cloudsmith.sh index 55dc3c3..c922b23 100755 --- a/.github/scripts/upload-to-cloudsmith.sh +++ b/.github/scripts/upload-to-cloudsmith.sh @@ -5,26 +5,9 @@ set -eo pipefail # Env: WORKSPACE, PACKAGE_NAME, CONTAINER, CLOUDSMITH_ORG, CLOUDSMITH_REPO, CLOUDSMITH_VERSION cd "${WORKSPACE}/artifacts" -# Determine distro tag from container -if [[ "${CONTAINER}" == *"kuiper"* ]]; then - DISTRO_TAG="-kuiper" -elif [[ "${CONTAINER}" == "debian:latest" || "${CONTAINER}" == "debian:forky" ]]; then - DISTRO_TAG="-debian" -else - DISTRO_TAG="" -fi - -# Source package files go to the raw repository -for f in "${PACKAGE_NAME}"*.dsc "${PACKAGE_NAME}"*.orig.tar.gz "${PACKAGE_NAME}"*.debian.tar.xz; do - [[ -f "$f" ]] || continue - cloudsmith push raw -SW --republish --no-wait-for-sync \ - --name "${f}" --tags "${f%%_*}${DISTRO_TAG}" --version "${CLOUDSMITH_VERSION}" \ - "${CLOUDSMITH_ORG}/${CLOUDSMITH_REPO}" "$f" -done - -# Binary packages go to the debian repository +# Binary packages go to the debian repository. Source package files (.dsc, .orig.tar.gz, .debian.tar.xz) are not uploaded for f in "${PACKAGE_NAME}"_*.deb; do [[ -f "$f" ]] || continue - cloudsmith push deb -SW --republish --no-wait-for-sync \ - "${CLOUDSMITH_ORG}/${CLOUDSMITH_REPO}/debian/trixie" "$f" + cloudsmith push deb --republish --no-wait-for-sync \ + "${CLOUDSMITH_ORG}/${CLOUDSMITH_REPO}/${DISTRIBUTION_NAME}" "$f" done diff --git a/.github/workflows/build-linux-image-adi-scripts.yaml b/.github/workflows/build-linux-image-adi-scripts.yaml index dde0f66..b5b9c0f 100644 --- a/.github/workflows/build-linux-image-adi-scripts.yaml +++ b/.github/workflows/build-linux-image-adi-scripts.yaml @@ -5,19 +5,12 @@ permissions: id-token: write on: - workflow_dispatch: - push: - branches: - - main - - kuiper2.0 - - '20[1-9][0-9]_R[1-9]' - tags: - - 'v*' - pull_request: - branches: - - main - - kuiper2.0 - - '20[1-9][0-9]_R[1-9]' + workflow_call: + inputs: + gt-version: + description: 'Gt debian version' + required: true + type: string concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -41,6 +34,7 @@ jobs: VERSION_FILE: packaging/VERSION CLOUDSMITH_PREFIX: adi-scripts build-linux: + needs: identify-version strategy: fail-fast: false matrix: @@ -51,8 +45,25 @@ jobs: - architecture: amd64 runs-on: ubuntu-26.04 version-suffix: +Ubuntu26.04 + - architecture: arm64 + runs-on: ubuntu-26.04-arm + container: docker.cloudsmith.io/adi/containers/kuiper_basic_64:latest + version-suffix: +Debian13 + - architecture: armhf + runs-on: ubuntu-26.04-arm + container: docker.cloudsmith.io/adi/containers/kuiper_basic_32:latest + platform: linux/arm/v7 + version-suffix: +Debian13 + - architecture: arm64 + runs-on: ubuntu-26.04-arm + container: debian:forky + version-suffix: +Debian14 + - architecture: armhf + runs-on: ubuntu-26.04-arm + container: debian:forky + platform: linux/arm/v7 + version-suffix: +Debian14 runs-on: ${{ matrix.runs-on }} - needs: identify-version container: ${{ matrix.architecture == 'arm64' && matrix.container || '' }} env: ARCHITECTURE: ${{ matrix.architecture }} @@ -62,13 +73,35 @@ jobs: CLOUDSMITH_VERSION: ${{ needs.identify-version.outputs.cloudsmith-version }} CLOUDSMITH_ORG: ${{ secrets.CLOUDSMITH_ORG }} CLOUDSMITH_REPO: ${{ secrets.CLOUDSMITH_REPO }} + CLOUDSMITH_USER: ${{ secrets.CLOUDSMITH_SVC }} VERSION_SUFFIX: ${{ matrix.version-suffix }} PACKAGE_NAME: adi-scripts CONTROL_PATH: packaging/debian OUTPUT_PREFIX: adi-scripts + GT_DEBIAN_VERSION: ${{ inputs.gt-version }}-1${{ matrix.version-suffix }} steps: - name: Checkout code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + # The cloudsmith action installer needs curl or wget, which the arm runner image / job container may not ship + - name: Install cloudsmith action prerequisites + shell: bash + run: | + # jq is required by the action's export-auth-token + if (command -v curl >/dev/null 2>&1 || command -v wget >/dev/null 2>&1) && command -v jq >/dev/null 2>&1; then + echo "curl/wget and jq already available" + exit 0 + fi + [[ "$(id -u)" == "0" ]] && SUDO="" || SUDO="sudo" + ${SUDO} apt-get update + ${SUDO} apt-get install -y curl ca-certificates jq + # Needed for installing gt from the private repo, regardless of publishing + - name: Setup cloudsmith + uses: cloudsmith-io/cloudsmith-cli-action@92b1383b22bbd36d804b858f273abcdf4d349f6b # v3 + with: + oidc-namespace: ${{ secrets.CLOUDSMITH_ORG }} + oidc-service-slug: ${{ secrets.CLOUDSMITH_SVC }} + # Exports the OIDC token as CLOUDSMITH_API_KEY (and CLOUDSMITH_USERNAME=token) for the gt repo setup + export-auth-token: true - name: Install deps shell: sh run: | @@ -99,12 +132,6 @@ jobs: path: | artifacts/ if-no-files-found: error - - name: Setup cloudsmith - if: ${{ env.CLOUDSMITH_VERSION != '' }} - uses: cloudsmith-io/cloudsmith-cli-action@92b1383b22bbd36d804b858f273abcdf4d349f6b # v3 - with: - oidc-namespace: ${{ secrets.CLOUDSMITH_ORG }} - oidc-service-slug: ${{ secrets.CLOUDSMITH_SVC }} - name: Push to cloudsmith if: ${{ env.CLOUDSMITH_VERSION != '' }} shell: bash diff --git a/.github/workflows/build-linux-usb-gadgets-gt.yaml b/.github/workflows/build-linux-usb-gadgets-gt.yaml index 4353490..49195e0 100644 --- a/.github/workflows/build-linux-usb-gadgets-gt.yaml +++ b/.github/workflows/build-linux-usb-gadgets-gt.yaml @@ -19,10 +19,6 @@ on: - kuiper2.0 - '20[1-9][0-9]_R[1-9]' -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - jobs: identify-version: runs-on: ubuntu-latest @@ -40,11 +36,20 @@ jobs: env: VERSION_FILE: packaging/VERSION_GT CLOUDSMITH_PREFIX: gt - build-linux: + build-gt: strategy: fail-fast: false matrix: include: + - architecture: amd64 + runs-on: ubuntu-24.04 + version-suffix: +Ubuntu24.04 + # Ubuntu 24.04 ships libusbgx 0.2.0, which lacks the inquiry_string + # attribute gt uses from bcf9525 on - build the commit before it + gt-ref: 7f9c45d98425a27444e49606ce3cf375e6164e8e + - architecture: amd64 + runs-on: ubuntu-26.04 + version-suffix: +Ubuntu26.04 - architecture: arm64 runs-on: ubuntu-26.04-arm container: docker.cloudsmith.io/adi/containers/kuiper_basic_64:latest @@ -77,12 +82,12 @@ jobs: VERSION_SUFFIX: ${{ matrix.version-suffix }} PACKAGE_NAME: gt CONTROL_PATH: packaging/debian - OUTPUT_PREFIX: gt steps: - name: Download GT source code uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: repository: linux-usb-gadgets/gt + ref: ${{ matrix.gt-ref }} - name: Checkout packaging and CI scripts uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 with: @@ -137,3 +142,9 @@ jobs: repo-scripts/.github/scripts/upload-to-cloudsmith.sh env: WORKSPACE: ${{ github.workspace }} + adi-scripts-build: + needs: [build-gt, identify-version] + uses: ./.github/workflows/build-linux-image-adi-scripts.yaml + with: + gt-version: ${{ needs.identify-version.outputs.ci-version }} + secrets: inherit diff --git a/packaging/debian/changelog b/packaging/debian/changelog index b1d304f..0406cf8 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -2,4 +2,4 @@ adi-scripts (@VERSION@) UNRELEASED; urgency=medium * Automated package build. - -- EngineerZone @DATE@ + -- Analog Devices Maintainers @DATE@ diff --git a/packaging/debian/control b/packaging/debian/control index d0109a0..ebe5669 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -1,13 +1,13 @@ Source: adi-scripts Section: utils Priority: optional -Maintainer: EngineerZone +Maintainer: Analog Devices Maintainers Build-Depends: debhelper-compat (= 13) Standards-Version: 4.6.2 Homepage: https://github.com/analogdevicesinc/linux_image_ADI-scripts Package: adi-scripts -Architecture: all +Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, bash, wget, systemd, gt (>= 1.0) Description: ADI Linux system configuration and test scripts This package contains shell scripts for configuring and testing Analog Devices hardware on Linux systems, including power management, USB gadget configuration, and various device test scripts. diff --git a/packaging/debian/copyright b/packaging/debian/copyright index c07e33a..5fe55cf 100644 --- a/packaging/debian/copyright +++ b/packaging/debian/copyright @@ -1,6 +1,6 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: linux_image_ADI-scripts -Upstream-Contact: EngineerZone +Upstream-Contact: Analog Devices Maintainers Source: https://github.com/analogdevicesinc/linux_image_ADI-scripts Files: * diff --git a/packaging/debian_gt/changelog b/packaging/debian_gt/changelog index 4718bbf..beb07fb 100644 --- a/packaging/debian_gt/changelog +++ b/packaging/debian_gt/changelog @@ -2,4 +2,4 @@ gt (@VERSION@) UNRELEASED; urgency=low * Automated package build. - -- EngineerZone @DATE@ + -- Analog Devices Maintainers @DATE@ diff --git a/packaging/debian_gt/control b/packaging/debian_gt/control index 5616b41..84ea178 100644 --- a/packaging/debian_gt/control +++ b/packaging/debian_gt/control @@ -1,7 +1,7 @@ Source: gt Section: utils Priority: optional -Maintainer: EngineerZone +Maintainer: Analog Devices Maintainers Build-Depends: debhelper-compat (= 13), cmake, libusbgx-dev, libconfig-dev, libglib2.0-dev Standards-Version: 4.6.2 Homepage: https://github.com/linux-usb-gadgets/gt diff --git a/packaging/debian_gt/rules b/packaging/debian_gt/rules index a489a26..296c5e7 100755 --- a/packaging/debian_gt/rules +++ b/packaging/debian_gt/rules @@ -7,15 +7,15 @@ export DH_VERBOSE = 1 override_dh_auto_configure: # Configure with cmake, install to /usr - cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_MANUAL_PAGE=off . + cd source && cmake -DCMAKE_INSTALL_PREFIX=/usr -DENABLE_MANUAL_PAGE=off -DCMAKE_POLICY_VERSION_MINIMUM=3.5 . override_dh_auto_build: # Build gt - $(MAKE) + cd source && $(MAKE) override_dh_auto_install: # Install using upstream cmake with DESTDIR - $(MAKE) install DESTDIR=$(CURDIR)/debian/gt + cd source && $(MAKE) install DESTDIR=$(CURDIR)/debian/gt override_dh_auto_test: # Skip tests