-
Notifications
You must be signed in to change notification settings - Fork 34
Add workflow to build debian package #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| name: Build debian package for Linux ADI-scripts | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - kuiper2.0 | ||
| - '20[1-9][0-9]_R[1-9]' | ||
NicuS03 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| pull_request: | ||
| branches: | ||
| - kuiper2.0 | ||
| - '20[1-9][0-9]_R[1-9]' | ||
| env: | ||
| APP_NAME: linux_image_ADI-scripts | ||
|
|
||
| jobs: | ||
| build_debian_package: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| id-token: write | ||
| steps: | ||
| - name: Checkout code repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| path: ${{env.APP_NAME}} | ||
| - name: Get version from file | ||
| run: | | ||
| VERSION=$(cat "${{env.APP_NAME}}/packaging/VERSION" 2>/dev/null | tr -d '[:space:]') | ||
| # Regex to match semantic versioning (from semver.org) | ||
| # Regex will match valid version number https://regex101.com/r/K8FvXg/1 | ||
| regex='^((0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?)$' | ||
| if ! [[ "$VERSION" =~ $regex ]]; then | ||
| echo "WARNING: Invalid or missing version '$VERSION', falling back to 0.0.1" | ||
| VERSION="0.0.1" | ||
| fi | ||
| echo "VERSION=$VERSION" >> "$GITHUB_ENV" | ||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt update | ||
| sudo apt install -y build-essential devscripts debhelper gettext | ||
| - name: Build debian package | ||
| run: | | ||
| "${{env.APP_NAME}}/packaging/build-adi-scripts-deb.sh" "${{github.head_ref}}" "${{env.VERSION}}" "${{env.APP_NAME}}" | ||
| - name: Upload debian artifacts to github | ||
| if: success() && env.PACKAGE_NAME != '' | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: ${{env.PACKAGE_NAME}}-${{env.VERSION}}-ubuntu | ||
| path: | | ||
| ${{env.PACKAGE_NAME}}_*.deb | ||
| ${{env.PACKAGE_NAME}}*.dsc | ||
| ${{env.PACKAGE_NAME}}*.debian.tar.xz | ||
| ${{env.PACKAGE_NAME}}*.orig.tar.gz | ||
| if-no-files-found: error | ||
| - name: Authenticate with Cloudsmith via OIDC | ||
| if: success() && github.event_name == 'push' && env.PACKAGE_NAME != '' | ||
| 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() && env.CLOUDSMITH_API_KEY != '' | ||
| run: | | ||
| pip install 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 | ||
|
|
||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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_<version>.orig.tar.gz` - Upstream source tarball | ||
| - `adi-scripts_<version>-1.debian.tar.xz` - Debian packaging files | ||
| - `adi-scripts_<version>-1.dsc` - Debian source package descriptor | ||
| - `adi-scripts_<version>-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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 1.0.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| #!/bin/bash -e | ||
|
|
||
| # Script that generates ADI scripts .deb package and source files using debhelper | ||
| # As a prerequire, the repository should be checked out before running this script | ||
|
|
||
|
|
||
| RELEASE=${1:-kuiper2.0} # Default to kuiper2.0 branch | ||
| VERSION=${2:-1.0.0} # Default to version 1.0.0 | ||
| UPSTREAM_DIR=${3:-linux_image_ADI-scripts} # Default to linux_image_ADI-scripts | ||
|
|
||
| # Package metadata | ||
| PACKAGE="adi-scripts" | ||
|
|
||
| # Set variable for github workflows | ||
| [ -n "$GITHUB_ENV" ] && echo "PACKAGE_NAME=$PACKAGE" >> $GITHUB_ENV | ||
|
|
||
| WORK_DIR="${PACKAGE}-${VERSION}" | ||
|
|
||
| # Rename extracted directory to match Debian conventions | ||
| cp -a ${UPSTREAM_DIR} ${WORK_DIR} | ||
|
|
||
| # Create the orig tarball with exclusions | ||
| echo "Creating source tarball with exclusions..." | ||
| tar czf ${PACKAGE}_${VERSION}.orig.tar.gz \ | ||
| --exclude='.git' \ | ||
| ${WORK_DIR} | ||
|
|
||
| # Substitute variables in templates | ||
| cd ${WORK_DIR} | ||
|
|
||
| # Copy debian directory into the extracted source tree | ||
| cp -r packaging/debian . | ||
|
|
||
| # Export all variables for envsubst and debian/rules | ||
| export VERSION PACKAGE RELEASE | ||
| export DATE=$(date -R) | ||
|
|
||
| # Create changelog entry | ||
| CHANGELOG_ENTRY="Build from ${RELEASE} 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..." | ||
| dpkg-buildpackage -us -uc | ||
|
|
||
| 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_all.deb (binary package)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ${PACKAGE} (${VERSION}-1) stable; urgency=medium | ||
|
|
||
| * ${CHANGELOG_ENTRY} | ||
|
|
||
| -- Engineerzone <https://ez.analog.com/sw-interface-tools> ${DATE} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| Source: ${PACKAGE} | ||
| Section: utils | ||
| Priority: optional | ||
| Maintainer: Engineerzone <https://ez.analog.com/sw-interface-tools> | ||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ | ||
| Upstream-Name: linux_image_ADI-scripts | ||
| Upstream-Contact: Analog Devices, Inc. | ||
| Source: https://github.com/analogdevicesinc/linux_image_ADI-scripts | ||
|
|
||
| Files: * | ||
| Copyright: 2018, Analog Devices Inc. | ||
| License: BSD-3-Clause | ||
|
|
||
| License: BSD-3-Clause | ||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
| : |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 3.0 (quilt) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.