CoreDesktop GNOME extension

This commit is contained in:
2026-11-27 12:28:07 -07:00
commit 7d9d2d6239
15 changed files with 1742 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
/src/
/pkg/
/coredesktop-extension/
*.pkg.tar.*
*.log
+43
View File
@@ -0,0 +1,43 @@
# Maintainer: David Young <david@federated.computer>
pkgname=gnome-shell-extension-coredesktop
_uuid=coredesktop@federated.computer
_repo=coredesktop-extension
pkgver=1.0.r0.g0000000
pkgrel=1
pkgdesc="Top bar menu for CoreDesktop's update, refresh, configure and version commands"
arch=(any)
url="https://gitea.federated.computer/Federated_Computer/$_repo"
license=(MIT)
depends=(
gnome-shell
systemd
)
makedepends=(git)
source=("git+$url.git")
b2sums=('SKIP')
# metadata.json's version-name plus the commit count and hash, so every commit
# upgrades the package
pkgver() {
cd $_repo
local version
version=$(sed -n 's/^ *"version-name": "\(.*\)",\?$/\1/p' $_uuid/metadata.json)
printf "%s.r%s.g%s" "$version" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
package() {
cd $_repo/$_uuid
local dest="$pkgdir/usr/share/gnome-shell/extensions/$_uuid"
install -Dm644 -t "$dest" metadata.json extension.js prefs.js stylesheet.css
install -Dm644 -t "$dest/lib" lib/*.js
install -Dm644 -t "$dest/icons" icons/*.svg
install -Dm755 -t "$dest/bin" bin/run-tracked
# Into the system schema dir, where glib2's pacman hook compiles it. Without
# a schemas/gschemas.compiled of its own, the extension's getSettings() looks
# there.
install -Dm644 -t "$pkgdir/usr/share/glib-2.0/schemas" \
schemas/org.gnome.shell.extensions.coredesktop.gschema.xml
}
+73
View File
@@ -0,0 +1,73 @@
#!/bin/bash
#
# Purpose : Build gnome-shell-extension-coredesktop from main on Gitea and
# upload it to the [federated] pacman repo, where CoreDesktop's
# update installs it from
#
# Needs GITEA_TOKEN: a Gitea access token with write access to packages
# (Settings > Applications > Generate token, scope "package: Read and write")
# for an account that can publish Federated_Computer's packages.
set -euo pipefail
SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# RELEASE_REGISTRY points it at another registry, for testing
REGISTRY="${RELEASE_REGISTRY:-https://gitea.federated.computer/api/packages/Federated_Computer/arch}"
REPO=federated
if [ -z "${GITEA_TOKEN:-}" ]; then
echo "Set GITEA_TOKEN to a Gitea token with write access to packages, e.g.:" >&2
echo " GITEA_TOKEN=... make release" >&2
exit 1
fi
# The package is built from main on Gitea, not from this folder. Say so if
# they differ, so a release doesn't quietly leave out local work.
TOP="$(git -C "$SELF" rev-parse --show-toplevel 2> /dev/null || true)"
if [ -n "$TOP" ]; then
if [ -n "$(git -C "$TOP" status --porcelain --untracked-files=no)" ]; then
echo "Note: you have uncommitted changes. The release is built from main on Gitea, without them."
fi
if git -C "$TOP" fetch --quiet origin main 2> /dev/null \
&& [ "$(git -C "$TOP" rev-parse HEAD)" != "$(git -C "$TOP" rev-parse FETCH_HEAD)" ]; then
echo "Note: this checkout isn't at origin/main. The release is built from origin/main."
fi
fi
OUT="$(mktemp -d)"
trap 'rm -rf "$OUT"' EXIT
echo "Building the package from main..."
# -C starts from a fresh source tree, so nothing from an earlier build gets in
(cd "$SELF" && PKGDEST="$OUT" makepkg --force --cleanbuild)
PKG="$(find "$OUT" -maxdepth 1 -name '*.pkg.tar.zst' | head -n 1)"
if [ -z "$PKG" ]; then
echo "makepkg didn't produce a package." >&2
exit 1
fi
echo "Uploading $(basename "$PKG") to [$REPO]..."
STATUS="$(curl -sS -o "$OUT/response" -w '%{http_code}' -X PUT \
-H "Authorization: token $GITEA_TOKEN" \
--upload-file "$PKG" "$REGISTRY/$REPO")"
case "$STATUS" in
201)
echo "Released $(basename "$PKG"). CoreDesktop's next update installs it."
;;
409)
echo "[$REPO] already has this version. Commit and push a change to main to release a new one." >&2
exit 1
;;
401|403)
echo "Gitea refused the upload ($STATUS): check that GITEA_TOKEN is valid and can write packages." >&2
exit 1
;;
*)
echo "The upload failed with HTTP $STATUS:" >&2
cat "$OUT/response" >&2
echo >&2
exit 1
;;
esac