From 1c30b2b9de1e8aec41a2423afce52ef6f5abc6bf Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Thu, 10 Jul 2014 00:10:53 +0400 Subject: [PATCH] Simplification: we are already able to search for all packages. #70 --- cmd/snapshot_pull.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cmd/snapshot_pull.go b/cmd/snapshot_pull.go index 956b29c2..c4a6c4f3 100644 --- a/cmd/snapshot_pull.go +++ b/cmd/snapshot_pull.go @@ -107,12 +107,10 @@ func aptlySnapshotPull(cmd *commander.Command, args []string) error { if !noRemove { // Remove all packages with the same name and architecture for _, pkg := range searchResults { - for pS := packageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}, allMatches); pS != nil; { - for _, p := range pS { - packageList.Remove(p) - context.Progress().ColoredPrintf("@r[-]@| %s removed", p) - } - pS = packageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}, allMatches) + pS := packageList.Search(deb.Dependency{Architecture: pkg.Architecture, Pkg: pkg.Name}, true) + for _, p := range pS { + packageList.Remove(p) + context.Progress().ColoredPrintf("@r[-]@| %s removed", p) } } } @@ -197,6 +195,5 @@ Example: cmd.Flag.Bool("no-remove", false, "don't remove other package versions when pulling package") cmd.Flag.Bool("all-matches", false, "pull all the packages that satisfy the dependency version requirements") - return cmd }