mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-12 06:30:35 +00:00
Architecture parsing, package list from reflist.
This commit is contained in:
Vendored
+33
@@ -2,7 +2,9 @@ package debian
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"github.com/smira/aptly/database"
|
||||
. "launchpad.net/gocheck"
|
||||
"sort"
|
||||
)
|
||||
|
||||
type PackageListSuite struct {
|
||||
@@ -65,6 +67,31 @@ func (s *PackageListSuite) TestForeach(c *C) {
|
||||
|
||||
}
|
||||
|
||||
func (s *PackageListSuite) TestNewPackageListFromRefList(c *C) {
|
||||
db, _ := database.OpenDB(c.MkDir())
|
||||
coll := NewPackageCollection(db)
|
||||
coll.Update(s.p1)
|
||||
coll.Update(s.p3)
|
||||
|
||||
s.list.Add(s.p1)
|
||||
s.list.Add(s.p3)
|
||||
s.list.Add(s.p5)
|
||||
s.list.Add(s.p6)
|
||||
|
||||
reflist := NewPackageRefListFromPackageList(s.list)
|
||||
|
||||
_, err := NewPackageListFromRefList(reflist, coll)
|
||||
c.Assert(err, ErrorMatches, "unable to load package with key.*")
|
||||
|
||||
coll.Update(s.p5)
|
||||
coll.Update(s.p6)
|
||||
|
||||
list, err := NewPackageListFromRefList(reflist, coll)
|
||||
c.Assert(err, IsNil)
|
||||
c.Check(list.Len(), Equals, 4)
|
||||
c.Check(list.Add(s.p4), ErrorMatches, "conflict in package.*")
|
||||
}
|
||||
|
||||
func (s *PackageListSuite) TestNewPackageRefList(c *C) {
|
||||
s.list.Add(s.p1)
|
||||
s.list.Add(s.p3)
|
||||
@@ -195,3 +222,9 @@ func (s *PackageIndexedListSuite) TestVerifyDependencies(c *C) {
|
||||
|
||||
c.Check(err, ErrorMatches, "unable to process package app-1.0_s390:.*")
|
||||
}
|
||||
|
||||
func (s *PackageIndexedListSuite) TestArchitectures(c *C) {
|
||||
archs := s.pl.Architectures()
|
||||
sort.Strings(archs)
|
||||
c.Check(archs, DeepEquals, []string{"amd64", "arm", "i386", "s390"})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user