In db cleanup include local repos.

This commit is contained in:
Andrey Smirnov
2014-02-24 23:46:11 +04:00
parent 1b10c87bad
commit c06e69a485
+16 -1
View File
@@ -20,7 +20,7 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
// collect information about references packages...
existingPackageRefs := debian.NewPackageRefList()
context.progress.Printf("Loading mirrors and snapshots...\n")
context.progress.Printf("Loading mirrors, local repos and snapshots...\n")
repoCollection := debian.NewRemoteRepoCollection(context.database)
err = repoCollection.ForEach(func(repo *debian.RemoteRepo) error {
err := repoCollection.LoadComplete(repo)
@@ -36,6 +36,21 @@ func aptlyDbCleanup(cmd *commander.Command, args []string) error {
return err
}
localRepoCollection := debian.NewLocalRepoCollection(context.database)
err = localRepoCollection.ForEach(func(repo *debian.LocalRepo) error {
err := localRepoCollection.LoadComplete(repo)
if err != nil {
return err
}
if repo.RefList() != nil {
existingPackageRefs = existingPackageRefs.Merge(repo.RefList(), false)
}
return nil
})
if err != nil {
return err
}
snapshotCollection := debian.NewSnapshotCollection(context.database)
err = snapshotCollection.ForEach(func(snapshot *debian.Snapshot) error {
err := snapshotCollection.LoadComplete(snapshot)