mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-01 14:56:30 +00:00
moved package properties to constants in metadata module
This commit is contained in:
parent
42587dde80
commit
d6a05c30d2
@ -23,6 +23,11 @@ import (
|
||||
"github.com/mholt/archiver/v3"
|
||||
)
|
||||
|
||||
const (
|
||||
PropertyDescription = "arch.description"
|
||||
PropertySignature = "arch.signature"
|
||||
)
|
||||
|
||||
var (
|
||||
// https://man.archlinux.org/man/PKGBUILD.5
|
||||
reName = regexp.MustCompile(`^[a-zA-Z0-9@._+-]+$`)
|
||||
|
@ -44,7 +44,7 @@ func GetPackageSignature(ctx *context.Context, distro, file string) (*bytes.Read
|
||||
}
|
||||
|
||||
for _, pp := range proprs {
|
||||
if pp.Name == "sign" {
|
||||
if pp.Name == arch_module.PropertySignature {
|
||||
b, err := hex.DecodeString(pp.Value)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -116,7 +116,7 @@ func CreatePacmanDb(ctx *context.Context, owner, arch, distro string) (*bytes.Bu
|
||||
}
|
||||
|
||||
pps, err := packages_model.GetPropertiesByName(
|
||||
ctx, packages_model.PropertyTypeFile, pf.ID, "desc",
|
||||
ctx, packages_model.PropertyTypeFile, pf.ID, arch_module.PropertyDescription,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -37,14 +37,14 @@ func UploadArchPackage(ctx *context.Context, upload io.Reader, filename, distro,
|
||||
}
|
||||
|
||||
properties := map[string]string{
|
||||
"desc": p.Desc(),
|
||||
arch_module.PropertyDescription: p.Desc(),
|
||||
}
|
||||
if sign != "" {
|
||||
_, err := hex.DecodeString(sign)
|
||||
if err != nil {
|
||||
return true, nil, errors.New("unable to decode package signature")
|
||||
}
|
||||
properties["sign"] = sign
|
||||
properties[arch_module.PropertySignature] = sign
|
||||
}
|
||||
|
||||
ver, _, err := packages_service.CreatePackageOrAddFileToExisting(
|
||||
|
Loading…
Reference in New Issue
Block a user