mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-07-27 13:57:46 +00:00
Merge branch 'master' into skipCleanup
This commit is contained in:
@@ -29,3 +29,8 @@ func InitContext(flags *flag.FlagSet) error {
|
|||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetContext gives access to the context
|
||||||
|
func GetContext() *ctx.AptlyContext {
|
||||||
|
return context
|
||||||
|
}
|
||||||
|
|||||||
+36
-16
@@ -124,6 +124,14 @@ func NewPackageListFromRefList(reflist *PackageRefList, collection *PackageColle
|
|||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Has checks whether package is already in the list
|
||||||
|
func (l *PackageList) Has(p *Package) bool {
|
||||||
|
key := l.keyFunc(p)
|
||||||
|
_, ok := l.packages[key]
|
||||||
|
|
||||||
|
return ok
|
||||||
|
}
|
||||||
|
|
||||||
// Add appends package to package list, additionally checking for uniqueness
|
// Add appends package to package list, additionally checking for uniqueness
|
||||||
func (l *PackageList) Add(p *Package) error {
|
func (l *PackageList) Add(p *Package) error {
|
||||||
key := l.keyFunc(p)
|
key := l.keyFunc(p)
|
||||||
@@ -441,18 +449,6 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*
|
|||||||
panic("list not indexed, can't search")
|
panic("list not indexed, can't search")
|
||||||
}
|
}
|
||||||
|
|
||||||
if dep.Relation == VersionDontCare {
|
|
||||||
for _, p := range l.providesIndex[dep.Pkg] {
|
|
||||||
if dep.Architecture == "" || p.MatchesArchitecture(dep.Architecture) {
|
|
||||||
searchResults = append(searchResults, p)
|
|
||||||
|
|
||||||
if !allMatches {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
i := sort.Search(len(l.packagesIndex), func(j int) bool { return l.packagesIndex[j].Name >= dep.Pkg })
|
i := sort.Search(len(l.packagesIndex), func(j int) bool { return l.packagesIndex[j].Name >= dep.Pkg })
|
||||||
|
|
||||||
for i < len(l.packagesIndex) && l.packagesIndex[i].Name == dep.Pkg {
|
for i < len(l.packagesIndex) && l.packagesIndex[i].Name == dep.Pkg {
|
||||||
@@ -468,6 +464,18 @@ func (l *PackageList) Search(dep Dependency, allMatches bool) (searchResults []*
|
|||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if dep.Relation == VersionDontCare {
|
||||||
|
for _, p := range l.providesIndex[dep.Pkg] {
|
||||||
|
if dep.Architecture == "" || p.MatchesArchitecture(dep.Architecture) {
|
||||||
|
searchResults = append(searchResults, p)
|
||||||
|
|
||||||
|
if !allMatches {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -511,15 +519,27 @@ func (l *PackageList) FilterWithProgress(queries []PackageQuery, withDependencie
|
|||||||
|
|
||||||
// try to satisfy dependencies
|
// try to satisfy dependencies
|
||||||
for _, dep := range missing {
|
for _, dep := range missing {
|
||||||
// dependency might have already been satisfied
|
if dependencyOptions&DepFollowAllVariants == 0 {
|
||||||
// with packages already been added
|
// dependency might have already been satisfied
|
||||||
if result.Search(dep, false) != nil {
|
// with packages already been added
|
||||||
continue
|
//
|
||||||
|
// when follow-all-variants is enabled, we need to try to expand anyway,
|
||||||
|
// as even if dependency is satisfied now, there might be other ways to satisfy dependency
|
||||||
|
if result.Search(dep, false) != nil {
|
||||||
|
if dependencyOptions&DepVerboseResolve == DepVerboseResolve && progress != nil {
|
||||||
|
progress.ColoredPrintf("@{y}Already satisfied dependency@|: %s with %s", &dep, result.Search(dep, true))
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResults := l.Search(dep, true)
|
searchResults := l.Search(dep, true)
|
||||||
if len(searchResults) > 0 {
|
if len(searchResults) > 0 {
|
||||||
for _, p := range searchResults {
|
for _, p := range searchResults {
|
||||||
|
if result.Has(p) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if dependencyOptions&DepVerboseResolve == DepVerboseResolve && progress != nil {
|
if dependencyOptions&DepVerboseResolve == DepVerboseResolve && progress != nil {
|
||||||
progress.ColoredPrintf("@{g}Injecting package@|: %s", p)
|
progress.ColoredPrintf("@{g}Injecting package@|: %s", p)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,6 +262,13 @@ func ParseDependency(dep string) (d Dependency, err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
d.Pkg = strings.TrimSpace(dep[0:i])
|
d.Pkg = strings.TrimSpace(dep[0:i])
|
||||||
|
if strings.ContainsRune(d.Pkg, ':') {
|
||||||
|
parts := strings.SplitN(d.Pkg, ":", 2)
|
||||||
|
d.Pkg, d.Architecture = parts[0], parts[1]
|
||||||
|
if d.Architecture == "any" {
|
||||||
|
d.Architecture = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rel := ""
|
rel := ""
|
||||||
if dep[i+1] == '>' || dep[i+1] == '<' || dep[i+1] == '=' {
|
if dep[i+1] == '>' || dep[i+1] == '<' || dep[i+1] == '=' {
|
||||||
|
|||||||
@@ -164,6 +164,20 @@ func (s *VersionSuite) TestParseDependency(c *C) {
|
|||||||
c.Check(d.Version, Equals, "1.6")
|
c.Check(d.Version, Equals, "1.6")
|
||||||
c.Check(d.Architecture, Equals, "i386")
|
c.Check(d.Architecture, Equals, "i386")
|
||||||
|
|
||||||
|
d, e = ParseDependency("python:any (>= 2.7~)")
|
||||||
|
c.Check(e, IsNil)
|
||||||
|
c.Check(d.Pkg, Equals, "python")
|
||||||
|
c.Check(d.Relation, Equals, VersionGreaterOrEqual)
|
||||||
|
c.Check(d.Version, Equals, "2.7~")
|
||||||
|
c.Check(d.Architecture, Equals, "")
|
||||||
|
|
||||||
|
d, e = ParseDependency("python:amd64 (>= 2.7~)")
|
||||||
|
c.Check(e, IsNil)
|
||||||
|
c.Check(d.Pkg, Equals, "python")
|
||||||
|
c.Check(d.Relation, Equals, VersionGreaterOrEqual)
|
||||||
|
c.Check(d.Version, Equals, "2.7~")
|
||||||
|
c.Check(d.Architecture, Equals, "amd64")
|
||||||
|
|
||||||
d, e = ParseDependency("dpkg{i386}")
|
d, e = ParseDependency("dpkg{i386}")
|
||||||
c.Check(e, IsNil)
|
c.Check(e, IsNil)
|
||||||
c.Check(d.Pkg, Equals, "dpkg")
|
c.Check(d.Pkg, Equals, "dpkg")
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
|
|||||||
tar_1.26+dfsg-0.1_i386
|
tar_1.26+dfsg-0.1_i386
|
||||||
ttf-bitstream-vera_1.10-8_all
|
ttf-bitstream-vera_1.10-8_all
|
||||||
ttf-dejavu-core_2.33-3_all
|
ttf-dejavu-core_2.33-3_all
|
||||||
|
ttf-freefont_20120503-1_all
|
||||||
ucf_3.0025+nmu3_all
|
ucf_3.0025+nmu3_all
|
||||||
x11-common_1:7.7+3~deb7u1_all
|
x11-common_1:7.7+3~deb7u1_all
|
||||||
xfonts-encodings_1:1.0.4-1_all
|
xfonts-encodings_1:1.0.4-1_all
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
[snap1]: Snapshot from mirror [wheezy-main]: http://mirror.yandex.ru/debian/ wheezy
|
[snap1]: Snapshot from mirror [wheezy-main]: http://mirror.yandex.ru/debian/ wheezy
|
||||||
[snap2]: Snapshot from mirror [wheezy-backports]: http://mirror.yandex.ru/debian/ wheezy-backports
|
[snap2]: Snapshot from mirror [wheezy-backports]: http://mirror.yandex.ru/debian/ wheezy-backports
|
||||||
|
Already satisfied dependency: init-system-helpers (>= 1.18~) [i386] with [init-system-helpers_1.18~bpo70+1_all]
|
||||||
Building indexes...
|
Building indexes...
|
||||||
Dependencies would be pulled into snapshot:
|
Dependencies would be pulled into snapshot:
|
||||||
Injecting package: init-system-helpers_1.18~bpo70+1_all
|
Injecting package: init-system-helpers_1.18~bpo70+1_all
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
|
|||||||
tar_1.26+dfsg-0.1_i386
|
tar_1.26+dfsg-0.1_i386
|
||||||
ttf-bitstream-vera_1.10-8_all
|
ttf-bitstream-vera_1.10-8_all
|
||||||
ttf-dejavu-core_2.33-3_all
|
ttf-dejavu-core_2.33-3_all
|
||||||
|
ttf-freefont_20120503-1_all
|
||||||
ucf_3.0025+nmu3_all
|
ucf_3.0025+nmu3_all
|
||||||
x11-common_1:7.7+3~deb7u1_all
|
x11-common_1:7.7+3~deb7u1_all
|
||||||
xfonts-encodings_1:1.0.4-1_all
|
xfonts-encodings_1:1.0.4-1_all
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ tar_1.26+dfsg-0.1_amd64
|
|||||||
tar_1.26+dfsg-0.1_i386
|
tar_1.26+dfsg-0.1_i386
|
||||||
ttf-bitstream-vera_1.10-8_all
|
ttf-bitstream-vera_1.10-8_all
|
||||||
ttf-dejavu-core_2.33-3_all
|
ttf-dejavu-core_2.33-3_all
|
||||||
|
ttf-freefont_20120503-1_all
|
||||||
ucf_3.0025+nmu3_all
|
ucf_3.0025+nmu3_all
|
||||||
x11-common_1:7.7+3~deb7u1_all
|
x11-common_1:7.7+3~deb7u1_all
|
||||||
xfonts-encodings_1:1.0.4-1_all
|
xfonts-encodings_1:1.0.4-1_all
|
||||||
|
|||||||
Reference in New Issue
Block a user