BlueGit

timfa posprint

Merge branch 'feature/aur-bin'

timfa Tim Falken · pushed by timfa

Authored 2026-08-14 · 3 months ago

Hash
0b46f1f67d1333861a322db8a3eda5a08a52d61c
13 files changed +252 −76
.gitlab-ci.yml +6 −0
@@ -89,10 +89,13 @@ build:linux-arch:
89 89 - su builduser -c "cd $CI_PROJECT_DIR/packaging/arch && makepkg -f --noconfirm"
90 90 - mkdir -p "$CI_PROJECT_DIR/dist"
91 91 - cp packaging/arch/*.pkg.tar.zst "$CI_PROJECT_DIR/dist/"
92 - chmod +x "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh"
93 - "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh" packaging/arch/*.pkg.tar.zst "$CI_PROJECT_DIR/dist/posprint-${PKGVER}-x86_64.tar.gz" "$PKGVER"
92 94 artifacts:
93 95 name: "posprint-arch-$CI_COMMIT_TAG"
94 96 paths:
95 97 - dist/*.pkg.tar.zst
98 - dist/posprint-*-x86_64.tar.gz
96 99 expire_in: 1 year
97 100
98 101 build:windows:
@@ -127,6 +130,7 @@ release:gitlab:
127 130 --description "Cross-platform POS print designer release $CI_COMMIT_TAG" \
128 131 --assets-link "{\"name\":\"Linux .deb (amd64)\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint_${CI_COMMIT_TAG#v}_amd64.deb?job=build%3Alinux-deb\",\"link_type\":\"package\"}" \
129 132 --assets-link "{\"name\":\"Arch Linux .pkg.tar.zst (x86_64)\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint_${CI_COMMIT_TAG#v}-1-x86_64.pkg.tar.zst?job=build%3Alinux-arch\",\"link_type\":\"package\"}" \
133 --assets-link "{\"name\":\"Linux binary tarball (x86_64, AUR posprint-bin)\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint-${CI_COMMIT_TAG#v}-x86_64.tar.gz?job=build%3Alinux-arch\",\"link_type\":\"package\"}" \
130 134 --assets-link "{\"name\":\"Windows .exe\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint.exe?job=build%3Awindows\",\"link_type\":\"package\"}"
131 135
132 136 publish:aur:
@@ -136,6 +140,8 @@ publish:aur:
136 140 - if: $CI_COMMIT_TAG
137 141 needs:
138 142 - release:gitlab
143 - job: build:linux-arch
144 artifacts: true
139 145 before_script:
140 146 # Only tools needed to update the AUR git repo (no Rust GUI build deps).
141 147 # Do not install package name "cargo" — it prompts for a provider (rust vs rustup).
@@ -89,10 +89,13 @@ build:linux-arch:
89 - su builduser -c "cd $CI_PROJECT_DIR/packaging/arch && makepkg -f --noconfirm"
89 - su builduser -c "cd $CI_PROJECT_DIR/packaging/arch && makepkg -f --noconfirm"
90 - mkdir -p "$CI_PROJECT_DIR/dist"
90 - mkdir -p "$CI_PROJECT_DIR/dist"
91 - cp packaging/arch/*.pkg.tar.zst "$CI_PROJECT_DIR/dist/"
91 - cp packaging/arch/*.pkg.tar.zst "$CI_PROJECT_DIR/dist/"
92 - chmod +x "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh"
93 - "$CI_PROJECT_DIR/scripts/make-linux-bin-tarball.sh" packaging/arch/*.pkg.tar.zst "$CI_PROJECT_DIR/dist/posprint-${PKGVER}-x86_64.tar.gz" "$PKGVER"
92 artifacts:
94 artifacts:
93 name: "posprint-arch-$CI_COMMIT_TAG"
95 name: "posprint-arch-$CI_COMMIT_TAG"
94 paths:
96 paths:
95 - dist/*.pkg.tar.zst
97 - dist/*.pkg.tar.zst
98 - dist/posprint-*-x86_64.tar.gz
96 expire_in: 1 year
99 expire_in: 1 year
97
100
98build:windows:
101build:windows:
@@ -127,6 +130,7 @@ release:gitlab:
127 --description "Cross-platform POS print designer release $CI_COMMIT_TAG" \
130 --description "Cross-platform POS print designer release $CI_COMMIT_TAG" \
128 --assets-link "{\"name\":\"Linux .deb (amd64)\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint_${CI_COMMIT_TAG#v}_amd64.deb?job=build%3Alinux-deb\",\"link_type\":\"package\"}" \
131 --assets-link "{\"name\":\"Linux .deb (amd64)\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint_${CI_COMMIT_TAG#v}_amd64.deb?job=build%3Alinux-deb\",\"link_type\":\"package\"}" \
129 --assets-link "{\"name\":\"Arch Linux .pkg.tar.zst (x86_64)\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint_${CI_COMMIT_TAG#v}-1-x86_64.pkg.tar.zst?job=build%3Alinux-arch\",\"link_type\":\"package\"}" \
132 --assets-link "{\"name\":\"Arch Linux .pkg.tar.zst (x86_64)\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint_${CI_COMMIT_TAG#v}-1-x86_64.pkg.tar.zst?job=build%3Alinux-arch\",\"link_type\":\"package\"}" \
133 --assets-link "{\"name\":\"Linux binary tarball (x86_64, AUR posprint-bin)\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint-${CI_COMMIT_TAG#v}-x86_64.tar.gz?job=build%3Alinux-arch\",\"link_type\":\"package\"}" \
130 --assets-link "{\"name\":\"Windows .exe\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint.exe?job=build%3Awindows\",\"link_type\":\"package\"}"
134 --assets-link "{\"name\":\"Windows .exe\",\"url\":\"${CI_PROJECT_URL}/-/jobs/artifacts/${CI_COMMIT_TAG}/raw/dist/posprint.exe?job=build%3Awindows\",\"link_type\":\"package\"}"
131
135
132publish:aur:
136publish:aur:
@@ -136,6 +140,8 @@ publish:aur:
136 - if: $CI_COMMIT_TAG
140 - if: $CI_COMMIT_TAG
137 needs:
141 needs:
138 - release:gitlab
142 - release:gitlab
143 - job: build:linux-arch
144 artifacts: true
139 before_script:
145 before_script:
140 # Only tools needed to update the AUR git repo (no Rust GUI build deps).
146 # Only tools needed to update the AUR git repo (no Rust GUI build deps).
141 # Do not install package name "cargo" — it prompts for a provider (rust vs rustup).
147 # Do not install package name "cargo" — it prompts for a provider (rust vs rustup).
README.md +2 −2
@@ -43,10 +43,10 @@ All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails
43 43 | Platform | Artifact | Install |
44 44 |----------|----------|---------|
45 45 | Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
46 | Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` |
46 | Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` or AUR `posprint` / `posprint-bin` |
47 47 | Windows | `posprint.exe` | Download from GitLab release job artifacts |
48 48
49 Tag a version (e.g. `0.4.0`) to trigger release builds. If AUR publishing is configured, the same tag pipeline also updates the AUR package.
49 Tag a version (e.g. `0.4.0`) to trigger release builds. If AUR publishing is configured, the same tag pipeline also updates the `posprint` and `posprint-bin` AUR packages.
50 50
51 51 ## Features
52 52
@@ -43,10 +43,10 @@ All `${Parameters}` must be supplied via `--set NAME=VALUE` or the command fails
43| Platform | Artifact | Install |
43| Platform | Artifact | Install |
44|----------|----------|---------|
44|----------|----------|---------|
45| Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
45| Linux (Debian/Ubuntu) | `.deb` (amd64) | `sudo dpkg -i posprint_*_amd64.deb` then `sudo apt-get install -f` |
46| Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` |
46| Linux (Arch) | `.pkg.tar.zst` (x86_64) | `sudo pacman -U posprint_*_x86_64.pkg.tar.zst` or AUR `posprint` / `posprint-bin` |
47| Windows | `posprint.exe` | Download from GitLab release job artifacts |
47| Windows | `posprint.exe` | Download from GitLab release job artifacts |
48
48
49Tag a version (e.g. `0.4.0`) to trigger release builds. If AUR publishing is configured, the same tag pipeline also updates the AUR package.
49Tag a version (e.g. `0.4.0`) to trigger release builds. If AUR publishing is configured, the same tag pipeline also updates the `posprint` and `posprint-bin` AUR packages.
50
50
51## Features
51## Features
52
52
docs/ARCHITECTURE.md +2 −1
@@ -174,7 +174,8 @@ Run: `cargo test` (~100 tests). CI: tests on merge requests; release artifacts o
174 174 ## Build and release
175 175
176 176 - **CI:** GitLab (`.gitlab-ci.yml`)
177 - **Artifacts:** Windows `.exe`, Debian `.deb`, Arch `.pkg.tar.zst`
177 - **Artifacts:** Windows `.exe`, Debian `.deb`, Arch `.pkg.tar.zst`, Linux `posprint-<ver>-x86_64.tar.gz` (AUR `posprint-bin`)
178 - **AUR:** source package `posprint` and binary package `posprint-bin` (see [AUR.md](AUR.md))
178 179 - **Versioning:** Semver in `Cargo.toml`; `.pos` `version` for file-format migrations
179 180
180 181 See [PRINTING.md](PRINTING.md), [DSL-SPEC.md](DSL-SPEC.md), and [BUILD.md](BUILD.md).
@@ -174,7 +174,8 @@ Run: `cargo test` (~100 tests). CI: tests on merge requests; release artifacts o
174## Build and release
174## Build and release
175
175
176- **CI:** GitLab (`.gitlab-ci.yml`)
176- **CI:** GitLab (`.gitlab-ci.yml`)
177- **Artifacts:** Windows `.exe`, Debian `.deb`, Arch `.pkg.tar.zst`
177- **Artifacts:** Windows `.exe`, Debian `.deb`, Arch `.pkg.tar.zst`, Linux `posprint-<ver>-x86_64.tar.gz` (AUR `posprint-bin`)
178- **AUR:** source package `posprint` and binary package `posprint-bin` (see [AUR.md](AUR.md))
178- **Versioning:** Semver in `Cargo.toml`; `.pos` `version` for file-format migrations
179- **Versioning:** Semver in `Cargo.toml`; `.pos` `version` for file-format migrations
179
180
180See [PRINTING.md](PRINTING.md), [DSL-SPEC.md](DSL-SPEC.md), and [BUILD.md](BUILD.md).
181See [PRINTING.md](PRINTING.md), [DSL-SPEC.md](DSL-SPEC.md), and [BUILD.md](BUILD.md).
docs/AUR.md +42 −28
@@ -4,46 +4,55 @@ How `posprint` is published to the Arch User Repository (AUR) from GitLab tags.
4 4
5 5 ## Chosen approach
6 6
7 This repository keeps **two Arch package definitions**:
7 This repository keeps **three** Arch package definitions:
8 8
9 9 - `packaging/arch/PKGBUILD`: local builds and GitLab artifact builds (`.pkg.tar.zst`)
10 - `packaging/aur/PKGBUILD`: AUR source package, built by the AUR user from the GitLab tag tarball
10 - `packaging/aur/PKGBUILD`: AUR **source** package (`posprint`), built by the AUR user from the GitLab tag tarball
11 - `packaging/aur-bin/PKGBUILD`: AUR **binary** package (`posprint-bin`), installs a prebuilt `usr/` tree from GitLab CI
11 12
12 The AUR package is **not** `-bin`. It downloads:
13 The source package downloads:
13 14
14 15 ```text
15 16 https://gitlab.com/Timfa/posprint/-/archive/<version>/posprint-<version>.tar.gz
16 17 ```
17 18
18 That keeps the AUR package simple, reproducible, and aligned with upstream tags.
19 The binary package downloads:
20
21 ```text
22 https://gitlab.com/Timfa/posprint/-/jobs/artifacts/<version>/raw/dist/posprint-<version>-x86_64.tar.gz?job=build:linux-arch
23 ```
24
25 That tarball is packed from the Arch CI package (`usr/` only). `posprint` and `posprint-bin` **conflict**; `posprint-bin` **provides** `posprint`.
19 26
20 27 ## Files in this repo
21 28
22 29 | Path | Purpose |
23 30 |------|---------|
24 | `packaging/aur/PKGBUILD` | AUR package template |
25 | `packaging/aur/.SRCINFO` | Initial generated metadata |
26 | `scripts/publish-aur.sh` | Clone AUR repo, update `PKGBUILD`/`.SRCINFO`, commit, push |
31 | `packaging/aur/PKGBUILD` | AUR source package template |
32 | `packaging/aur/.SRCINFO` | Initial generated metadata (source) |
33 | `packaging/aur-bin/PKGBUILD` | AUR binary package template |
34 | `packaging/aur-bin/.SRCINFO` | Initial generated metadata (binary) |
35 | `scripts/make-linux-bin-tarball.sh` | Pack `usr/` from `.pkg.tar.zst` for `posprint-bin` |
36 | `scripts/publish-aur.sh` | Update both AUR repos (`posprint` and `posprint-bin`) |
27 37 | `scripts/aur-ssh-setup.sh` | Install SSH key from GitLab File or base64 variable |
28 | `scripts/bootstrap-aur-repo.sh` | One-time initial push to create the AUR repo |
29 | `.gitlab-ci.yml` | Runs AUR publish on tags |
38 | `scripts/bootstrap-aur-repo.sh` | One-time initial push to create an AUR repo |
39 | `.gitlab-ci.yml` | Builds the binary tarball and runs AUR publish on tags |
30 40
31 41 ## Release flow
32 42
33 43 When a Git tag is pushed:
34 44
35 1. GitLab builds the normal release artifacts.
36 2. GitLab creates the upstream release.
45 1. GitLab builds the normal release artifacts, including `posprint-<version>-x86_64.tar.gz`.
46 2. GitLab creates the upstream release (with a link to that tarball).
37 47 3. GitLab runs `scripts/publish-aur.sh "$CI_COMMIT_TAG"`.
38 48 4. The script:
39 - downloads the tagged source tarball
40 - computes its SHA-256
41 - clones the AUR repo
49 - downloads the tagged **source** tarball and hashes it
50 - uses the CI **binary** tarball from `dist/` (or downloads the job artifact) and hashes it
51 - clones each AUR repo (`posprint`, `posprint-bin`), or creates it on first push
42 52 - updates `pkgver`, `pkgrel`, and `sha256sums`
43 - regenerates `.SRCINFO` via `makepkg --printsrcinfo` (as non-root `aurbuild` when CI runs as root; parent tempdir is made traversable and `BUILDDIR` is forced under that user)
44 - strips a leading `v` from the tag when resolving the GitLab source archive URL
45
46 - commits and pushes to AUR `master`
53 - regenerates `.SRCINFO` via `makepkg --printsrcinfo` (as non-root `aurbuild` when CI runs as root; parent tempdir is made traversable and `BUILDDIR` is forced under that user)
54 - strips a leading `v` from the tag when resolving GitLab URLs
55 - commits and pushes to each AUR `master`
47 56
48 57 ## GitLab CI secrets
49 58
@@ -81,7 +90,6 @@ Remove `AUR_SSH_PRIVATE_KEY` if it is also set (B64 is preferred by the setup sc
81 90 | `AUR_SSH_PRIVATE_KEY` | **File** | Full private key text, including `-----BEGIN OPENSSH PRIVATE KEY-----` / `END` lines |
82 91 | `AUR_GIT_AUTHOR_NAME` | Variable | Your name |
83 92 | `AUR_GIT_AUTHOR_EMAIL` | Variable | Your email |
84 | `AUR_PKGBASE` | Variable (optional) | Defaults to `posprint` |
85 93
86 94 **Mask must be off** for File + raw key (newlines). Protected may stay on.
87 95 `scripts/aur-ssh-setup.sh` strips CR so Windows CRLF pastes still work (from 0.5.1+).
@@ -96,7 +104,9 @@ Recommended:
96 104 - mark release variables as **Protected**
97 105 - run tag pipelines only on **protected tags**
98 106
99 ## How to create the AUR repository
107 The same SSH key publishes **both** `posprint` and `posprint-bin`.
108
109 ## How to create the AUR repositories
100 110
101 111 If you have an AUR account but no package yet:
102 112
@@ -107,19 +117,22 @@ If you have an AUR account but no package yet:
107 117 ```bash
108 118 chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh
109 119 ./scripts/bootstrap-aur-repo.sh
120 ./scripts/bootstrap-aur-repo.sh posprint-bin packaging/aur-bin
110 121 ```
111 122
112 This copies `packaging/aur/PKGBUILD` and `.SRCINFO`, commits, and pushes to `ssh://aur@aur.archlinux.org/posprint.git`.
123 This copies the matching `PKGBUILD` and `.SRCINFO`, commits, and pushes to `ssh://aur@aur.archlinux.org/<pkgbase>.git`.
124
125 Tag pipelines can also create a missing AUR repo on first publish (clone fails → `git init` + push). Bootstrapping still lets you create the pages before the next tag.
113 126
114 Manual equivalent:
127 Manual equivalent for `posprint-bin`:
115 128
116 129 ```bash
117 mkdir ~/posprint-aur && cd ~/posprint-aur
130 mkdir ~/posprint-bin-aur && cd ~/posprint-bin-aur
118 131 git init
119 git remote add origin ssh://aur@aur.archlinux.org/posprint.git
132 git remote add origin ssh://aur@aur.archlinux.org/posprint-bin.git
120 133 git checkout -b master
121 cp /path/to/posprint/packaging/aur/PKGBUILD .
122 cp /path/to/posprint/packaging/aur/.SRCINFO .
134 cp /path/to/posprint/packaging/aur-bin/PKGBUILD .
135 cp /path/to/posprint/packaging/aur-bin/.SRCINFO .
123 136 git add PKGBUILD .SRCINFO
124 137 git commit -m "initial import"
125 138 git push origin master
@@ -129,11 +142,11 @@ After the first push, the AUR package page exists and later tag pipelines can up
129 142
130 143 ## Bootstrapping manually
131 144
132 Before enabling CI automation, test one update locally:
145 Before enabling CI automation, test one update locally (needs a binary tarball in `dist/` or a completed tag pipeline):
133 146
134 147 ```bash
135 148 cd /path/to/posprint
136 ./scripts/publish-aur.sh 0.4.0
149 ./scripts/publish-aur.sh 0.5.6
137 150 ```
138 151
139 152 Requirements on that machine:
@@ -150,3 +163,4 @@ Requirements on that machine:
150 163 - If you need an AUR-only packaging fix without a new upstream release, bump `pkgrel` in the AUR repo manually.
151 164 - `.SRCINFO` must always be committed together with `PKGBUILD`.
152 165 - The AUR only accepts pushes to the `master` branch.
166 - Install with `yay -S posprint` (compile) or `yay -S posprint-bin` (prebuilt).
@@ -4,46 +4,55 @@ How `posprint` is published to the Arch User Repository (AUR) from GitLab tags.
4
4
5## Chosen approach
5## Chosen approach
6
6
7This repository keeps **two Arch package definitions**:
7This repository keeps **three** Arch package definitions:
8
8
9- `packaging/arch/PKGBUILD`: local builds and GitLab artifact builds (`.pkg.tar.zst`)
9- `packaging/arch/PKGBUILD`: local builds and GitLab artifact builds (`.pkg.tar.zst`)
10- `packaging/aur/PKGBUILD`: AUR source package, built by the AUR user from the GitLab tag tarball
10- `packaging/aur/PKGBUILD`: AUR **source** package (`posprint`), built by the AUR user from the GitLab tag tarball
11- `packaging/aur-bin/PKGBUILD`: AUR **binary** package (`posprint-bin`), installs a prebuilt `usr/` tree from GitLab CI
11
12
12The AUR package is **not** `-bin`. It downloads:
13The source package downloads:
13
14
14```text
15```text
15https://gitlab.com/Timfa/posprint/-/archive/<version>/posprint-<version>.tar.gz
16https://gitlab.com/Timfa/posprint/-/archive/<version>/posprint-<version>.tar.gz
16```
17```
17
18
18That keeps the AUR package simple, reproducible, and aligned with upstream tags.
19The binary package downloads:
20
21```text
22https://gitlab.com/Timfa/posprint/-/jobs/artifacts/<version>/raw/dist/posprint-<version>-x86_64.tar.gz?job=build:linux-arch
23```
24
25That tarball is packed from the Arch CI package (`usr/` only). `posprint` and `posprint-bin` **conflict**; `posprint-bin` **provides** `posprint`.
19
26
20## Files in this repo
27## Files in this repo
21
28
22| Path | Purpose |
29| Path | Purpose |
23|------|---------|
30|------|---------|
24| `packaging/aur/PKGBUILD` | AUR package template |
31| `packaging/aur/PKGBUILD` | AUR source package template |
25| `packaging/aur/.SRCINFO` | Initial generated metadata |
32| `packaging/aur/.SRCINFO` | Initial generated metadata (source) |
26| `scripts/publish-aur.sh` | Clone AUR repo, update `PKGBUILD`/`.SRCINFO`, commit, push |
33| `packaging/aur-bin/PKGBUILD` | AUR binary package template |
34| `packaging/aur-bin/.SRCINFO` | Initial generated metadata (binary) |
35| `scripts/make-linux-bin-tarball.sh` | Pack `usr/` from `.pkg.tar.zst` for `posprint-bin` |
36| `scripts/publish-aur.sh` | Update both AUR repos (`posprint` and `posprint-bin`) |
27| `scripts/aur-ssh-setup.sh` | Install SSH key from GitLab File or base64 variable |
37| `scripts/aur-ssh-setup.sh` | Install SSH key from GitLab File or base64 variable |
28| `scripts/bootstrap-aur-repo.sh` | One-time initial push to create the AUR repo |
38| `scripts/bootstrap-aur-repo.sh` | One-time initial push to create an AUR repo |
29| `.gitlab-ci.yml` | Runs AUR publish on tags |
39| `.gitlab-ci.yml` | Builds the binary tarball and runs AUR publish on tags |
30
40
31## Release flow
41## Release flow
32
42
33When a Git tag is pushed:
43When a Git tag is pushed:
34
44
351. GitLab builds the normal release artifacts.
451. GitLab builds the normal release artifacts, including `posprint-<version>-x86_64.tar.gz`.
362. GitLab creates the upstream release.
462. GitLab creates the upstream release (with a link to that tarball).
373. GitLab runs `scripts/publish-aur.sh "$CI_COMMIT_TAG"`.
473. GitLab runs `scripts/publish-aur.sh "$CI_COMMIT_TAG"`.
384. The script:
484. The script:
39 - downloads the tagged source tarball
49 - downloads the tagged **source** tarball and hashes it
40 - computes its SHA-256
50 - uses the CI **binary** tarball from `dist/` (or downloads the job artifact) and hashes it
41 - clones the AUR repo
51 - clones each AUR repo (`posprint`, `posprint-bin`), or creates it on first push
42 - updates `pkgver`, `pkgrel`, and `sha256sums`
52 - updates `pkgver`, `pkgrel`, and `sha256sums`
43- regenerates `.SRCINFO` via `makepkg --printsrcinfo` (as non-root `aurbuild` when CI runs as root; parent tempdir is made traversable and `BUILDDIR` is forced under that user)
53 - regenerates `.SRCINFO` via `makepkg --printsrcinfo` (as non-root `aurbuild` when CI runs as root; parent tempdir is made traversable and `BUILDDIR` is forced under that user)
44- strips a leading `v` from the tag when resolving the GitLab source archive URL
54 - strips a leading `v` from the tag when resolving GitLab URLs
45
55 - commits and pushes to each AUR `master`
46 - commits and pushes to AUR `master`
47
56
48## GitLab CI secrets
57## GitLab CI secrets
49
58
@@ -81,7 +90,6 @@ Remove `AUR_SSH_PRIVATE_KEY` if it is also set (B64 is preferred by the setup sc
81| `AUR_SSH_PRIVATE_KEY` | **File** | Full private key text, including `-----BEGIN OPENSSH PRIVATE KEY-----` / `END` lines |
90| `AUR_SSH_PRIVATE_KEY` | **File** | Full private key text, including `-----BEGIN OPENSSH PRIVATE KEY-----` / `END` lines |
82| `AUR_GIT_AUTHOR_NAME` | Variable | Your name |
91| `AUR_GIT_AUTHOR_NAME` | Variable | Your name |
83| `AUR_GIT_AUTHOR_EMAIL` | Variable | Your email |
92| `AUR_GIT_AUTHOR_EMAIL` | Variable | Your email |
84| `AUR_PKGBASE` | Variable (optional) | Defaults to `posprint` |
85
93
86**Mask must be off** for File + raw key (newlines). Protected may stay on.
94**Mask must be off** for File + raw key (newlines). Protected may stay on.
87`scripts/aur-ssh-setup.sh` strips CR so Windows CRLF pastes still work (from 0.5.1+).
95`scripts/aur-ssh-setup.sh` strips CR so Windows CRLF pastes still work (from 0.5.1+).
@@ -96,7 +104,9 @@ Recommended:
96- mark release variables as **Protected**
104- mark release variables as **Protected**
97- run tag pipelines only on **protected tags**
105- run tag pipelines only on **protected tags**
98
106
99## How to create the AUR repository
107The same SSH key publishes **both** `posprint` and `posprint-bin`.
108
109## How to create the AUR repositories
100
110
101If you have an AUR account but no package yet:
111If you have an AUR account but no package yet:
102
112
@@ -107,19 +117,22 @@ If you have an AUR account but no package yet:
107```bash
117```bash
108chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh
118chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh
109./scripts/bootstrap-aur-repo.sh
119./scripts/bootstrap-aur-repo.sh
120./scripts/bootstrap-aur-repo.sh posprint-bin packaging/aur-bin
110```
121```
111
122
112This copies `packaging/aur/PKGBUILD` and `.SRCINFO`, commits, and pushes to `ssh://aur@aur.archlinux.org/posprint.git`.
123This copies the matching `PKGBUILD` and `.SRCINFO`, commits, and pushes to `ssh://aur@aur.archlinux.org/<pkgbase>.git`.
124
125Tag pipelines can also create a missing AUR repo on first publish (clone fails → `git init` + push). Bootstrapping still lets you create the pages before the next tag.
113
126
114Manual equivalent:
127Manual equivalent for `posprint-bin`:
115
128
116```bash
129```bash
117mkdir ~/posprint-aur && cd ~/posprint-aur
130mkdir ~/posprint-bin-aur && cd ~/posprint-bin-aur
118git init
131git init
119git remote add origin ssh://aur@aur.archlinux.org/posprint.git
132git remote add origin ssh://aur@aur.archlinux.org/posprint-bin.git
120git checkout -b master
133git checkout -b master
121cp /path/to/posprint/packaging/aur/PKGBUILD .
134cp /path/to/posprint/packaging/aur-bin/PKGBUILD .
122cp /path/to/posprint/packaging/aur/.SRCINFO .
135cp /path/to/posprint/packaging/aur-bin/.SRCINFO .
123git add PKGBUILD .SRCINFO
136git add PKGBUILD .SRCINFO
124git commit -m "initial import"
137git commit -m "initial import"
125git push origin master
138git push origin master
@@ -129,11 +142,11 @@ After the first push, the AUR package page exists and later tag pipelines can up
129
142
130## Bootstrapping manually
143## Bootstrapping manually
131
144
132Before enabling CI automation, test one update locally:
145Before enabling CI automation, test one update locally (needs a binary tarball in `dist/` or a completed tag pipeline):
133
146
134```bash
147```bash
135cd /path/to/posprint
148cd /path/to/posprint
136./scripts/publish-aur.sh 0.4.0
149./scripts/publish-aur.sh 0.5.6
137```
150```
138
151
139Requirements on that machine:
152Requirements on that machine:
@@ -150,3 +163,4 @@ Requirements on that machine:
150- If you need an AUR-only packaging fix without a new upstream release, bump `pkgrel` in the AUR repo manually.
163- If you need an AUR-only packaging fix without a new upstream release, bump `pkgrel` in the AUR repo manually.
151- `.SRCINFO` must always be committed together with `PKGBUILD`.
164- `.SRCINFO` must always be committed together with `PKGBUILD`.
152- The AUR only accepts pushes to the `master` branch.
165- The AUR only accepts pushes to the `master` branch.
166- Install with `yay -S posprint` (compile) or `yay -S posprint-bin` (prebuilt).
docs/BUILD.md +5 −4
@@ -107,11 +107,12 @@ Normal local Arch packaging uses `packaging/arch/PKGBUILD`.
107 107
108 108 Automated AUR publishing uses:
109 109
110 - `packaging/aur/PKGBUILD`
111 - `packaging/aur/.SRCINFO`
112 - `scripts/publish-aur.sh`
110 - `packaging/aur/PKGBUILD` — source package (`posprint`)
111 - `packaging/aur-bin/PKGBUILD` — binary package (`posprint-bin`)
112 - `scripts/publish-aur.sh` — updates both AUR repos on tags
113 - `scripts/make-linux-bin-tarball.sh` — packs `usr/` from the Arch CI `.pkg.tar.zst`
113 114
114 That AUR package builds from the GitLab tag tarball, not from a prebuilt binary.
115 The source package builds from the GitLab tag tarball. The binary package installs a prebuilt tree from CI.
115 116
116 117 Setup and required GitLab secrets are documented in [AUR.md](AUR.md).
117 118
@@ -107,11 +107,12 @@ Normal local Arch packaging uses `packaging/arch/PKGBUILD`.
107
107
108Automated AUR publishing uses:
108Automated AUR publishing uses:
109
109
110- `packaging/aur/PKGBUILD`
110- `packaging/aur/PKGBUILD` — source package (`posprint`)
111- `packaging/aur/.SRCINFO`
111- `packaging/aur-bin/PKGBUILD` — binary package (`posprint-bin`)
112- `scripts/publish-aur.sh`
112- `scripts/publish-aur.sh` — updates both AUR repos on tags
113- `scripts/make-linux-bin-tarball.sh` — packs `usr/` from the Arch CI `.pkg.tar.zst`
113
114
114That AUR package builds from the GitLab tag tarball, not from a prebuilt binary.
115The source package builds from the GitLab tag tarball. The binary package installs a prebuilt tree from CI.
115
116
116Setup and required GitLab secrets are documented in [AUR.md](AUR.md).
117Setup and required GitLab secrets are documented in [AUR.md](AUR.md).
117
118
packaging/arch/PKGBUILD +1 −0
@@ -6,6 +6,7 @@ pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS prin
6 6 arch=('x86_64')
7 7 url="https://gitlab.com/Timfa/posprint"
8 8 license=('MIT')
9 conflicts=('posprint-bin')
9 10 depends=(
10 11 'gcc-libs'
11 12 'libxkbcommon'
@@ -6,6 +6,7 @@ pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS prin
6arch=('x86_64')
6arch=('x86_64')
7url="https://gitlab.com/Timfa/posprint"
7url="https://gitlab.com/Timfa/posprint"
8license=('MIT')
8license=('MIT')
9conflicts=('posprint-bin')
9depends=(
10depends=(
10 'gcc-libs'
11 'gcc-libs'
11 'libxkbcommon'
12 'libxkbcommon'
packaging/aur-bin/.SRCINFO added +25 −0
@@ -0,0 +1,25 @@
1 pkgbase = posprint-bin
2 pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)
3 pkgver = 0.5.6
4 pkgrel = 1
5 url = https://gitlab.com/Timfa/posprint
6 arch = x86_64
7 license = MIT
8 provides = posprint=0.5.6
9 conflicts = posprint
10 depends = gcc-libs
11 depends = libxkbcommon
12 depends = libxcb
13 depends = openssl
14 depends = dbus
15 depends = wayland
16 depends = libx11
17 depends = fontconfig
18 depends = freetype2
19 depends = libglvnd
20 options = !strip
21 options = !debug
22 source = posprint-0.5.6-x86_64.tar.gz::https://gitlab.com/Timfa/posprint/-/jobs/artifacts/0.5.6/raw/dist/posprint-0.5.6-x86_64.tar.gz?job=build:linux-arch
23 sha256sums = 0000000000000000000000000000000000000000000000000000000000000000
24
25 pkgname = posprint-bin
@@ -0,0 +1,25 @@
1pkgbase = posprint-bin
2 pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)
3 pkgver = 0.5.6
4 pkgrel = 1
5 url = https://gitlab.com/Timfa/posprint
6 arch = x86_64
7 license = MIT
8 provides = posprint=0.5.6
9 conflicts = posprint
10 depends = gcc-libs
11 depends = libxkbcommon
12 depends = libxcb
13 depends = openssl
14 depends = dbus
15 depends = wayland
16 depends = libx11
17 depends = fontconfig
18 depends = freetype2
19 depends = libglvnd
20 options = !strip
21 options = !debug
22 source = posprint-0.5.6-x86_64.tar.gz::https://gitlab.com/Timfa/posprint/-/jobs/artifacts/0.5.6/raw/dist/posprint-0.5.6-x86_64.tar.gz?job=build:linux-arch
23 sha256sums = 0000000000000000000000000000000000000000000000000000000000000000
24
25pkgname = posprint-bin
packaging/aur-bin/PKGBUILD added +29 −0
@@ -0,0 +1,29 @@
1 # Maintainer: posprint contributors
2 pkgname=posprint-bin
3 pkgver=0.5.6
4 pkgrel=1
5 pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)"
6 arch=('x86_64')
7 url="https://gitlab.com/Timfa/posprint"
8 license=('MIT')
9 depends=(
10 'gcc-libs'
11 'libxkbcommon'
12 'libxcb'
13 'openssl'
14 'dbus'
15 'wayland'
16 'libx11'
17 'fontconfig'
18 'freetype2'
19 'libglvnd'
20 )
21 provides=("posprint=${pkgver}")
22 conflicts=('posprint')
23 options=('!strip' '!debug')
24 source=("posprint-${pkgver}-x86_64.tar.gz::https://gitlab.com/Timfa/posprint/-/jobs/artifacts/${pkgver}/raw/dist/posprint-${pkgver}-x86_64.tar.gz?job=build:linux-arch")
25 sha256sums=('0000000000000000000000000000000000000000000000000000000000000000')
26
27 package() {
28 cp -a "$srcdir/usr" "$pkgdir/"
29 }
@@ -0,0 +1,29 @@
1# Maintainer: posprint contributors
2pkgname=posprint-bin
3pkgver=0.5.6
4pkgrel=1
5pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing (prebuilt binary)"
6arch=('x86_64')
7url="https://gitlab.com/Timfa/posprint"
8license=('MIT')
9depends=(
10 'gcc-libs'
11 'libxkbcommon'
12 'libxcb'
13 'openssl'
14 'dbus'
15 'wayland'
16 'libx11'
17 'fontconfig'
18 'freetype2'
19 'libglvnd'
20)
21provides=("posprint=${pkgver}")
22conflicts=('posprint')
23options=('!strip' '!debug')
24source=("posprint-${pkgver}-x86_64.tar.gz::https://gitlab.com/Timfa/posprint/-/jobs/artifacts/${pkgver}/raw/dist/posprint-${pkgver}-x86_64.tar.gz?job=build:linux-arch")
25sha256sums=('0000000000000000000000000000000000000000000000000000000000000000')
26
27package() {
28 cp -a "$srcdir/usr" "$pkgdir/"
29}
packaging/aur/.SRCINFO +1 −0
@@ -5,6 +5,7 @@ pkgbase = posprint
5 5 url = https://gitlab.com/Timfa/posprint
6 6 arch = x86_64
7 7 license = MIT
8 conflicts = posprint-bin
8 9 makedepends = rust
9 10 makedepends = cargo
10 11 makedepends = pkgconf
@@ -5,6 +5,7 @@ pkgbase = posprint
5 url = https://gitlab.com/Timfa/posprint
5 url = https://gitlab.com/Timfa/posprint
6 arch = x86_64
6 arch = x86_64
7 license = MIT
7 license = MIT
8 conflicts = posprint-bin
8 makedepends = rust
9 makedepends = rust
9 makedepends = cargo
10 makedepends = cargo
10 makedepends = pkgconf
11 makedepends = pkgconf
packaging/aur/PKGBUILD +1 −0
@@ -6,6 +6,7 @@ pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS prin
6 6 arch=('x86_64')
7 7 url="https://gitlab.com/Timfa/posprint"
8 8 license=('MIT')
9 conflicts=('posprint-bin')
9 10 depends=(
10 11 'gcc-libs'
11 12 'libxkbcommon'
@@ -6,6 +6,7 @@ pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS prin
6arch=('x86_64')
6arch=('x86_64')
7url="https://gitlab.com/Timfa/posprint"
7url="https://gitlab.com/Timfa/posprint"
8license=('MIT')
8license=('MIT')
9conflicts=('posprint-bin')
9depends=(
10depends=(
10 'gcc-libs'
11 'gcc-libs'
11 'libxkbcommon'
12 'libxkbcommon'
scripts/bootstrap-aur-repo.sh +14 −4
@@ -1,10 +1,15 @@
1 1 #!/usr/bin/env bash
2 # One-time: create the AUR package repo and push initial PKGBUILD + .SRCINFO.
2 # One-time: create an AUR package repo and push initial PKGBUILD + .SRCINFO.
3 3 # Run on a machine where your AUR SSH key works (same key as on aur.archlinux.org).
4 #
5 # Usage:
6 # ./scripts/bootstrap-aur-repo.sh # posprint (source)
7 # ./scripts/bootstrap-aur-repo.sh posprint-bin packaging/aur-bin
4 8 set -euo pipefail
5 9
6 10 ROOT="$(cd "$(dirname "$0")/.." && pwd)"
7 PKGBASE="${AUR_PKGBASE:-posprint}"
11 PKGBASE="${1:-${AUR_PKGBASE:-posprint}}"
12 TEMPLATE_DIR="${2:-${AUR_TEMPLATE:-packaging/aur}}"
8 13 AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"
9 14 WORKDIR="${TMPDIR:-/tmp}/${PKGBASE}-aur-bootstrap-$$"
10 15 cleanup() { rm -rf "$WORKDIR"; }
@@ -14,6 +19,11 @@ for cmd in git ssh; do
14 19 command -v "$cmd" >/dev/null || { echo "Missing: $cmd" >&2; exit 1; }
15 20 done
16 21
22 if [[ ! -f "$ROOT/$TEMPLATE_DIR/PKGBUILD" || ! -f "$ROOT/$TEMPLATE_DIR/.SRCINFO" ]]; then
23 echo "Missing $TEMPLATE_DIR/PKGBUILD or .SRCINFO" >&2
24 exit 1
25 fi
26
17 27 "$ROOT/scripts/aur-ssh-setup.sh"
18 28
19 29 mkdir -p "$WORKDIR/repo"
@@ -22,8 +32,8 @@ git init
22 32 git remote add origin "$AUR_REMOTE"
23 33 git checkout -b master
24 34
25 cp "$ROOT/packaging/aur/PKGBUILD" .
26 cp "$ROOT/packaging/aur/.SRCINFO" .
35 cp "$ROOT/$TEMPLATE_DIR/PKGBUILD" .
36 cp "$ROOT/$TEMPLATE_DIR/.SRCINFO" .
27 37
28 38 git add PKGBUILD .SRCINFO
29 39 git commit -m "initial import"
@@ -1,10 +1,15 @@
1#!/usr/bin/env bash
1#!/usr/bin/env bash
2# One-time: create the AUR package repo and push initial PKGBUILD + .SRCINFO.
2# One-time: create an AUR package repo and push initial PKGBUILD + .SRCINFO.
3# Run on a machine where your AUR SSH key works (same key as on aur.archlinux.org).
3# Run on a machine where your AUR SSH key works (same key as on aur.archlinux.org).
4#
5# Usage:
6# ./scripts/bootstrap-aur-repo.sh # posprint (source)
7# ./scripts/bootstrap-aur-repo.sh posprint-bin packaging/aur-bin
4set -euo pipefail
8set -euo pipefail
5
9
6ROOT="$(cd "$(dirname "$0")/.." && pwd)"
10ROOT="$(cd "$(dirname "$0")/.." && pwd)"
7PKGBASE="${AUR_PKGBASE:-posprint}"
11PKGBASE="${1:-${AUR_PKGBASE:-posprint}}"
12TEMPLATE_DIR="${2:-${AUR_TEMPLATE:-packaging/aur}}"
8AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"
13AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"
9WORKDIR="${TMPDIR:-/tmp}/${PKGBASE}-aur-bootstrap-$$"
14WORKDIR="${TMPDIR:-/tmp}/${PKGBASE}-aur-bootstrap-$$"
10cleanup() { rm -rf "$WORKDIR"; }
15cleanup() { rm -rf "$WORKDIR"; }
@@ -14,6 +19,11 @@ for cmd in git ssh; do
14 command -v "$cmd" >/dev/null || { echo "Missing: $cmd" >&2; exit 1; }
19 command -v "$cmd" >/dev/null || { echo "Missing: $cmd" >&2; exit 1; }
15done
20done
16
21
22if [[ ! -f "$ROOT/$TEMPLATE_DIR/PKGBUILD" || ! -f "$ROOT/$TEMPLATE_DIR/.SRCINFO" ]]; then
23 echo "Missing $TEMPLATE_DIR/PKGBUILD or .SRCINFO" >&2
24 exit 1
25fi
26
17"$ROOT/scripts/aur-ssh-setup.sh"
27"$ROOT/scripts/aur-ssh-setup.sh"
18
28
19mkdir -p "$WORKDIR/repo"
29mkdir -p "$WORKDIR/repo"
@@ -22,8 +32,8 @@ git init
22git remote add origin "$AUR_REMOTE"
32git remote add origin "$AUR_REMOTE"
23git checkout -b master
33git checkout -b master
24
34
25cp "$ROOT/packaging/aur/PKGBUILD" .
35cp "$ROOT/$TEMPLATE_DIR/PKGBUILD" .
26cp "$ROOT/packaging/aur/.SRCINFO" .
36cp "$ROOT/$TEMPLATE_DIR/.SRCINFO" .
27
37
28git add PKGBUILD .SRCINFO
38git add PKGBUILD .SRCINFO
29git commit -m "initial import"
39git commit -m "initial import"
scripts/make-linux-bin-tarball.sh added +48 −0
@@ -0,0 +1,48 @@
1 #!/usr/bin/env bash
2 # Pack usr/ from an Arch .pkg.tar.zst into posprint-<ver>-x86_64.tar.gz for AUR posprint-bin.
3 set -euo pipefail
4
5 ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6 PKG_ZST="${1:-}"
7 OUT="${2:-}"
8 VERSION="${3:-}"
9
10 if [[ -z "$PKG_ZST" ]]; then
11 shopt -s nullglob
12 candidates=("$ROOT"/packaging/arch/*.pkg.tar.zst "$ROOT"/dist/*.pkg.tar.zst)
13 shopt -u nullglob
14 if [[ ${#candidates[@]} -eq 0 ]]; then
15 echo "Usage: $0 <posprint-*.pkg.tar.zst> [out.tar.gz] [version]" >&2
16 exit 1
17 fi
18 PKG_ZST="${candidates[0]}"
19 fi
20
21 if [[ -z "$VERSION" ]]; then
22 VERSION="$(grep '^version = ' "$ROOT/Cargo.toml" | sed -E 's/.*"([^"]+)"/\1/')"
23 fi
24 VERSION="${VERSION#v}"
25
26 if [[ -z "$OUT" ]]; then
27 mkdir -p "$ROOT/dist"
28 OUT="$ROOT/dist/posprint-${VERSION}-x86_64.tar.gz"
29 fi
30
31 EXTRACT="$(mktemp -d)"
32 cleanup() { rm -rf "$EXTRACT"; }
33 trap cleanup EXIT
34
35 if command -v bsdtar >/dev/null; then
36 bsdtar -C "$EXTRACT" -xf "$PKG_ZST"
37 else
38 tar -C "$EXTRACT" -xf "$PKG_ZST"
39 fi
40
41 if [[ ! -d "$EXTRACT/usr" ]]; then
42 echo "Arch package did not contain usr/: $PKG_ZST" >&2
43 exit 1
44 fi
45
46 mkdir -p "$(dirname "$OUT")"
47 tar -C "$EXTRACT" -czf "$OUT" usr
48 echo "Wrote $OUT"
@@ -0,0 +1,48 @@
1#!/usr/bin/env bash
2# Pack usr/ from an Arch .pkg.tar.zst into posprint-<ver>-x86_64.tar.gz for AUR posprint-bin.
3set -euo pipefail
4
5ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6PKG_ZST="${1:-}"
7OUT="${2:-}"
8VERSION="${3:-}"
9
10if [[ -z "$PKG_ZST" ]]; then
11 shopt -s nullglob
12 candidates=("$ROOT"/packaging/arch/*.pkg.tar.zst "$ROOT"/dist/*.pkg.tar.zst)
13 shopt -u nullglob
14 if [[ ${#candidates[@]} -eq 0 ]]; then
15 echo "Usage: $0 <posprint-*.pkg.tar.zst> [out.tar.gz] [version]" >&2
16 exit 1
17 fi
18 PKG_ZST="${candidates[0]}"
19fi
20
21if [[ -z "$VERSION" ]]; then
22 VERSION="$(grep '^version = ' "$ROOT/Cargo.toml" | sed -E 's/.*"([^"]+)"/\1/')"
23fi
24VERSION="${VERSION#v}"
25
26if [[ -z "$OUT" ]]; then
27 mkdir -p "$ROOT/dist"
28 OUT="$ROOT/dist/posprint-${VERSION}-x86_64.tar.gz"
29fi
30
31EXTRACT="$(mktemp -d)"
32cleanup() { rm -rf "$EXTRACT"; }
33trap cleanup EXIT
34
35if command -v bsdtar >/dev/null; then
36 bsdtar -C "$EXTRACT" -xf "$PKG_ZST"
37else
38 tar -C "$EXTRACT" -xf "$PKG_ZST"
39fi
40
41if [[ ! -d "$EXTRACT/usr" ]]; then
42 echo "Arch package did not contain usr/: $PKG_ZST" >&2
43 exit 1
44fi
45
46mkdir -p "$(dirname "$OUT")"
47tar -C "$EXTRACT" -czf "$OUT" usr
48echo "Wrote $OUT"
scripts/publish-aur.sh +76 −37
@@ -2,11 +2,9 @@
2 2 set -euo pipefail
3 3
4 4 ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5 PKGBASE="${AUR_PKGBASE:-posprint}"
6 AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"
7 5 VERSION="${1:-}"
8 6 TMPDIR="${TMPDIR:-/tmp}"
9 WORKDIR="$(mktemp -d "$TMPDIR/${PKGBASE}-aur-XXXXXX")"
7 WORKDIR="$(mktemp -d "$TMPDIR/posprint-aur-XXXXXX")"
10 8 cleanup() { rm -rf "$WORKDIR"; }
11 9 trap cleanup EXIT
12 10
@@ -26,29 +24,9 @@ if [[ "$(id -u)" -eq 0 ]]; then
26 24 command -v useradd >/dev/null || { echo "Missing command: useradd" >&2; exit 1; }
27 25 fi
28 26
29 if [[ ! -f packaging/aur/PKGBUILD ]]; then
30 echo "Missing packaging/aur/PKGBUILD template" >&2
31 exit 1
32 fi
33
34 ARCHIVE_URL="https://gitlab.com/Timfa/posprint/-/archive/${VERSION}/posprint-${VERSION}.tar.gz"
35
36 echo "Checking source tarball: $ARCHIVE_URL"
37 TMP_TARBALL="$WORKDIR/source.tar.gz"
38 curl -fsSL "$ARCHIVE_URL" -o "$TMP_TARBALL"
39 ARCHIVE_SHA="$(sha256sum "$TMP_TARBALL" | awk '{print $1}')"
40
41 echo "Cloning AUR repo: $AUR_REMOTE"
42 git clone "$AUR_REMOTE" "$WORKDIR/repo"
43 cd "$WORKDIR/repo"
44
45 git config user.name "${AUR_GIT_AUTHOR_NAME:-posprint release bot}"
46 git config user.email "${AUR_GIT_AUTHOR_EMAIL:-noreply@example.invalid}"
47
48 cp "$ROOT/packaging/aur/PKGBUILD" PKGBUILD
49 sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
50 sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD
51 sed -i "s|^sha256sums=.*|sha256sums=('${ARCHIVE_SHA}')|" PKGBUILD
27 SOURCE_ARCHIVE_URL="https://gitlab.com/Timfa/posprint/-/archive/${VERSION}/posprint-${VERSION}.tar.gz"
28 BIN_TARBALL_NAME="posprint-${VERSION}-x86_64.tar.gz"
29 BIN_ARTIFACT_URL="https://gitlab.com/Timfa/posprint/-/jobs/artifacts/${VERSION}/raw/dist/${BIN_TARBALL_NAME}?job=build:linux-arch"
52 30
53 31 generate_srcinfo() {
54 32 # makepkg refuses root. mktemp parents are 0700 — aurbuild must be able to traverse
@@ -60,26 +38,87 @@ generate_srcinfo() {
60 38 useradd --system --create-home --shell /bin/bash "$makepkg_user"
61 39 fi
62 40 chmod 755 "$WORKDIR"
63 chown -R "$makepkg_user:$makepkg_user" "$WORKDIR/repo"
41 chown -R "$makepkg_user:$makepkg_user" "$PWD"
64 42 build_tmp="$(runuser -u "$makepkg_user" -- mktemp -d)"
65 43 # Belt-and-suspenders: force BUILDDIR into a dir aurbuild definitely owns.
66 44 runuser -u "$makepkg_user" -- env BUILDDIR="$build_tmp" makepkg --printsrcinfo > .SRCINFO
67 45 rm -rf "$build_tmp"
68 chown -R root:root "$WORKDIR/repo"
46 chown -R root:root "$PWD"
69 47 else
70 48 makepkg --printsrcinfo > .SRCINFO
71 49 fi
72 50 }
73 51
74 generate_srcinfo
52 clone_or_init_aur_repo() {
53 local pkgbase="$1"
54 local dest="$2"
55 local remote="ssh://aur@aur.archlinux.org/${pkgbase}.git"
75 56
76 if git diff --quiet -- PKGBUILD .SRCINFO; then
77 echo "AUR repo already up to date for ${VERSION}"
78 exit 0
79 fi
57 echo "Cloning AUR repo: $remote"
58 if git clone "$remote" "$dest"; then
59 return 0
60 fi
61
62 echo "AUR repo ${pkgbase} does not exist yet; creating on first push"
63 mkdir -p "$dest"
64 git -C "$dest" init
65 git -C "$dest" checkout -b master
66 git -C "$dest" remote add origin "$remote"
67 }
68
69 publish_package() {
70 local pkgbase="$1"
71 local template_dir="$2"
72 local archive_sha="$3"
73 local dest="$WORKDIR/${pkgbase}"
74
75 if [[ ! -f "$ROOT/$template_dir/PKGBUILD" ]]; then
76 echo "Missing $template_dir/PKGBUILD template" >&2
77 exit 1
78 fi
80 79
81 git add PKGBUILD .SRCINFO
82 git commit -m "upstream release ${VERSION}"
83 git push origin master
80 clone_or_init_aur_repo "$pkgbase" "$dest"
81 cd "$dest"
84 82
85 echo "AUR updated: ${PKGBASE} ${VERSION}"
83 git config user.name "${AUR_GIT_AUTHOR_NAME:-posprint release bot}"
84 git config user.email "${AUR_GIT_AUTHOR_EMAIL:-noreply@example.invalid}"
85
86 cp "$ROOT/$template_dir/PKGBUILD" PKGBUILD
87 sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
88 sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD
89 sed -i "s|^sha256sums=.*|sha256sums=('${archive_sha}')|" PKGBUILD
90
91 generate_srcinfo
92
93 if git diff --quiet -- PKGBUILD .SRCINFO 2>/dev/null && git rev-parse --verify HEAD >/dev/null 2>&1; then
94 echo "AUR repo already up to date: ${pkgbase} ${VERSION}"
95 cd "$ROOT"
96 return 0
97 fi
98
99 git add PKGBUILD .SRCINFO
100 if git rev-parse --verify HEAD >/dev/null 2>&1; then
101 git commit -m "upstream release ${VERSION}"
102 else
103 git commit -m "initial import ${VERSION}"
104 fi
105 git push -u origin master
106
107 echo "AUR updated: ${pkgbase} ${VERSION}"
108 cd "$ROOT"
109 }
110
111 echo "Checking source tarball: $SOURCE_ARCHIVE_URL"
112 TMP_SOURCE="$WORKDIR/source.tar.gz"
113 curl -fsSL "$SOURCE_ARCHIVE_URL" -o "$TMP_SOURCE"
114 SOURCE_SHA="$(sha256sum "$TMP_SOURCE" | awk '{print $1}')"
115 publish_package "posprint" "packaging/aur" "$SOURCE_SHA"
116
117 BIN_TARBALL="$ROOT/dist/${BIN_TARBALL_NAME}"
118 if [[ ! -f "$BIN_TARBALL" ]]; then
119 echo "Binary tarball not in dist/; downloading $BIN_ARTIFACT_URL"
120 mkdir -p "$ROOT/dist"
121 curl -fsSL "$BIN_ARTIFACT_URL" -o "$BIN_TARBALL"
122 fi
123 BIN_SHA="$(sha256sum "$BIN_TARBALL" | awk '{print $1}')"
124 publish_package "posprint-bin" "packaging/aur-bin" "$BIN_SHA"
@@ -2,11 +2,9 @@
2set -euo pipefail
2set -euo pipefail
3
3
4ROOT="$(cd "$(dirname "$0")/.." && pwd)"
4ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5PKGBASE="${AUR_PKGBASE:-posprint}"
6AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"
7VERSION="${1:-}"
5VERSION="${1:-}"
8TMPDIR="${TMPDIR:-/tmp}"
6TMPDIR="${TMPDIR:-/tmp}"
9WORKDIR="$(mktemp -d "$TMPDIR/${PKGBASE}-aur-XXXXXX")"
7WORKDIR="$(mktemp -d "$TMPDIR/posprint-aur-XXXXXX")"
10cleanup() { rm -rf "$WORKDIR"; }
8cleanup() { rm -rf "$WORKDIR"; }
11trap cleanup EXIT
9trap cleanup EXIT
12
10
@@ -26,29 +24,9 @@ if [[ "$(id -u)" -eq 0 ]]; then
26 command -v useradd >/dev/null || { echo "Missing command: useradd" >&2; exit 1; }
24 command -v useradd >/dev/null || { echo "Missing command: useradd" >&2; exit 1; }
27fi
25fi
28
26
29if [[ ! -f packaging/aur/PKGBUILD ]]; then
27SOURCE_ARCHIVE_URL="https://gitlab.com/Timfa/posprint/-/archive/${VERSION}/posprint-${VERSION}.tar.gz"
30 echo "Missing packaging/aur/PKGBUILD template" >&2
28BIN_TARBALL_NAME="posprint-${VERSION}-x86_64.tar.gz"
31 exit 1
29BIN_ARTIFACT_URL="https://gitlab.com/Timfa/posprint/-/jobs/artifacts/${VERSION}/raw/dist/${BIN_TARBALL_NAME}?job=build:linux-arch"
32fi
33
34ARCHIVE_URL="https://gitlab.com/Timfa/posprint/-/archive/${VERSION}/posprint-${VERSION}.tar.gz"
35
36echo "Checking source tarball: $ARCHIVE_URL"
37TMP_TARBALL="$WORKDIR/source.tar.gz"
38curl -fsSL "$ARCHIVE_URL" -o "$TMP_TARBALL"
39ARCHIVE_SHA="$(sha256sum "$TMP_TARBALL" | awk '{print $1}')"
40
41echo "Cloning AUR repo: $AUR_REMOTE"
42git clone "$AUR_REMOTE" "$WORKDIR/repo"
43cd "$WORKDIR/repo"
44
45git config user.name "${AUR_GIT_AUTHOR_NAME:-posprint release bot}"
46git config user.email "${AUR_GIT_AUTHOR_EMAIL:-noreply@example.invalid}"
47
48cp "$ROOT/packaging/aur/PKGBUILD" PKGBUILD
49sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
50sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD
51sed -i "s|^sha256sums=.*|sha256sums=('${ARCHIVE_SHA}')|" PKGBUILD
52
30
53generate_srcinfo() {
31generate_srcinfo() {
54 # makepkg refuses root. mktemp parents are 0700 — aurbuild must be able to traverse
32 # makepkg refuses root. mktemp parents are 0700 — aurbuild must be able to traverse
@@ -60,26 +38,87 @@ generate_srcinfo() {
60 useradd --system --create-home --shell /bin/bash "$makepkg_user"
38 useradd --system --create-home --shell /bin/bash "$makepkg_user"
61 fi
39 fi
62 chmod 755 "$WORKDIR"
40 chmod 755 "$WORKDIR"
63 chown -R "$makepkg_user:$makepkg_user" "$WORKDIR/repo"
41 chown -R "$makepkg_user:$makepkg_user" "$PWD"
64 build_tmp="$(runuser -u "$makepkg_user" -- mktemp -d)"
42 build_tmp="$(runuser -u "$makepkg_user" -- mktemp -d)"
65 # Belt-and-suspenders: force BUILDDIR into a dir aurbuild definitely owns.
43 # Belt-and-suspenders: force BUILDDIR into a dir aurbuild definitely owns.
66 runuser -u "$makepkg_user" -- env BUILDDIR="$build_tmp" makepkg --printsrcinfo > .SRCINFO
44 runuser -u "$makepkg_user" -- env BUILDDIR="$build_tmp" makepkg --printsrcinfo > .SRCINFO
67 rm -rf "$build_tmp"
45 rm -rf "$build_tmp"
68 chown -R root:root "$WORKDIR/repo"
46 chown -R root:root "$PWD"
69 else
47 else
70 makepkg --printsrcinfo > .SRCINFO
48 makepkg --printsrcinfo > .SRCINFO
71 fi
49 fi
72}
50}
73
51
74generate_srcinfo
52clone_or_init_aur_repo() {
53 local pkgbase="$1"
54 local dest="$2"
55 local remote="ssh://aur@aur.archlinux.org/${pkgbase}.git"
75
56
76if git diff --quiet -- PKGBUILD .SRCINFO; then
57 echo "Cloning AUR repo: $remote"
77 echo "AUR repo already up to date for ${VERSION}"
58 if git clone "$remote" "$dest"; then
78 exit 0
59 return 0
79fi
60 fi
61
62 echo "AUR repo ${pkgbase} does not exist yet; creating on first push"
63 mkdir -p "$dest"
64 git -C "$dest" init
65 git -C "$dest" checkout -b master
66 git -C "$dest" remote add origin "$remote"
67}
68
69publish_package() {
70 local pkgbase="$1"
71 local template_dir="$2"
72 local archive_sha="$3"
73 local dest="$WORKDIR/${pkgbase}"
74
75 if [[ ! -f "$ROOT/$template_dir/PKGBUILD" ]]; then
76 echo "Missing $template_dir/PKGBUILD template" >&2
77 exit 1
78 fi
80
79
81git add PKGBUILD .SRCINFO
80 clone_or_init_aur_repo "$pkgbase" "$dest"
82git commit -m "upstream release ${VERSION}"
81 cd "$dest"
83git push origin master
84
82
85echo "AUR updated: ${PKGBASE} ${VERSION}"
83 git config user.name "${AUR_GIT_AUTHOR_NAME:-posprint release bot}"
84 git config user.email "${AUR_GIT_AUTHOR_EMAIL:-noreply@example.invalid}"
85
86 cp "$ROOT/$template_dir/PKGBUILD" PKGBUILD
87 sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD
88 sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD
89 sed -i "s|^sha256sums=.*|sha256sums=('${archive_sha}')|" PKGBUILD
90
91 generate_srcinfo
92
93 if git diff --quiet -- PKGBUILD .SRCINFO 2>/dev/null && git rev-parse --verify HEAD >/dev/null 2>&1; then
94 echo "AUR repo already up to date: ${pkgbase} ${VERSION}"
95 cd "$ROOT"
96 return 0
97 fi
98
99 git add PKGBUILD .SRCINFO
100 if git rev-parse --verify HEAD >/dev/null 2>&1; then
101 git commit -m "upstream release ${VERSION}"
102 else
103 git commit -m "initial import ${VERSION}"
104 fi
105 git push -u origin master
106
107 echo "AUR updated: ${pkgbase} ${VERSION}"
108 cd "$ROOT"
109}
110
111echo "Checking source tarball: $SOURCE_ARCHIVE_URL"
112TMP_SOURCE="$WORKDIR/source.tar.gz"
113curl -fsSL "$SOURCE_ARCHIVE_URL" -o "$TMP_SOURCE"
114SOURCE_SHA="$(sha256sum "$TMP_SOURCE" | awk '{print $1}')"
115publish_package "posprint" "packaging/aur" "$SOURCE_SHA"
116
117BIN_TARBALL="$ROOT/dist/${BIN_TARBALL_NAME}"
118if [[ ! -f "$BIN_TARBALL" ]]; then
119 echo "Binary tarball not in dist/; downloading $BIN_ARTIFACT_URL"
120 mkdir -p "$ROOT/dist"
121 curl -fsSL "$BIN_ARTIFACT_URL" -o "$BIN_TARBALL"
122fi
123BIN_SHA="$(sha256sum "$BIN_TARBALL" | awk '{print $1}')"
124publish_package "posprint-bin" "packaging/aur-bin" "$BIN_SHA"