Adjust built-in preferred content expressions to make most types of repositories want content that is only located on untrusted or dead repositories.

This commit is contained in:
Joey Hess 2013-03-31 17:10:25 -04:00
parent c57baaaa30
commit 940e167ecc
3 changed files with 44 additions and 13 deletions

View file

@ -16,6 +16,7 @@ data StandardGroup
| FullArchiveGroup
| SourceGroup
| ManualGroup
| UnwantedGroup
deriving (Eq, Ord, Enum, Bounded, Show)
fromStandardGroup :: StandardGroup -> String
@ -27,6 +28,7 @@ fromStandardGroup SmallArchiveGroup = "smallarchive"
fromStandardGroup FullArchiveGroup = "archive"
fromStandardGroup SourceGroup = "source"
fromStandardGroup ManualGroup = "manual"
fromStandardGroup UnwantedGroup = "unwanted"
toStandardGroup :: String -> Maybe StandardGroup
toStandardGroup "client" = Just ClientGroup
@ -37,6 +39,7 @@ toStandardGroup "smallarchive" = Just SmallArchiveGroup
toStandardGroup "archive" = Just FullArchiveGroup
toStandardGroup "source" = Just SourceGroup
toStandardGroup "manual" = Just ManualGroup
toStandardGroup "unwanted" = Just UnwantedGroup
toStandardGroup _ = Nothing
descStandardGroup :: StandardGroup -> String
@ -48,14 +51,26 @@ descStandardGroup SmallArchiveGroup = "small archive: archives files located in
descStandardGroup FullArchiveGroup = "full archive: archives all files not archived elsewhere"
descStandardGroup SourceGroup = "file source: moves files on to other repositories"
descStandardGroup ManualGroup = "manual mode: only stores files you manually choose"
descStandardGroup UnwantedGroup "unwanted: a repository in the process of being removed"
{- See doc/preferred_content.mdwn for explanations of these expressions. -}
preferredContent :: StandardGroup -> String
preferredContent ClientGroup = "exclude=*/archive/* and exclude=archive/*"
preferredContent TransferGroup = "not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup
preferredContent ClientGroup = normal
"exclude=*/archive/* and exclude=archive/*"
preferredContent TransferGroup = normal $
"not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup
preferredContent BackupGroup = "include=*"
preferredContent IncrementalBackupGroup = "include=* and (not copies=incrementalbackup:1)"
preferredContent SmallArchiveGroup = "(include=*/archive/* or include=archive/*) and " ++ preferredContent FullArchiveGroup
preferredContent FullArchiveGroup = "not (copies=archive:1 or copies=smallarchive:1)"
preferredContent IncrementalBackupGroup = normal $
"include=* and (not copies=incrementalbackup:1)"
preferredContent SmallArchiveGroup = normal $
"(include=*/archive/* or include=archive/*) and " ++ preferredContent FullArchiveGroup
preferredContent FullArchiveGroup = normal $
"not (copies=archive:1 or copies=smallarchive:1)"
preferredContent SourceGroup = "not (copies=1)"
preferredContent ManualGroup = "present and exclude=*/archive/* and exclude=archive/*"
preferredContent ManualGroup = normal $
"present and exclude=*/archive/* and exclude=archive/*"
preferredContent UnwantedGroup = "exclude=*"
where
{- Most repositories want any content that is only on untrusted
- or dead repositories. -}
normal s = "(" ++ s ++ ") or (not copies=semitrusted:1)"