From d92a79e4697e6847c605586b47a58484fd09f9a1 Mon Sep 17 00:00:00 2001 From: ook37 Date: Sat, 12 Oct 2024 14:52:39 -0400 Subject: [PATCH 1/2] ref: correct SRCINFO API --- client/src/types/package-info.ts | 52 +++++++++------- server/go.mod | 2 +- server/go.sum | 6 ++ server/types/pac/script.go | 104 ++++++++++++++++--------------- 4 files changed, 88 insertions(+), 76 deletions(-) diff --git a/client/src/types/package-info.ts b/client/src/types/package-info.ts index 126d0d9c..ea9b3292 100644 --- a/client/src/types/package-info.ts +++ b/client/src/types/package-info.ts @@ -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 { diff --git a/server/go.mod b/server/go.mod index 665a53bf..70976129 100644 --- a/server/go.mod +++ b/server/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/bwmarrin/discordgo v0.28.1 github.com/joomcode/errorx v1.1.1 - github.com/pacstall/go-srcinfo v0.0.0-20240916164747-6f75fe362117 + github.com/pacstall/go-srcinfo v0.0.0-20241012184439-3f3ecf1028c4 github.com/treelightsoftware/go-matomo v0.1.0-beta gorm.io/driver/mysql v1.5.7 gorm.io/gorm v1.25.12 diff --git a/server/go.sum b/server/go.sum index 25891e12..c6e1abcd 100644 --- a/server/go.sum +++ b/server/go.sum @@ -43,6 +43,12 @@ 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/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= diff --git a/server/types/pac/script.go b/server/types/pac/script.go index 96b43298..c1c776da 100644 --- a/server/types/pac/script.go +++ b/server/types/pac/script.go @@ -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 { @@ -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, } } From b4c62b829b54178fd06aeef5cc894096792f20d4 Mon Sep 17 00:00:00 2001 From: oklopfer <104327997+oklopfer@users.noreply.github.com> Date: Fri, 8 Nov 2024 22:32:26 +0000 Subject: [PATCH 2/2] bump --- server/go.mod | 2 +- server/go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/server/go.mod b/server/go.mod index 70976129..aa9ca38d 100644 --- a/server/go.mod +++ b/server/go.mod @@ -13,7 +13,7 @@ require ( require ( github.com/bwmarrin/discordgo v0.28.1 github.com/joomcode/errorx v1.1.1 - github.com/pacstall/go-srcinfo v0.0.0-20241012184439-3f3ecf1028c4 + 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 diff --git a/server/go.sum b/server/go.sum index c6e1abcd..0d32901a 100644 --- a/server/go.sum +++ b/server/go.sum @@ -49,6 +49,8 @@ github.com/pacstall/go-srcinfo v0.0.0-20241012184115-e59787789952 h1:KmOabQNWvca 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=