From c06e69a48567376d38f61170ec3f866fe12a748a Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 24 Feb 2014 23:46:11 +0400 Subject: [PATCH] In db cleanup include local repos. --- cmd/db_cleanup.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/db_cleanup.go b/cmd/db_cleanup.go index fdd1ff89..fdb14967 100644 --- a/cmd/db_cleanup.go +++ b/cmd/db_cleanup.go @@ -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)