aboutsummaryrefslogtreecommitdiffstats
path: root/modules/packages
diff options
context:
space:
mode:
authorExploding Dragon <explodingfkl@gmail.com>2024-12-18 15:25:05 +0800
committerGitHub <noreply@github.com>2024-12-18 15:25:05 +0800
commit2beaedc4179ba6a3917ca99e2fd95fd2f476925e (patch)
treeb616b25fb8c76110b0c5cda0c2b2bd309a0444ce /modules/packages
parentf9f62b4c4cb356c7a06b4ce6b0be2e672aa47725 (diff)
downloadgitea-2beaedc4179ba6a3917ca99e2fd95fd2f476925e.tar.gz
gitea-2beaedc4179ba6a3917ca99e2fd95fd2f476925e.zip
Fix Arch package metadata introduced incorrect field (#32881)
Incorrect content was introduced while generating the index, which has now been removed, and the missing fields have been added. ![](https://github.com/user-attachments/assets/4fbb8884-337e-43b1-939f-a5ba687f7ffd)
Diffstat (limited to 'modules/packages')
-rw-r--r--modules/packages/arch/metadata.go6
-rw-r--r--modules/packages/arch/metadata_test.go4
2 files changed, 10 insertions, 0 deletions
diff --git a/modules/packages/arch/metadata.go b/modules/packages/arch/metadata.go
index e1e79c60e0..06a2206a36 100644
--- a/modules/packages/arch/metadata.go
+++ b/modules/packages/arch/metadata.go
@@ -69,10 +69,12 @@ type FileMetadata struct {
Packager string `json:"packager,omitempty"`
Groups []string `json:"groups,omitempty"`
Provides []string `json:"provides,omitempty"`
+ Replaces []string `json:"replaces,omitempty"`
Depends []string `json:"depends,omitempty"`
OptDepends []string `json:"opt_depends,omitempty"`
MakeDepends []string `json:"make_depends,omitempty"`
CheckDepends []string `json:"check_depends,omitempty"`
+ Conflicts []string `json:"conflicts,omitempty"`
XData []string `json:"xdata,omitempty"`
Backup []string `json:"backup,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)
case "depend":
p.FileMetadata.Depends = append(p.FileMetadata.Depends, value)
+ case "replaces":
+ p.FileMetadata.Replaces = append(p.FileMetadata.Replaces, value)
case "optdepend":
p.FileMetadata.OptDepends = append(p.FileMetadata.OptDepends, value)
case "makedepend":
p.FileMetadata.MakeDepends = append(p.FileMetadata.MakeDepends, value)
case "checkdepend":
p.FileMetadata.CheckDepends = append(p.FileMetadata.CheckDepends, value)
+ case "conflict":
+ p.FileMetadata.Conflicts = append(p.FileMetadata.Conflicts, value)
case "backup":
p.FileMetadata.Backup = append(p.FileMetadata.Backup, value)
case "group":
diff --git a/modules/packages/arch/metadata_test.go b/modules/packages/arch/metadata_test.go
index f611ef5e84..37c0a553b8 100644
--- a/modules/packages/arch/metadata_test.go
+++ b/modules/packages/arch/metadata_test.go
@@ -42,8 +42,10 @@ depend = gitea
provides = common
provides = gitea
optdepend = hex
+replaces = gogs
checkdepend = common
makedepend = cmake
+conflict = ninja
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{"common", "gitea"}, p.FileMetadata.Provides)
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{"common"}, p.FileMetadata.CheckDepends)
+ assert.ElementsMatch(t, []string{"ninja"}, p.FileMetadata.Conflicts)
assert.ElementsMatch(t, []string{"cmake"}, p.FileMetadata.MakeDepends)
assert.ElementsMatch(t, []string{"usr/bin/paket1"}, p.FileMetadata.Backup)
})