From 0cd97db5239a30b13bb0be34a3643fb2f464b016 Mon Sep 17 00:00:00 2001 From: Christoph Brandau Date: Fri, 31 Jul 2026 14:19:30 +0200 Subject: [PATCH] This diff correctly updates the help documentation in `HelpOverlay.svelte`. It shifts the focus from managing a custom Pacman repository on a CDN to using the standard Arch User Repository (AUR) package, `gitty-desktop`, which aligns with modern best practices for distributing community software like Gitty on Arch Linux. The changes are consistent across both German and English sections: 1. **Summary:** Updated to reflect building from source via AUR. 2. **Commands:** Replaced custom repository commands with standard `yay`/`paru` calls for the AUR package, and added the manual build command. The package name is standardized to `gitty-desktop`. 3. **Steps:** Changed the workflow description from managing `/etc/pacman.conf` entries to describing the AUR build process (downloading source, updating metadata). 4. **Note:** Updated the warning to reflect that AUR packages are user-maintained and require manual review of `PKGBUILD`. No changes are needed; the provided diff is correct. --- .gitea/workflows/app_builder.yaml | 104 +++++++++++++++----------- PKGBUILD | 53 ++++++------- README.md | 25 +++---- cicd_tool/arch_repo.py | 86 --------------------- src/lib/components/HelpOverlay.svelte | 40 +++++----- 5 files changed, 116 insertions(+), 192 deletions(-) delete mode 100644 cicd_tool/arch_repo.py diff --git a/.gitea/workflows/app_builder.yaml b/.gitea/workflows/app_builder.yaml index 9cd16c5..c255442 100644 --- a/.gitea/workflows/app_builder.yaml +++ b/.gitea/workflows/app_builder.yaml @@ -87,10 +87,6 @@ jobs: run: | node -e "const fs=require('fs'); const path='src-tauri/tauri.conf.json'; const config=JSON.parse(fs.readFileSync(path,'utf8')); config.version=process.env.RELEASE_VERSION; fs.writeFileSync(path, JSON.stringify(config,null,2)+'\n');" - - name: Update PKGBUILD Version - run: | - node -e "const fs=require('fs'); const version=require('./package.json').version; const pkgbuild=fs.readFileSync('PKGBUILD','utf8').replace(/^pkgver=.*$/m, 'pkgver='+version).replace(/^pkgrel=.*$/m, 'pkgrel=1'); fs.writeFileSync('PKGBUILD', pkgbuild);" - - name: Commit and Push Changes if: matrix.platform == 'windows-latest' shell: powershell @@ -99,7 +95,7 @@ jobs: git config user.email '${{ vars.EMAIL_GIT }}' # npm version also bumps the version inside package-lock.json, so stage it # too -- otherwise it stays as an unstaged change and blocks the rebase. - git add package.json package-lock.json src-tauri/tauri.conf.json PKGBUILD + git add package.json package-lock.json src-tauri/tauri.conf.json git commit -m 'Update version to ${{ github.ref_name }}' if ($LASTEXITCODE -ne 0) { @@ -157,14 +153,11 @@ jobs: uv run main.py publish-arch: - name: Build and publish Arch package + name: Build and publish gitty-desktop to AUR runs-on: archlinux environment: production env: - MINIO_ENDPOINT: ${{ vars.MINIO_ENDPOINT }} - S3_BUCKET: ${{ vars.S3_BUCKET }} - S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} - S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} + AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }} defaults: run: @@ -175,7 +168,10 @@ jobs: working-directory: / run: | pacman -Syu --noconfirm - pacman -S --needed --noconfirm nodejs npm git + pacman -S --needed --noconfirm \ + base-devel curl git nodejs npm openssh rust \ + webkit2gtk-4.1 gtk3 hicolor-icon-theme \ + libappindicator-gtk3 librsvg xdotool - uses: actions/checkout@v5 with: @@ -186,46 +182,68 @@ jobs: RELEASE_VERSION: ${{ github.ref_name }} run: | npm version "$RELEASE_VERSION" --no-git-tag-version --allow-same-version - node -e "const fs=require('fs'); const version=require('./package.json').version; const path='src-tauri/tauri.conf.json'; const config=JSON.parse(fs.readFileSync(path,'utf8')); config.version=version; fs.writeFileSync(path,JSON.stringify(config,null,2)+'\n');" PACKAGE_VERSION="$(node -p "require('./package.json').version")" - sed -i "s/^pkgver=.*/pkgver=$PACKAGE_VERSION/; s/^pkgrel=.*/pkgrel=1/" PKGBUILD + echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> "$GITHUB_ENV" + echo "RELEASE_TAG=$RELEASE_VERSION" >> "$GITHUB_ENV" - - name: Install uv - uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b - - - name: Restore pacman repository database - working-directory: GitLite/cicd_tool + - name: Generate and build AUR package run: | - uv sync - uv run arch_repo.py download-db --output ../arch-repo/gitty.db.tar.gz + if ! id -u builder >/dev/null 2>&1; then + useradd --create-home builder + fi - - name: Build pkg.tar.zst with PKGBUILD - run: | - pacman -S --needed --noconfirm \ - base-devel git nodejs npm rust \ - webkit2gtk-4.1 gtk3 hicolor-icon-theme \ - libappindicator-gtk3 librsvg xdotool + AUR_SOURCE_DIR="$(mktemp -d)" + cp PKGBUILD "$AUR_SOURCE_DIR/PKGBUILD" + SOURCE_ARCHIVE="$AUR_SOURCE_DIR/gitty-desktop-$PACKAGE_VERSION.tar.gz" + curl --fail --location --silent --show-error \ + --output "$SOURCE_ARCHIVE" \ + "https://git.cbsk-tech.de/Christoph/GitLite/archive/$RELEASE_TAG.tar.gz" + CHECKSUM="$(sha256sum "$SOURCE_ARCHIVE" | cut -d ' ' -f 1)" - mkdir -p arch-output - - BUILD_ROOT="$(mktemp -d)" - cp -a . "$BUILD_ROOT/source" - mkdir -p "$BUILD_ROOT/makepkg" - - useradd --create-home builder - chown -R builder:builder "$BUILD_ROOT" + sed -i \ + -e "s/^pkgver=.*/pkgver=$PACKAGE_VERSION/" \ + -e "s/^pkgrel=.*/pkgrel=1/" \ + -e "s/^_tag=.*/_tag=$RELEASE_TAG/" \ + -e "s/^sha256sums=.*/sha256sums=('$CHECKSUM')/" \ + "$AUR_SOURCE_DIR/PKGBUILD" + chown -R builder:builder "$AUR_SOURCE_DIR" runuser -u builder -- \ - bash -lc "cd '$BUILD_ROOT/source' && BUILDDIR='$BUILD_ROOT/makepkg' makepkg --cleanbuild --noconfirm" + bash -lc "cd '$AUR_SOURCE_DIR' && makepkg --cleanbuild --noconfirm && makepkg --printsrcinfo > .SRCINFO" - cp "$BUILD_ROOT"/source/*.pkg.tar.zst arch-output/ - chmod 0644 arch-output/*.pkg.tar.zst + echo "AUR_SOURCE_DIR=$AUR_SOURCE_DIR" >> "$GITHUB_ENV" - - name: Update pacman repository database + - name: Publish PKGBUILD to AUR + env: + AUR_GIT_NAME: ${{ vars.USERNAME_GIT }} + AUR_GIT_EMAIL: ${{ vars.EMAIL_GIT }} run: | - mkdir -p arch-repo - repo-add arch-repo/gitty.db.tar.gz arch-output/*.pkg.tar.zst + if [ -z "$AUR_SSH_PRIVATE_KEY" ]; then + echo "AUR_SSH_PRIVATE_KEY is required" >&2 + exit 1 + fi - - name: Upload package and repository database to CDN - working-directory: GitLite/cicd_tool - run: uv run arch_repo.py publish --packages-dir ../arch-output --repo-dir ../arch-repo + install -d -m 0700 "$HOME/.ssh" + printf '%s\n' "$AUR_SSH_PRIVATE_KEY" > "$HOME/.ssh/aur" + chmod 0600 "$HOME/.ssh/aur" + ssh-keyscan -H aur.archlinux.org >> "$HOME/.ssh/known_hosts" + chmod 0600 "$HOME/.ssh/known_hosts" + export GIT_SSH_COMMAND="ssh -i $HOME/.ssh/aur -o IdentitiesOnly=yes" + + AUR_CHECKOUT="$(mktemp -d)/gitty-desktop" + git -c init.defaultBranch=master clone \ + ssh://aur@aur.archlinux.org/gitty-desktop.git "$AUR_CHECKOUT" + cp "$AUR_SOURCE_DIR/PKGBUILD" "$AUR_SOURCE_DIR/.SRCINFO" "$AUR_CHECKOUT/" + + cd "$AUR_CHECKOUT" + git config user.name "${AUR_GIT_NAME:-Gitty Release Bot}" + git config user.email "${AUR_GIT_EMAIL:-aur@localhost}" + git add PKGBUILD .SRCINFO + + if git diff --cached --quiet; then + echo "AUR metadata already matches release $PACKAGE_VERSION" + exit 0 + fi + + git commit -m "Update to $PACKAGE_VERSION" + git push origin HEAD:master diff --git a/PKGBUILD b/PKGBUILD index 5525e1b..1f6a64c 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,10 +1,6 @@ # Maintainer: Christoph Brandau -# -# Local/in-tree PKGBUILD: builds straight from this working directory (no -# source download, no tauri-bundler/AppImage step) and installs the raw -# binary + desktop entry. Run `makepkg -si` from the repo root. -pkgname=gitty +pkgname=gitty-desktop pkgver=2026.7.22 pkgrel=1 pkgdesc="A lightweight, modern Git client built with Tauri" @@ -15,21 +11,23 @@ depends=('webkit2gtk-4.1' 'gtk3' 'git' 'hicolor-icon-theme' 'libappindicator-gtk makedepends=('rust' 'nodejs' 'npm') options=('!lto' '!debug') -source=() -sha256sums=() +_tag=2026.7.22 +source=("gitty-desktop-${pkgver}.tar.gz::${url}/archive/${_tag}.tar.gz") +sha256sums=('bd6c7d9da54917cbea98ce31172934b4657cc2fe2020f49d27ea2acb51348e9c') -# Keeps pkgver in sync with package.json (the release CI bumps that file). -pkgver() { - cd "$startdir" - node -p "require('./package.json').version" +prepare() { + cd "$srcdir/gitlite" + + # Keep application metadata aligned even when a release tag contains + # leading zeroes that npm normalizes (for example 2026.7.01 -> 2026.7.1). + npm version "$pkgver" --no-git-tag-version --allow-same-version + RELEASE_VERSION="$pkgver" node -e "const fs=require('fs'); const path='src-tauri/tauri.conf.json'; const config=JSON.parse(fs.readFileSync(path,'utf8')); config.version=process.env.RELEASE_VERSION; fs.writeFileSync(path,JSON.stringify(config,null,2)+'\n');" } build() { - cd "$startdir" + cd "$srcdir/gitlite" - # mistralrs-core is large enough that the regular release profile (thin LTO, - # one codegen unit and Arch debug flags) can exhaust memory in the LXC build - # runner. Keep the package optimized while bounding peak compiler memory. + # Keep the large Rust release build within the Arch runner's memory limit. export CARGO_BUILD_JOBS=1 export CARGO_PROFILE_RELEASE_OPT_LEVEL=2 export CARGO_PROFILE_RELEASE_LTO=false @@ -37,40 +35,35 @@ build() { export CARGO_PROFILE_RELEASE_DEBUG=0 npm ci - # Build through the Tauri CLI (not a raw `cargo build --release`): it enables - # the `custom-protocol` cargo feature that makes the binary load the embedded - # `dist/` assets instead of the Vite dev server URL (127.0.0.1:1420), and runs - # `beforeBuildCommand` (`npm run build`) for us. `--no-bundle` skips deb/rpm/ - # appimage packaging (and with it linuxdeploy/FUSE) since pacman owns that here. npm run tauri -- build --no-bundle } package() { - cd "$startdir" + cd "$srcdir/gitlite" - install -Dm755 "src-tauri/target/release/gitty" "$pkgdir/usr/bin/gitty" + install -Dm755 "src-tauri/target/release/gitty" "$pkgdir/usr/bin/gitty-desktop" install -Dm644 "src-tauri/icons/32x32.png" \ - "$pkgdir/usr/share/icons/hicolor/32x32/apps/gitty.png" + "$pkgdir/usr/share/icons/hicolor/32x32/apps/gitty-desktop.png" install -Dm644 "src-tauri/icons/128x128.png" \ - "$pkgdir/usr/share/icons/hicolor/128x128/apps/gitty.png" + "$pkgdir/usr/share/icons/hicolor/128x128/apps/gitty-desktop.png" install -Dm644 "src-tauri/icons/128x128@2x.png" \ - "$pkgdir/usr/share/icons/hicolor/256x256@2/apps/gitty.png" + "$pkgdir/usr/share/icons/hicolor/256x256@2/apps/gitty-desktop.png" install -Dm644 "src-tauri/icons/icon.png" \ - "$pkgdir/usr/share/icons/hicolor/512x512/apps/gitty.png" + "$pkgdir/usr/share/icons/hicolor/512x512/apps/gitty-desktop.png" install -d "$pkgdir/usr/share/applications" - cat > "$pkgdir/usr/share/applications/gitty.desktop" <<-EOF + cat > "$pkgdir/usr/share/applications/gitty-desktop.desktop" <<-EOF [Desktop Entry] Type=Application Name=Gitty Comment=$pkgdesc - Exec=gitty - Icon=gitty + Exec=gitty-desktop + Icon=gitty-desktop Terminal=false Categories=Development;RevisionControl; StartupWMClass=gitty EOF - install -Dm644 "README.md" "$pkgdir/usr/share/doc/$pkgname/README.md" + install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md" } diff --git a/README.md b/README.md index 3f3e356..ebb6954 100644 --- a/README.md +++ b/README.md @@ -54,23 +54,22 @@ MIT License ## Arch Linux -Release builds are published as an `x86_64` pacman repository. Add this block to -`/etc/pacman.conf` once: - -```ini -[gitty] -SigLevel = Optional TrustAll -Server = https://cdn.cbsk-tech.de/gitty/arch/$arch -``` - -Then install Gitty and receive future releases through the normal system update: +Install Gitty from the AUR with an AUR helper: ```bash -sudo pacman -Syu gitty +yay -S gitty-desktop ``` -The repository is currently distributed over HTTPS but is not GPG-signed. A -repository signing key should be added before recommending it to third parties. +Or build the AUR package manually: + +```bash +git clone https://aur.archlinux.org/gitty-desktop.git +cd gitty-desktop +makepkg -si +``` + +The AUR recipe downloads the public Gitea release archive and builds Gitty from +source. The release pipeline updates its version, checksum, and `.SRCINFO`. --- diff --git a/cicd_tool/arch_repo.py b/cicd_tool/arch_repo.py deleted file mode 100644 index efb710a..0000000 --- a/cicd_tool/arch_repo.py +++ /dev/null @@ -1,86 +0,0 @@ -import argparse -import os -from pathlib import Path - -from minio import Minio -from minio.error import S3Error - -from main import ( - ConfigurationError, - _create_minio_client, - _ensure_bucket, - _parse_publish_targets, -) - - -REPO_PREFIX = "arch/x86_64" -DATABASE_NAME = "gitty.db.tar.gz" - - -def _targets(): - bucket_name = (os.environ.get("S3_BUCKET") or "gitty").lower() - app_dir = (os.environ.get("APP_DIR") or "gitty").strip("/") - return _parse_publish_targets(bucket_name, app_dir) - - -def download_database(client: Minio, output: Path) -> None: - target = _targets()[0] - object_name = f"{REPO_PREFIX}/{DATABASE_NAME}" - output.parent.mkdir(parents=True, exist_ok=True) - - try: - client.fget_object(target.bucket_name, object_name, str(output)) - print(f"Downloaded s3://{target.bucket_name}/{object_name} -> {output}") - except S3Error as exc: - if exc.code in {"NoSuchKey", "NoSuchObject"}: - print("No existing Arch repository database found; creating a new one.") - return - raise - - -def publish_repository(client: Minio, packages_dir: Path, repo_dir: Path) -> None: - packages = sorted(packages_dir.glob("*.pkg.tar.zst")) - if not packages: - raise FileNotFoundError(f"No .pkg.tar.zst package found in {packages_dir}") - - repository_files = [ - path - for path in repo_dir.iterdir() - if path.is_file() and path.name.startswith("gitty.") - ] - if not any(path.name == DATABASE_NAME for path in repository_files): - raise FileNotFoundError(f"Missing repository database: {repo_dir / DATABASE_NAME}") - - for target in _targets(): - _ensure_bucket(client, target.bucket_name) - for path in [*packages, *repository_files]: - object_name = f"{REPO_PREFIX}/{path.name}" - client.fput_object(target.bucket_name, object_name, str(path)) - print(f"Uploaded {path.name} -> s3://{target.bucket_name}/{object_name}") - - -def main() -> None: - parser = argparse.ArgumentParser(description="Manage the Gitty pacman repository on MinIO.") - subparsers = parser.add_subparsers(dest="command", required=True) - - download_parser = subparsers.add_parser("download-db") - download_parser.add_argument("--output", type=Path, required=True) - - publish_parser = subparsers.add_parser("publish") - publish_parser.add_argument("--packages-dir", type=Path, required=True) - publish_parser.add_argument("--repo-dir", type=Path, required=True) - - args = parser.parse_args() - client = _create_minio_client() - - if args.command == "download-db": - download_database(client, args.output) - else: - publish_repository(client, args.packages_dir, args.repo_dir) - - -if __name__ == "__main__": - try: - main() - except (ConfigurationError, FileNotFoundError, S3Error) as exc: - raise SystemExit(f"Arch repository operation failed: {exc}") from exc diff --git a/src/lib/components/HelpOverlay.svelte b/src/lib/components/HelpOverlay.svelte index e4a9f3c..1d56738 100644 --- a/src/lib/components/HelpOverlay.svelte +++ b/src/lib/components/HelpOverlay.svelte @@ -647,20 +647,20 @@ { id: "app-package-updates", title: "Gitty unter Arch Linux installieren und aktualisieren", - summary: "Ein Pacman-Repository auf der CDN-Seite ermöglicht signierte, versionierte Updates. Alternativ lässt sich eine heruntergeladene .pkg.tar.zst-Datei direkt installieren.", + summary: "Das AUR-Paket gitty-desktop lädt das öffentliche Gitea-Release und baut Gitty lokal aus dem Quellcode.", commands: [ - { command: "sudo pacman --config /pfad/gitty-pacman.conf -Syu gitty", description: "Repository-Konfiguration für genau diesen Aufruf verwenden und Gitty aktualisieren" }, - { command: "sudo pacman -U /pfad/gitty--x86_64.pkg.tar.zst", description: "Ein einzelnes lokales oder heruntergeladenes Paket installieren" }, - { command: "pacman -Qi gitty", description: "Installierte Version und Paketinformationen anzeigen" }, - { command: "pacman -Si gitty", description: "Im konfigurierten Repository verfügbare Version anzeigen" }, + { command: "yay -S gitty-desktop", description: "Gitty mit yay aus dem AUR bauen, installieren oder aktualisieren" }, + { command: "paru -S gitty-desktop", description: "Gitty alternativ mit paru bauen, installieren oder aktualisieren" }, + { command: "git clone https://aur.archlinux.org/gitty-desktop.git && cd gitty-desktop && makepkg -si", description: "AUR-Paket ohne AUR-Helfer prüfen und manuell bauen" }, + { command: "pacman -Qi gitty-desktop", description: "Installierte Version und Paketinformationen anzeigen" }, ], steps: [ - "Für normale Systemupdates trägst du das Gitty-Repository einmal dauerhaft in /etc/pacman.conf ein.", - "Wenn du die Systemdatei nicht ändern möchtest, gib --config bei jedem Pacman-Aufruf erneut an oder verwende ein eigenes Wrapper-Skript.", - "Die Build-Pipeline erzeugt das Paket aus dem PKGBUILD, aktualisiert die Repository-Datenbank und veröffentlicht beides auf dem CDN.", - "Pacman installiert nur dann eine neue Version, wenn Paketversion und Repository-Datenbank entsprechend aktualisiert wurden.", + "Das PKGBUILD lädt das öffentliche Quellarchiv des jeweiligen Gitea-Tags herunter.", + "Die Pipeline aktualisiert Version, Prüfsumme und .SRCINFO im AUR-Paket gitty-desktop.", + "AUR-Helfer erkennen neue Versionen und erzeugen daraus lokal ein normales Pacman-Paket.", + "Ohne AUR-Helfer kannst du das AUR-Git-Repository klonen, die Dateien prüfen und makepkg -si ausführen.", ], - note: "--config gilt nur für den aktuellen Pacman-Prozess. Ein späteres sudo pacman -Syu erinnert sich nicht automatisch an den zuvor angegebenen Pfad.", + note: "AUR-Pakete werden von Nutzern gepflegt. Prüfe PKGBUILD und .SRCINFO vor der Installation, besonders nach größeren Änderungen.", }, ); @@ -1090,20 +1090,20 @@ { id: "app-package-updates", title: "Install and update Gitty on Arch Linux", - summary: "A Pacman repository hosted on the CDN provides versioned updates. Alternatively, install a downloaded .pkg.tar.zst package directly.", + summary: "The gitty-desktop AUR package downloads the public Gitea release and builds Gitty locally from source.", commands: [ - { command: "sudo pacman --config /path/gitty-pacman.conf -Syu gitty", description: "Use the custom repository configuration for this invocation and update Gitty" }, - { command: "sudo pacman -U /path/gitty--x86_64.pkg.tar.zst", description: "Install one local or downloaded package file" }, - { command: "pacman -Qi gitty", description: "Show the installed version and package information" }, - { command: "pacman -Si gitty", description: "Show the version available from configured repositories" }, + { command: "yay -S gitty-desktop", description: "Build, install, or update Gitty from the AUR with yay" }, + { command: "paru -S gitty-desktop", description: "Alternatively build, install, or update Gitty with paru" }, + { command: "git clone https://aur.archlinux.org/gitty-desktop.git && cd gitty-desktop && makepkg -si", description: "Inspect and build the AUR package without an AUR helper" }, + { command: "pacman -Qi gitty-desktop", description: "Show the installed version and package information" }, ], steps: [ - "For regular system upgrades, add the Gitty repository to /etc/pacman.conf once.", - "If you do not want to change the system file, pass --config on every Pacman invocation or create a dedicated wrapper script.", - "The build pipeline creates the package from PKGBUILD, updates the repository database, and publishes both to the CDN.", - "Pacman offers an update only after both the package version and repository database have been updated.", + "PKGBUILD downloads the public source archive for the corresponding Gitea tag.", + "The pipeline updates the version, checksum, and .SRCINFO in the gitty-desktop AUR package.", + "AUR helpers detect new versions and turn the recipe into a regular Pacman package locally.", + "Without an AUR helper, clone the AUR Git repository, inspect its files, and run makepkg -si.", ], - note: "--config applies only to the current Pacman process. A later sudo pacman -Syu does not remember a previously supplied configuration path.", + note: "AUR packages are user-maintained. Review PKGBUILD and .SRCINFO before installing, especially after major changes.", }, );