-
-
Save mullikine/ee0401455c881bd2b5981f182cd38705 to your computer and use it in GitHub Desktop.
haskell turtle shell script to check NVRs of epel7 packages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {-# LANGUAGE OverloadedStrings #-} | |
| import Turtle | |
| import Data.Text (words) | |
| rpmspecSrc qf spec = do | |
| (_res, out) <- procStrict "rpmspec" ["-q", "--srpm", "--undefine=dist", "--qf", qf, spec] empty | |
| return out | |
| nvr = "%{name}-%{version}-%{release}" | |
| checkPkg :: Turtle.FilePath -> Text -> Shell () | |
| checkPkg top p = do | |
| el7 <- testdir $ branchDir "epel7" | |
| when el7 $ do | |
| hasSpec <- testfile $ specfile "epel7" | |
| when hasSpec $ do | |
| arch <- rpmspecSrc "%{arch}" $ specfile_ "epel7" | |
| unless (arch == "noarch") $ do | |
| el7 <- rpmspecSrc nvr (specfile_ "epel7") | |
| (_, out) <- procStrict "koji" ["latest-pkg", "--quiet", "epel7", p] empty | |
| when (out /= "") $ do | |
| let cur = (head . Data.Text.words) out | |
| when (cur == el7 <> ".el7") $ do | |
| hasf20 <- testfile $ specfile "f20" | |
| when hasf20 $ do | |
| f20 <- rpmspecSrc nvr (specfile_ "f20") | |
| if (el7 < f20) | |
| then echo $ el7 <> " < F20 " <> f20 | |
| else do | |
| f21 <- rpmspecSrc nvr (specfile_ "f21") | |
| when (el7 < f21) $ | |
| echo $ el7 <> "< F21 " <> f21 | |
| where | |
| branchDir brch = top </> fromText p </> brch | |
| branchDir_ brch = format fp $ branchDir brch | |
| spec = fromText p <.> "spec" | |
| specfile brch = branchDir brch </> spec | |
| specfile_ brch = format fp $ specfile brch | |
| main = sh $ do | |
| top <- pwd | |
| arguments >>= mapM_ (checkPkg top) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment