Skip to content

Commit beeb255

Browse files
committed
fix(aur): support ARM64 in stable and nightly packages
1 parent 9e85538 commit beeb255

5 files changed

Lines changed: 175 additions & 36 deletions

File tree

‎packaging/aur/README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
This directory maintains the [`t3code-bin`](https://aur.archlinux.org/packages/t3code-bin) and
44
[`t3code-nightly-bin`](https://aur.archlinux.org/packages/t3code-nightly-bin) packages. Both
5-
repackage the official x86_64 AppImage from GitHub Releases.
5+
repackage the official x86_64 and ARM64 AppImages from GitHub Releases.
66

77
## Publishing
88

99
The release workflow calls `.github/workflows/publish-aur.yml` after publishing a GitHub release;
1010
the workflow can also be run manually for a specific tag. It selects the stable or nightly
11-
package, then updates its version and checksums, builds it, regenerates `.SRCINFO`, and pushes it
12-
to the AUR.
11+
package, then updates its version and both architectures' asset names and checksums, builds it
12+
for the host architecture, regenerates `.SRCINFO`, and pushes it to the AUR.
1313

1414
To validate a release on Arch Linux:
1515

1616
```bash
1717
sudo pacman -Syu --needed base-devel github-cli jq namcap
18-
GH_TOKEN=$(gh auth token) RELEASE_TAG=v0.0.33 \
18+
GH_TOKEN=$(gh auth token) RELEASE_TAG=v0.1.7 \
1919
packaging/aur/scripts/release.sh
2020
```

‎packaging/aur/scripts/release.sh‎

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,26 @@ fi
1717

1818
version="${tag#v}"
1919
pkgver="${version//-/_}"
20-
asset_name="T3-Code-${version}-x86_64.AppImage"
2120
release_json="$(gh api "repos/$repo/releases/tags/$tag")"
22-
asset_digest="$(jq -r --arg name "$asset_name" \
23-
'.assets[] | select(.name == $name) | .digest' <<<"$release_json")"
24-
appimage_sha256="${asset_digest#sha256:}"
25-
26-
if [[ ! "$appimage_sha256" =~ ^[0-9a-f]{64}$ ]]; then
27-
echo "Release $tag is missing $asset_name or its SHA-256 digest." >&2
28-
exit 1
29-
fi
21+
declare -A appimage_names appimage_checksums
22+
for architecture in x86_64 aarch64; do
23+
upstream_arch="${architecture/aarch64/arm64}"
24+
if ! asset="$(jq -er --arg suffix "-${upstream_arch}.AppImage" '
25+
[.assets[] | select(.name | startswith("T3-Code-") and endswith($suffix))]
26+
| select(length == 1) | .[0] | [.name, .digest] | @tsv
27+
' <<<"$release_json")"; then
28+
echo "Release $tag must contain exactly one T3 Code $upstream_arch AppImage." >&2
29+
exit 1
30+
fi
31+
IFS=$'\t' read -r asset_name asset_digest <<<"$asset"
32+
checksum="${asset_digest#sha256:}"
33+
if [[ ! "$checksum" =~ ^[0-9a-f]{64}$ ]]; then
34+
echo "Release $tag is missing the SHA-256 digest for $asset_name." >&2
35+
exit 1
36+
fi
37+
appimage_names[$architecture]="$asset_name"
38+
appimage_checksums[$architecture]="$checksum"
39+
done
3040

3141
work_dir="$(mktemp -d)"
3242
trap 'rm -rf -- "$work_dir"' EXIT
@@ -39,10 +49,16 @@ cd "$package_dir"
3949
sed -Ei \
4050
-e "s/^pkgver=.*/pkgver=$pkgver/" \
4151
-e "s/^pkgrel=.*/pkgrel=$pkgrel/" \
42-
-e "/# AppImage$/s/'[0-9a-f]{64}'/'$appimage_sha256'/" \
4352
-e "/# upstream license$/s/'[0-9a-f]{64}'/'$license_sha256'/" \
4453
PKGBUILD
4554

55+
for architecture in x86_64 aarch64; do
56+
sed -Ei \
57+
-e "s/^_asset_${architecture}=.*/_asset_${architecture}=\"${appimage_names[$architecture]}\"/" \
58+
-e "s/^sha256sums_${architecture}=.*/sha256sums_${architecture}=('${appimage_checksums[$architecture]}')/" \
59+
PKGBUILD
60+
done
61+
4662
run_as_builder() {
4763
if [[ "$(id -u)" == 0 ]]; then
4864
runuser -u builder -- "$@"

‎packaging/aur/t3code-bin/PKGBUILD‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Maintainer: maria-rcks <maria at kuuro dot net>
22

33
pkgname=t3code-bin
4-
pkgver=0.0.33
4+
pkgver=0.1.7
55
pkgrel=1
66
pkgdesc='Desktop control surface for local coding agents'
7-
arch=('x86_64')
7+
arch=('x86_64' 'aarch64')
88
url='https://github.com/pingdotgg/t3code'
99
license=('MIT')
1010
depends=(
@@ -43,15 +43,15 @@ provides=("t3code=$pkgver")
4343
conflicts=('t3code')
4444
options=('!debug' '!strip')
4545

46-
_appimage="T3-Code-${pkgver}-x86_64.AppImage"
47-
source=(
48-
"$_appimage::https://github.com/pingdotgg/t3code/releases/download/v${pkgver}/$_appimage"
49-
"${pkgname}-${pkgver}-LICENSE::https://raw.githubusercontent.com/pingdotgg/t3code/v${pkgver}/LICENSE"
50-
)
51-
sha256sums=(
52-
'415c8648f43c3d22d572f27f2c50fdc8c310ea7fcde9537b903e1e2f1c8775a1' # AppImage
53-
'935d8f2af0c703f9c39517ee57cc4930b19d02d533be930b63f0e82f93614b43' # upstream license
54-
)
46+
_appimage="T3-Code-${pkgver}-${CARCH/aarch64/arm64}.AppImage"
47+
_asset_x86_64="T3-Code-0.1.7-x86_64.AppImage"
48+
_asset_aarch64="T3-Code-0.1.7-arm64.AppImage"
49+
source=("${pkgname}-${pkgver}-LICENSE::https://raw.githubusercontent.com/pingdotgg/t3code/v${pkgver}/LICENSE")
50+
sha256sums=('935d8f2af0c703f9c39517ee57cc4930b19d02d533be930b63f0e82f93614b43') # upstream license
51+
source_x86_64=("T3-Code-${pkgver}-x86_64.AppImage::https://github.com/pingdotgg/t3code/releases/download/v${pkgver}/$_asset_x86_64")
52+
sha256sums_x86_64=('faaee4094dca1276057840a1a45a6b2d00d7418afbf5735f75a7503b774e63d1')
53+
source_aarch64=("T3-Code-${pkgver}-arm64.AppImage::https://github.com/pingdotgg/t3code/releases/download/v${pkgver}/$_asset_aarch64")
54+
sha256sums_aarch64=('4445beffacf96da3be2c81c280222020e3b2623579e3364b10f44e84bfd1e3c2')
5555

5656
prepare() {
5757
chmod +x "$srcdir/$_appimage"

‎packaging/aur/t3code-nightly-bin/PKGBUILD‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Maintainer: maria-rcks <maria at kuuro dot net>
22

33
pkgname=t3code-nightly-bin
4-
pkgver=0.0.34_nightly.20260814.1095
4+
pkgver=0.1.8_nightly.20261104.4179
55
pkgrel=1
66
pkgdesc='Nightly desktop control surface for local coding agents'
7-
arch=('x86_64')
7+
arch=('x86_64' 'aarch64')
88
url='https://github.com/pingdotgg/t3code'
99
license=('MIT')
1010
depends=(
@@ -44,15 +44,15 @@ conflicts=('t3code-nightly' 't3code')
4444
options=('!debug' '!strip')
4545

4646
_upstream_version="${pkgver/_nightly./-nightly.}"
47-
_appimage="T3-Code-${_upstream_version}-x86_64.AppImage"
48-
source=(
49-
"$_appimage::https://github.com/pingdotgg/t3code/releases/download/v${_upstream_version}/$_appimage"
50-
"${pkgname}-${pkgver}-LICENSE::https://raw.githubusercontent.com/pingdotgg/t3code/v${_upstream_version}/LICENSE"
51-
)
52-
sha256sums=(
53-
'c4dea5bba9ed0b51b2f60f2d4a4867e61d62b57c50ea66f2792a73112e054566' # AppImage
54-
'935d8f2af0c703f9c39517ee57cc4930b19d02d533be930b63f0e82f93614b43' # upstream license
55-
)
47+
_appimage="T3-Code-${_upstream_version}-${CARCH/aarch64/arm64}.AppImage"
48+
_asset_x86_64="T3-Code-0.1.8-nightly.20261104.4179-x86_64.AppImage"
49+
_asset_aarch64="T3-Code-0.1.8-nightly.20261104.4179-arm64.AppImage"
50+
source=("${pkgname}-${pkgver}-LICENSE::https://raw.githubusercontent.com/pingdotgg/t3code/v${_upstream_version}/LICENSE")
51+
sha256sums=('935d8f2af0c703f9c39517ee57cc4930b19d02d533be930b63f0e82f93614b43') # upstream license
52+
source_x86_64=("T3-Code-${_upstream_version}-x86_64.AppImage::https://github.com/pingdotgg/t3code/releases/download/v${_upstream_version}/$_asset_x86_64")
53+
sha256sums_x86_64=('6d145972076801efb21dc9e2a3e0fb2ac55d786bc2df2b0ebbe48ed1c3323046')
54+
source_aarch64=("T3-Code-${_upstream_version}-arm64.AppImage::https://github.com/pingdotgg/t3code/releases/download/v${_upstream_version}/$_asset_aarch64")
55+
sha256sums_aarch64=('b80f1cd55a391caa4da94b94209750ce68586d474f8cc5ee983a2bf6ae6e8be3')
5656

5757
prepare() {
5858
chmod +x "$srcdir/$_appimage"

‎scripts/aur-release.test.ts‎

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
import * as NodeServices from "@effect/platform-node/NodeServices";
2+
import { assert, describe, it } from "@effect/vitest";
3+
import * as HostProcess from "@t3tools/shared/HostProcess";
4+
import * as Effect from "effect/Effect";
5+
import * as FileSystem from "effect/FileSystem";
6+
import * as Path from "effect/Path";
7+
import * as Stream from "effect/Stream";
8+
import { ChildProcess, ChildProcessSpawner } from "effect/process";
9+
10+
const run = Effect.fn("test.aur.run")(function* (
11+
command: string,
12+
args: ReadonlyArray<string>,
13+
cwd: string,
14+
env: Record<string, string | undefined>,
15+
) {
16+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
17+
const child = yield* spawner.spawn(
18+
ChildProcess.make(command, args, { cwd, env, extendEnv: false }),
19+
);
20+
const collect = <E>(stream: Stream.Stream<Uint8Array, E>) =>
21+
stream.pipe(
22+
Stream.decodeText(),
23+
Stream.runFold(
24+
() => "",
25+
(left, right) => left + right,
26+
),
27+
);
28+
const [stdout, stderr, code] = yield* Effect.all(
29+
[collect(child.stdout), collect(child.stderr), child.exitCode],
30+
{ concurrency: "unbounded" },
31+
);
32+
return { stdout, stderr, code };
33+
}, Effect.scoped);
34+
35+
describe.skipIf(HostProcess.Platform.defaultValue() !== "linux")("AUR release", () => {
36+
it.live.each([
37+
{ nightly: false, naming: "versioned", failure: undefined },
38+
{ nightly: true, naming: "versioned", failure: undefined },
39+
{ nightly: false, naming: "versionless", failure: undefined },
40+
{ nightly: true, naming: "versionless", failure: undefined },
41+
{ nightly: false, naming: "versioned", failure: "missing" },
42+
{ nightly: false, naming: "versioned", failure: "digest" },
43+
])("updates architecture-specific sources: %j", ({ nightly, naming, failure }) =>
44+
Effect.gen(function* () {
45+
const fs = yield* FileSystem.FileSystem;
46+
const path = yield* Path.Path;
47+
const inherited = yield* HostProcess.Environment;
48+
const root = yield* fs.makeTempDirectoryScoped({ prefix: "t3-aur-release-" });
49+
const aur = path.join(root, "packaging/aur");
50+
yield* fs.copy(path.join(import.meta.dirname, "../packaging/aur"), aur);
51+
const tools = path.join(root, "tools");
52+
yield* fs.makeDirectory(tools);
53+
for (const [name, source] of Object.entries({
54+
gh: '#!/bin/bash\nif [[ "$*" == *releases/tags/* ]]; then cat "$AUR_FIXTURE_RELEASE"; else echo "fixture license"; fi\n',
55+
id: "#!/bin/sh\necho 1000\n",
56+
namcap: "#!/bin/sh\nexit 0\n",
57+
makepkg: '#!/bin/sh\nif [ "$1" = --packagelist ]; then echo fixture.pkg.tar.zst; fi\n',
58+
})) {
59+
const file = path.join(tools, name);
60+
yield* fs.writeFileString(file, source);
61+
yield* fs.chmod(file, 0o755);
62+
}
63+
const version = nightly ? "1.2.4-nightly.20261104.1" : "1.2.3";
64+
const pkgname = nightly ? "t3code-nightly-bin" : "t3code-bin";
65+
const prefix =
66+
naming === "versioned" ? `T3-Code-${version}` : nightly ? "T3-Code-Nightly" : "T3-Code";
67+
const assets = [
68+
{ name: `${prefix}-x86_64.AppImage`, digest: `sha256:${"a".repeat(64)}` },
69+
...(failure === "missing"
70+
? []
71+
: [
72+
{
73+
name: `${prefix}-arm64.AppImage`,
74+
digest: failure === "digest" ? "invalid" : `sha256:${"b".repeat(64)}`,
75+
},
76+
]),
77+
];
78+
const fixture = path.join(root, "release.json");
79+
yield* fs.writeFileString(fixture, JSON.stringify({ assets }));
80+
const packageDir = path.join(aur, pkgname);
81+
const recipe = path.join(packageDir, "PKGBUILD");
82+
const before = yield* fs.readFileString(recipe);
83+
const env = {
84+
PATH: `${tools}:${inherited.PATH}`,
85+
RELEASE_TAG: `v${version}`,
86+
AUR_FIXTURE_RELEASE: fixture,
87+
AUR_SSH_PRIVATE_KEY: "",
88+
};
89+
const result = yield* run("bash", [path.join(aur, "scripts/release.sh")], root, env);
90+
if (failure) {
91+
assert.notEqual(Number(result.code), 0, result.stdout + result.stderr);
92+
assert.equal(yield* fs.readFileString(recipe), before);
93+
return;
94+
}
95+
assert.equal(Number(result.code), 0, result.stdout + result.stderr);
96+
for (const [arch, upstreamArch, checksum] of [
97+
["x86_64", "x86_64", "a"],
98+
["aarch64", "arm64", "b"],
99+
] as const) {
100+
const selected = yield* run(
101+
"bash",
102+
[
103+
"-c",
104+
`source PKGBUILD
105+
declare -n sources="source_$CARCH" sums="sha256sums_$CARCH"
106+
printf '%s\\n' "$pkgver" "\${arch[*]}" "\${sources[@]}" "\${sums[@]}" "$_appimage"`,
107+
],
108+
packageDir,
109+
{ ...env, CARCH: arch },
110+
);
111+
assert.equal(Number(selected.code), 0, selected.stderr);
112+
const localName = `T3-Code-${version}-${upstreamArch}.AppImage`;
113+
assert.deepEqual(selected.stdout.trim().split("\n"), [
114+
version.replace("-nightly.", "_nightly."),
115+
"x86_64 aarch64",
116+
`${localName}::https://github.com/pingdotgg/t3code/releases/download/v${version}/${prefix}-${upstreamArch}.AppImage`,
117+
checksum.repeat(64),
118+
localName,
119+
]);
120+
}
121+
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
122+
);
123+
});

0 commit comments

Comments
 (0)