mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-08 05:50:47 +00:00
Add -json flag to snapshot show|list
Signed-off-by: Joshua Colson <joshua.colson@gmail.com>
This commit is contained in:
committed by
Lorenzo Bolla
parent
f9c0d99790
commit
0f1575d5af
+13
@@ -266,6 +266,19 @@ func (l *PackageList) Strings() []string {
|
||||
return result
|
||||
}
|
||||
|
||||
// FullNames builds a list of package {name}_{version}_{arch}
|
||||
func (l *PackageList) FullNames() []string {
|
||||
result := make([]string, l.Len())
|
||||
i := 0
|
||||
|
||||
for _, p := range l.packages {
|
||||
result[i] = p.GetFullName()
|
||||
i++
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// depSliceDeduplicate removes dups in slice of Dependencies
|
||||
func depSliceDeduplicate(s []Dependency) []Dependency {
|
||||
l := len(s)
|
||||
|
||||
@@ -361,6 +361,11 @@ func (p *Package) GetName() string {
|
||||
return p.Name
|
||||
}
|
||||
|
||||
// GetFullName returns the package full name
|
||||
func (p *Package) GetFullName() string {
|
||||
return strings.Join([]string{p.Name, p.Version, p.Architecture}, "_")
|
||||
}
|
||||
|
||||
// GetVersion returns package version
|
||||
func (p *Package) GetVersion() string {
|
||||
return p.Version
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ const (
|
||||
|
||||
// RemoteRepo represents remote (fetchable) Debian repository.
|
||||
//
|
||||
// Repostitory could be filtered when fetching by components, architectures
|
||||
// Repository could be filtered when fetching by components, architectures
|
||||
type RemoteRepo struct {
|
||||
// Permanent internal ID
|
||||
UUID string
|
||||
|
||||
+7
-1
@@ -26,8 +26,14 @@ type Snapshot struct {
|
||||
CreatedAt time.Time
|
||||
|
||||
// Source: kind + ID
|
||||
SourceKind string `codec:"SourceKind" json:"-"`
|
||||
SourceKind string `codec:"SourceKind"`
|
||||
SourceIDs []string `codec:"SourceIDs" json:"-"`
|
||||
// Sources
|
||||
Snapshots []*Snapshot `codec:"-" json:",omitempty"`
|
||||
RemoteRepos []*RemoteRepo `codec:"-" json:",omitempty"`
|
||||
LocalRepos []*LocalRepo `codec:"-" json:",omitempty"`
|
||||
Packages []string `codec:"-" json:",omitempty"`
|
||||
|
||||
// Description of how snapshot was created
|
||||
Description string
|
||||
|
||||
|
||||
Reference in New Issue
Block a user