mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-30 04:20:53 +00:00
Slight refactoring, add oldRefs. #8
This commit is contained in:
+12
-14
@@ -34,9 +34,14 @@ type PublishedRepo struct {
|
|||||||
// SourceUUID is UUID of either snapshot or local repo
|
// SourceUUID is UUID of either snapshot or local repo
|
||||||
SourceUUID string `codec:"SnapshotUUID"`
|
SourceUUID string `codec:"SnapshotUUID"`
|
||||||
|
|
||||||
snapshot *Snapshot
|
// Pointer to snapshot if SourceKind == "snapshot"
|
||||||
localRepo *LocalRepo
|
snapshot *Snapshot
|
||||||
|
// Pointer to local repo if SourceKind == "local"
|
||||||
|
localRepo *LocalRepo
|
||||||
|
// Package references is SourceKind == "local"
|
||||||
packageRefs *PackageRefList
|
packageRefs *PackageRefList
|
||||||
|
// Old (currently created) package references
|
||||||
|
oldRefs *PackageRefList
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPublishedRepo creates new published repository
|
// NewPublishedRepo creates new published repository
|
||||||
@@ -203,7 +208,10 @@ func (p *PublishedRepo) RefList() *PackageRefList {
|
|||||||
if p.SourceKind == "local" {
|
if p.SourceKind == "local" {
|
||||||
return p.packageRefs
|
return p.packageRefs
|
||||||
}
|
}
|
||||||
return p.snapshot.RefList()
|
if p.SourceKind == "snapshot" {
|
||||||
|
return p.snapshot.RefList()
|
||||||
|
}
|
||||||
|
panic("unknown source")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Encode does msgpack encoding of PublishedRepo
|
// Encode does msgpack encoding of PublishedRepo
|
||||||
@@ -249,18 +257,8 @@ func (p *PublishedRepo) Publish(packagePool aptly.PackagePool, publishedStorage
|
|||||||
progress.Printf("Loading packages...\n")
|
progress.Printf("Loading packages...\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
var refList *PackageRefList
|
|
||||||
|
|
||||||
if p.snapshot != nil {
|
|
||||||
refList = p.snapshot.RefList()
|
|
||||||
} else if p.localRepo != nil {
|
|
||||||
refList = p.localRepo.RefList()
|
|
||||||
} else {
|
|
||||||
panic("no source")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load all packages
|
// Load all packages
|
||||||
list, err := NewPackageListFromRefList(refList, collectionFactory.PackageCollection(), progress)
|
list, err := NewPackageListFromRefList(p.RefList(), collectionFactory.PackageCollection(), progress)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("unable to load packages: %s", err)
|
return fmt.Errorf("unable to load packages: %s", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user