Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref: correct SRCINFO API #1042

Merged
merged 3 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 28 additions & 24 deletions client/src/types/package-info.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,48 @@
export default interface PackageInfo {
architectures: string[]
version: string
packageName: string
maintainers: string[]
prettyName: string
description: string
source: ArchDistroString[]
version: string
release: string
epoch: string
latestVersion?: string
homepage: string
priority: string
architectures: string[]
license: string[]
gives: ArchDistroString
runtimeDependencies: ArchDistroString[]
checkDependencies: ArchDistroString[]
buildDependencies: ArchDistroString[]
optionalDependencies: ArchDistroString[]
checkDependencies: ArchDistroString[]
pacstallDependencies: ArchDistroString[]
checkConflicts: ArchDistroString[]
buildConflicts: ArchDistroString[]
conflicts: ArchDistroString[]
gives: ArchDistroString
provides: ArchDistroString[]
breaks: ArchDistroString[]
replaces: ArchDistroString[]
enhances: ArchDistroString[]
recommends: ArchDistroString[]
suggests: ArchDistroString[]
mask: string[]
compatible: string[]
incompatible: string[]
maintainers: string[]
source: ArchDistroString[]
noExtract: string[]
noSubmodules: string[]
md5sums: ArchDistroString[]
sha1sums: ArchDistroString[]
sha224sums: ArchDistroString[]
sha256sums: ArchDistroString[]
sha384sums: ArchDistroString[]
sha512sums: ArchDistroString[]
md5sums: ArchDistroString[]
priority: ArchDistroString[]
backup: string[]
repology: string[]
requiredBy: string[]
suggests: ArchDistroString[]
recommends: ArchDistroString[]
latestVersion?: string
prettyName: string
updateStatus: UpdateStatus
lastUpdatedAt: string
enhances: ArchDistroString[]
changelog: string
backup: string[]
compatible: string[]
incompatible: string[]
epoch: string
install: string
license: string[]
mask: string[]
noExtract: string[]
validPgpKeys: string[]
groups: string[]
}

export interface ArchDistroString {
Expand Down
2 changes: 1 addition & 1 deletion server/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
require (
github.com/bwmarrin/discordgo v0.28.1
github.com/joomcode/errorx v1.2.0
github.com/pacstall/go-srcinfo v0.0.0-20240916164747-6f75fe362117
github.com/pacstall/go-srcinfo v0.0.0-20241108210032-cd3b76a984ca
github.com/treelightsoftware/go-matomo v0.1.0-beta
gorm.io/driver/mysql v1.5.7
gorm.io/gorm v1.25.12
Expand Down
8 changes: 8 additions & 0 deletions server/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/pacstall/go-srcinfo v0.0.0-20240916164747-6f75fe362117 h1:UVCtjWIdoAxLgASvjvuDKcKfRq1bmy5nGOIBinLZ9vE=
github.com/pacstall/go-srcinfo v0.0.0-20240916164747-6f75fe362117/go.mod h1:0LUf6eSIfP1kloShefbkOeYgk8aUbkeDuN955aq1jxY=
github.com/pacstall/go-srcinfo v0.0.0-20240924203444-226fd2dada50 h1:gI44W+fSxQazkSNMIWz9oQsavmW8vDMtVQRW/I36uy0=
github.com/pacstall/go-srcinfo v0.0.0-20240924203444-226fd2dada50/go.mod h1:0LUf6eSIfP1kloShefbkOeYgk8aUbkeDuN955aq1jxY=
github.com/pacstall/go-srcinfo v0.0.0-20241012184115-e59787789952 h1:KmOabQNWvcamBXWwOzgrZ12XRMA4Yee2IcHuNYqoITI=
github.com/pacstall/go-srcinfo v0.0.0-20241012184115-e59787789952/go.mod h1:0LUf6eSIfP1kloShefbkOeYgk8aUbkeDuN955aq1jxY=
github.com/pacstall/go-srcinfo v0.0.0-20241012184439-3f3ecf1028c4 h1:kVSATl3d6FZ0cQ4amtYv4SgRmtsCONLawRu08L4oivc=
github.com/pacstall/go-srcinfo v0.0.0-20241012184439-3f3ecf1028c4/go.mod h1:0LUf6eSIfP1kloShefbkOeYgk8aUbkeDuN955aq1jxY=
github.com/pacstall/go-srcinfo v0.0.0-20241108210032-cd3b76a984ca h1:aeGaejNX+llCdI7THrMA2sEbiVA1DOAM23vAFCU+d1Q=
github.com/pacstall/go-srcinfo v0.0.0-20241108210032-cd3b76a984ca/go.mod h1:0LUf6eSIfP1kloShefbkOeYgk8aUbkeDuN955aq1jxY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down
104 changes: 53 additions & 51 deletions server/types/pac/script.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,49 +43,50 @@ func (a ArchDistroString) Equals(b types.Equaller) bool {
}

type Script struct {
Architectures []string `json:"architectures"`
PackageName string `json:"packageName"`
PrettyName string `json:"prettyName"`
Description string `json:"description"`
Version string `json:"version"`
Release string `json:"release"`
Epoch string `json:"epoch"`
LatestVersion *string `json:"latestVersion"`
PackageName string `json:"packageName"`
Maintainers []string `json:"maintainers"`
Description string `json:"description"`
Source []ArchDistroString `json:"source"`
Homepage string `json:"homepage"`
Priority string `json:"priority"`
Architectures []string `json:"architectures"`
License []string `json:"license"`
Gives []ArchDistroString `json:"gives"`
RuntimeDependencies []ArchDistroString `json:"runtimeDependencies"`
CheckDependencies []ArchDistroString `json:"checkDependencies"`
BuildDependencies []ArchDistroString `json:"buildDependencies"`
OptionalDependencies []ArchDistroString `json:"optionalDependencies"`
CheckDependencies []ArchDistroString `json:"checkDependencies"`
PacstallDependencies []ArchDistroString `json:"pacstallDependencies"`
CheckConflicts []ArchDistroString `json:"checkConflicts"`
BuildConflicts []ArchDistroString `json:"buildConflicts"`
Conflicts []ArchDistroString `json:"conflicts"`
Provides []ArchDistroString `json:"provides"`
Breaks []ArchDistroString `json:"breaks"`
Gives []ArchDistroString `json:"gives"`
Replaces []ArchDistroString `json:"replaces"`
Enhances []ArchDistroString `json:"enhances"`
Recommends []ArchDistroString `json:"recommends"`
Suggests []ArchDistroString `json:"suggests"`
Mask []string `json:"mask"`
Compatible []string `json:"compatible"`
Incompatible []string `json:"incompatible"`
Maintainers []string `json:"maintainers"`
Source []ArchDistroString `json:"source"`
NoExtract []string `json:"noExtract"`
NoSubmodules []string `json:"NoSubmodules"`
Md5Sums []ArchDistroString `json:"md5sums"`
Sha1Sums []ArchDistroString `json:"sha1sums"`
Sha224Sums []ArchDistroString `json:"sha224sums"`
Sha256Sums []ArchDistroString `json:"sha256sums"`
Sha384Sums []ArchDistroString `json:"sha384sums"`
Sha512Sums []ArchDistroString `json:"sha512sums"`
Md5Sums []ArchDistroString `json:"md5sums"`
Priority []ArchDistroString `json:"priority"`
Recommends []ArchDistroString `json:"recommends"`
Suggests []ArchDistroString `json:"suggests"`
PacstallDependencies []ArchDistroString `json:"pacstallDependencies"`
Enhances []ArchDistroString `json:"enhances"`
Backup []string `json:"backup"`
Repology []string `json:"repology"`
RequiredBy []string `json:"requiredBy"`
LastUpdatedAt time.Time `json:"lastUpdatedAt"`
UpdateStatus int `json:"updateStatus"` // enum UpdateStatus
Changelog string `json:"changelog"`
Backup []string `json:"backup"`
Compatible []string `json:"compatible"`
Incompatible []string `json:"incompatible"`
Epoch string `json:"epoch"`
Install string `json:"install"`
License []string `json:"license"`
Mask []string `json:"mask"`
NoExtract []string `json:"noExtract"`
ValidPGPKeys []string `json:"validPgpKeys"`
Groups []string `json:"groups"`
LastUpdatedAt time.Time `json:"lastUpdatedAt"`
}

func (p *Script) Type() types.PackageTypeName {
Expand All @@ -100,47 +101,48 @@ func (p *Script) Type() types.PackageTypeName {

func FromSrcInfo(info srcinfo.Srcinfo) *Script {
return &Script{
PackageName: info.Packages[0].Pkgname, // needs to be looped for every pkgname within pkgbase
PrettyName: "",
Description: info.Pkgdesc,
Version: info.Version(),
Release: info.Pkgrel,
Epoch: info.Epoch,
LatestVersion: nil,
PackageName: info.Packages[0].Pkgname,
Maintainers: info.Maintainer,
Description: info.Pkgdesc,
Source: toArchDistroStrings(info.Source),
Homepage: info.URL,
Priority: info.Priority,
Architectures: info.Arch,
License: orEmptyArray(info.License),
Gives: toArchDistroStrings(info.Gives),
RuntimeDependencies: toArchDistroStrings(info.Depends),
CheckDependencies: toArchDistroStrings(info.CheckDepends),
BuildDependencies: toArchDistroStrings(info.MakeDepends),
OptionalDependencies: toArchDistroStrings(info.OptDepends),
PacstallDependencies: toArchDistroStrings(info.Pacdeps),
CheckConflicts: toArchDistroStrings(info.CheckConflicts),
BuildConflicts: toArchDistroStrings(info.MakeConflicts),
Conflicts: toArchDistroStrings(info.Conflicts),
Provides: toArchDistroStrings(info.Provides),
Breaks: toArchDistroStrings(info.Breaks),
Gives: toArchDistroStrings(info.Gives),
Replaces: toArchDistroStrings(info.Replaces),
PacstallDependencies: toArchDistroStrings(info.Pacdeps),
Architectures: info.Arch,
Repology: info.Repology,
RequiredBy: []string{},
Enhances: toArchDistroStrings(info.Enhances),
Recommends: toArchDistroStrings(info.Recommends),
Suggests: toArchDistroStrings(info.Suggests),
Mask: orEmptyArray(info.Mask),
Compatible: orEmptyArray(info.Compatible),
Incompatible: orEmptyArray(info.Incompatible),
Maintainers: info.Maintainer,
Source: toArchDistroStrings(info.Source),
NoExtract: orEmptyArray(info.NoExtract),
NoSubmodules: orEmptyArray(info.NoSubmodules),
Md5Sums: toArchDistroStrings(info.MD5Sums),
Sha1Sums: toArchDistroStrings(info.SHA1Sums),
Sha224Sums: toArchDistroStrings(info.SHA224Sums),
Sha256Sums: toArchDistroStrings(info.SHA256Sums),
Sha384Sums: toArchDistroStrings(info.SHA384Sums),
Sha512Sums: toArchDistroStrings(info.SHA512Sums),
PrettyName: "",
Changelog: info.Changelog,
Backup: orEmptyArray(info.Backup),
Compatible: orEmptyArray(info.Compatible),
Incompatible: orEmptyArray(info.Incompatible),
Epoch: info.Epoch,
Install: info.Install,
License: orEmptyArray(info.License),
Mask: orEmptyArray(info.Mask),
NoExtract: orEmptyArray(info.NoExtract),
ValidPGPKeys: orEmptyArray(info.ValidPGPKeys),
Groups: orEmptyArray(info.Groups),
Enhances: toArchDistroStrings(info.Enhances),
CheckDependencies: toArchDistroStrings(info.CheckDepends),
Md5Sums: toArchDistroStrings(info.MD5Sums),
Priority: toArchDistroStrings(info.Priority),
Suggests: toArchDistroStrings(info.Suggests),
Recommends: toArchDistroStrings(info.Recommends),
Repology: info.Repology,
RequiredBy: []string{},
UpdateStatus: UpdateStatus.Unknown,
}
}
Expand Down