native-packages 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +1 -1
- data/docs/_guides/apple-notarization.md +2 -0
- data/docs/_guides/distribution-recipes.md +2 -1
- data/docs/_guides/getting-started.md +4 -2
- data/docs/_guides/github-actions.md +4 -4
- data/docs/_guides/hosted-repositories.md +124 -5
- data/docs/_guides/native-recipes.md +3 -1
- data/docs/_guides/release-signing.md +3 -3
- data/docs/_guides/windows-signing.md +4 -2
- data/docs/_reference/commands.md +5 -3
- data/docs/_reference/configuration.md +4 -3
- data/docs/_reference/platforms.md +4 -4
- data/docs/_reference/troubleshooting.md +2 -2
- data/docs/index.md +3 -3
- data/examples/native-packages-all-formats.yaml +1 -1
- data/examples/native-packages-linux-distribution.yaml +1 -1
- data/examples/native-packages.yaml +1 -1
- data/lib/native_packages/apt_repository.rb +21 -28
- data/lib/native_packages/bucket.rb +265 -0
- data/lib/native_packages/build.rb +8 -4
- data/lib/native_packages/configuration.rb +5 -2
- data/lib/native_packages/dnf_repository.rb +22 -15
- data/lib/native_packages/flatpak_repository.rb +3 -1
- data/lib/native_packages/hosted_repository.rb +155 -7
- data/lib/native_packages/openpgp.rb +4 -2
- data/lib/native_packages/pacman_repository.rb +205 -0
- data/lib/native_packages/support.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52275a403bb6d197c51988bea1f799f1dca5b0776539340678a58bc739f5b661
|
|
4
|
+
data.tar.gz: d2d83aec2360b71f80cedc5899160c44d982eca3011bcc8d67ed76eb54b0ba5c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8c8aa4b6cb06916565e89e81ee365afec1ca3fa4a77d523b1d965ca89180be1d816852026780ec4588a925b6116c1f0405142ea2d34a7de58d7cc4436bc5dc12
|
|
7
|
+
data.tar.gz: f4f967fae18689296a59d950443845f6f456f3ab0889fce5d7bcbb8882715a340ab2f6e4cb08dcfc0672a1c05b7df46fc903db0bfe540403633c7bd8753f0ed1
|
data/CONTRIBUTING.md
CHANGED
|
@@ -18,7 +18,7 @@ To check the packaged gem and standalone command:
|
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
20
|
gem build native-packages.gemspec
|
|
21
|
-
ruby test/gem_install.rb native-packages-0.
|
|
21
|
+
ruby test/gem_install.rb native-packages-0.14.0.gem
|
|
22
22
|
```
|
|
23
23
|
|
|
24
24
|
See [Releasing the gem](docs/releasing.md) for publication and
|
|
@@ -191,4 +191,5 @@ Once the process is tested, enable destination publication in
|
|
|
191
191
|
For package files themselves, use [Publishing a release](publishing.md).
|
|
192
192
|
To ship your AUR binary recipe in Omarchy's repository as well, see
|
|
193
193
|
[Omarchy packages](omarchy.md).
|
|
194
|
-
|
|
194
|
+
To serve signed APT, DNF or pacman repositories of your own, see
|
|
195
|
+
[Hosted package repositories](hosted-repositories.md).
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Getting started
|
|
3
|
+
seo:
|
|
4
|
+
title: "Getting started: build a DEB and RPM package"
|
|
3
5
|
description: Install native-packages and build a DEB and RPM from a compiled Linux application.
|
|
4
6
|
nav_order: 1
|
|
5
7
|
---
|
|
@@ -17,7 +19,7 @@ own compiled executable, or build the tiny example below.
|
|
|
17
19
|
You need Ruby 3.2 or later. Install the version used by these guides:
|
|
18
20
|
|
|
19
21
|
```sh
|
|
20
|
-
gem install native-packages --version 0.
|
|
22
|
+
gem install native-packages --version 0.14.0
|
|
21
23
|
```
|
|
22
24
|
|
|
23
25
|
For Linux packages, install **nFPM 2.47.0**, the helper native-packages uses to
|
|
@@ -79,7 +81,7 @@ Open the generated `native-packages.yaml` and replace its contents with:
|
|
|
79
81
|
```yaml
|
|
80
82
|
schema: 1
|
|
81
83
|
tool:
|
|
82
|
-
version: '0.
|
|
84
|
+
version: '0.14.0'
|
|
83
85
|
nfpm: '2.47.0'
|
|
84
86
|
|
|
85
87
|
nfpm:
|
|
@@ -24,7 +24,7 @@ packaging:
|
|
|
24
24
|
needs: release
|
|
25
25
|
permissions:
|
|
26
26
|
contents: write
|
|
27
|
-
uses: crmne/native-packages/.github/workflows/package.yml@v0.
|
|
27
|
+
uses: crmne/native-packages/.github/workflows/package.yml@v0.14.0
|
|
28
28
|
with:
|
|
29
29
|
version: ${{ github.ref_name }}
|
|
30
30
|
publish: true
|
|
@@ -39,7 +39,7 @@ The configuration must include `release.repository` and a `release_asset`
|
|
|
39
39
|
for each selected target. See [Publishing a release](publishing.md).
|
|
40
40
|
|
|
41
41
|
Use the same native-packages release for the workflow and `tool.version`.
|
|
42
|
-
For an immutable workflow reference, replace `v0.
|
|
42
|
+
For an immutable workflow reference, replace `v0.14.0` with that release's
|
|
43
43
|
full commit SHA.
|
|
44
44
|
|
|
45
45
|
## Build without publishing
|
|
@@ -57,7 +57,7 @@ permissions:
|
|
|
57
57
|
contents: read
|
|
58
58
|
jobs:
|
|
59
59
|
packaging:
|
|
60
|
-
uses: crmne/native-packages/.github/workflows/package.yml@v0.
|
|
60
|
+
uses: crmne/native-packages/.github/workflows/package.yml@v0.14.0
|
|
61
61
|
```
|
|
62
62
|
|
|
63
63
|
Validation does not compile the app or check that future release inputs exist.
|
|
@@ -72,7 +72,7 @@ packaging:
|
|
|
72
72
|
needs: build
|
|
73
73
|
permissions:
|
|
74
74
|
contents: write
|
|
75
|
-
uses: crmne/native-packages/.github/workflows/package.yml@v0.
|
|
75
|
+
uses: crmne/native-packages/.github/workflows/package.yml@v0.14.0
|
|
76
76
|
with:
|
|
77
77
|
version: '1.2.3'
|
|
78
78
|
source-artifact: linux-binaries
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Hosted package repositories
|
|
3
|
-
description: Publish signed APT, DNF and Flatpak repositories that users add once and update with their package manager.
|
|
3
|
+
description: Publish signed APT, DNF, pacman and Flatpak repositories that users add once and update with their package manager.
|
|
4
4
|
nav_order: 13
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -50,6 +50,10 @@ dnf:
|
|
|
50
50
|
directory: ../hello-site/rpm
|
|
51
51
|
url: https://example.org/rpm
|
|
52
52
|
signing_key: 0123456789ABCDEF0123456789ABCDEF01234567
|
|
53
|
+
pacman:
|
|
54
|
+
directory: ../hello-site/arch
|
|
55
|
+
url: https://example.org/arch
|
|
56
|
+
signing_key: 0123456789ABCDEF0123456789ABCDEF01234567
|
|
53
57
|
flatpak:
|
|
54
58
|
# The app's id, runtime, command and permissions, as for any Flatpak.
|
|
55
59
|
repository:
|
|
@@ -61,11 +65,13 @@ flatpak:
|
|
|
61
65
|
|
|
62
66
|
| Field | Purpose |
|
|
63
67
|
| --- | --- |
|
|
64
|
-
| `directory` | Required. Where the repository is written, relative to the configuration file. |
|
|
68
|
+
| `directory` | Required, unless `bucket` is set. Where the repository is written, relative to the configuration file. With `bucket`, a working copy of the bucket, kept between publications to save downloads; a temporary directory if omitted. |
|
|
65
69
|
| `url` | Required. The `https://` URL at which that directory is served. |
|
|
66
70
|
| `signing_key` | Required. The signing key's full fingerprint. |
|
|
67
|
-
| `keep` | APT and
|
|
71
|
+
| `keep` | APT, DNF and pacman only. How many versions of each package and architecture to keep. Defaults to `3`. |
|
|
68
72
|
| `suite`, `component` | APT only. Default to `stable` and `main`. |
|
|
73
|
+
| `name` | APT, DNF and pacman only. The repository's name: it names the key and source files users download, APT's `Origin` and `Label`, and the section in `.repo` files and `pacman.conf`. Defaults to the package name; set it when several apps share the repository. |
|
|
74
|
+
| `bucket` | APT, DNF and pacman only. Publish into an S3-compatible bucket; see [Publish to a bucket](#publish-to-a-bucket). |
|
|
69
75
|
| `title`, `homepage` | Flatpak only. The repository's name in software centers (defaults to the package name) and an `https://` homepage. |
|
|
70
76
|
|
|
71
77
|
## 3. Publish
|
|
@@ -74,7 +80,7 @@ Build as usual, then publish the build to the repositories:
|
|
|
74
80
|
|
|
75
81
|
```sh
|
|
76
82
|
native-packages build --version 1.2.3
|
|
77
|
-
native-packages publish --from dist/packages/1.2.3 --to github,apt,dnf,flatpak
|
|
83
|
+
native-packages publish --from dist/packages/1.2.3 --to github,apt,dnf,pacman,flatpak
|
|
78
84
|
```
|
|
79
85
|
|
|
80
86
|
Each publication adds the build's packages to what the directory already
|
|
@@ -82,6 +88,95 @@ holds, removes versions beyond `keep`, and rewrites and signs the indexes. A
|
|
|
82
88
|
file that is already published can only be published again unchanged. Then
|
|
83
89
|
commit and push the directory.
|
|
84
90
|
|
|
91
|
+
### One repository for several apps
|
|
92
|
+
|
|
93
|
+
Several apps can publish into the same directories. The APT, DNF and pacman
|
|
94
|
+
indexes are rebuilt from every package in the directory, whichever app
|
|
95
|
+
published it, and `keep` counts versions of each package separately, so
|
|
96
|
+
publishing one app leaves the others' packages listed. For this to hold, the
|
|
97
|
+
directory must contain everything already published before you publish into
|
|
98
|
+
it, and one release must publish at a time. A [bucket](#publish-to-a-bucket)
|
|
99
|
+
takes care of both. Use the same signing key for every app, and give each
|
|
100
|
+
repository the same `name` in every app's configuration, such as the name of
|
|
101
|
+
your site, rather than an app's: users then add one `example.sources`,
|
|
102
|
+
`example.repo` or `[example]` section and get every app from it.
|
|
103
|
+
|
|
104
|
+
### Publish to a bucket
|
|
105
|
+
|
|
106
|
+
Each repository can live in an S3-compatible bucket, such as Cloudflare R2
|
|
107
|
+
or Amazon S3, served from the bucket's public URL or a domain in front of it.
|
|
108
|
+
Every app's release then publishes straight into it:
|
|
109
|
+
|
|
110
|
+
```yaml
|
|
111
|
+
apt:
|
|
112
|
+
url: https://packages.example.org/apt
|
|
113
|
+
name: example
|
|
114
|
+
signing_key: 0123456789ABCDEF0123456789ABCDEF01234567
|
|
115
|
+
bucket:
|
|
116
|
+
endpoint: https://ACCOUNT_ID.r2.cloudflarestorage.com
|
|
117
|
+
name: packages
|
|
118
|
+
prefix: apt
|
|
119
|
+
pacman:
|
|
120
|
+
url: https://packages.example.org/arch
|
|
121
|
+
name: example
|
|
122
|
+
signing_key: 0123456789ABCDEF0123456789ABCDEF01234567
|
|
123
|
+
bucket:
|
|
124
|
+
endpoint: https://ACCOUNT_ID.r2.cloudflarestorage.com
|
|
125
|
+
name: packages
|
|
126
|
+
prefix: arch
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
| Field | Purpose |
|
|
130
|
+
| --- | --- |
|
|
131
|
+
| `endpoint` | Required. The bucket service's `https://` URL, without a path. |
|
|
132
|
+
| `name` | Required. The bucket's name. |
|
|
133
|
+
| `prefix` | Required. The folder in the bucket that holds this repository and nothing else, such as `apt`. Repositories cannot share or nest folders. |
|
|
134
|
+
| `region` | The bucket's region. Defaults to `auto`, which R2 expects; S3 needs the real one. |
|
|
135
|
+
| `lock_timeout` | How many seconds to wait for another publication to finish. Defaults to `900`. |
|
|
136
|
+
|
|
137
|
+
The credentials come from `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`
|
|
138
|
+
(and `AWS_SESSION_TOKEN` if you use one), which native-packages removes from
|
|
139
|
+
its environment before running any other program. On R2, make an API token
|
|
140
|
+
with Object Read & Write permission for this bucket alone. Then
|
|
141
|
+
`publish --to apt,pacman`:
|
|
142
|
+
|
|
143
|
+
1. Takes the lock: it creates `PREFIX/.lock`, recording who publishes and
|
|
144
|
+
since when, only if no such object exists. If another publication holds
|
|
145
|
+
it, it waits, up to `lock_timeout`. A lock older than 30 minutes belongs
|
|
146
|
+
to a publication that died; it is broken with a warning.
|
|
147
|
+
2. Copies the repository from the bucket into `directory`, downloading only
|
|
148
|
+
the files it lacks or holds in another version. Rebuilding the indexes
|
|
149
|
+
reads every package, so the working copy holds them all; keep
|
|
150
|
+
`directory` between runs (in a CI cache, for example) to download only
|
|
151
|
+
what changed. R2 does not charge for these downloads.
|
|
152
|
+
3. Publishes there, as without a bucket.
|
|
153
|
+
4. Uploads what changed: first the packages and their signatures, with
|
|
154
|
+
`Cache-Control: public, max-age=31536000, immutable`, then the indexes,
|
|
155
|
+
with `public, max-age=60`, and last the files that point at them
|
|
156
|
+
(`InRelease`, `repomd.xml`, the pacman databases). Each file gets its
|
|
157
|
+
content type.
|
|
158
|
+
5. Deletes what pruning removed, once the indexes no longer list it, and
|
|
159
|
+
releases the lock, also when publishing fails.
|
|
160
|
+
|
|
161
|
+
A package already in the bucket can only be published again unchanged.
|
|
162
|
+
`PREFIX/.published` records every package file ever uploaded with its
|
|
163
|
+
SHA-256, so one deleted from the bucket and published again with other
|
|
164
|
+
contents is refused too: caches may hold the old one for a year. Give a
|
|
165
|
+
rebuilt package a new version or release number instead.
|
|
166
|
+
|
|
167
|
+
A release workflow passes the secrets to the publish step:
|
|
168
|
+
|
|
169
|
+
```yaml
|
|
170
|
+
- run: native-packages publish --from dist/native-packages --to github,apt,dnf,pacman
|
|
171
|
+
env:
|
|
172
|
+
GH_TOKEN: ${{ github.token }}
|
|
173
|
+
NATIVE_PACKAGES_GPG_KEY: ${{ secrets.NATIVE_PACKAGES_GPG_KEY }}
|
|
174
|
+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
175
|
+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Publishing DNF repositories still needs `createrepo_c` on the runner.
|
|
179
|
+
|
|
85
180
|
## APT
|
|
86
181
|
|
|
87
182
|
`publish --to apt` copies each `.deb` into `pool/main/h/hello/` and writes
|
|
@@ -121,6 +216,30 @@ for Zypper (`zypper addrepo https://example.org/rpm/hello.repo`). Install
|
|
|
121
216
|
`createrepo_c` (in the `createrepo-c` package on Debian and Ubuntu) on the
|
|
122
217
|
machine that publishes.
|
|
123
218
|
|
|
219
|
+
## pacman
|
|
220
|
+
|
|
221
|
+
`publish --to pacman` copies each Arch package into a directory per
|
|
222
|
+
architecture, such as `x86_64/` and `aarch64/` (a package built for `any`
|
|
223
|
+
goes into each), and signs it beside itself as `.sig`. It then writes the
|
|
224
|
+
databases pacman reads, `hello.db` and `hello.files`, the way `repo-add`
|
|
225
|
+
does, without pacman's own tools, and signs them. Static hosts serve no
|
|
226
|
+
symbolic links, so `hello.db.tar.gz` and `hello.files.tar.gz` are copies of
|
|
227
|
+
the same files rather than links. Beside the architectures goes the public key
|
|
228
|
+
as `hello.asc`. Users install with:
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
curl -fsSL https://example.org/arch/hello.asc | sudo pacman-key --add -
|
|
232
|
+
sudo pacman-key --lsign-key 0123456789ABCDEF0123456789ABCDEF01234567
|
|
233
|
+
printf '\n[hello]\nSigLevel = Required\nServer = https://example.org/arch/$arch\n' | sudo tee -a /etc/pacman.conf
|
|
234
|
+
sudo pacman -Syu hello
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
`SigLevel = Required` makes pacman check the signatures of both the
|
|
238
|
+
databases and the packages. Signatures are binary, as pacman requires, and
|
|
239
|
+
are served beside the packages rather than embedded in the database, as
|
|
240
|
+
`repo-add` does by default. Publishing needs `bsdtar` (libarchive), which
|
|
241
|
+
builds of Arch packages already use.
|
|
242
|
+
|
|
124
243
|
## Flatpak
|
|
125
244
|
|
|
126
245
|
`publish --to flatpak` imports each Flatpak bundle into an OSTree
|
|
@@ -155,7 +274,7 @@ release job can check out the site beside the app:
|
|
|
155
274
|
repository: example/hello-site
|
|
156
275
|
path: hello-site
|
|
157
276
|
token: ${{ secrets.SITE_TOKEN }}
|
|
158
|
-
- run: native-packages publish --from dist/native-packages --to apt,dnf,flatpak
|
|
277
|
+
- run: native-packages publish --from dist/native-packages --to apt,dnf,pacman,flatpak
|
|
159
278
|
env:
|
|
160
279
|
NATIVE_PACKAGES_GPG_KEY: ${{ secrets.PACKAGES_GPG_KEY }}
|
|
161
280
|
- run: |
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: macOS and Windows installers
|
|
3
|
+
seo:
|
|
4
|
+
title: DMG, MSI and Inno Setup installers
|
|
3
5
|
description: Connect your DMG, MSI or Inno Setup script to the same build and publication process as your Linux packages.
|
|
4
6
|
nav_order: 5
|
|
5
7
|
---
|
|
@@ -31,7 +33,7 @@ Here is a complete configuration for an ARM64 Mac app and an x86-64 Windows app:
|
|
|
31
33
|
```yaml
|
|
32
34
|
schema: 1
|
|
33
35
|
tool:
|
|
34
|
-
version: '0.
|
|
36
|
+
version: '0.14.0'
|
|
35
37
|
nfpm: '2.47.0'
|
|
36
38
|
nfpm:
|
|
37
39
|
name: hello
|
|
@@ -67,7 +67,7 @@ Package publication's separate `packaging-checksums.txt` is also unchanged.
|
|
|
67
67
|
|
|
68
68
|
## Attest in the application's build job
|
|
69
69
|
|
|
70
|
-
The examples use `v0.
|
|
70
|
+
The examples use `v0.14.0` for readability. For release workflows, replace it
|
|
71
71
|
with that release's reviewed full commit SHA, not a mutable branch.
|
|
72
72
|
After producing the final package, before uploading it, add this step to the
|
|
73
73
|
job that built it:
|
|
@@ -79,7 +79,7 @@ permissions:
|
|
|
79
79
|
attestations: write
|
|
80
80
|
steps:
|
|
81
81
|
# Existing checkout, build, platform signing and packaging steps go here.
|
|
82
|
-
- uses: crmne/native-packages/.github/actions/attest@v0.
|
|
82
|
+
- uses: crmne/native-packages/.github/actions/attest@v0.14.0
|
|
83
83
|
with:
|
|
84
84
|
subject-path: dist/*.tar.gz
|
|
85
85
|
```
|
|
@@ -108,7 +108,7 @@ and install Ruby 3.2 or later with Ed25519-capable OpenSSL before the signing
|
|
|
108
108
|
step. Then call:
|
|
109
109
|
|
|
110
110
|
```yaml
|
|
111
|
-
- uses: crmne/native-packages/.github/actions/sign-release@v0.
|
|
111
|
+
- uses: crmne/native-packages/.github/actions/sign-release@v0.14.0
|
|
112
112
|
with:
|
|
113
113
|
directory: dist/release
|
|
114
114
|
public-key: assets/update-public-key.hex
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Windows code signing
|
|
3
|
-
|
|
3
|
+
seo:
|
|
4
|
+
title: "Windows code signing: Azure Artifact Signing"
|
|
5
|
+
description: Sign Windows executables and installers with Azure Artifact Signing (formerly Trusted Signing) from GitHub Actions through OIDC, with no stored secret.
|
|
4
6
|
nav_order: 7
|
|
5
7
|
---
|
|
6
8
|
|
|
@@ -150,7 +152,7 @@ jobs:
|
|
|
150
152
|
- uses: ruby/setup-ruby@v1
|
|
151
153
|
with:
|
|
152
154
|
ruby-version: '4.0'
|
|
153
|
-
- run: gem install native-packages --version 0.
|
|
155
|
+
- run: gem install native-packages --version 0.14.0 --no-document
|
|
154
156
|
- run: cargo build --locked --release --target x86_64-pc-windows-msvc
|
|
155
157
|
- name: Sign in to Azure for code signing
|
|
156
158
|
if: vars.AZURE_SIGNING_PROFILE != ''
|
data/docs/_reference/commands.md
CHANGED
|
@@ -98,8 +98,10 @@ native-packages publish --from dist/linux --to github --target linux-amd64
|
|
|
98
98
|
|
|
99
99
|
`--from` selects the build directory; `--to` lists destinations separated by
|
|
100
100
|
commas. `github` uploads release assets, `snapcraft` uploads snaps to the
|
|
101
|
-
Snap Store, and `apt`, `dnf` and `flatpak` write the signed repositories configured under
|
|
102
|
-
`apt`, `dnf` and `flatpak.repository`.
|
|
101
|
+
Snap Store, and `apt`, `dnf`, `pacman` and `flatpak` write the signed repositories configured under
|
|
102
|
+
`apt`, `dnf`, `pacman` and `flatpak.repository`. An APT, DNF or pacman
|
|
103
|
+
repository with a `bucket` is published into it under the bucket's lock;
|
|
104
|
+
see [Publish to a bucket](../_guides/hosted-repositories.md#publish-to-a-bucket). Other names select entries or groups in `repositories`.
|
|
103
105
|
|
|
104
106
|
The build must be complete and its recorded files unmodified. Repeated
|
|
105
107
|
`--target` options require exactly those targets, with all their formats.
|
|
@@ -222,7 +224,7 @@ If several gem versions are installed, RubyGems lets you select the one required
|
|
|
222
224
|
by the configuration:
|
|
223
225
|
|
|
224
226
|
```sh
|
|
225
|
-
native-packages _0.
|
|
227
|
+
native-packages _0.14.0_ build --version 1.2.3
|
|
226
228
|
```
|
|
227
229
|
|
|
228
230
|
Bundler also works if you prefer to manage the gem in a Gemfile.
|
|
@@ -28,7 +28,7 @@ expressions. Use the replacement values listed below.
|
|
|
28
28
|
| Field | Purpose |
|
|
29
29
|
| --- | --- |
|
|
30
30
|
| `schema` | Required. Set to `1`. |
|
|
31
|
-
| `tool.version` | Required. Exact native-packages version, such as `'0.
|
|
31
|
+
| `tool.version` | Required. Exact native-packages version, such as `'0.14.0'`. |
|
|
32
32
|
| `tool.nfpm` | Required. Set to `'2.47.0'`, including in native-only configurations. |
|
|
33
33
|
| `nfpm` | Shared package metadata and installed-file mappings, or a relative YAML filename. Requires `name`. |
|
|
34
34
|
| `targets` | Required. Named build targets; use `{}` for recipe-only projects. |
|
|
@@ -43,8 +43,9 @@ expressions. Use the replacement values listed below.
|
|
|
43
43
|
| `windows` | Optional. `windows.signing` turns on [Windows code signing](#windows-signing). |
|
|
44
44
|
| `flatpak` | Required by `flatpak` targets: the app ID, runtime, command and permissions. See [Flatpak](platforms.md#flatpak). |
|
|
45
45
|
| `snap` | Required by `snap` targets: the base, confinement and apps, and the Snap Store channels. See [Snap](platforms.md#snap). |
|
|
46
|
-
| `apt` | Optional signed APT repository for `publish --to apt
|
|
47
|
-
| `dnf` | Optional signed DNF repository for `publish --to dnf
|
|
46
|
+
| `apt` | Optional signed APT repository for `publish --to apt`, in a directory or an S3-compatible bucket. See [Hosted package repositories](../_guides/hosted-repositories.md). |
|
|
47
|
+
| `dnf` | Optional signed DNF repository for `publish --to dnf`, in a directory or a bucket. See [Hosted package repositories](../_guides/hosted-repositories.md). |
|
|
48
|
+
| `pacman` | Optional signed pacman repository for `publish --to pacman`, in a directory or a bucket. See [Hosted package repositories](../_guides/hosted-repositories.md). |
|
|
48
49
|
|
|
49
50
|
Quote tool versions so they remain strings. A version mismatch reports the
|
|
50
51
|
command needed to install and select the configured gem.
|
|
@@ -16,7 +16,7 @@ libraries.
|
|
|
16
16
|
| --- | --- | --- | --- |
|
|
17
17
|
| `deb` | Linux | Compatible Linux files and package metadata. | nFPM, `readelf` for binaries; `gpg` for a hosted APT repository. |
|
|
18
18
|
| `rpm` | Linux | Compatible Linux files and RPM-specific dependencies. | nFPM, `readelf` for binaries; `createrepo_c` and `gpg` for a hosted DNF repository. |
|
|
19
|
-
| `archlinux` | Linux | Arch-compatible files and explicit dependencies. | nFPM, `readelf` for binaries. |
|
|
19
|
+
| `archlinux` | Linux | Arch-compatible files and explicit dependencies. | nFPM, `readelf` for binaries; `bsdtar` and `gpg` for a hosted pacman repository. |
|
|
20
20
|
| `apk` | Linux | Suitable Alpine files, usually musl or static binaries, and dependencies. | nFPM, `readelf` for binaries. |
|
|
21
21
|
| `ipk` | Linux | Files for the device/distribution baseline, dependencies, and an `abi` label. | nFPM, `readelf` for binaries. |
|
|
22
22
|
| `appimage` | Linux | The same files as the DEB/RPM, including one desktop entry and its icon. | `mksquashfs` (squashfs-tools), `curl`, `readelf`; `zsyncmake` (zsync) with update information. |
|
|
@@ -279,9 +279,9 @@ An Arch package file and an AUR recipe are separate outputs: the former can
|
|
|
279
279
|
be installed directly; the latter tells Arch tooling how to obtain and package
|
|
280
280
|
your app.
|
|
281
281
|
|
|
282
|
-
native-packages can also write signed APT, DNF and Flatpak
|
|
283
|
-
your DEB, RPM and Flatpak packages, served as static
|
|
284
|
-
[Hosted package repositories](../_guides/hosted-repositories.md). There is no
|
|
282
|
+
native-packages can also write signed APT, DNF, pacman and Flatpak
|
|
283
|
+
repositories from your DEB, RPM, Arch and Flatpak packages, served as static
|
|
284
|
+
files; see [Hosted package repositories](../_guides/hosted-repositories.md). There is no
|
|
285
285
|
NSIS adapter. Keep that workflow in your app's release process if you need it.
|
|
286
286
|
|
|
287
287
|
## What validation establishes
|
|
@@ -23,8 +23,8 @@ working on with `doctor --target ID` and `build --target ID --dry-run`.
|
|
|
23
23
|
Install and select the version named in the error:
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
gem install native-packages --version 0.
|
|
27
|
-
native-packages _0.
|
|
26
|
+
gem install native-packages --version 0.14.0
|
|
27
|
+
native-packages _0.14.0_ doctor
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
`tool.version` is an exact match. In CI, use the matching released reusable
|
data/docs/index.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
layout: home
|
|
3
3
|
title: native-packages
|
|
4
|
+
seo:
|
|
5
|
+
title: DEB, RPM, AppImage, DMG and MSI from one config
|
|
4
6
|
description: Turn your built application into Linux packages, macOS disk images, and Windows installers. Publish releases from one configuration.
|
|
5
7
|
permalink: /
|
|
6
8
|
hero:
|
|
@@ -11,9 +13,7 @@ hero:
|
|
|
11
13
|
- theme: brand
|
|
12
14
|
text: Get started
|
|
13
15
|
link: /getting-started/
|
|
14
|
-
-
|
|
15
|
-
text: GitHub
|
|
16
|
-
link: https://github.com/crmne/native-packages
|
|
16
|
+
- star: true
|
|
17
17
|
image:
|
|
18
18
|
src: /assets/images/logo.svg
|
|
19
19
|
alt: native-packages logo
|
|
@@ -12,7 +12,8 @@ module NativePackages
|
|
|
12
12
|
# by this class without Debian's own tools. Beside them go the public key
|
|
13
13
|
# (NAME.gpg) and a deb822 NAME.sources file for users to install.
|
|
14
14
|
class AptRepository < HostedRepository
|
|
15
|
-
|
|
15
|
+
SECTION = "apt"
|
|
16
|
+
KEYS = (HostedRepository::KEYS + %w[name bucket suite component]).freeze
|
|
16
17
|
WORD = /\A[a-z0-9][a-z0-9._-]*\z/
|
|
17
18
|
# The order apt-ftparchive writes; other fields follow in their own order.
|
|
18
19
|
FIELDS = %w[Package Version Architecture].freeze
|
|
@@ -26,10 +27,6 @@ module NativePackages
|
|
|
26
27
|
end
|
|
27
28
|
end
|
|
28
29
|
|
|
29
|
-
def initialize(configuration)
|
|
30
|
-
super(configuration, configuration.data.fetch("apt") { raise Error, "configure apt to publish --to apt" })
|
|
31
|
-
end
|
|
32
|
-
|
|
33
30
|
def suite = settings.fetch("suite", "stable")
|
|
34
31
|
def component = settings.fetch("component", "main")
|
|
35
32
|
|
|
@@ -104,10 +101,11 @@ module NativePackages
|
|
|
104
101
|
|
|
105
102
|
def publish(debs, secret: nil, passphrase: nil)
|
|
106
103
|
raise Error, "the build contains no deb packages to publish --to apt" if debs.empty?
|
|
107
|
-
debs.
|
|
104
|
+
names = debs.map do |path|
|
|
108
105
|
package = self.class.fields(self.class.control(path)).fetch("Package")
|
|
109
106
|
prefix = package.start_with?("lib") ? package[0, 4] : package[0]
|
|
110
107
|
place(path, directory / "pool" / component / prefix / package / path.basename)
|
|
108
|
+
package
|
|
111
109
|
end
|
|
112
110
|
entries = Pathname.glob(directory / "pool/**/*.deb").sort.to_h do |path|
|
|
113
111
|
control = self.class.control(path)
|
|
@@ -116,14 +114,19 @@ module NativePackages
|
|
|
116
114
|
end
|
|
117
115
|
entries = prune(entries) { |left, right| self.class.compare(left, right) }
|
|
118
116
|
signer(secret: secret, passphrase: passphrase).session { |signing| write_indexes(entries, signing) }
|
|
119
|
-
puts "Published #{entries.length} package#{"s" unless entries.length == 1} to #{directory}. Install with:", *instructions.map { |line| " #{line}" }
|
|
117
|
+
puts "Published #{entries.length} package#{"s" unless entries.length == 1} to #{directory}. Install with:", *instructions(names.uniq).map { |line| " #{line}" }
|
|
120
118
|
end
|
|
121
119
|
|
|
122
|
-
|
|
120
|
+
# Package files keep their contents once published; indexes change.
|
|
121
|
+
def immutable = Pathname.glob(directory / "pool/**/*.deb").sort
|
|
122
|
+
|
|
123
|
+
def entry_points = %w[Release Release.gpg InRelease].map { |file| directory / "dists" / suite / file }
|
|
124
|
+
|
|
125
|
+
def instructions(packages = [name])
|
|
123
126
|
["sudo install -d -m 0755 /etc/apt/keyrings",
|
|
124
|
-
"sudo curl -fsSLo /etc/apt/keyrings/#{
|
|
125
|
-
"sudo curl -fsSLo /etc/apt/sources.list.d/#{
|
|
126
|
-
"sudo apt update && sudo apt install #{
|
|
127
|
+
"sudo curl -fsSLo /etc/apt/keyrings/#{repository}.gpg #{url}/#{repository}.gpg",
|
|
128
|
+
"sudo curl -fsSLo /etc/apt/sources.list.d/#{repository}.sources #{url}/#{repository}.sources",
|
|
129
|
+
"sudo apt update && sudo apt install #{packages.join(' ')}"]
|
|
127
130
|
end
|
|
128
131
|
|
|
129
132
|
private
|
|
@@ -143,16 +146,16 @@ module NativePackages
|
|
|
143
146
|
write(dists / "#{relative}.gz", gzip(text))
|
|
144
147
|
[relative, "#{relative}.gz"]
|
|
145
148
|
end
|
|
146
|
-
write(dists / "Release",
|
|
149
|
+
write(dists / "Release", release_text(dists, architectures, indexes))
|
|
147
150
|
signing.clearsign(dists / "Release", dists / "InRelease")
|
|
148
151
|
signing.detach_sign(dists / "Release", dists / "Release.gpg")
|
|
149
|
-
write(directory / "#{
|
|
150
|
-
write(directory / "#{
|
|
152
|
+
write(directory / "#{repository}.gpg", signing.public_key)
|
|
153
|
+
write(directory / "#{repository}.sources", <<~SOURCES)
|
|
151
154
|
Types: deb
|
|
152
155
|
URIs: #{url}
|
|
153
156
|
Suites: #{suite}
|
|
154
157
|
Components: #{component}
|
|
155
|
-
Signed-By: /etc/apt/keyrings/#{
|
|
158
|
+
Signed-By: /etc/apt/keyrings/#{repository}.gpg
|
|
156
159
|
SOURCES
|
|
157
160
|
end
|
|
158
161
|
|
|
@@ -165,26 +168,16 @@ module NativePackages
|
|
|
165
168
|
"MD5sum: #{Digest::MD5.hexdigest(bytes)}\nSHA1: #{Digest::SHA1.hexdigest(bytes)}\nSHA256: #{Digest::SHA256.hexdigest(bytes)}\n"
|
|
166
169
|
end
|
|
167
170
|
|
|
168
|
-
def
|
|
171
|
+
def release_text(dists, architectures, indexes)
|
|
169
172
|
epoch = ENV["SOURCE_DATE_EPOCH"] ? Integer(ENV.fetch("SOURCE_DATE_EPOCH")) : Time.now.to_i
|
|
170
|
-
lines = ["Origin: #{
|
|
173
|
+
lines = ["Origin: #{repository}", "Label: #{repository}", "Suite: #{suite}", "Codename: #{suite}",
|
|
171
174
|
"Date: #{Time.at(epoch).utc.strftime('%a, %d %b %Y %H:%M:%S UTC')}", "Architectures: #{architectures.join(' ')}",
|
|
172
|
-
"Components: #{component}", "Description: #{
|
|
175
|
+
"Components: #{component}", "Description: #{repository} packages"]
|
|
173
176
|
{ "MD5Sum" => Digest::MD5, "SHA1" => Digest::SHA1, "SHA256" => Digest::SHA256 }.each do |label, digest|
|
|
174
177
|
lines << "#{label}:"
|
|
175
178
|
indexes.each { |relative| lines << " #{digest.file(dists / relative).hexdigest} #{(dists / relative).size} #{relative}" }
|
|
176
179
|
end
|
|
177
180
|
lines.join("\n") + "\n"
|
|
178
181
|
end
|
|
179
|
-
|
|
180
|
-
# The same bytes for the same index: no name or time in the header.
|
|
181
|
-
def gzip(text)
|
|
182
|
-
io = StringIO.new("".b)
|
|
183
|
-
writer = Zlib::GzipWriter.new(io, Zlib::BEST_COMPRESSION)
|
|
184
|
-
writer.mtime = 0
|
|
185
|
-
writer.write(text)
|
|
186
|
-
writer.finish
|
|
187
|
-
io.string
|
|
188
|
-
end
|
|
189
182
|
end
|
|
190
183
|
end
|