Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arch packages implementation #25396

Closed
wants to merge 187 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
ec18d9b
added arch packages implementation
Jun 20, 2023
d24e41a
fixed db download failure and incorrect package owner assigned on push
Jun 20, 2023
6ec9686
updated icon name and centered viewbox
Jun 20, 2023
4811ebc
Merge branch 'main' into pacman-packages
silverwind Jun 20, 2023
6328a92
generated optimized svg arch icon
Jun 21, 2023
808a7ae
replaced zstd with archiver and limit reader to speed up metadata eje…
Jun 21, 2023
b354f02
code refactoring and package version publisher id correction
Jun 21, 2023
af99efb
moved arch package routes to the same scope with other packages
Jun 22, 2023
e75ddfd
reused existing services/packages functions for package and signature…
Jun 22, 2023
ae79dbd
package UI corrections
Jun 22, 2023
a5784f6
Update web_src/svg/octicon-arch.svg
Jun 22, 2023
f31e52d
corrected arch icon reference and optimization
Jun 23, 2023
41667b2
changed signature verification library to reuse existing dependency
Jun 23, 2023
e399ce8
opdated operation pacman database craetion to form or update database…
Jun 24, 2023
e2b12f2
fixed error when attempting to read empty database
Jun 24, 2023
c372311
corrected package database connection description and documentation r…
Jun 24, 2023
5beeb24
added method to remove package verified with user's GPG key, removed …
Jun 25, 2023
04a3ddd
changed function retrieving package version when deleting package ver…
Jun 25, 2023
749a106
updated remove function description
Jun 25, 2023
1d1a5a3
added function removing old package entries from pacman database to a…
Jun 25, 2023
f1fae9a
changed procedure of package metadata ejection, removed unnecessary f…
Jun 26, 2023
39e42f7
fixed dependencies appended to wrong field in metadata
Jun 26, 2023
6ac2815
Merge branch 'main' into pacman-packages
Jun 27, 2023
2873deb
documentation for arch packages, additional signature in arch package…
Jun 28, 2023
b42b8c5
Merge branch 'main' into pacman-packages
Jun 29, 2023
6532fe0
Merge branch 'go-gitea:main' into pacman-packages
Jun 30, 2023
3ffb4b2
Merge branch 'main' into pacman-packages
silverwind Jun 30, 2023
6d1037d
db desc file for pacman database is saved in the same space with package
Jul 1, 2023
56772de
corrected package blob structure, pacman database is created on get r…
Jul 2, 2023
0ed4d0c
Merge branch 'main' into pacman-packages
Jul 3, 2023
6d7c770
build date, installed and compressed size UI view
Jul 3, 2023
568c3b1
test for package create, get and delete operations
Jul 4, 2023
b5db5b8
Merge branch 'main' into pacman-packages
silverwind Jul 4, 2023
176b09b
Merge branch 'go-gitea:main' into pacman-packages
Jul 6, 2023
d8623be
added test printing after execution
Jul 6, 2023
f0d569c
Merge branch 'go-gitea:main' into pacman-packages
Jul 8, 2023
364c33b
fixed pacman database creation error for case with multiple architect…
Jul 9, 2023
b5218eb
Merge branch 'go-gitea:main' into pacman-packages
Jul 9, 2023
38024b5
time mocked for arch package unit tests
Jul 9, 2023
da5c7c2
created user with gpg token in arch package tests
Jul 9, 2023
2685f1a
Merge branch 'main' into pacman-packages
silverwind Jul 9, 2023
1df0a1d
fixed file size for mock and scope of time patch
Jul 9, 2023
f912dd6
corrected tests, added test cases for databases with different archit…
Jul 10, 2023
73fe874
Merge branch 'go-gitea:main' into pacman-packages
Jul 10, 2023
8195185
lint corrections
Jul 10, 2023
f3841f0
fixed response status code for metadata update operation
Jul 12, 2023
d679c7e
Merge branch 'main' into pacman-packages
Jul 12, 2023
c4f3fb3
markdown and code documentation lint corrections
Jul 12, 2023
1e16783
Merge branch 'main' into pacman-packages
Jul 13, 2023
c20e1e0
temporarily removed dependency for time mock in tests
Jul 16, 2023
1a08290
Merge branch 'main' into pacman-packages
Jul 16, 2023
baf3a03
fixed dependency for time mocks in integration tests for arch linux p…
Jul 16, 2023
8d691f0
Merge branch 'main' into pacman-packages
silverwind Jul 16, 2023
e24db36
fixed version order when creating pacman database for package with mu…
Jul 16, 2023
9e7c6ef
updated documentation about metadata update function
Jul 16, 2023
1ea4d48
fixed package version owner in metadata update operation
Jul 17, 2023
faff9d9
getting storage object instead of reading bytes
Jul 17, 2023
245a545
Merge branch 'main' into pacman-packages
Jul 22, 2023
597a948
replaced custom auth with existing methods
Jul 23, 2023
542882d
fixed tests, corrected documentation
Jul 23, 2023
cdc5107
corrected SigLevel value for pacman database connection in documentation
Jul 23, 2023
0093004
removed distro field from arch package metadata, corrected related UI
Jul 23, 2023
0632f57
lint corrections
Jul 23, 2023
67bd2bc
simplified push in docs, corrected pkg UI
Jul 24, 2023
23f1ba1
replaced base domain variable in metadata with registry host variable…
Jul 24, 2023
e22a3c7
Merge branch 'main' into pacman-packages
Jul 24, 2023
aec1780
arch icon lint fix
Jul 24, 2023
672b00b
Merge branch 'main' into pacman-packages
silverwind Jul 24, 2023
523e826
Merge branch 'main' into pacman-packages
Jul 25, 2023
b13e3d3
Merge branch 'main' into pacman-packages
Jul 26, 2023
749a873
Merge branch 'go-gitea:main' into pacman-packages
Jul 26, 2023
59bf7a7
changed mirrors, documentation location
Jul 26, 2023
ab1a9a1
changed context doer to context user, fixed package config setting
Jul 26, 2023
ce0d393
removed unnecessary headers in arch package template
Jul 26, 2023
9543262
removed unused package size limit
Jul 26, 2023
3cef8c6
corrected title in documentation
Jul 26, 2023
1abff64
refactoring function to find unique values
Jul 26, 2023
7b92529
Update routers/api/packages/arch/arch.go
Jul 27, 2023
524a2a0
Update routers/api/packages/arch/arch.go
Jul 27, 2023
1e33f61
Update routers/api/packages/arch/arch.go
Jul 27, 2023
8b06f76
replaced HTTP headers with url params
Jul 27, 2023
730cbb1
dynamic architecture and distribution in arch repo link
Jul 27, 2023
3df8d52
changed pacman database creation mechanics, storing package desc as f…
Jul 28, 2023
5e4c582
Merge branch 'main' into pacman-packages
Jul 30, 2023
3c6dd37
Merge branch 'main' into pacman-packages
Jul 31, 2023
f422942
fixed mechanics of pacman database creation
Jul 31, 2023
a15a924
Merge branch 'main' into pacman-packages
Aug 1, 2023
d069303
fixed pacman database creation algorithm, arch UI template
Aug 1, 2023
a95453b
Merge branch 'main' into pacman-packages
Aug 2, 2023
d2d8aa7
documentation fixes
Aug 2, 2023
fdd807d
Merge branch 'main' into pacman-packages
Aug 3, 2023
bfe6b37
reduced package size in tests, additional tests to verify package sig…
Aug 3, 2023
e01ac83
documentation corrections
Aug 3, 2023
ebaa543
lint corrections
Aug 3, 2023
0c7aa7f
refactoring
Aug 3, 2023
1c0a0e2
Merge branch 'main' into pacman-packages
Aug 3, 2023
a45be30
Merge branch 'main' into pacman-packages
Aug 4, 2023
28712bc
refactoring
Aug 4, 2023
a3cb45c
Merge branch 'main' into pacman-packages
Aug 5, 2023
02dcce8
Merge branch 'main' into pacman-packages
Aug 6, 2023
2548414
Merge branch 'main' into pacman-packages
Aug 8, 2023
e86bdfc
metadata and signature are stored in package properties instead of ob…
Aug 8, 2023
0d08eaa
reduced amount of logic, removed unnecessary fields
Aug 8, 2023
27fa815
fixed database creation procedure for packages with any architecture
Aug 8, 2023
c311ec2
Merge branch 'main' into pacman-packages
Aug 11, 2023
4a40107
Merge branch 'main' into pacman-packages
Aug 14, 2023
a702734
Merge branch 'main' into pacman-packages
Aug 14, 2023
ccccfae
Merge branch 'main' into pacman-packages
Aug 16, 2023
9273dc0
removed AUR helpers from arch package manager list
Aug 16, 2023
065d134
Merge branch 'main' into pacman-packages
Aug 17, 2023
8604494
Merge branch 'main' into pacman-packages
Aug 18, 2023
eb7f51a
Merge branch 'main' into pacman-packages
Aug 18, 2023
ce01499
removed/corrected some documentation
Aug 18, 2023
ad2af70
Merge branch 'main' into pacman-packages
Aug 26, 2023
93b1f85
Merge branch 'main' into pacman-packages
Aug 30, 2023
431dabf
fixed procedure of retrieving package properties for signatures and p…
Sep 5, 2023
70effa2
Merge branch 'go-gitea:main' into pacman-packages
Sep 5, 2023
934d119
Merge branch 'go-gitea:main' into pacman-packages
Sep 6, 2023
f914c93
Merge branch 'go-gitea:main' into pacman-packages
Sep 7, 2023
7c2d1b3
fixed package key when getting any architecture
Sep 7, 2023
429477e
Merge branch 'main' into pacman-packages
Sep 12, 2023
a2aaae3
refactoring funciton creating arch package database archive
Sep 12, 2023
a4d878c
Merge branch 'go-gitea:main' into pacman-packages
Sep 18, 2023
1b4b03d
Merge branch 'main' into pacman-packages
Sep 19, 2023
17f02ce
Merge branch 'main' into pacman-packages
Sep 20, 2023
8faea42
Merge branch 'main' into pacman-packages
Sep 23, 2023
d7bd108
Update models/packages/package_file.go
Sep 23, 2023
6005281
fix request permission access position for push/remove handlers
Sep 23, 2023
a9a5b7a
service method to get package file stream
Sep 23, 2023
54fd84d
function to get package file property by composite key, refactoring f…
Sep 24, 2023
907aa02
refactoring create pacman database function
Sep 24, 2023
946d8cc
Merge branch 'main' into pacman-packages
Sep 25, 2023
4656b3b
replaced bytes.Buffer with packages.HashedBuffer to return working io…
Sep 25, 2023
0dd3db2
fixed user in package upload operation
Sep 25, 2023
c09da2a
removed functionality related to automatic source code repository con…
Sep 28, 2023
a1ee2a0
Merge branch 'main' into pacman-packages
Sep 28, 2023
ba92fc5
pass context to package service methods
Sep 28, 2023
fcb3fd1
corrected procedure of retrieving package file property to package ow…
Oct 2, 2023
f515f6e
removed unnecessary filename from composite key
Oct 2, 2023
4bf84c1
corrected arch template and related locale options
Oct 2, 2023
8974d27
refactoring in metadata module, better readability
Oct 2, 2023
784b4f9
refactoring in metadata module, pacman database creation function
Oct 3, 2023
33ae3bd
Merge branch 'main' into pacman-packages
Oct 3, 2023
94f45f4
change interface{} to any, move apiError function to bottom
Oct 3, 2023
d473e01
fixed pacman database creation process, corrected switch to next entr…
Oct 3, 2023
b7725c6
formatting corrections
Oct 3, 2023
54c0816
refactoring, better readability in arch package metadata module
Oct 5, 2023
26e5f9e
Merge branch 'main' into pacman-packages
Oct 7, 2023
b63af7e
metadata tests, json struct tag unification with other linux packages…
Oct 9, 2023
99f856a
Merge branch 'main' into pacman-packages
thionic Oct 12, 2023
54a9c8b
corrected response codes in push and remove operations
thionic Oct 12, 2023
6052aea
moved upload function to arch service
thionic Oct 12, 2023
f812aa7
fixes in arch package metadata tests
thionic Oct 12, 2023
95a1df6
import naming unification with other package types
thionic Oct 12, 2023
fe9086b
Merge branch 'main' into pacman-packages
thionic Oct 18, 2023
52a5c61
Merge branch 'main' into pacman-packages
thionic Oct 23, 2023
f8b78cb
Merge branch 'main' into pacman-packages
thionic Oct 26, 2023
8aeada8
additional validations for package metadata fields, split package met…
thionic Oct 31, 2023
5becd3c
initialize regular expressions for arch package validation once
thionic Oct 31, 2023
73aef3a
integration tests for databases with different architectures, versio…
thionic Oct 31, 2023
1840207
refactoring arch package integration tests
thionic Oct 31, 2023
6652fba
remove endpoint tests
thionic Oct 31, 2023
5c22b91
lint corrections
thionic Oct 31, 2023
45c86cc
Merge branch 'main' into pacman-packages
thionic Oct 31, 2023
1e972d7
unified approach to compare pacman databases (independed from archive…
thionic Nov 1, 2023
fc8f807
comparison of pacman database entries in integration tests
thionic Nov 1, 2023
42587dd
Merge branch 'main' into pacman-packages
thionic Nov 1, 2023
d6a05c3
moved package properties to constants in metadata module
thionic Nov 1, 2023
ca66c6d
use buffer in pacman db desc function
thionic Nov 1, 2023
c9abcf9
error message clarification, typo fix in integration tests
thionic Nov 1, 2023
11bc5f6
Update docs/content/usage/packages/arch.en-us.md
Nov 1, 2023
1d168c6
Update docs/content/usage/packages/arch.en-us.md
Nov 1, 2023
8d0e301
Update docs/content/usage/packages/arch.en-us.md
Nov 1, 2023
d42e381
Update docs/content/usage/packages/arch.en-us.md
Nov 1, 2023
373d904
Update docs/content/usage/packages/arch.en-us.md
Nov 1, 2023
16da9f9
Update docs/content/usage/packages/arch.en-us.md
Nov 1, 2023
ffca863
moved link to arch package documentation from translation to html tem…
thionic Nov 1, 2023
4b96ddd
Update web_src/svg/gitea-arch.svg
Nov 1, 2023
a054f02
fixed context references in arch package html templates, removed URL …
thionic Nov 1, 2023
d234b66
translations for arch metadata fields
thionic Nov 2, 2023
d9080be
Merge branch 'main' into pacman-packages
silverwind Nov 2, 2023
4ba0567
fix arch linux icon
thionic Nov 2, 2023
b12de2a
integration tests fixes and enhancements: isolated tests for differen…
thionic Nov 3, 2023
b97d4f9
fix: context doer as package creator
thionic Nov 8, 2023
a4af98e
Merge branch 'main' into pacman-packages
thionic Nov 12, 2023
9202199
Merge branch 'main' into pacman-packages
thionic Mar 11, 2024
feb99cd
Merge branch 'main' into pacman-packages
thionic May 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions docs/content/usage/packages/arch.en-us.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
date: "2016-11-08T16:00:00+02:00"
title: "Arch Package Registry"
weight: 10
toc: true
draft: false
menu:
sidebar:
parent: "packages"
name: "Arch"
weight: 10
identifier: "arch"
---

# Arch package registry

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.

**Table of Contents**

{{< toc >}}

## Install packages

First, you need to update your pacman configuration, adding following lines:

```conf
[{owner}.{domain}]
SigLevel = Optional TrustAll
Server = https://{domain}/api/packages/{owner}/arch/{distribution}/{architecture}
```

Then, you can run pacman sync command (with -y flag to load connected database file), to install your package:

```sh
pacman -Sy package
```

## Upload packages

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).

The following command will upload arch package and related signature to gitea with basic authentification:

```sh
curl -X PUT \
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') \
--user your_username:your_token_or_password \
--header "Content-Type: application/octet-stream" \
--data-binary '@/path/to/package/file/package-1-1-x86_64.pkg.tar.zst'
```

## Delete packages

The `DELETE` method will remove specific package version, and all package files related to that version:

```sh
curl -X DELETE \
https://{domain}/api/packages/{user}/arch/remove/{package}/{version} \
--user your_username:your_token_or_password
```

## Clients

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/)).
1 change: 1 addition & 0 deletions docs/content/usage/packages/overview.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ The following package managers are currently supported:
| Name | Language | Package client |
| ---- | -------- | -------------- |
| [Alpine](usage/packages/alpine.md) | - | `apk` |
| [Arch](usage/packages/arch.md) | - | `pacman` |
| [Cargo](usage/packages/cargo.md) | Rust | `cargo` |
| [Chef](usage/packages/chef.md) | - | `knife` |
| [Composer](usage/packages/composer.md) | PHP | `composer` |
Expand Down
3 changes: 3 additions & 0 deletions models/packages/descriptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/json"
"code.gitea.io/gitea/modules/packages/alpine"
"code.gitea.io/gitea/modules/packages/arch"
"code.gitea.io/gitea/modules/packages/cargo"
"code.gitea.io/gitea/modules/packages/chef"
"code.gitea.io/gitea/modules/packages/composer"
Expand Down Expand Up @@ -150,6 +151,8 @@ func GetPackageDescriptor(ctx context.Context, pv *PackageVersion) (*PackageDesc
switch p.Type {
case TypeAlpine:
metadata = &alpine.VersionMetadata{}
case TypeArch:
metadata = &arch.VersionMetadata{}
case TypeCargo:
metadata = &cargo.Metadata{}
case TypeChef:
Expand Down
6 changes: 6 additions & 0 deletions models/packages/package.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type Type string
// List of supported packages
const (
TypeAlpine Type = "alpine"
TypeArch Type = "arch"
TypeCargo Type = "cargo"
TypeChef Type = "chef"
TypeComposer Type = "composer"
Expand All @@ -55,6 +56,7 @@ const (

var TypeList = []Type{
TypeAlpine,
TypeArch,
TypeCargo,
TypeChef,
TypeComposer,
Expand Down Expand Up @@ -82,6 +84,8 @@ func (pt Type) Name() string {
switch pt {
case TypeAlpine:
return "Alpine"
case TypeArch:
return "Arch"
case TypeCargo:
return "Cargo"
case TypeChef:
Expand Down Expand Up @@ -131,6 +135,8 @@ func (pt Type) SVGName() string {
switch pt {
case TypeAlpine:
return "gitea-alpine"
case TypeArch:
return "gitea-arch"
case TypeCargo:
return "gitea-cargo"
case TypeChef:
Expand Down
Loading
Loading