packages feed

koji-tool 0.8.6 → 0.8.7

raw patch · 7 files changed

+117/−35 lines, 7 files

Files

ChangeLog.md view
@@ -1,15 +1,23 @@ # Version history of koji-tool -# 0.8.6 (2022-05-13)+## 0.8.7 (2022-05-14)+'quick' enhancements:+- better help+- support "current" state for ongoing jobs+- --debug flag+- an extra unknown word is now taken to be a package name+- append "\'s" to a username to search for their build tasks++## 0.8.6 (2022-05-13) - new 'quick' command for a few limited common searchs - install: --prefix to set subpackage prefix if different to package basename - install: fix infinite loop when no match for subpackage glob -# 0.8.5 (2022-05-10)+## 0.8.5 (2022-05-10) - use rpm-nvr-0.1.2 for better NVR and NVRA parsing ensuring non-empty names - when parsing koji build request fields, detect git hash and fork builds -# 0.8.4 (2022-05-09)+## 0.8.4 (2022-05-09) - Install: completely rework logic using installed status and NVRA etc - install: '--no-reinstall' replaces '--reinstall-nvrs' - install: determine package name from child or parent task@@ -17,23 +25,23 @@ - tasks: parse taskid as arg and drop --task and --children - Tasks: print parent Task taskid compactly and then its children -# 0.8.3 (2022-04-23)+## 0.8.3 (2022-04-23) - 'latest': new cmd to list latest package build for tag - 'install': use --reinstall-nvrs to reinstall rpms for current nvr - 'install': now prompts before proceeding - 'install': handle build tasks by finding buildArch - 'install': --list now always lists rpms -# 0.8.2 (2022-03-28)+## 0.8.2 (2022-03-28) - use the formatting library for rendering aligned output -# 0.8.1 (2022-03-21)+## 0.8.1 (2022-03-21) - query results ordered by taskid or buildid for speed - 'builds', 'tasks': argument is now a package otherwise use --pattern (replaces --package) - 'install': add a --yes option to avoid questions (#2) - print archs appended with '.' prefix -# 0.8 (2022-03-02)+## 0.8 (2022-03-02) - rename 'query' to 'tasks' - 'tasks': new '--tail' option to fetch and display tail of build.log   (shows root.log instead if build.log is too small)@@ -47,14 +55,14 @@ - 'tasks' and 'builds' have --details option otherwise output is compact   (unless there is a single result) -# 0.7 (2022-01-25)+## 0.7 (2022-01-25) - query: new options: '--package' to search recent builds and '--latest' - query --method: now defaults to buildArch (use 'any' to include all) - query: now defaults to "--before now" (instead of "--from today 00:00") - query --arch: map i686 to i386 and armv7hl to armhfp - query: do not drop tasks without string request -# 0.6.1 (2022-01-14)+## 0.6.1 (2022-01-14) - install --list: now lists the rpms of a unique nvr - install --list: new --latest option which only finds the latest build - install --nv: now actually looks for N-V nor N-V-R
README.md view
@@ -22,7 +22,7 @@ ## Commands ```shellsession $ koji-tool --version-0.8.6+0.8.7 $ koji-tool --help Query and track Koji tasks, and install rpms from Koji. @@ -42,8 +42,8 @@   install                  Install rpm packages directly from a Koji build task   progress                 Track running Koji tasks by buildlog size   buildlog-sizes           Show buildlog sizes for nvr patterns-  quick                    Simple common queries using words ('my', 'last',-                           'fail', 'build')+  quick                    Simple common queries using words+                           ('my','last','fail','complete','current','build') ```  ## koji-tool builds@@ -197,11 +197,25 @@ ### Usage `koji-tool quick my builds` shows your 10 most recent koji builds (equivalent to `koji-tool builds --mine`) -`koji-tool quick my last fail` shows your most recent task failure including the tail of the build.log (equivalent to `koji-tool tasks -MLT`).+`koji-tool quick my last fail` shows your most recent task failure including the tail of the build.log (equivalent to `koji-tool tasks -MLT -s fail`).  `koji-tool quick last complete build` shows the latest completed koji build (equivalent to `koji-tool builds -L -s complete`). +### Help+```shellsession+$ koji-tool quick+koji-tool: quick handles these words: +my mine+last latest+fail failure failed+complete completed completion close closed finish finished+current building open+build builds+PACKAGE+USER's+```+ ## koji-tool install  Download and install rpms from a Koji build or task.@@ -227,6 +241,12 @@ $ koji-tool install TASKID --exclude "*-devel" ``` will install all the non-devel subpackages from the task.++A more complex example:+```shellsession+$ koji-tool install google-noto-fonts --prefix google-noto -p 'sans-*-vf-fonts' -x 'sans-*-ui-vf-fonts'+```+installs all the Google Noto Sans variable fonts excluding UI faces.  One can use `--hub` to specify a different Koji hub build service. 
koji-tool.cabal view
@@ -1,5 +1,5 @@ name:                koji-tool-version:             0.8.6+version:             0.8.7 synopsis:            Koji CLI tool for querying tasks and installing builds description:         koji-tool is a CLI interface to Koji with commands to query
src/Install.hs view
@@ -62,6 +62,7 @@ -- FIXME --arch (including src) -- FIXME --debuginfo -- FIXME --delete after installing+-- FIXME --dnf to install selected packages using default dnf repo instead installCmd :: Bool -> Bool -> Yes -> Maybe String -> Maybe String -> Bool            -> Bool -> Bool -> Maybe String -> Mode -> String -> Request            -> [String] -> IO ()
src/Main.hs view
@@ -107,10 +107,11 @@       buildlogSizesCmd <$> strArg "NVRPATTERN"      , Subcommand "quick"-      "Simple common queries using words ('my', 'last', 'fail', 'complete', 'build')" $+      "Simple common queries using words ('my','last','fail','complete','current','build')" $       quickCmd       <$> hubOpt-      <*> some (strArg "PHRASE")+      <*> switchWith 'D' "debug" "Debug output including XML results"+      <*> many (strArg "PHRASE")     ]   where     hubOpt = optional (strOptionWith 'H' "hub" "HUB"
src/Quick.hs view
@@ -7,6 +7,8 @@   ) where +import Data.Char ( isDigit, isAsciiLower, isAsciiUpper )+import Data.List.Extra ((\\), dropSuffix, isSuffixOf) import Distribution.Koji import SimpleCmd (error') @@ -14,26 +16,73 @@ import qualified Tasks import User --- Package to choose build--- FIXME: building--- handle some extra words?-quickCmd :: Maybe String -> [String] -> IO ()-quickCmd _ [] = error' "please use words: 'my', 'last', 'fail', 'build'"-quickCmd mhub args = do-  let mine = if any (`elem` ["my","mine"]) args+data Words = Mine | Limit | Failure | Complete | Current | Build+  deriving (Enum,Bounded)++quickWords :: Words -> [String]+quickWords Mine = ["my","mine"]+quickWords Limit = ["last","latest"]+quickWords Failure = ["fail","failure","failed"]+quickWords Complete = ["complete","completed","completion",+                       "close","closed",+                       "finish","finished"]+quickWords Current = ["current", "building", "open"]+quickWords Build = ["build","builds"]++allWords :: [String]+allWords = concatMap quickWords [minBound..]++-- FIXME: arch+-- FIXME: method+-- FIXME: mlt (or mlft)+quickCmd :: Maybe String -> Bool -> [String] -> IO ()+quickCmd _ _ [] = error' $ "quick handles these words:\n\n" +++                  unlines+                  (map (unwords . quickWords) [minBound..] +++                  ["PACKAGE", "USER's"])+quickCmd mhub debug args = do+  let user = if hasWord Mine              then Just UserSelf-             else Nothing-      limit = if any (`elem` ["last","latest"]) args-              then 1-              else 10-      failure = any (`elem` ["fail","failure","failed"]) args-      complete = any (`elem` ["complete","completed","close","closed",-                              "finish","finished"]) args-      build = any (`elem` ["build","builds"]) args+             else case filter ("'s" `isSuffixOf`) args of+                    [] -> Nothing+                    [users] -> Just $ User (dropSuffix "'s" users)+                    more -> error' $ "more than one user's given: " +++                            unwords more+      limit = if hasWord Limit then 1 else 10+      failure = hasWord Failure+      complete = hasWord Complete+      current = hasWord Current+      build = hasWord Build+      mpkg =+        case removeUsers (args \\ allWords) of+          [] -> Nothing+          -- FIXME allow pattern?+          [pkg] | all isPkgNameChar pkg -> Just pkg+          other ->+            error' $+            "you can only specify one package - too many unknown words: " +++            unwords other   if build     then-    let states = [BuildFailed|failure] ++ [BuildComplete|complete]-    in Builds.buildsCmd mhub mine limit states Nothing (Just "rpm") False False Builds.BuildQuery+    let states = [BuildFailed|failure] ++ [BuildComplete|complete] +++                 [BuildBuilding|current]+        buildreq = maybe Builds.BuildQuery Builds.BuildPackage mpkg+    in Builds.buildsCmd mhub user limit states Nothing (Just "rpm") False debug buildreq     else-    let states = [TaskFailed|failure] ++ [TaskClosed|complete]-    in Tasks.tasksCmd mhub mine limit states [] Nothing Nothing False False Nothing failure Tasks.TaskQuery+    let states = [TaskFailed|failure] ++ [TaskClosed|complete] +++                 [TaskOpen|current]+        taskreq = maybe Tasks.TaskQuery Tasks.Package mpkg+    in Tasks.tasksCmd mhub user limit states [] Nothing Nothing False debug Nothing failure taskreq+  where+    hasWord :: Words -> Bool+    hasWord word = any (`elem` quickWords word) args++    removeUsers :: [String] -> [String]+    removeUsers = filter (not . ("'s" `isSuffixOf`))++-- [Char] generated by+-- sort . nub <$> cmd "dnf" ["repoquery", "--qf=%{name}", "*"]+-- "+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"+isPkgNameChar :: Char -> Bool+isPkgNameChar c =+  isAsciiLower c || isAsciiUpper c || c `elem` "-.+_" || isDigit c
test/tests.hs view
@@ -35,6 +35,9 @@   ,     (["latest"],      [["rawhide", "ghc"]])+  ,+    (["quick"],+     [["last", "failed", "build"]])   ]   where     sysdist = if havedist then [] else ["-d", "fc35"]