Merge branch 'feature/aur-bin'
@@ -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
98
build:windows:
101
build: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
132
publish:aur:
136
publish: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).
@@ -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 fails43
| 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
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
## Features51
## Features52
52
@@ -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 o174
## Build and release174
## Build and release175
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 migrations179
- **Versioning:** Semver in `Cargo.toml`; `.pos` `version` for file-format migrations179
180
180
See [PRINTING.md](PRINTING.md), [DSL-SPEC.md](DSL-SPEC.md), and [BUILD.md](BUILD.md).181
See [PRINTING.md](PRINTING.md), [DSL-SPEC.md](DSL-SPEC.md), and [BUILD.md](BUILD.md).@@ -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 approach5
## Chosen approach6
6
7
This repository keeps **two Arch package definitions**:7
This 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 tarball10
- `packaging/aur/PKGBUILD`: AUR **source** package (`posprint`), built by the AUR user from the GitLab tag tarball11
- `packaging/aur-bin/PKGBUILD`: AUR **binary** package (`posprint-bin`), installs a prebuilt `usr/` tree from GitLab CI11
12
12
The AUR package is **not** `-bin`. It downloads:13
The source package downloads:13
14
14
```text15
```text15
https://gitlab.com/Timfa/posprint/-/archive/<version>/posprint-<version>.tar.gz16
https://gitlab.com/Timfa/posprint/-/archive/<version>/posprint-<version>.tar.gz16
```17
```17
18
18
That keeps the AUR package simple, reproducible, and aligned with upstream tags.19
The binary package downloads:20
21
```text22
https://gitlab.com/Timfa/posprint/-/jobs/artifacts/<version>/raw/dist/posprint-<version>-x86_64.tar.gz?job=build:linux-arch23
```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
## Files in this repo27
## Files in this repo21
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 flow41
## Release flow32
42
33
When a Git tag is pushed:43
When a Git tag is pushed:34
44
35
1. GitLab builds the normal release artifacts.45
1. GitLab builds the normal release artifacts, including `posprint-<version>-x86_64.tar.gz`.36
2. GitLab creates the upstream release.46
2. GitLab creates the upstream release (with a link to that tarball).37
3. GitLab runs `scripts/publish-aur.sh "$CI_COMMIT_TAG"`.47
3. GitLab runs `scripts/publish-aur.sh "$CI_COMMIT_TAG"`.38
4. The script:48
4. The script:39
- downloads the tagged source tarball49
- downloads the tagged **source** tarball and hashes it40
- computes its SHA-25650
- uses the CI **binary** tarball from `dist/` (or downloads the job artifact) and hashes it41
- clones the AUR repo51
- clones each AUR repo (`posprint`, `posprint-bin`), or creates it on first push42
- 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 URL54
- strips a leading `v` from the tag when resolving GitLab URLs45
55
- commits and pushes to each AUR `master`46
- commits and pushes to AUR `master`47
56
48
## GitLab CI secrets57
## GitLab CI secrets49
58
@@ -81,7 +90,6 @@ Remove `AUR_SSH_PRIVATE_KEY` if it is also set (B64 is preferred by the setup sc81
| `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 repository107
The same SSH key publishes **both** `posprint` and `posprint-bin`.108
109
## How to create the AUR repositories100
110
101
If you have an AUR account but no package yet: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
```bash117
```bash108
chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh118
chmod +x scripts/bootstrap-aur-repo.sh scripts/aur-ssh-setup.sh109
./scripts/bootstrap-aur-repo.sh119
./scripts/bootstrap-aur-repo.sh120
./scripts/bootstrap-aur-repo.sh posprint-bin packaging/aur-bin110
```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
```bash129
```bash117
mkdir ~/posprint-aur && cd ~/posprint-aur130
mkdir ~/posprint-bin-aur && cd ~/posprint-bin-aur118
git init131
git init119
git remote add origin ssh://aur@aur.archlinux.org/posprint.git132
git remote add origin ssh://aur@aur.archlinux.org/posprint-bin.git120
git checkout -b master133
git checkout -b master121
cp /path/to/posprint/packaging/aur/PKGBUILD .134
cp /path/to/posprint/packaging/aur-bin/PKGBUILD .122
cp /path/to/posprint/packaging/aur/.SRCINFO .135
cp /path/to/posprint/packaging/aur-bin/.SRCINFO .123
git add PKGBUILD .SRCINFO136
git add PKGBUILD .SRCINFO124
git commit -m "initial import"137
git commit -m "initial import"125
git push origin master138
git push origin master@@ -129,11 +142,11 @@ After the first push, the AUR package page exists and later tag pipelines can up129
142
130
## Bootstrapping manually143
## Bootstrapping manually131
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
```bash147
```bash135
cd /path/to/posprint148
cd /path/to/posprint136
./scripts/publish-aur.sh 0.4.0149
./scripts/publish-aur.sh 0.5.6137
```150
```138
151
139
Requirements on that machine:152
Requirements 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).@@ -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
108
Automated AUR publishing uses:108
Automated 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 tags113
- `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
Setup and required GitLab secrets are documented in [AUR.md](AUR.md).117
Setup and required GitLab secrets are documented in [AUR.md](AUR.md).117
118
@@ -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 prin6
arch=('x86_64')6
arch=('x86_64')7
url="https://gitlab.com/Timfa/posprint"7
url="https://gitlab.com/Timfa/posprint"8
license=('MIT')8
license=('MIT')9
conflicts=('posprint-bin')9
depends=(10
depends=(10
'gcc-libs'11
'gcc-libs'11
'libxkbcommon'12
'libxkbcommon'@@ -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 @@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,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 contributors2
pkgname=posprint-bin3
pkgver=0.5.64
pkgrel=15
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
}@@ -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 = posprint5
url = https://gitlab.com/Timfa/posprint5
url = https://gitlab.com/Timfa/posprint6
arch = x86_646
arch = x86_647
license = MIT7
license = MIT8
conflicts = posprint-bin8
makedepends = rust9
makedepends = rust9
makedepends = cargo10
makedepends = cargo10
makedepends = pkgconf11
makedepends = pkgconf@@ -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 prin6
arch=('x86_64')6
arch=('x86_64')7
url="https://gitlab.com/Timfa/posprint"7
url="https://gitlab.com/Timfa/posprint"8
license=('MIT')8
license=('MIT')9
conflicts=('posprint-bin')9
depends=(10
depends=(10
'gcc-libs'11
'gcc-libs'11
'libxkbcommon'12
'libxkbcommon'@@ -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 bash1
#!/usr/bin/env bash2
# 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-bin4
set -euo pipefail8
set -euo pipefail5
9
6
ROOT="$(cd "$(dirname "$0")/.." && pwd)"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
AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"13
AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"9
WORKDIR="${TMPDIR:-/tmp}/${PKGBASE}-aur-bootstrap-$$"14
WORKDIR="${TMPDIR:-/tmp}/${PKGBASE}-aur-bootstrap-$$"10
cleanup() { rm -rf "$WORKDIR"; }15
cleanup() { rm -rf "$WORKDIR"; }@@ -14,6 +19,11 @@ for cmd in git ssh; do14
command -v "$cmd" >/dev/null || { echo "Missing: $cmd" >&2; exit 1; }19
command -v "$cmd" >/dev/null || { echo "Missing: $cmd" >&2; exit 1; }15
done20
done16
21
22
if [[ ! -f "$ROOT/$TEMPLATE_DIR/PKGBUILD" || ! -f "$ROOT/$TEMPLATE_DIR/.SRCINFO" ]]; then23
echo "Missing $TEMPLATE_DIR/PKGBUILD or .SRCINFO" >&224
exit 125
fi26
17
"$ROOT/scripts/aur-ssh-setup.sh"27
"$ROOT/scripts/aur-ssh-setup.sh"18
28
19
mkdir -p "$WORKDIR/repo"29
mkdir -p "$WORKDIR/repo"@@ -22,8 +32,8 @@ git init22
git remote add origin "$AUR_REMOTE"32
git remote add origin "$AUR_REMOTE"23
git checkout -b master33
git checkout -b master24
34
25
cp "$ROOT/packaging/aur/PKGBUILD" .35
cp "$ROOT/$TEMPLATE_DIR/PKGBUILD" .26
cp "$ROOT/packaging/aur/.SRCINFO" .36
cp "$ROOT/$TEMPLATE_DIR/.SRCINFO" .27
37
28
git add PKGBUILD .SRCINFO38
git add PKGBUILD .SRCINFO29
git commit -m "initial import"39
git commit -m "initial import"@@ -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 bash2
# Pack usr/ from an Arch .pkg.tar.zst into posprint-<ver>-x86_64.tar.gz for AUR posprint-bin.3
set -euo pipefail4
5
ROOT="$(cd "$(dirname "$0")/.." && pwd)"6
PKG_ZST="${1:-}"7
OUT="${2:-}"8
VERSION="${3:-}"9
10
if [[ -z "$PKG_ZST" ]]; then11
shopt -s nullglob12
candidates=("$ROOT"/packaging/arch/*.pkg.tar.zst "$ROOT"/dist/*.pkg.tar.zst)13
shopt -u nullglob14
if [[ ${#candidates[@]} -eq 0 ]]; then15
echo "Usage: $0 <posprint-*.pkg.tar.zst> [out.tar.gz] [version]" >&216
exit 117
fi18
PKG_ZST="${candidates[0]}"19
fi20
21
if [[ -z "$VERSION" ]]; then22
VERSION="$(grep '^version = ' "$ROOT/Cargo.toml" | sed -E 's/.*"([^"]+)"/\1/')"23
fi24
VERSION="${VERSION#v}"25
26
if [[ -z "$OUT" ]]; then27
mkdir -p "$ROOT/dist"28
OUT="$ROOT/dist/posprint-${VERSION}-x86_64.tar.gz"29
fi30
31
EXTRACT="$(mktemp -d)"32
cleanup() { rm -rf "$EXTRACT"; }33
trap cleanup EXIT34
35
if command -v bsdtar >/dev/null; then36
bsdtar -C "$EXTRACT" -xf "$PKG_ZST"37
else38
tar -C "$EXTRACT" -xf "$PKG_ZST"39
fi40
41
if [[ ! -d "$EXTRACT/usr" ]]; then42
echo "Arch package did not contain usr/: $PKG_ZST" >&243
exit 144
fi45
46
mkdir -p "$(dirname "$OUT")"47
tar -C "$EXTRACT" -czf "$OUT" usr48
echo "Wrote $OUT"@@ -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 @@2
set -euo pipefail2
set -euo pipefail3
3
4
ROOT="$(cd "$(dirname "$0")/.." && pwd)"4
ROOT="$(cd "$(dirname "$0")/.." && pwd)"5
PKGBASE="${AUR_PKGBASE:-posprint}"6
AUR_REMOTE="ssh://aur@aur.archlinux.org/${PKGBASE}.git"7
VERSION="${1:-}"5
VERSION="${1:-}"8
TMPDIR="${TMPDIR:-/tmp}"6
TMPDIR="${TMPDIR:-/tmp}"9
WORKDIR="$(mktemp -d "$TMPDIR/${PKGBASE}-aur-XXXXXX")"7
WORKDIR="$(mktemp -d "$TMPDIR/posprint-aur-XXXXXX")"10
cleanup() { rm -rf "$WORKDIR"; }8
cleanup() { rm -rf "$WORKDIR"; }11
trap cleanup EXIT9
trap cleanup EXIT12
10
@@ -26,29 +24,9 @@ if [[ "$(id -u)" -eq 0 ]]; then26
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; }27
fi25
fi28
26
29
if [[ ! -f packaging/aur/PKGBUILD ]]; then27
SOURCE_ARCHIVE_URL="https://gitlab.com/Timfa/posprint/-/archive/${VERSION}/posprint-${VERSION}.tar.gz"30
echo "Missing packaging/aur/PKGBUILD template" >&228
BIN_TARBALL_NAME="posprint-${VERSION}-x86_64.tar.gz"31
exit 129
BIN_ARTIFACT_URL="https://gitlab.com/Timfa/posprint/-/jobs/artifacts/${VERSION}/raw/dist/${BIN_TARBALL_NAME}?job=build:linux-arch"32
fi33
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" PKGBUILD49
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD50
sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD51
sed -i "s|^sha256sums=.*|sha256sums=('${ARCHIVE_SHA}')|" PKGBUILD52
30
53
generate_srcinfo() {31
generate_srcinfo() {54
# makepkg refuses root. mktemp parents are 0700 — aurbuild must be able to traverse32
# 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
fi39
fi62
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 > .SRCINFO44
runuser -u "$makepkg_user" -- env BUILDDIR="$build_tmp" makepkg --printsrcinfo > .SRCINFO67
rm -rf "$build_tmp"45
rm -rf "$build_tmp"68
chown -R root:root "$WORKDIR/repo"46
chown -R root:root "$PWD"69
else47
else70
makepkg --printsrcinfo > .SRCINFO48
makepkg --printsrcinfo > .SRCINFO71
fi49
fi72
}50
}73
51
74
generate_srcinfo52
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; then57
echo "Cloning AUR repo: $remote"77
echo "AUR repo already up to date for ${VERSION}"58
if git clone "$remote" "$dest"; then78
exit 059
return 079
fi60
fi61
62
echo "AUR repo ${pkgbase} does not exist yet; creating on first push"63
mkdir -p "$dest"64
git -C "$dest" init65
git -C "$dest" checkout -b master66
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" ]]; then76
echo "Missing $template_dir/PKGBUILD template" >&277
exit 178
fi80
79
81
git add PKGBUILD .SRCINFO80
clone_or_init_aur_repo "$pkgbase" "$dest"82
git commit -m "upstream release ${VERSION}"81
cd "$dest"83
git push origin master84
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" PKGBUILD87
sed -i "s/^pkgver=.*/pkgver=${VERSION}/" PKGBUILD88
sed -i "s/^pkgrel=.*/pkgrel=1/" PKGBUILD89
sed -i "s|^sha256sums=.*|sha256sums=('${archive_sha}')|" PKGBUILD90
91
generate_srcinfo92
93
if git diff --quiet -- PKGBUILD .SRCINFO 2>/dev/null && git rev-parse --verify HEAD >/dev/null 2>&1; then94
echo "AUR repo already up to date: ${pkgbase} ${VERSION}"95
cd "$ROOT"96
return 097
fi98
99
git add PKGBUILD .SRCINFO100
if git rev-parse --verify HEAD >/dev/null 2>&1; then101
git commit -m "upstream release ${VERSION}"102
else103
git commit -m "initial import ${VERSION}"104
fi105
git push -u origin master106
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" ]]; then119
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
fi123
BIN_SHA="$(sha256sum "$BIN_TARBALL" | awk '{print $1}')"124
publish_package "posprint-bin" "packaging/aur-bin" "$BIN_SHA"