fedora-repoquery 0.3.1 → 0.3.2
raw patch · 7 files changed
+36/−20 lines, 7 filesdep −optparse-applicative
Dependencies removed: optparse-applicative
Files
- ChangeLog.md +5/−0
- README.md +1/−1
- fedora-repoquery.cabal +1/−2
- src/List.hs +4/−3
- src/Main.hs +3/−2
- src/Query.hs +18/−11
- test/tests.hs +4/−1
ChangeLog.md view
@@ -1,5 +1,10 @@ # Revision history for fedora-repoquery +## 0.3.2 (2024-02-19)+- enable centos 10 stream (still alpha)+- Query: disable --qf for --provides+- minor debug tweaks+ ## 0.3.1 (2024-02-12) - use dnf5 when available - add --all-archs to query across all 64bit architectures
README.md view
@@ -20,7 +20,7 @@ `$ fdrq --version` ```-0.3.1+0.3.2 ``` `$ fdrq --help` ```
fedora-repoquery.cabal view
@@ -1,5 +1,5 @@ name: fedora-repoquery-version: 0.3.1+version: 0.3.2 synopsis: Fedora repoquery tool description: CLI tool for querying the location and version of Fedora packages@@ -47,7 +47,6 @@ filepath, http-client, http-directory >= 0.1.4 && (< 0.1.6 || >= 0.1.8),- optparse-applicative, regex-compat, simple-cmd, simple-cmd-args,
src/List.hs view
@@ -14,16 +14,17 @@ import Types import URL -listVersionsCmd :: Verbosity -> RepoSource -> Arch -> IO ()+listVersionsCmd :: Bool -> Verbosity -> RepoSource -> Arch -> IO () -- listVersionsCmd _verbose _reposource = -- error' "listing Centos Stream versions not supported" -- --showReleaseCmd mgr server (RepoCentosStream chan) arch -- listVersionsCmd _ RepoKoji = -- error' "listing Koji versions not supported"-listVersionsCmd verbose reposource arch = do+listVersionsCmd debug verbose reposource arch = do mgr <- httpManager -- FIXME handle non-fedora versions (eg epel)- (url,_) <- getFedoraServer False mgr reposource (fedoraTop arch) ["releases"]+ -- FIXME no longer releases/, but parent dir+ (url,_) <- getFedoraServer debug mgr reposource (fedoraTop arch) ["releases"] let rurl = renderUrl url unless (verbose == Quiet) $ warning $! "<" ++ rurl ++ ">" -- FIXME filter very old releases
src/Main.hs view
@@ -59,12 +59,13 @@ releaseM :: ReadM Release releaseM = maybeReader readRelease -runMain :: Arch -> Verbosity -> RepoSource -> [Arch] -> Bool -> Bool -> Command -> IO ()+runMain :: Arch -> Verbosity -> RepoSource -> [Arch] -> Bool -> Bool+ -> Command -> IO () runMain sysarch verbose reposource archs testing debug command = do case command of CacheSize -> cacheSize CacheEmpties -> cleanEmptyCaches- List -> listVersionsCmd verbose reposource sysarch+ List -> listVersionsCmd debug verbose reposource sysarch Query release args -> do if null args then if null archs
src/Query.hs view
@@ -41,7 +41,7 @@ repoqueryCmd debug verbose release reposource sysarch archs testing args = do forM_ (if null archs then [sysarch] else archs) $ \arch -> do repoConfigs <- showRelease debug verbose True reposource release sysarch (Just arch) testing- let qfAllowed = not $ any (`elem` ["-i","--info","-l","--list","-s","--source","--nvr","--nevra","--envra","-qf","--queryformat", "--changelog"]) args+ let qfAllowed = not $ any (`elem` ["-i","--info","-l","--list","-s","--source","--nvr","--nevra","--envra","-qf","--queryformat", "--changelog", "--provides"]) args mdnf5 <- findExecutable "dnf5" let queryformat = "%{name}-%{version}-%{release}.%{arch} (%{repoid})" ++@@ -154,7 +154,6 @@ let (reponame,(url',path')) = repoConfigArgs reposource sysarch march release repourl baserepo = url' +//+ path' when debug $ do- putStrLn $ "url" +-+ renderUrl url' putStrLn $ renderUrl baserepo ok <- httpExists mgr $ trailingSlash $ renderUrl baserepo if ok@@ -166,6 +165,7 @@ then url' +//+ ["repo.json"] else case release of+ Centos 10 -> url' +//+ ["metadata","composeinfo.json"] Centos _ -> url' +//+ ["COMPOSE_ID"] -- ["metadata","composeinfo.json"] ELN -> url' +//+ ["metadata","composeinfo.json"] EPEL _ -> url' +//+ ["Everything", "state"]@@ -204,15 +204,22 @@ getURL :: Bool -> Manager -> RepoSource -> Release -> Arch -> IO (URL,[String]) getURL debug mgr reposource@(RepoSource koji chan _mirror) release arch = case release of- Centos 9 ->- let url = URL $- if koji- then "https://odcs.stream.centos.org"- else "https://mirror.stream.centos.org/9-stream/"- in return (url,[])- Centos 8 ->- return (URL "http://mirror.centos.org/centos/8-stream/", [])- Centos _ -> error' "old Centos is not supported yet"+ Centos n ->+ case n of+ 10 ->+ let url = URL $+ if koji+ then "https://odcs.stream.centos.org/stream-10"+ else "https://composes.stream.centos.org/stream-10/production/latest-CentOS-Stream/compose/"+ in return (url,[])+ 9 ->+ let url = URL $+ if koji+ then "https://odcs.stream.centos.org"+ else "https://mirror.stream.centos.org/9-stream/"+ in return (url,[])+ 8 -> return (URL "http://mirror.centos.org/centos/8-stream/", [])+ _ -> error' "old Centos is not supported yet" ELN -> return (URL "https://odcs.fedoraproject.org/composes", [channel chan, "latest-Fedora-ELN", "compose"]) EPEL n | n < 7 ->
test/tests.hs view
@@ -19,14 +19,17 @@ tests :: [([String],Maybe String)] tests = [(["rawhide"], Nothing)+ ,(["40"], Nothing) ,(["39"], Nothing) ,(["38"], Nothing) ,(["rawhide"], Just "coreutils")+ ,(["40"], Just "gtk4") ,(["39"], Just "bash") ,(["38"], Just "fontconfig")- ,(["-t", "38"], Just "podman")+ ,(["-t", "39"], Just "podman") ,(["eln"], Just "ibus") ,(["epel9"], Just "ghc")+ ,(["c10"], Just "bash") ,(["c9"], Just "kernel") ,(["c8"], Just "pandoc") ]