mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
List of architectures now includes optionally "source" virtual arch.
This commit is contained in:
+2
-2
@@ -179,7 +179,7 @@ func aptlySnapshotVerify(cmd *commander.Command, args []string) error {
|
|||||||
if len(context.architecturesList) > 0 {
|
if len(context.architecturesList) > 0 {
|
||||||
architecturesList = context.architecturesList
|
architecturesList = context.architecturesList
|
||||||
} else {
|
} else {
|
||||||
architecturesList = packageList.Architectures()
|
architecturesList = packageList.Architectures(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(architecturesList) == 0 {
|
if len(architecturesList) == 0 {
|
||||||
@@ -271,7 +271,7 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error {
|
|||||||
if len(context.architecturesList) > 0 {
|
if len(context.architecturesList) > 0 {
|
||||||
architecturesList = context.architecturesList
|
architecturesList = context.architecturesList
|
||||||
} else {
|
} else {
|
||||||
architecturesList = packageList.Architectures()
|
architecturesList = packageList.Architectures(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(architecturesList) == 0 {
|
if len(architecturesList) == 0 {
|
||||||
|
|||||||
Vendored
+5
-3
@@ -158,11 +158,13 @@ func (l *PackageList) Remove(p *Package) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Architectures returns list of architectures present in packages
|
// Architectures returns list of architectures present in packages and flag if source packages are present.
|
||||||
func (l *PackageList) Architectures() (result []string) {
|
//
|
||||||
|
// If includeSource is true, meta-architecture "source" would be present in the list
|
||||||
|
func (l *PackageList) Architectures(includeSource bool) (result []string) {
|
||||||
result = make([]string, 0, 10)
|
result = make([]string, 0, 10)
|
||||||
for _, pkg := range l.packages {
|
for _, pkg := range l.packages {
|
||||||
if pkg.Architecture != "all" && !utils.StrSliceHasItem(result, pkg.Architecture) {
|
if pkg.Architecture != "all" && (pkg.Architecture != "source" || includeSource) && !utils.StrSliceHasItem(result, pkg.Architecture) {
|
||||||
result = append(result, pkg.Architecture)
|
result = append(result, pkg.Architecture)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+11
-6
@@ -51,6 +51,7 @@ func (s *PackageListSuite) SetUpTest(c *C) {
|
|||||||
&Package{Name: "dpkg", Version: "1.6.1-3", Architecture: "amd64", Provides: []string{"package-installer"}},
|
&Package{Name: "dpkg", Version: "1.6.1-3", Architecture: "amd64", Provides: []string{"package-installer"}},
|
||||||
&Package{Name: "libx", Version: "1.5", Architecture: "arm", PreDepends: []string{"dpkg (>= 1.6)"}},
|
&Package{Name: "libx", Version: "1.5", Architecture: "arm", PreDepends: []string{"dpkg (>= 1.6)"}},
|
||||||
&Package{Name: "dpkg", Version: "1.6.1-3", Architecture: "arm", Provides: []string{"package-installer"}},
|
&Package{Name: "dpkg", Version: "1.6.1-3", Architecture: "arm", Provides: []string{"package-installer"}},
|
||||||
|
&Package{Name: "dpkg", Version: "1.6.1-3", Architecture: "source", SourceArchitecture: "any"},
|
||||||
}
|
}
|
||||||
for _, p := range s.packages {
|
for _, p := range s.packages {
|
||||||
s.il.Add(p)
|
s.il.Add(p)
|
||||||
@@ -110,14 +111,14 @@ func (s *PackageListSuite) TestRemoveWhenIndexed(c *C) {
|
|||||||
for i, p := range s.il.packagesIndex {
|
for i, p := range s.il.packagesIndex {
|
||||||
names[i] = p.Name
|
names[i] = p.Name
|
||||||
}
|
}
|
||||||
c.Check(names, DeepEquals, []string{"aa", "app", "app", "app", "app", "data", "dpkg", "dpkg", "dpkg", "libx", "mailer"})
|
c.Check(names, DeepEquals, []string{"aa", "app", "app", "app", "app", "data", "dpkg", "dpkg", "dpkg", "dpkg", "libx", "mailer"})
|
||||||
|
|
||||||
s.il.Remove(s.packages[4])
|
s.il.Remove(s.packages[4])
|
||||||
names = make([]string, s.il.Len())
|
names = make([]string, s.il.Len())
|
||||||
for i, p := range s.il.packagesIndex {
|
for i, p := range s.il.packagesIndex {
|
||||||
names[i] = p.Name
|
names[i] = p.Name
|
||||||
}
|
}
|
||||||
c.Check(names, DeepEquals, []string{"aa", "app", "app", "app", "app", "data", "dpkg", "dpkg", "dpkg", "libx"})
|
c.Check(names, DeepEquals, []string{"aa", "app", "app", "app", "app", "data", "dpkg", "dpkg", "dpkg", "dpkg", "libx"})
|
||||||
c.Check(s.il.providesIndex["mail-agent"], DeepEquals, []*Package{})
|
c.Check(s.il.providesIndex["mail-agent"], DeepEquals, []*Package{})
|
||||||
|
|
||||||
s.il.Remove(s.packages[9])
|
s.il.Remove(s.packages[9])
|
||||||
@@ -125,7 +126,7 @@ func (s *PackageListSuite) TestRemoveWhenIndexed(c *C) {
|
|||||||
for i, p := range s.il.packagesIndex {
|
for i, p := range s.il.packagesIndex {
|
||||||
names[i] = p.Name
|
names[i] = p.Name
|
||||||
}
|
}
|
||||||
c.Check(names, DeepEquals, []string{"aa", "app", "app", "app", "app", "data", "dpkg", "dpkg", "libx"})
|
c.Check(names, DeepEquals, []string{"aa", "app", "app", "app", "app", "data", "dpkg", "dpkg", "dpkg", "libx"})
|
||||||
c.Check(s.il.providesIndex["package-installer"], HasLen, 2)
|
c.Check(s.il.providesIndex["package-installer"], HasLen, 2)
|
||||||
|
|
||||||
s.il.Remove(s.packages[1])
|
s.il.Remove(s.packages[1])
|
||||||
@@ -133,7 +134,7 @@ func (s *PackageListSuite) TestRemoveWhenIndexed(c *C) {
|
|||||||
for i, p := range s.il.packagesIndex {
|
for i, p := range s.il.packagesIndex {
|
||||||
names[i] = p.Name
|
names[i] = p.Name
|
||||||
}
|
}
|
||||||
c.Check(names, DeepEquals, []string{"aa", "app", "app", "app", "app", "data", "dpkg", "libx"})
|
c.Check(names, DeepEquals, []string{"aa", "app", "app", "app", "app", "data", "dpkg", "dpkg", "libx"})
|
||||||
c.Check(s.il.providesIndex["package-installer"], DeepEquals, []*Package{s.packages[11]})
|
c.Check(s.il.providesIndex["package-installer"], DeepEquals, []*Package{s.packages[11]})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -173,7 +174,7 @@ func (s *PackageListSuite) TestAppend(c *C) {
|
|||||||
|
|
||||||
err := s.list.Append(s.il)
|
err := s.list.Append(s.il)
|
||||||
c.Check(err, IsNil)
|
c.Check(err, IsNil)
|
||||||
c.Check(s.list.Len(), Equals, 14)
|
c.Check(s.list.Len(), Equals, 15)
|
||||||
|
|
||||||
list := NewPackageList()
|
list := NewPackageList()
|
||||||
list.Add(s.p4)
|
list.Add(s.p4)
|
||||||
@@ -238,7 +239,11 @@ func (s *PackageListSuite) TestVerifyDependencies(c *C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *PackageListSuite) TestArchitectures(c *C) {
|
func (s *PackageListSuite) TestArchitectures(c *C) {
|
||||||
archs := s.il.Architectures()
|
archs := s.il.Architectures(true)
|
||||||
|
sort.Strings(archs)
|
||||||
|
c.Check(archs, DeepEquals, []string{"amd64", "arm", "i386", "s390", "source"})
|
||||||
|
|
||||||
|
archs = s.il.Architectures(false)
|
||||||
sort.Strings(archs)
|
sort.Strings(archs)
|
||||||
c.Check(archs, DeepEquals, []string{"amd64", "arm", "i386", "s390"})
|
c.Check(archs, DeepEquals, []string{"amd64", "arm", "i386", "s390"})
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+1
-1
@@ -113,7 +113,7 @@ func (p *PublishedRepo) Publish(repo *Repository, packageCollection *PackageColl
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(p.Architectures) == 0 {
|
if len(p.Architectures) == 0 {
|
||||||
p.Architectures = list.Architectures()
|
p.Architectures = list.Architectures(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(p.Architectures) == 0 {
|
if len(p.Architectures) == 0 {
|
||||||
|
|||||||
Reference in New Issue
Block a user