Skip to content

Commit 7a671bf

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 7a671bf

3 files changed

Lines changed: 158 additions & 0 deletions

File tree

.github/workflows/arch.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+
python-click \
30+
python-requests \
31+
python-gitpython \
32+
python-yaml \
33+
python-tabulate \
34+
python-matplotlib \
35+
namcap
36+
37+
- name: Update PKGBUILD version from pyproject.toml
38+
working-directory: packaging/arch
39+
run: |
40+
VERSION=$(grep '^version = ' ../../pyproject.toml | sed 's/version = "\(.*\)"/\1/')
41+
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
42+
echo "Building version: ${VERSION}"
43+
44+
- name: Validate PKGBUILD
45+
working-directory: packaging/arch
46+
run: namcap PKGBUILD
47+
48+
- name: Build package
49+
working-directory: packaging/arch
50+
run: |
51+
# makepkg cannot run as root, create a build user
52+
useradd -m builder
53+
chown -R builder:builder .
54+
su builder -c "makepkg --printsrcinfo > .SRCINFO"
55+
su builder -c "makepkg -s --noconfirm"
56+
57+
- name: Validate built package
58+
working-directory: packaging/arch
59+
run: namcap *.pkg.tar.zst
60+
61+
- name: Collect artifacts
62+
run: |
63+
mkdir -p artifacts
64+
mv packaging/arch/*.pkg.tar.zst artifacts/
65+
cp packaging/arch/PKGBUILD artifacts/
66+
cp packaging/arch/.SRCINFO artifacts/
67+
68+
- name: Upload Arch package artifact
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: kci-dev-arch-package
72+
path: artifacts/
73+
74+
- name: Upload Arch package to GitHub Release on new tag
75+
if: startsWith(github.ref, 'refs/tags/')
76+
uses: softprops/action-gh-release@v2
77+
env:
78+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
with:
80+
tag_name: ${{ github.ref_name }}
81+
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)