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
4
4
import Control.Exception
5
5
import Control.Monad
6
6
import Control.Monad.Trans
7
+ import Data.Function (on )
7
8
import Data.List
9
+ import qualified Data.List.NonEmpty as NonEmpty
8
10
import Data.Version
9
11
import Network.Browser
10
12
import System.Directory
@@ -118,10 +120,14 @@ mirrorOnce verbosity opts
118
120
| null (selectedPkgs opts) = pkgsMissingFromDest
119
121
| otherwise = subsetIndex (selectedPkgs opts)
120
122
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
125
131
mirrorCount = length pkgsToMirror'
126
132
ignoreCount = length pkgsToMirror - mirrorCount
127
133
You can’t perform that action at this time.
0 commit comments