fedora-dists 2.0.0 → 2.1.0
raw patch · 5 files changed
+35/−11 lines, 5 filesdep −bytestringdep −timePVP ok
version bump matches the API change (PVP)
Dependencies removed: bytestring, time
API changes (from Hackage documentation)
+ Distribution.Fedora: EPELNext :: Int -> Dist
+ Distribution.Fedora.Branch: EPELNext :: Int -> Branch
Files
- CHANGELOG.md +4/−0
- README.md +2/−1
- fedora-dists.cabal +6/−7
- src/Distribution/Fedora.hs +9/−2
- src/Distribution/Fedora/Branch.hs +14/−1
CHANGELOG.md view
@@ -2,6 +2,10 @@ `fedora-dists` uses [PVP Versioning](https://pvp.haskell.org). +## 2.1.0 (2022-05-18)+- add epel-next to Dist and Branch (juhp/fbrnch#29)+- remove obsolete deps on bytestring and time+ ## 2.0.0 (2022-01-17) - Distribution.Fedora: new IO-based Dist API without Fedora version hardcoding
README.md view
@@ -6,5 +6,6 @@ [](http://stackage.org/nightly/package/fedora-dists) [](https://github.com/juhp/fedora-dists/actions) - Library for Fedora distribution versions++See <https://hackage.haskell.org/package/fedora-dists> for documentation.
fedora-dists.cabal view
@@ -1,12 +1,13 @@ cabal-version: 1.18 name: fedora-dists-version: 2.0.0+version: 2.1.0 synopsis: Library for Fedora distribution versions description:- This library provides the Dist datatype and various associated- metadata functions for Red Hat distributions (Fedora, EPEL, RHEL)- needed for packaging development and building. It uses current- releasedata from Fedora PDC. Also provides a Branch type.+ This library provides the Dist and Branch datatypes+ and various associated metadata functions for+ Red Hat distributions (Fedora, EPEL, RHEL) needed for+ packaging development and building.+ It uses current releasedata from Fedora PDC. homepage: https://github.com/juhp/fedora-dists bug-reports: https://github.com/juhp/fedora-dists/issues license: GPL-3@@ -34,11 +35,9 @@ build-depends: base >= 4.6 && < 5 , aeson- , bytestring , pdc , cached-json-file , text- , time ghc-options: -Wall if impl(ghc >= 8.0)
src/Distribution/Fedora.hs view
@@ -52,18 +52,21 @@ -- (roughly corresponds to a git branch) data Dist = RHEL Version -- ^ RHEL version | EPEL Int -- ^ EPEL release+ | EPELNext Int -- ^ EPEL Next release | Fedora Int -- ^ Fedora release deriving (Eq, Ord) instance Show Dist where show (Fedora n) = "f" ++ show n show (EPEL n) = (if n <= 6 then "el" else "epel") ++ show n+ show (EPELNext n) = "epel" ++ show n ++ "-next" show (RHEL v) = "rhel-" ++ showVersion v -- | Read from eg "f35", "epel8" instance Read Dist where- readPrec = choice [pFedora, pEPEL, pRHEL] where+ readPrec = choice [pFedora, pEPELNext, pEPEL, pRHEL] where pFedora = Fedora <$> (lift (char 'f') *> readPrec)+ pEPELNext = EPELNext <$> (lift (string "epel") *> readPrec <* lift (string "-next")) pEPEL = EPEL <$> (lift (string "epel") *> readPrec) pRHEL = RHEL <$> lift (do v <- string "rhel-" >> parseVersion@@ -167,6 +170,7 @@ distRepo branched (Fedora n) | Fedora n > branched = "rawhide" | otherwise = "fedora" distRepo _ (EPEL _) = "epel"+distRepo _ (EPELNext _) = "epel-next" distRepo _ (RHEL _) = "rhel" -- | Map `Dist` to Maybe the DNF/YUM updates repo name, relative to latest branch@@ -178,7 +182,8 @@ -- | Whether dist has overrides in Bodhi, relative to latest branch distOverride :: Dist -> Dist -> Bool distOverride branch (Fedora n) = Fedora n <= branch-distOverride _ (EPEL n) = n < 9+distOverride _ (EPEL n) = n < 10+distOverride _ (EPELNext n) = n < 10 distOverride _ _ = False -- | OS release major version for `Dist`, relative to latest branch@@ -186,6 +191,7 @@ distVersion branch (Fedora n) | Fedora n > branch = "rawhide" distVersion _ (Fedora n) = show n distVersion _ (EPEL n) = show n+distVersion _ (EPELNext n) = show n distVersion _ (RHEL n) = show n -- | Mock configuration for `Dist` and arch, relative to latest branch@@ -202,6 +208,7 @@ rpmDistTag :: Dist -> String rpmDistTag (Fedora n) = ".fc" ++ show n rpmDistTag (EPEL n) = ".el" ++ show n+rpmDistTag (EPELNext n) = ".el" ++ show n rpmDistTag (RHEL v) = ".el" ++ (show . head . versionBranch) v -- | Command line tool for `Dist` (eg "koji")
src/Distribution/Fedora/Branch.hs view
@@ -46,13 +46,16 @@ -- | Branch datatype -- -- Branch can be rawhide, or a fedora or epel branch-data Branch = EPEL Int | Fedora Int | Rawhide+data Branch = EPEL Int | EPELNext Int | Fedora Int | Rawhide deriving (Eq, Ord) -- | Read a Fedora Branch name, otherwise return branch string eitherBranch :: String -> Either String Branch eitherBranch "rawhide" = Right Rawhide eitherBranch ('f':ns) | all isDigit ns = let br = Fedora (read ns) in Right br+-- FIXME add proper parsing:+eitherBranch "epel8-next" = Right $ EPELNext 8+eitherBranch "epel9-next" = Right $ EPELNext 9 eitherBranch ('e':'p':'e':'l':n) | all isDigit n = let br = EPEL (read n) in Right br eitherBranch ('e':'l':n) | all isDigit n = let br = EPEL (read n) in Right br eitherBranch cs = Left cs@@ -110,17 +113,20 @@ show Rawhide = "rawhide" show (Fedora n) = "f" ++ show n show (EPEL n) = (if n <= 6 then "el" else "epel") ++ show n+ show (EPELNext n) = "epel" ++ show n ++ "-next" -- | Map Branch to Koji destination tag branchDestTag :: Branch -> String branchDestTag Rawhide = "rawhide" branchDestTag (Fedora n) = show (Fedora n) ++ "-updates-candidate" branchDestTag (EPEL n) = show (EPEL n) ++ "-testing-candidate"+branchDestTag (EPELNext n) = show (EPELNext n) ++ "-testing-candidate" -- | Default build target associated with a branch branchTarget :: Branch -> String branchTarget (Fedora n) = show (Fedora n) branchTarget (EPEL n) = show (EPEL n)+branchTarget (EPELNext n) = show (EPELNext n) branchTarget Rawhide = "rawhide" --getLatestBranch :: IO Branch@@ -142,6 +148,12 @@ then EPEL (n+1) else EPEL n else error' $ "Unsupported branch: " ++ show (EPEL n)+newerBranch (EPELNext n) branches =+ if EPELNext n `elem` branches+ then if EPELNext (n+1) `elem` branches+ then EPELNext (n+1)+ else EPELNext n+ else error' $ "Unsupported branch: " ++ show (EPELNext n) --olderBranch :: Branch -> Branch --olderBranch Rawhide = latestBranch@@ -182,4 +194,5 @@ branchDist :: Branch -> IO Dist.Dist branchDist (Fedora n) = return $ Dist.Fedora n branchDist (EPEL n) = return $ Dist.EPEL n+branchDist (EPELNext n) = return $ Dist.EPELNext n branchDist Rawhide = Dist.getRawhideDist