Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ExplodingDragon committed May 21, 2024
1 parent 1007ce7 commit 9a3f45a
Show file tree
Hide file tree
Showing 20 changed files with 1,734 additions and 1 deletion.
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

0 comments on commit 9a3f45a

Please sign in to comment.