Skip to content

Commit 9a3f45a

Browse files
apply #25396
1 parent 1007ce7 commit 9a3f45a

File tree

20 files changed

+1734
-1
lines changed

20 files changed

+1734
-1
lines changed
+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
date: "2016-11-08T16:00:00+02:00"
3+
title: "Arch Package Registry"
4+
weight: 10
5+
toc: true
6+
draft: false
7+
menu:
8+
sidebar:
9+
parent: "packages"
10+
name: "Arch"
11+
weight: 10
12+
identifier: "arch"
13+
---
14+
15+
# Arch package registry
16+
17+
Gitea has a Arch Linux package registry, which can act as a fully working [Arch linux mirror](https://wiki.archlinux.org/title/mirrors) and connected directly in `/etc/pacman.conf`. Gitea automatically creates pacman database for packages in user/organization space when a new Arch package is uploaded.
18+
19+
**Table of Contents**
20+
21+
{{< toc >}}
22+
23+
## Install packages
24+
25+
First, you need to update your pacman configuration, adding following lines:
26+
27+
```conf
28+
[{owner}.{domain}]
29+
SigLevel = Optional TrustAll
30+
Server = https://{domain}/api/packages/{owner}/arch/{distribution}/{architecture}
31+
```
32+
33+
Then, you can run pacman sync command (with -y flag to load connected database file), to install your package:
34+
35+
```sh
36+
pacman -Sy package
37+
```
38+
39+
## Upload packages
40+
41+
When uploading the package to gitea, you have to prepare package file with the `.pkg.tar.zst` extension and its `.pkg.tar.zst.sig` signature. You can use [curl](https://curl.se/) or any other HTTP client, Gitea supports multiple [authentication schemes](https://docs.gitea.com/usage/authentication). The upload command will create 3 files: package, signature and desc file for the pacman database (which will be created automatically on request).
42+
43+
The following command will upload arch package and related signature to gitea with basic authentification:
44+
45+
```sh
46+
curl -X PUT \
47+
https://{domain}/api/packages/{owner}/arch/push/{package-1-1-x86_64.pkg.tar.zst}/{archlinux}/$(xxd -p package-1-1-x86_64.pkg.tar.zst.sig | tr -d '\n') \
48+
--user your_username:your_token_or_password \
49+
--header "Content-Type: application/octet-stream" \
50+
--data-binary '@/path/to/package/file/package-1-1-x86_64.pkg.tar.zst'
51+
```
52+
53+
## Delete packages
54+
55+
The `DELETE` method will remove specific package version, and all package files related to that version:
56+
57+
```sh
58+
curl -X DELETE \
59+
https://{domain}/api/packages/{user}/arch/remove/{package}/{version} \
60+
--user your_username:your_token_or_password
61+
```
62+
63+
## Clients
64+
65+
Any `pacman` compatible package manager or AUR-helper can be used to install packages from gitea ([yay](https://github.com/Jguer/yay), [paru](https://github.com/Morganamilo/paru), [pikaur](https://github.com/actionless/pikaur), [aura](https://github.com/fosskers/aura)). Alternatively, you can try [pack](https://fmnx.su/core/pack) which supports full gitea API (install/push/remove). Also, any HTTP client can be used to execute get/push/remove operations ([curl](https://curl.se/), [postman](https://www.postman.com/), [thunder-client](https://www.thunderclient.com/)).

docs/content/usage/packages/overview.en-us.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ The following package managers are currently supported:
2424
| Name | Language | Package client |
2525
| ---- | -------- | -------------- |
2626
| [Alpine](usage/packages/alpine.md) | - | `apk` |
27+
| [Arch](usage/packages/arch.md) | - | `pacman` |
2728
| [Cargo](usage/packages/cargo.md) | Rust | `cargo` |
2829
| [Chef](usage/packages/chef.md) | - | `knife` |
2930
| [Composer](usage/packages/composer.md) | PHP | `composer` |

models/packages/descriptor.go

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
user_model "code.gitea.io/gitea/models/user"
1414
"code.gitea.io/gitea/modules/json"
1515
"code.gitea.io/gitea/modules/packages/alpine"
16+
"code.gitea.io/gitea/modules/packages/arch"
1617
"code.gitea.io/gitea/modules/packages/cargo"
1718
"code.gitea.io/gitea/modules/packages/chef"
1819
"code.gitea.io/gitea/modules/packages/composer"
@@ -150,6 +151,8 @@ func GetPackageDescriptor(ctx context.Context, pv *PackageVersion) (*PackageDesc
150151
switch p.Type {
151152
case TypeAlpine:
152153
metadata = &alpine.VersionMetadata{}
154+
case TypeArch:
155+
metadata = &arch.VersionMetadata{}
153156
case TypeCargo:
154157
metadata = &cargo.Metadata{}
155158
case TypeChef:

models/packages/package.go

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ type Type string
3131
// List of supported packages
3232
const (
3333
TypeAlpine Type = "alpine"
34+
TypeArch Type = "arch"
3435
TypeCargo Type = "cargo"
3536
TypeChef Type = "chef"
3637
TypeComposer Type = "composer"
@@ -55,6 +56,7 @@ const (
5556

5657
var TypeList = []Type{
5758
TypeAlpine,
59+
TypeArch,
5860
TypeCargo,
5961
TypeChef,
6062
TypeComposer,
@@ -82,6 +84,8 @@ func (pt Type) Name() string {
8284
switch pt {
8385
case TypeAlpine:
8486
return "Alpine"
87+
case TypeArch:
88+
return "Arch"
8589
case TypeCargo:
8690
return "Cargo"
8791
case TypeChef:
@@ -131,6 +135,8 @@ func (pt Type) SVGName() string {
131135
switch pt {
132136
case TypeAlpine:
133137
return "gitea-alpine"
138+
case TypeArch:
139+
return "gitea-arch"
134140
case TypeCargo:
135141
return "gitea-cargo"
136142
case TypeChef:

0 commit comments

Comments
 (0)