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..74d566e --- /dev/null +++ b/.github/scripts/install-app.sh @@ -0,0 +1,69 @@ +#!/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), +# GITHUB_ENV +CONTROL_PATH="${CONTROL_PATH:-packaging/debian}" +# 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) + +# 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 '"') || true + +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 new file mode 100755 index 0000000..b960a8b --- /dev/null +++ b/.github/scripts/install-deps-linux.sh @@ -0,0 +1,60 @@ +#!/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 \ + -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 + [[ "$ARCHITECTURE" == "arm64" ]] && SUDO="" || SUDO="sudo" + + 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 new file mode 100755 index 0000000..c922b23 --- /dev/null +++ b/.github/scripts/upload-to-cloudsmith.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -eo pipefail + +# Env: WORKSPACE, PACKAGE_NAME, CONTAINER, CLOUDSMITH_ORG, CLOUDSMITH_REPO, CLOUDSMITH_VERSION +cd "${WORKSPACE}/artifacts" + +# 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 --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 new file mode 100644 index 0000000..b5b9c0f --- /dev/null +++ b/.github/workflows/build-linux-image-adi-scripts.yaml @@ -0,0 +1,141 @@ +name: Build debian package for Linux ADI-scripts + +permissions: + contents: read + id-token: write + +on: + workflow_call: + inputs: + gt-version: + description: 'Gt debian version' + required: true + type: string + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +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 + env: + VERSION_FILE: packaging/VERSION + CLOUDSMITH_PREFIX: adi-scripts + build-linux: + needs: identify-version + 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 + - 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 }} + 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 }} + 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: | + .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: | + .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.DEBIAN_ARTIFACT }} + path: | + artifacts/ + if-no-files-found: error + - name: Push to cloudsmith + if: ${{ env.CLOUDSMITH_VERSION != '' }} + shell: bash + run: | + .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 new file mode 100644 index 0000000..49195e0 --- /dev/null +++ b/.github/workflows/build-linux-usb-gadgets-gt.yaml @@ -0,0 +1,150 @@ +name: Build debian package for GT (linux-usb-gadgets) + +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]' + +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 + env: + VERSION_FILE: packaging/VERSION_GT + CLOUDSMITH_PREFIX: gt + 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 + 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 + 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: + path: repo-scripts + - 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: | + mkdir -p packaging + cp -r repo-scripts/packaging/debian_gt packaging/debian + - name: Install deps + shell: sh + run: | + 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: | + 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.DEBIAN_ARTIFACT }} + 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 + run: | + 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/.github/workflows/build_gt.yml b/.github/workflows/build_gt.yml deleted file mode 100644 index 9cde9de..0000000 --- a/.github/workflows/build_gt.yml +++ /dev/null @@ -1,109 +0,0 @@ -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/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/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 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/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 new file mode 100644 index 0000000..0406cf8 --- /dev/null +++ b/packaging/debian/changelog @@ -0,0 +1,5 @@ +adi-scripts (@VERSION@) UNRELEASED; urgency=medium + + * Automated package build. + + -- Analog Devices Maintainers @DATE@ diff --git a/packaging/debian/control b/packaging/debian/control new file mode 100644 index 0000000..ebe5669 --- /dev/null +++ b/packaging/debian/control @@ -0,0 +1,13 @@ +Source: adi-scripts +Section: utils +Priority: optional +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: 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 new file mode 100644 index 0000000..5fe55cf --- /dev/null +++ b/packaging/debian/copyright @@ -0,0 +1,83 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: linux_image_ADI-scripts +Upstream-Contact: Analog Devices Maintainers +Source: https://github.com/analogdevicesinc/linux_image_ADI-scripts + +Files: * +Copyright: 2018, 2021, 2024, Analog Devices Inc. +License: BSD-3-clause + +Files: usb-gadget-service/systemd/* +Copyright: 2021, Analog Devices Inc. +License: LGPL-2.1+ + +Files: usb-gadget-service/udev/* +Copyright: 2019, Collabora Ltd +License: Expat or LGPL-2.1+ + +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 + . + 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/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 new file mode 100755 index 0000000..e73bcbc --- /dev/null +++ b/packaging/debian/rules @@ -0,0 +1,29 @@ +#!/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: + # No configuration needed + : + +override_dh_auto_build: + # Nothing to build - shell scripts only + : + +override_dh_auto_install: + # 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 + : 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 diff --git a/packaging/debian_gt/changelog b/packaging/debian_gt/changelog new file mode 100644 index 0000000..beb07fb --- /dev/null +++ b/packaging/debian_gt/changelog @@ -0,0 +1,5 @@ +gt (@VERSION@) UNRELEASED; urgency=low + + * Automated package build. + + -- Analog Devices Maintainers @DATE@ diff --git a/CI/gt_deb_scripts/debian/control.template b/packaging/debian_gt/control similarity index 77% rename from CI/gt_deb_scripts/debian/control.template rename to packaging/debian_gt/control index 0308621..84ea178 100644 --- a/CI/gt_deb_scripts/debian/control.template +++ b/packaging/debian_gt/control @@ -1,13 +1,13 @@ -Source: ${PACKAGE} +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 -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_gt/copyright similarity index 100% rename from CI/gt_deb_scripts/debian/copyright rename to packaging/debian_gt/copyright diff --git a/CI/gt_deb_scripts/debian/rules b/packaging/debian_gt/rules similarity index 77% rename from CI/gt_deb_scripts/debian/rules rename to packaging/debian_gt/rules index 7f3b802..296c5e7 100755 --- a/CI/gt_deb_scripts/debian/rules +++ b/packaging/debian_gt/rules @@ -1,7 +1,5 @@ #!/usr/bin/make -f -PACKAGE ?= gt - export DH_VERBOSE = 1 %: @@ -9,7 +7,7 @@ export DH_VERBOSE = 1 override_dh_auto_configure: # Configure with cmake, install to /usr - cd source && 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 @@ -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/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)