1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-23 00:54:28 +00:00

Fix Arch package metadata introduced incorrect field (#32881) (#32882)

Backport #32881 by ExplodingDragon

Incorrect content was introduced while generating the index, which has
now been removed, and the missing fields have been added.

Co-authored-by: Exploding Dragon <explodingfkl@gmail.com>
This commit is contained in:
Giteabot 2024-12-18 19:56:47 +08:00 committed by GitHub
parent c8ffe777cf
commit cb42232080
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View File

@ -69,10 +69,12 @@ type FileMetadata struct {
Packager string `json:"packager,omitempty"` Packager string `json:"packager,omitempty"`
Groups []string `json:"groups,omitempty"` Groups []string `json:"groups,omitempty"`
Provides []string `json:"provides,omitempty"` Provides []string `json:"provides,omitempty"`
Replaces []string `json:"replaces,omitempty"`
Depends []string `json:"depends,omitempty"` Depends []string `json:"depends,omitempty"`
OptDepends []string `json:"opt_depends,omitempty"` OptDepends []string `json:"opt_depends,omitempty"`
MakeDepends []string `json:"make_depends,omitempty"` MakeDepends []string `json:"make_depends,omitempty"`
CheckDepends []string `json:"check_depends,omitempty"` CheckDepends []string `json:"check_depends,omitempty"`
Conflicts []string `json:"conflicts,omitempty"`
XData []string `json:"xdata,omitempty"` XData []string `json:"xdata,omitempty"`
Backup []string `json:"backup,omitempty"` Backup []string `json:"backup,omitempty"`
Files []string `json:"files,omitempty"` Files []string `json:"files,omitempty"`
@ -201,12 +203,16 @@ func ParsePackageInfo(r io.Reader) (*Package, error) {
p.FileMetadata.Provides = append(p.FileMetadata.Provides, value) p.FileMetadata.Provides = append(p.FileMetadata.Provides, value)
case "depend": case "depend":
p.FileMetadata.Depends = append(p.FileMetadata.Depends, value) p.FileMetadata.Depends = append(p.FileMetadata.Depends, value)
case "replaces":
p.FileMetadata.Replaces = append(p.FileMetadata.Replaces, value)
case "optdepend": case "optdepend":
p.FileMetadata.OptDepends = append(p.FileMetadata.OptDepends, value) p.FileMetadata.OptDepends = append(p.FileMetadata.OptDepends, value)
case "makedepend": case "makedepend":
p.FileMetadata.MakeDepends = append(p.FileMetadata.MakeDepends, value) p.FileMetadata.MakeDepends = append(p.FileMetadata.MakeDepends, value)
case "checkdepend": case "checkdepend":
p.FileMetadata.CheckDepends = append(p.FileMetadata.CheckDepends, value) p.FileMetadata.CheckDepends = append(p.FileMetadata.CheckDepends, value)
case "conflict":
p.FileMetadata.Conflicts = append(p.FileMetadata.Conflicts, value)
case "backup": case "backup":
p.FileMetadata.Backup = append(p.FileMetadata.Backup, value) p.FileMetadata.Backup = append(p.FileMetadata.Backup, value)
case "group": case "group":

View File

@ -42,8 +42,10 @@ depend = gitea
provides = common provides = common
provides = gitea provides = gitea
optdepend = hex optdepend = hex
replaces = gogs
checkdepend = common checkdepend = common
makedepend = cmake makedepend = cmake
conflict = ninja
backup = usr/bin/paket1`) backup = usr/bin/paket1`)
} }
@ -149,8 +151,10 @@ func TestParsePackageInfo(t *testing.T) {
assert.ElementsMatch(t, []string{"group"}, p.FileMetadata.Groups) assert.ElementsMatch(t, []string{"group"}, p.FileMetadata.Groups)
assert.ElementsMatch(t, []string{"common", "gitea"}, p.FileMetadata.Provides) assert.ElementsMatch(t, []string{"common", "gitea"}, p.FileMetadata.Provides)
assert.ElementsMatch(t, []string{"common", "gitea"}, p.FileMetadata.Depends) assert.ElementsMatch(t, []string{"common", "gitea"}, p.FileMetadata.Depends)
assert.ElementsMatch(t, []string{"gogs"}, p.FileMetadata.Replaces)
assert.ElementsMatch(t, []string{"hex"}, p.FileMetadata.OptDepends) assert.ElementsMatch(t, []string{"hex"}, p.FileMetadata.OptDepends)
assert.ElementsMatch(t, []string{"common"}, p.FileMetadata.CheckDepends) assert.ElementsMatch(t, []string{"common"}, p.FileMetadata.CheckDepends)
assert.ElementsMatch(t, []string{"ninja"}, p.FileMetadata.Conflicts)
assert.ElementsMatch(t, []string{"cmake"}, p.FileMetadata.MakeDepends) assert.ElementsMatch(t, []string{"cmake"}, p.FileMetadata.MakeDepends)
assert.ElementsMatch(t, []string{"usr/bin/paket1"}, p.FileMetadata.Backup) assert.ElementsMatch(t, []string{"usr/bin/paket1"}, p.FileMetadata.Backup)
}) })

View File

@ -371,11 +371,12 @@ func writeDescription(tw *tar.Writer, opts *entryOptions) error {
{"BUILDDATE", fmt.Sprintf("%d", opts.FileMetadata.BuildDate)}, {"BUILDDATE", fmt.Sprintf("%d", opts.FileMetadata.BuildDate)},
{"PACKAGER", opts.FileMetadata.Packager}, {"PACKAGER", opts.FileMetadata.Packager},
{"PROVIDES", strings.Join(opts.FileMetadata.Provides, "\n")}, {"PROVIDES", strings.Join(opts.FileMetadata.Provides, "\n")},
{"REPLACES", strings.Join(opts.FileMetadata.Replaces, "\n")},
{"CONFLICTS", strings.Join(opts.FileMetadata.Conflicts, "\n")},
{"DEPENDS", strings.Join(opts.FileMetadata.Depends, "\n")}, {"DEPENDS", strings.Join(opts.FileMetadata.Depends, "\n")},
{"OPTDEPENDS", strings.Join(opts.FileMetadata.OptDepends, "\n")}, {"OPTDEPENDS", strings.Join(opts.FileMetadata.OptDepends, "\n")},
{"MAKEDEPENDS", strings.Join(opts.FileMetadata.MakeDepends, "\n")}, {"MAKEDEPENDS", strings.Join(opts.FileMetadata.MakeDepends, "\n")},
{"CHECKDEPENDS", strings.Join(opts.FileMetadata.CheckDepends, "\n")}, {"CHECKDEPENDS", strings.Join(opts.FileMetadata.CheckDepends, "\n")},
{"XDATA", strings.Join(opts.FileMetadata.XData, "\n")},
}) })
} }