File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,9 @@ module Main (main) where
44import Control.Exception
55import Control.Monad
66import Control.Monad.Trans
7+ import Data.Function (on )
78import Data.List
9+ import qualified Data.List.NonEmpty as NonEmpty
810import Data.Version
911import Network.Browser
1012import System.Directory
@@ -118,10 +120,14 @@ mirrorOnce verbosity opts
118120 | null (selectedPkgs opts) = pkgsMissingFromDest
119121 | otherwise = subsetIndex (selectedPkgs opts)
120122 pkgsMissingFromDest
121- pkgsToMirror' = filter (\ (PkgIndexInfo pkg _ _ _) ->
122- pkg `Set.notMember` missingPkgs
123- && pkg `Set.notMember` unmirrorablePkgs )
124- pkgsToMirror
123+ byPkgId cmp = on cmp (\ (PkgIndexInfo pkg _ _ _) -> pkg)
124+ pkgsToMirror'
125+ -- Remove any duplicates in the index from metadata revisions
126+ = map NonEmpty. head . NonEmpty. groupBy (byPkgId (==) ) . sortBy (byPkgId compare )
127+ $ filter (\ (PkgIndexInfo pkg _ _ _) ->
128+ pkg `Set.notMember` missingPkgs
129+ && pkg `Set.notMember` unmirrorablePkgs)
130+ pkgsToMirror
125131 mirrorCount = length pkgsToMirror'
126132 ignoreCount = length pkgsToMirror - mirrorCount
127133
You can’t perform that action at this time.
0 commit comments