Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-24 10:46:10 +01:00
forgejo/templates/package/content/arch.tmpl
Exploding Dragon f17194ca91 Arch packages implementation (#4785)
This PR is from https://github.com/go-gitea/gitea/pull/31037

This PR was originally created by @d1nch8g , and the original source code comes from https://ion.lc/core/gitea.

This PR adds a package registry for [Arch Linux](https://archlinux.org/) packages with support for package files, [signatures](https://wiki.archlinux.org/title/Pacman/Package_signing), and automatic [pacman-database](https://archlinux.org/pacman/repo-add.8.html) management.

Features:

1. Push any ` tar.zst ` package and Gitea sign it.
2. Delete endpoint for specific package version and all related files
3. Supports trust levels with `SigLevel = Required`.
4. Package UI with instructions to connect to the new pacman database and visualised package metadata

![](/attachments/810ca6df-bd20-44c2-bdf7-95e94886d750)

You can follow [this tutorial](https://wiki.archlinux.org/title/Creating_packages) to build a *.pkg.tar.zst package for testing

docs pr: https://codeberg.org/forgejo/docs/pulls/791

Co-authored-by: d1nch8g@ion.lc
Co-authored-by: @KN4CK3R
Co-authored-by: @mahlzahn
Co-authored-by: @silverwind
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4785
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Exploding Dragon <explodingfkl@gmail.com>
Co-committed-by: Exploding Dragon <explodingfkl@gmail.com>
2024-08-04 06:16:29 +00:00

144 lines
4.4 KiB
Go HTML Template

{{if eq .PackageDescriptor.Package.Type "arch"}}
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.installation"}}</h4>
<div class="ui attached segment">
<div class="ui form">
<div class="field">
<label>{{svg "octicon-terminal"}} {{ctx.Locale.Tr "packages.arch.pacman.helper.gpg"}}</label>
<div class="markup">
<pre class="code-block"><code>wget -O sign.gpg <origin-url data-url="{{AppSubUrl}}/api/packages/{{.PackageDescriptor.Owner.Name}}/arch/repository.key"></origin-url>
pacman-key --add sign.gpg
pacman-key --lsign-key '{{$.SignMail}}'</code></pre>
</div>
</div>
<div class="field">
<label>{{svg "octicon-gear"}} {{ctx.Locale.Tr "packages.arch.pacman.conf"}}</label>
<div class="markup">
<pre
class="code-block"><code>
{{- if gt (len $.Groups) 1 -}}
# {{ctx.Locale.Tr "packages.arch.pacman.repo.multi" $.PackageDescriptor.Package.LowerName}}
{{end -}}
{{- $GroupSize := (len .Groups) -}}
{{- range $i,$v := .Groups -}}
{{- if gt $i 0}}
{{end -}}{{- if gt $GroupSize 1 -}}
# {{ctx.Locale.Tr "packages.arch.pacman.repo.multi.item" .}}
{{end -}}
[{{$.PackageDescriptor.Owner.LowerName}}.{{$.RegistryHost}}]
SigLevel = Required
Server = <origin-url data-url="{{AppSubUrl}}/api/packages/{{$.PackageDescriptor.Owner.Name}}/arch/{{.}}/$arch"></origin-url>
{{end -}}
</code></pre>
</div>
</div>
<div class="field">
<label>{{svg "octicon-sync"}} {{ctx.Locale.Tr "packages.arch.pacman.sync"}}</label>
<div class="markup">
<pre class="code-block"><code>pacman -Sy {{.PackageDescriptor.Package.LowerName}}</code></pre>
</div>
</div>
<div class="field">
<label>{{ctx.Locale.Tr "packages.registry.documentation" "Arch"
"https://forgejo.org/docs/latest/user/packages/arch/"}}</label>
</div>
</div>
</div>
<h4 class="ui top attached header">{{ctx.Locale.Tr "packages.arch.version.properties"}}</h4>
<div class="ui attached segment">
<table class="ui very basic compact table">
<tbody>
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.description"}}</h5>
</td>
<td>{{.PackageDescriptor.Metadata.Description}}</td>
</tr>
{{if .PackageDescriptor.Metadata.Groups}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.groups"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.Groups ", "}}</td>
</tr>
{{end}}
{{if .PackageDescriptor.Metadata.Provides}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.provides"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.Provides ", "}}</td>
</tr>
{{end}}
{{if .PackageDescriptor.Metadata.Depends}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.depends"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.Depends ", "}}</td>
</tr>
{{end}}
{{if .PackageDescriptor.Metadata.OptDepends}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.optdepends"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.OptDepends ", "}}</td>
</tr>
{{end}}
{{if .PackageDescriptor.Metadata.MakeDepends}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.makedepends"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.MakeDepends ", "}}</td>
</tr>
{{end}}
{{if .PackageDescriptor.Metadata.CheckDepends}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.checkdepends"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.CheckDepends ", "}}</td>
</tr>
{{end}}
{{if .PackageDescriptor.Metadata.Conflicts}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.conflicts"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.Conflicts ", "}}</td>
</tr>
{{end}}
{{if .PackageDescriptor.Metadata.Replaces}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.replaces"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.Replaces ", "}}</td>
</tr>
{{end}}
{{if .PackageDescriptor.Metadata.Backup}}
<tr>
<td class="collapsing">
<h5>{{ctx.Locale.Tr "packages.arch.version.backup"}}</h5>
</td>
<td>{{StringUtils.Join $.PackageDescriptor.Metadata.Backup ", "}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
{{end}}