koji-tool
Koji CLI tool for querying tasks and installing builds
https://github.com/juhp/koji-tool
LTS Haskell 22.40: | 1.1.1 |
Stackage Nightly 2024-11-08: | 1.2 |
Latest on Hackage: | 1.2 |
koji-tool-1.2@sha256:4c385586800c4756c9a1bb11de07d92527b096799b159e90df3ae531855e6ce3,3299
Module documentation for 1.2
There are no documented modules for this package.
koji-tool
A CLI UI to the Koji buildsystem with commands to query builds and tasks, install rpms, and check buildlog sizes.
Koji is the RPM package buildsystem used by Fedora Linux, CentOS Stream, RHEL, and some other projects.
By default Fedora Koji is used.
A few illustrative examples:
koji-tool tasks --mine --latest --state fail --tail
:
shows details of your last buildArch failure and the tail of the build.log
(equivalently you can use koji-tool find my last fail
).
koji-tool install systemd
: will try to install or update to the newest rpm packages from koji.
koji-tool builds -L -s complete firefox
:
shows the last successful build with a url and other details.
Commands
$ koji-tool --version
1.2
$ koji-tool --help
Query and track Koji tasks, and install rpms from Koji.
Usage: koji-tool [--version] COMMAND
see https://github.com/juhp/koji-tool#readme
Available options:
-h,--help Show this help text
--version Show version
Available commands:
builds Query Koji builds (by default lists the most recent
builds)
tasks Query Koji tasks (by default lists the most recent
buildArch tasks)
latest Query latest Koji build for tag
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
find Simple quick common queries using words like: [my,
last, fail, complete, current, build, detail,
install, tail, notail, hwinfo, x86_64, debug,
PACKAGE, USER\'s, LIMIT]
koji-tool builds
The builds
command queries Koji for builds.
Somewhat like koji list-builds --quiet ...
,
but it shows duration, and kojiweb urls.
Note results are ordered by build_id (not time) for speed.
Usage
By default it lists up to 10 Fedora Koji builds -
this can be changed with the --limit
or --unlimited
options.
One can select builds also by time/date options,
which are parsed by the system date
utility.
One can also use an NVR glob pattern to select builds.
$ koji-tool builds --help
Usage: koji-tool builds [-H|--hub HUB] [(-u|--user USER) | (-M|--mine)]
[(-L|--latest) | (-U|--unlimited) | (-l|--limit INT)]
[-s|--state STATE]
[(-B|--before TIMESTAMP) | (-F|--from TIMESTAMP)]
[-T|--type TYPE] [(-d|--details) | (-t|--tasks)]
[-i|--install INSTALLOPTS] [-D|--debug]
[(-b|--build NVR/BUILDID) | (-p|--pattern NVRPAT) |
PACKAGE]
Query Koji builds (by default lists the most recent builds)
Available options:
-H,--hub HUB KojiHub shortname or url (HUB = fedora, stream,
rpmfusion, or URL) [default: fedora]
-u,--user USER Koji user
-M,--mine Your tasks (krb fasid)
-L,--latest Latest build
-U,--unlimited No limit on number of results
-l,--limit INT Maximum number of builds to show [default: 20]
-s,--state STATE Filter builds by state
(building,complete,deleted,fail(ed),cancel(ed)
-B,--before TIMESTAMP Builds completed before timedate [default: now]
-F,--from TIMESTAMP Builds completed after timedate
-T,--type TYPE Select builds by type: all,image,maven,module,rpm,win
-d,--details Show more build details
-t,--tasks Show details and tasks
-i,--install INSTALLOPTS Install the package with 'install' options
-D,--debug Pretty-print raw XML result
-b,--build NVR/BUILDID Show build
-p,--pattern NVRPAT Builds matching glob pattern
-h,--help Show this help text
Examples:
$ koji-tool builds -M -s fail
lists your recent builds that failed.
List latest build of a package:
$ koji-tool builds --pattern redhat-rpm-config*.fc40 --latest
redhat-rpm-config-288-1.fc40 BuildComplete (fweimer)
https://koji.fedoraproject.org/koji/buildinfo?buildID=2460713
https://koji.fedoraproject.org/koji/taskinfo?taskID=118524958
start: Tue Jun 4 03:07:58 +08 2024
completion: Tue Jun 4 03:12:51 +08 2024
duration: 4 min 53 sec
https://kojipkgs.fedoraproject.org/packages/redhat-rpm-config/288/1.fc40
koji-tool tasks
The tasks
command queries Koji for tasks.
Somewhat like koji list-tasks --quiet --all ...
,
but it shows duration, kojiweb urls and optionally build.log size.
Note results are ordered by task id (not time) for speed.
Usage
By default it lists 10 most recent Fedora Koji buildArch tasks,
this can be changed with the --limit
or --unlimited
options.
Tasks can be searched by package, task id (including parent and children), by build or NVR pattern, also by state, method, and user.
Results can be restricted by date options,
which are parsed by the date
utility.
The received results can be filtered too locally by package or nvr prefix.
Multiple results are listed concisely each on one line by default.
A single task result is displayed in detail over multiple lines.
These levels of detail can be controlled with
the --details
and --concise
options.
$ koji-tool tasks --help
Usage: koji-tool tasks [-H|--hub HUB] [(-u|--user USER) | (-M|--mine)]
[(-L|--latest) | (-U|--unlimited) | (-l|--limit INT)]
[-s|--state STATE] [-a|--arch ARCH]
[(-B|--before TIMESTAMP) | (-F|--from TIMESTAMP)]
[-m|--method METHOD] [-D|--debug]
[(-P|--only-package PKG) | (-N|--only-nvr PREFIX)]
[(-d|--details) | (-c|--concise)] [-T|--tail] [--hw-info]
[-g|--grep STRING] [-i|--install INSTALLOPTS]
[(-b|--build BUILD) | (-p|--pattern NVRPAT) |
--children TASKID | --parent TASKID | PACKAGE|TASKID]
Query Koji tasks (by default lists the most recent buildArch tasks)
Available options:
-H,--hub HUB KojiHub shortname or url (HUB = fedora, stream,
rpmfusion, or URL) [default: fedora]
-u,--user USER Koji user
-M,--mine Your tasks (krb fasid)
-L,--latest Latest build or task
-U,--unlimited No limit on number of results
-l,--limit INT Maximum number of tasks to show [default: 20]
-s,--state STATE Filter tasks by state
(open,close(d),cancel(ed),fail(ed),assigned,free)
-a,--arch ARCH Task arch
-B,--before TIMESTAMP Tasks completed before timedate [default: now]
-F,--from TIMESTAMP Tasks completed after timedate
-m,--method METHOD Select tasks by method (default 'buildArch'):
all,appliance,build,buildArch,buildContainer,buildMaven,buildNotification,buildSRPMFromSCM,chainbuild,chainmaven,createAppliance,createContainer,createImage,createLiveCD,createLiveMedia,createdistrepo,createrepo,dependantTask,distRepo,image,indirectionimage,livecd,livemedia,maven,newRepo,rebuildSRPM,runroot,tagBuild,tagNotification,vmExec,waitrepo,winbuild,wrapperRPM
-D,--debug Pretty-print raw XML result
-P,--only-package PKG Filter task results to specified package
-N,--only-nvr PREFIX Filter task results by NVR prefix
-d,--details Show more task details
-c,--concise Compact task output
-T,--tail Fetch the tail of build.log
--hw-info Fetch hw_info.log
-g,--grep STRING Filter matching log lines
-i,--install INSTALLOPTS Install the package with 'install' options
-b,--build BUILD List child tasks of build
-p,--pattern NVRPAT Build tasks of matching pattern
--children TASKID Children tasks of parent
--parent TASKID Parent of task
-h,--help Show this help text
Examples:
$ koji-tool tasks -M -a aarch64 -s fail
lists your recent arm64 tasks that failed.
Show latest newRepo task:
$ koji-tool tasks --method newrepo --latest
eln-build-side-93068 newRepo TaskClosed (kojira)
https://koji.fedoraproject.org/koji/taskinfo?taskID=121120828
create: Sat Jul 27 18:59:06 +08 2024
start: Sat Jul 27 19:00:03 +08 2024
completion: Sat Jul 27 19:03:12 +08 2024
delay: 57 sec
duration: 3 min 9 sec
List latest package build’s tasks:
$ koji-tool tasks --latest redhat-rpm-config
redhat-rpm-config-293-1.eln140.noarch TaskClosed (distrobuildsync-eln/jenkins-continuous-infra.apps.ci.centos.org)
https://koji.fedoraproject.org/koji/taskinfo?taskID=119218471 (parent: 119209735)
create: Tue Jun 18 14:40:53 +08 2024
start: Tue Jun 18 19:13:53 +08 2024
completion: Tue Jun 18 19:15:12 +08 2024
delay: 4 hours 33 min
duration: 1 min 19 sec
https://kojipkgs.fedoraproject.org/packages/redhat-rpm-config/293/1.eln140/data/logs/noarch/build.log (17kB)
It is also possible to install packages from a task using
--install "SUBPKG OPTIONS"
.
See the install command documentation below for more details.
Use --tail
to show the tail of the build.log: it falls back to root.log
automatically if the build.log is considered too small.
Use --hw-info
to display hw_info.log instead.
Also using the --grep
option one can filter the log output for lines matching
the given string (accepts leading ^
and trailing $
).
koji-tool install
Use the install
command to download and install rpms
from a Koji build or task.
By default it only downloads binaries of already-installed subpackages, but there are options to list and select or exclude specific subpackages.
Note this command is intended for development and testing purposes and should not be necessary/used normally on production systems, but it can be very helpful for quickly testing a specific package build or update locally.
Usage
$ koji-tool install podman
will download the latest build for your Fedora version,
and try to install it.
Use --disttag
suffix to select a different OS version.
$ koji-tool install TASKID --except "*-devel"
will install all the non-devel subpackages from the task.
A more complex example:
$ koji-tool install google-noto-fonts --prefix google-noto --package 'sans-*-vf-fonts' --exclude '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.
Selecting subpackages
By default only installed subpackages are downloaded and updated, but the following options change the behavior:
--package
: select subpackages by name or glob pattern
--except
: select subpackages not matching name or glob pattern
--exclude
: exclude subpackages by name or glob pattern (overrides –package and –except)
--include
: include subpackages by name or glob pattern (overrides –exclude)
--all
: install all subpackages
--ask
: ask about each subpackage
--prefix
: override the subpackage prefix
(Subpackage selection has only really been tested so far for a single build/task.)
Help
$ koji-tool install --help
Usage: koji-tool install [-n|--dry-run] [-D|--debug] [-y|--yes] [-H|--hub HUB]
[-P|--packages-url URL] [-l|--list] [-L|--latest]
[-t|--check-remote-time]
[--rpm | --rpm-ostree | --dnf5 | --dnf3]
[-a|--arch ARCH]
[(-N|--no-reinstall) | (-S|--skip-existing)]
[-b|--prefix SUBPKGPREFIX]
[--all | --ask | [-p|--package SUBPKG]
[-e|--except SUBPKG] [-x|--exclude SUBPKG]
[-i|--include SUBPKG]] [-d|--disttag DISTTAG]
[(-R|--nvr) | (-V|--nv)] PKG|NVR|TASKID...
Install rpm packages directly from a Koji build task
Available options:
-n,--dry-run Don't actually download anything
-D,--debug More detailed output
-y,--yes Assume yes to questions
-H,--hub HUB KojiHub shortname or url (HUB = fedora, stream,
rpmfusion, or URL) [default: fedora]
-P,--packages-url URL KojiFiles packages url [default: Fedora]
-l,--list List builds
-L,--latest Latest build
-t,--check-remote-time Check remote rpm timestamps
--rpm Use rpm instead of dnf
--rpm-ostree Use rpm-ostree instead of dnf
--dnf5 Use dnf5 to install
--dnf3 Use dnf-3 to install [default dnf unless ostree]
-a,--arch ARCH Task arch
-N,--no-reinstall Do not reinstall existing NVRs
-S,--skip-existing Ignore already installed subpackages (implies
--no-reinstall)
-b,--prefix SUBPKGPREFIX Prefix to use for subpackages [default: base package]
--all all subpackages [default if not installed]
--ask ask for each subpackage
-p,--package SUBPKG select subpackage (glob) matches
-e,--except SUBPKG select subpackages not matching (glob)
-x,--exclude SUBPKG deselect subpackage (glob): overrides -p and -e
-i,--include SUBPKG additional subpackage (glob) to install: overrides -x
-d,--disttag DISTTAG Select a disttag different to system
-R,--nvr Give an N-V-R instead of package name
-V,--nv Give an N-V instead of package name
-h,--help Show this help text
koji-tool find
This provides shortcuts to a few select common searches
Usage
koji-tool find my builds
shows your 10 most recent koji builds (equivalent to koji-tool builds --mine
)
koji-tool find 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 find last complete build
shows the latest completed koji build (equivalent to koji-tool builds -L -s complete
).
Help
$ koji-tool find --help
Usage: koji-tool find [-H|--hub HUB] [PHRASE]
Simple quick common queries using words like: [my, last, fail, complete,
current, build, detail, install, tail, notail, hwinfo, x86_64, debug, PACKAGE,
USER\'s, LIMIT]
Available options:
-H,--hub HUB KojiHub shortname or url (HUB = fedora, stream,
rpmfusion, or URL) [default: fedora]
-h,--help Show this help text
koji-tool progress
Shows the progress of active koji builds tasks by checking the size of their build.log files.
This is useful for monitoring the build progress of large packages that take a long time to complete for which some arch’s may take considerably longer.
By default it shows progress of the user’s open build tasks.
Usage
$ koji-tool progress
:
:
$ koji-tool progress 93808251
21:39:41 webkitgtk-2.38.2-1.eln123 (93808251) 9h 32m
aarch64 87,669kB (16:50:31) 3h 55m TaskClosed
i386 88,120kB (16:33:14) 4h 21m TaskClosed
noarch 3kB (12:11:19) 3m 28s TaskClosed SRPM
ppc64le 85,853kB (21:25:42)
s390x 87,692kB (21:20:43) 9h 11m TaskClosed
x86_64 89,914kB (19:57:47) 7h 48m TaskClosed
21:47:57 webkitgtk-2.38.2-1.eln123 (93808251) 89914kB, 9h 40m
ppc64le 88,117kB (21:47:21) [ 1,742 B/s] (1299s)
:
The buildlog-sizes
command is similar but runs once over nvr patterns.
Installation
koji-tool is packaged in Fedora
Building from git/source
Either use cabal-install
or stack
.
Either way you need a ghc compiler installed, of course.
Build from source with cabal
With cabal, you can save a lot of time by first running cabal-rpm builddep
to install distro deps, and then:
$ cabal install
Build from source with stack
$ stack init --resolver lts
$ stack install
Contributing
koji-tool is distributed under a BSD license.
Bug reports, suggestions and contributions are welcomed: please open an issue at: https://github.com/juhp/koji-tool/
Changes
Version history of koji-tool
1.2 (2024-07-27)
- allow –unlimited results: useful for open tasks/builds
- builds: also show owner
- find: also support noarch
- find: move –debug to debug arg
- improve detailed output handling with Maybe Details for tasks and builds
- improvements to log url logic
- install: include noarch in getArchs to include noarch rpms
- lookupArch first checks the label field then arch field
- progress: use safe maximumMay of sizes
- tasks: add –children and –parent of taskid
- tasks: add –install option
- tasks: also show create time and owner
- tasks: in addition to buildlog size also print timestamp
- tasks: ignore subtask limit for Package, ParentOf, ChildrenOf
1.1.1 (2023-10-20)
- ‘builds’: reformat short build result to align better
- ‘install’: detect ostree with “/sysroot/ostree” not rpm-ostree
- ‘tasks’: reorder output format for better alignment
- Time compactZonedTime: add space before timezone
1.1 (2023-07-22)
- tasks: now shows children of ‘build’ task
- install: correctly handle arch for installed packages (#4)
- install: support dnf5 and dnf-3 (default dnf)
- use simple-prompt
1.0.1 (2023-05-08)
- ‘install’ now supports multiple arch options (#4)
- ‘find’: interpret small number as a limit (default still 10 results)
1.0 (2023-04-24)
- ‘builds’: fix –install to use nvr instead of taskid
- ‘install’: allow installing from an ongoing build; add kojiGetBuildTaskRPMs
- ‘install’: change download dir to (xdg) ~/Downloads/koji-tool/
- ‘install’: curl don’t need/print progress for debug
- ‘install’: error if no rpms found
- ‘install’ now supports –arch option
- ‘progress’: correctly use parent taskid when given child id
- ‘progress’: drop redundant duplicate debug option
- ‘progress’: when given build don’t query with state/method/user
- ‘progress’: improve size formatting
- ‘progress’: no longer hide archs nor repeat output when no progress
- ‘tasks’: improved request logic
- ‘tasks’: increase log tail size to 6000B
- ‘tasks’: bump root.log threshold to <4000
- ‘tasks’: separate taskid errors for –user, time, and filter
- ‘buildlog-sizes’: handle ongoing builds and show build states
- ‘buildlog-sizes’: try appending a * to pattern: might be a package name
- DownloadDir: simplify the logic considerably
- Install installRPMs: revert to old 0.9.5 reinstall behavior
- base times off
create_time
rather thanstart_time
- getTasks factored from tasksCmd for progress; lookupTime changes
0.9.6 (2022-11-05)
- install: completely rework subpackage selection logic
- install: separate –except from –exclude and rename –add to –include
- install: –no-reinstall and –skip-existing skip rpms before rpms selection
- install: show installed states with character symbol prefixes
- tasks: add –hw-info for hw_info.log and –grep to filter logs
- progress: back-off up to 5 times
0.9.5 (2022-09-12)
- ‘install’: fix determination of package name from srpm
- ‘progress’: correctly determine NVR from srpm again
0.9.4 (2022-09-09)
- ‘install’: rework install logic to combine reinstall and install pkgs
- ‘install’: do not choose rebuildSRPM subtask
- ‘install’: show correct top download dir
- ‘install’: –add to specify additional package
- ‘install’: change rpms prompt to require Enter for consistency with dnf
- ‘progress’: another major logic refactor: determine poll delay from last-modified time
- ‘progress’: skip wait for a build.log after [1..6] sec tries
- ‘progress’: put interval times into task outputs
- ‘progress’: only print task header if updated task outputs
0.9.3 (2022-08-03)
- ‘builds’ for a package now use specified query options
- ‘builds’: add –install and –tasks options
- ‘install’: –exclude globs now filter –package globs
- ‘install’: update installed subpackages first then install any new subpkgs
- ‘install’: separate prompt logic for “install above” packages
- ‘install’: experimental support for rpm-ostree overlaying (–rpm-ostree)
- ‘install’: allow noarch tasks
- ‘install’: allow package filtering in –list mode
- ‘install’: –skip-existing to leave already installed subpackages untouched
- ‘progress’ records the largest finished build.log size
- ‘progress’: exclude srpm from max log sizes
- ‘progress’: show pkg name instead of “unknown” nvr early on
- ‘progress’: only use current time if task unfinished
- ‘tasks’: fix output url selection for scratch builds
- ‘tasks’: check build.log exists before getting its size
- make parsing of states strict for earlier errors
- error if koji userid not found
0.9.2 (2022-06-12)
- tasks –install now takes install options string
- install: place rpms in a nvr subdirectory
- install: when downloading check if local files’ timestamp within build time
- progress: no longer quit after srpm build
- progress: show duration of build and finished tasks
0.9.1 (2022-05-29)
- ‘find’: add “install”, “tail”, “notail”, and archs support
- ‘install’: –rpm option to install directly with rpm instead of dnf
- ‘tasks’: add –install option
- ‘tasks’: major rework of the log file handling
- ‘tasks –tail’: fix output when task still running
- ‘tasks’: compact output shows duration
- ‘builds’: now outputs packages archive url
0.9 (2022-05-20)
- rename ‘quick’ command to ‘find’
- ‘builds’: compact output now appends url
- ‘find’: add “details” word
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)
- 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)
- 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
- Install: confirm for –all and –exclude, respecting –yes
- 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)
- ‘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)
- use the formatting library for rendering aligned output
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)
- 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)
- ‘tasks’: extend list of methods and list them in –method help
- new ‘builds’ query command (replaces ‘tasks’ builds listing)
- only query print date when option given by user
- –debug now displays query options
- ‘tasks’ and ‘builds’ now use –hub like ‘install’
- new –mine (self-user) option (instead of defaulting to mine)
- ‘tasks’ and ‘builds’ support build NVR pattern search (requires Koji 1.24+)
- ‘tasks’ and ‘builds’ have –details option otherwise output is compact (unless there is a single result)
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)
- 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
- install –exclude: don’t exclude subpackage when a rpm package matches
0.6 (2022-01-13)
- renamed from koji-install to koji-tool, which combines koji-query and koji-progress
- subcommands are ‘install’, ‘query’, ‘progress’, and ‘buildlog-sizes’
- ‘query’ now has separate before/after options: –before and –from
- ‘query’ now defaults to ‘–from 00:00’ and supports days of week & today/yesterday timedates
- ‘query’ now limits to 10 results by default in descending order
- ‘install’ now uses a single curl invocation to download multiple rpms
Release history for koji-install
0.5 (2021-12-27)
- –package and –exclude filters can now be combined
- –package and –exclude now also check subpackage names without base prefix
0.4 (2021-12-20)
- support installing/listing by koji taskid
- select subpackages with –package and –exclude, by name or globbing
- check remote files date/size with http-directory
- listing a task either lists the task’s children or rpms
- use dnf reinstall for installed packages and otherwise localinstall
- more detailed debug output
- system arch no longer hardcoded to x86_64
0.3 (2021-12-03)
- add
--list
command to list recent builds - fix bug in generating kojifiles url from short name
- workarounds for rpmfusion’s older koji not supporting patterns
- check if %dist is defined
0.2.0 (2021-12-03)
- initial Hackage release
--hub
to select hub--pkgsurl
to override kojifiles url- override
--disttag
- select specific build with
--nvr
or--nv
--debug
output
0.1.0 (2021-08-12)
- pre-release on copr
- initial options: –all/–ask/–base-only/–exclude-devel –dry-run
- only supports Fedora Koji