fedora-composes 0.2 → 0.2.1
raw patch · 5 files changed
+60/−38 lines, 5 files
Files
- ChangeLog.md +6/−0
- README.md +27/−20
- fedora-composes.cabal +8/−7
- src/Main.hs +15/−8
- test/tests.hs +4/−3
ChangeLog.md view
@@ -1,5 +1,11 @@ # Version history for fedora-composes +## 0.2.1 (2024-09-09)+- status: for updates default to yes for more+- status: don't prompt for more with --limit+- ignore undated compose directories+- add readme url to help description+ ## 0.2 (2024-02-14) - output compose urls and use multiple lines for status - status: default to showing latest finished and prompt to show older
README.md view
@@ -5,47 +5,52 @@ ## Examples `$ fedora-composes list --latest rawhide`+ ```-https://kojipkgs.fedoraproject.org/compose/rawhide/Fedora-Rawhide-20240214.n.1+https://kojipkgs.fedoraproject.org/compose/rawhide/Fedora-Rawhide-20240909.n.0 ``` `$ fedora-composes list -l2 branched`+ ```-https://kojipkgs.fedoraproject.org/compose/branched/Fedora-40-20240214.n.0-https://kojipkgs.fedoraproject.org/compose/branched/Fedora-40-20240213.n.1+https://kojipkgs.fedoraproject.org/compose/branched/Fedora-41-20240909.n.0+https://kojipkgs.fedoraproject.org/compose/branched/Fedora-41-20240908.n.0 ``` `$ fedora-composes status --no-more branched`-```-https://kojipkgs.fedoraproject.org/compose/branched/Fedora-40-20240214.n.0/logs/global/-2024-02-14 15:19:10 +08-2024-02-14 15:31:52 +08 DOOMED -https://kojipkgs.fedoraproject.org/compose/branched/Fedora-40-20240213.n.1-2024-02-14 03:40:26 +08-2024-02-14 08:52:37 +08 FINISHED_INCOMPLETE+```+https://kojipkgs.fedoraproject.org/compose/branched/Fedora-41-20240909.n.0+2024-09-09 15:15:03 +08+2024-09-09 19:59:30 +08 FINISHED_INCOMPLETE ``` -`$ fedora-composes status -n updates 39`+`$ fedora-composes status -n updates 40`+ ```-https://kojipkgs.fedoraproject.org/compose/updates/Fedora-39-updates-testing-20240214.0-2024-02-14 09:25:36 +08-2024-02-14 10:03:51 +08 FINISHED+https://kojipkgs.fedoraproject.org/compose/updates/Fedora-40-updates-testing-20240909.0+2024-09-09 22:33:40 +08 STARTED +https://kojipkgs.fedoraproject.org/compose/updates/Fedora-40-updates-20240909.0+2024-09-09 08:15:35 +08+2024-09-09 09:13:03 +08 FINISHED+ ``` ## Usage `$ fedora-composes --version`+ ```-0.2+0.2.1 ``` `$ fedora-composes --help`+ ``` check status of fedora composes Usage: fedora-composes [--version] COMMAND - description here+ https://github.com/juhp/fedora-composes#readme Available options: -h,--help Show this help text@@ -58,8 +63,8 @@ There is the notion of repos and composes. -For example `Fedora-39-updates` is a repo-and `Fedora-39-updates-20230810.0` is a compose for it.+For example `Fedora-40-updates` is a repo+and `Fedora-40-updates-20240809.0` is a compose for it. Filtering is case insensitive. @@ -74,6 +79,7 @@ `fedora-composes list branched` shows latest branched composes `$ fedora-composes list --help`+ ``` Usage: fedora-composes list [-d|--debug] [(-a|--all-composes) | (-L|--latest) | @@ -94,11 +100,12 @@ `fedora-composes status rawhide` shows time and status of newest rawhide -`fedora-composes status updates fedora-39` shows time and status of updates push+`fedora-composes status updates fedora-40` shows time and status of updates push -`fedora-composes status branched 39` shows time and status of branched compose+`fedora-composes status branched 41` shows time and status of branched compose `$ fedora-composes status --help`+ ``` Usage: fedora-composes status [-d|--debug] [(-a|--all-composes) | (-L|--latest) |
fedora-composes.cabal view
@@ -1,5 +1,5 @@ name: fedora-composes-version: 0.2+version: 0.2.1 synopsis: Query Fedora composes description: CLI tool to list and check status of Fedora composes@@ -16,12 +16,13 @@ ChangeLog.md cabal-version: 2.0 tested-with: GHC == 8.6.5- || == 8.8.4- || == 8.10.7- || == 9.0.2- || == 9.2.8- || == 9.4.8- || == 9.6.4+ || == 8.8.4+ || == 8.10.7+ || == 9.0.2+ || == 9.2.8+ || == 9.4.8+ || == 9.6.6+ || == 9.8.2 source-repository head type: git
src/Main.hs view
@@ -8,7 +8,7 @@ import Data.Char ( isDigit ) import Data.Functor ((<&>)) import Data.List.Extra (isPrefixOf, lower, nub, sort, takeEnd)-import Data.Maybe (isJust, isNothing)+import Data.Maybe (isJust, isNothing, mapMaybe) import Data.Text (Text) import qualified Data.Text as T import qualified Data.Text.IO as T@@ -29,7 +29,7 @@ main = simpleCmdArgs' (Just version) "check status of fedora composes"- "description here" $+ "https://github.com/juhp/fedora-composes#readme" $ subcommands [ Subcommand "list" "List dirs/composes (by default only last compose)" $@@ -77,10 +77,14 @@ Compose {compDate :: Text, compRepo :: Text} deriving (Eq, Ord, Show) -readCompose :: Text -> Compose+readCompose :: Text -> Maybe Compose readCompose t =- case T.breakOnEnd (T.pack "-") t of- (repoDash,date) -> Compose date (T.init repoDash)+ -- ignore undated composes like "epel10.0/"+ if T.pack "-202" `T.isInfixOf` t+ then+ case T.breakOnEnd (T.pack "-") t of+ (repoDash,date) -> Just $ Compose date (T.init repoDash)+ else Nothing showCompose :: Compose -> String showCompose (Compose d r) = T.unpack r <> "-" <> T.unpack d@@ -96,7 +100,7 @@ limitComposes . sort . repoSubset .- map readCompose .+ mapMaybe readCompose . filter (\c -> isDigit (T.last c) && T.any (== '.') c) <$> httpDirectories url when debug $ print repocomposes@@ -132,9 +136,12 @@ if isNothing mfinished then if nomore- then return False+ then return False+ else+ if isJust mlimit+ then return True else do- yes <- yesNoDefault False "Show more results"+ yes <- yesNoDefault (dir == "updates") "Show more results" cursorUp 1 >> clearFromCursorToLineEnd return yes else return True
test/tests.hs view
@@ -17,15 +17,16 @@ [["rawhide"] ,["-r", "updates"] ,["-l2", "updates"]- ,["updates", "fedora-39"]+ ,["updates", "fedora-40"] ]) , ("status", [["updates", "-n"]- ,["updates", "-n", "fedora-38"]+ ,["updates", "-n", "fedora-40"]+ ,["updates", "-n", "fedora-41"] ,["rawhide", "-L"] ,["branched", "-l2"]- ,["branched", "-n", "39"]+ ,["branched", "-n", "41"] ]) ]