mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-06 22:18:28 +00:00
When loading package index for the mirror, ignore duplicate packages (and print about them). #183
This commit is contained in:
+6
-1
@@ -38,6 +38,11 @@ type PackageList struct {
|
|||||||
providesIndex map[string][]*Package
|
providesIndex map[string][]*Package
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// PackageConflictError means that package can't be added to the list due to error
|
||||||
|
type PackageConflictError struct {
|
||||||
|
error
|
||||||
|
}
|
||||||
|
|
||||||
// Verify interface
|
// Verify interface
|
||||||
var (
|
var (
|
||||||
_ sort.Interface = &PackageList{}
|
_ sort.Interface = &PackageList{}
|
||||||
@@ -90,7 +95,7 @@ func (l *PackageList) Add(p *Package) error {
|
|||||||
existing, ok := l.packages[key]
|
existing, ok := l.packages[key]
|
||||||
if ok {
|
if ok {
|
||||||
if !existing.Equals(p) {
|
if !existing.Equals(p) {
|
||||||
return fmt.Errorf("conflict in package %s", p)
|
return &PackageConflictError{fmt.Errorf("conflict in package %s", p)}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -468,8 +468,12 @@ func (repo *RemoteRepo) DownloadPackageIndexes(progress aptly.Progress, d aptly.
|
|||||||
}
|
}
|
||||||
err = repo.packageList.Add(p)
|
err = repo.packageList.Add(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if _, ok := err.(*PackageConflictError); ok {
|
||||||
|
progress.ColoredPrintf("@y[!]@| @!skipping package %s: duplicate in packages index@|", p)
|
||||||
|
} else {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = collectionFactory.PackageCollection().Update(p)
|
err = collectionFactory.PackageCollection().Update(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user