Query package info from upstream repository¶
This guide describes how to query package information from the Clear Linux OS upstream repositories. This guide is intended for developers and advanced users.
Overview¶
In Clear Linux* OS, the swupd tool manages software dependencies and installs bundles instead of packages. Although a bundle is a collection of one or more packages, Clear Linux OS does not work with packages on the client side. However, on the upstream/factory side, Clear Linux OS does work with packages using a process called mixing.
Currently, swupd does not report which packages are installed, provide package version information, or return other package details. This guide describes a method for retrieving package information from the Clear Linux OS upstream repositories using DNF commands.
Prerequisites¶
This guide assumes you have installed Clear Linux OS on your host system. For detailed instructions on installing Clear Linux OS on a bare metal system, visit the bare metal installation guide.
Before you install any new packages, update Clear Linux OS with the following command:
sudo swupd update
Configure DNF¶
Install the DNF bundle with the command:
sudo swupd bundle-add dnf
Create a
dnf.conf
file with the commands:sudo mkdir -p /etc/dnf sudo curl -L https://github.com/clearlinux/common/raw/master/conf/dnf.conf --output /etc/dnf/dnf.conf
Edit the
/etc/dnf/dnf.conf
file and set the baseurl variable for binary and source RPMs as shown in lines 3 and 9 in the following example.1[clear] 2name=Clear 3baseurl=https://cdn.download.clearlinux.org/releases/$releasever/clear/x86_64/os/ 4enabled=1 5gpgcheck=0 6[clear-source] 7name=Clear sources 8failovermethod=priority 9baseurl=https://cdn.download.clearlinux.org/releases/$releasever/clear/source/SRPMS/ 10enabled=1 11gpgcheck=0
Initialize the RPM database with the command:
sudo rpm --initdb
DNF command usage examples¶
List all binary and source RPMs in the current release¶
Command:
dnf repoquery --releasever=current
Sample output:
Clear 5.1 MB/s | 13 MB 00:02
Clear sources 1.8 MB/s | 1.7 MB 00:00
AVB-AudioModules-0:4.1.0-1.src
AVB-AudioModules-0:4.1.0-1.x86_64
AVB-AudioModules-data-0:4.1.0-1.x86_64
AVB-AudioModules-dev-0:4.1.0-1.x86_64
AVB-AudioModules-lib-0:4.1.0-1.x86_64
AVB-AudioModules-license-0:4.1.0-1.x86_64
AVBStreamHandler-0:1.1.0-21.src
AVBStreamHandler-0:1.1.0-21.x86_64
AVBStreamHandler-abi-0:1.1.0-21.x86_64
AVBStreamHandler-bin-0:1.1.0-21.x86_64
AVBStreamHandler-data-0:1.1.0-21.x86_64
AVBStreamHandler-dev-0:1.1.0-21.x86_64
AVBStreamHandler-lib-0:1.1.0-21.x86_64
AVBStreamHandler-license-0:1.1.0-21.x86_64
...
<trimmed>
Show version information for a package in current release¶
This example queries version information for the zstd package.
Command:
dnf repoquery --releasever=current zstd
Sample output:
Last metadata expiration check: 0:02:30 ago on Tue 16 Jul 2019 03:03:34 PM PDT.
zstd-0:1.4.0-46.src
zstd-0:1.4.0-46.x86_64
Show version information for a package in a specific release¶
This example queries version information for the zstd package in release 21000.
Command:
dnf repoquery --releasever=21000 zstd
Sample output:
Clear
2.7 MB/s | 3.9 MB 00:01
Clear sources
628 kB/s | 559 kB 00:00
zstd-0:1.3.3-20.src
zstd-0:1.3.3-20.x86_64
Show only version and release information for a package in a specific release¶
This example queries version and release information for the zstd package in release 15000.
Command:
dnf repoquery --releasever=15000 --qf="%{VERSION}\n%{RELEASE}" zstd
Sample output:
Clear
3.4 MB/s | 3.9 MB 00:01
Clear sources
345 kB/s | 528 kB 00:01
1.1.4
5
Show the binary package for a specified binary file¶
This example returns the binary package that contains the
/usr/bin/zip
binary file.
Command:
dnf repoquery --releasever=current --whatprovides /usr/bin/zip
Sample output:
Last metadata expiration check: 0:04:47 ago on Tue 16 Jul 2019 03:03:34 PM PDT.
zip-bin-0:3.0-23.x86_64
Show the source package for a specified binary file¶
This example returns the source package that contains the
/usr/bin/zip
binary file.
Command:
dnf repoquery --releasever=current --whatprovides /usr/bin/zip --srpm
Sample output:
Last metadata expiration check: 0:05:50 ago on Tue 16 Jul 2019 03:03:34 PM PDT.
zip-0:3.0-23.src