Skip to content

Commit 0d40dbb

Browse files
committed
packaging: arch: add Arch Linux packaging support
Add PKGBUILD into kci-dev, this builds kci-dev and publishes the *.pkg.tar.zst into GitHub release. We extract the version from pyproject.toml for CI to automate release versions. This possibly can be a cleaner way of doing it, but it gets us half way there. We can add steps to auto publish to AUR, or simply let users install it from the GitHub release. Signed-off-by: Ben Copeland <ben.copeland@linaro.org>
1 parent 715ee02 commit 0d40dbb

File tree

3 files changed

+152
-0
lines changed

3 files changed

+152
-0
lines changed

.github/workflows/arch.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Make Arch Package
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-pkg:
13+
runs-on: ubuntu-latest
14+
container:
15+
image: archlinux:base-devel
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Install build dependencies
21+
run: |
22+
pacman -Syu --noconfirm
23+
pacman -S --noconfirm \
24+
python \
25+
python-build \
26+
python-installer \
27+
python-wheel \
28+
python-poetry-core \
29+
namcap
30+
31+
- name: Update PKGBUILD version from pyproject.toml
32+
working-directory: packaging/arch
33+
run: |
34+
VERSION=$(grep '^version = ' ../../pyproject.toml | sed 's/version = "\(.*\)"/\1/')
35+
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
36+
echo "Building version: ${VERSION}"
37+
38+
- name: Validate PKGBUILD
39+
working-directory: packaging/arch
40+
run: namcap PKGBUILD
41+
42+
- name: Build package
43+
working-directory: packaging/arch
44+
run: |
45+
# makepkg cannot run as root, create a build user
46+
useradd -m builder
47+
chown -R builder:builder .
48+
su builder -c "makepkg --printsrcinfo > .SRCINFO"
49+
su builder -c "makepkg -s --noconfirm"
50+
51+
- name: Validate built package
52+
working-directory: packaging/arch
53+
run: namcap *.pkg.tar.zst
54+
55+
- name: Collect artifacts
56+
run: |
57+
mkdir -p artifacts
58+
mv packaging/arch/*.pkg.tar.zst artifacts/
59+
cp packaging/arch/PKGBUILD artifacts/
60+
cp packaging/arch/.SRCINFO artifacts/
61+
62+
- name: Upload Arch package artifact
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: kci-dev-arch-package
66+
path: artifacts/
67+
68+
- name: Upload Arch package to GitHub Release on new tag
69+
if: startsWith(github.ref, 'refs/tags/')
70+
uses: softprops/action-gh-release@v2
71+
env:
72+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
with:
74+
tag_name: ${{ github.ref_name }}
75+
files: artifacts/*.pkg.tar.zst

packaging/arch/.SRCINFO

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
pkgbase = kci-dev
2+
pkgdesc = Stand alone tool for Linux Kernel developers and maintainers to interact with KernelCI
3+
pkgver = 0.1.9
4+
pkgrel = 1
5+
url = https://github.com/kernelci/kci-dev
6+
arch = any
7+
license = LGPL-2.1-or-later
8+
makedepends = python-build
9+
makedepends = python-installer
10+
makedepends = python-wheel
11+
makedepends = python-poetry-core
12+
depends = python>=3.10
13+
depends = python-click
14+
depends = python-requests
15+
depends = python-gitpython
16+
depends = python-yaml
17+
depends = python-tabulate
18+
depends = python-matplotlib
19+
optdepends = python-mplcursors: interactive cursor support for plots (AUR)
20+
optdepends = bash-completion: bash completion support
21+
source = kci-dev-0.1.9.tar.gz::https://github.com/kernelci/kci-dev/archive/refs/tags/v0.1.9.tar.gz
22+
sha256sums = SKIP
23+
24+
pkgname = kci-dev

packaging/arch/PKGBUILD

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Maintainer: Ben Copeland <ben.copeland@linaro.org>
2+
# https://github.com/kernelci/kci-dev
3+
4+
pkgname=kci-dev
5+
pkgver=0.1.9
6+
pkgrel=1
7+
pkgdesc='Stand alone tool for Linux Kernel developers and maintainers to interact with KernelCI'
8+
arch=('any')
9+
url='https://github.com/kernelci/kci-dev'
10+
license=('LGPL-2.1-or-later')
11+
depends=(
12+
'python>=3.10'
13+
'python-click'
14+
'python-requests'
15+
'python-gitpython'
16+
'python-yaml'
17+
'python-tabulate'
18+
'python-matplotlib'
19+
)
20+
makedepends=(
21+
'python-build'
22+
'python-installer'
23+
'python-wheel'
24+
'python-poetry-core'
25+
)
26+
optdepends=(
27+
'python-mplcursors: interactive cursor support for plots (AUR)'
28+
'bash-completion: bash completion support'
29+
)
30+
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/kernelci/kci-dev/archive/refs/tags/v${pkgver}.tar.gz")
31+
sha256sums=('SKIP')
32+
33+
build() {
34+
cd "${pkgname}-${pkgver}"
35+
python -m build --wheel --no-isolation
36+
}
37+
38+
package() {
39+
cd "${pkgname}-${pkgver}"
40+
python -m installer --destdir="${pkgdir}" dist/*.whl
41+
42+
# Shell completions
43+
install -Dm644 completions/kci-dev-completion.bash \
44+
"${pkgdir}/usr/share/bash-completion/completions/kci-dev"
45+
install -Dm644 completions/_kci-dev \
46+
"${pkgdir}/usr/share/zsh/site-functions/_kci-dev"
47+
install -Dm644 completions/kci-dev.fish \
48+
"${pkgdir}/usr/share/fish/vendor_completions.d/kci-dev.fish"
49+
50+
# License and documentation
51+
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
52+
install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
53+
}

0 commit comments

Comments
 (0)