mirror of
https://github.com/haskell/hackage-server.git
synced 2024-11-28 14:22:38 +03:00
Merge pull request #1225 from RaoulHC/avoid-repeated-tarball-mirroring
Filter out metadata revisions in index before mirroring
This commit is contained in:
commit
5662ff4a0d
@ -4,7 +4,9 @@ module Main (main) where
|
|||||||
import Control.Exception
|
import Control.Exception
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Control.Monad.Trans
|
import Control.Monad.Trans
|
||||||
|
import Data.Function (on)
|
||||||
import Data.List
|
import Data.List
|
||||||
|
import qualified Data.List.NonEmpty as NonEmpty
|
||||||
import Data.Version
|
import Data.Version
|
||||||
import Network.Browser
|
import Network.Browser
|
||||||
import System.Directory
|
import System.Directory
|
||||||
@ -118,10 +120,14 @@ mirrorOnce verbosity opts
|
|||||||
| null (selectedPkgs opts) = pkgsMissingFromDest
|
| null (selectedPkgs opts) = pkgsMissingFromDest
|
||||||
| otherwise = subsetIndex (selectedPkgs opts)
|
| otherwise = subsetIndex (selectedPkgs opts)
|
||||||
pkgsMissingFromDest
|
pkgsMissingFromDest
|
||||||
pkgsToMirror' = filter (\(PkgIndexInfo pkg _ _ _) ->
|
byPkgId cmp = on cmp (\(PkgIndexInfo pkg _ _ _) -> pkg)
|
||||||
pkg `Set.notMember` missingPkgs
|
pkgsToMirror'
|
||||||
&& pkg `Set.notMember` unmirrorablePkgs )
|
-- Remove any duplicates in the index from metadata revisions
|
||||||
pkgsToMirror
|
= map NonEmpty.head . NonEmpty.groupBy (byPkgId (==)) . sortBy (byPkgId compare)
|
||||||
|
$ filter (\(PkgIndexInfo pkg _ _ _) ->
|
||||||
|
pkg `Set.notMember` missingPkgs
|
||||||
|
&& pkg `Set.notMember` unmirrorablePkgs)
|
||||||
|
pkgsToMirror
|
||||||
mirrorCount = length pkgsToMirror'
|
mirrorCount = length pkgsToMirror'
|
||||||
ignoreCount = length pkgsToMirror - mirrorCount
|
ignoreCount = length pkgsToMirror - mirrorCount
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user