Fedora - RPM packages explained - Printable Version +- Sick Gaming (https://www.sickgaming.net) +-- Forum: Computers (https://www.sickgaming.net/forum-86.html) +--- Forum: Linux, FreeBSD, and Unix types (https://www.sickgaming.net/forum-88.html) +--- Thread: Fedora - RPM packages explained (/thread-91061.html) |
Fedora - RPM packages explained - xSicKxBot - 06-27-2019 RPM packages explained <div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/06/rpm-packages-explained.png" width="1024" height="558" title="" alt="" /></div><div><p>Perhaps the best known way the Fedora community pursues its <a href="https://docs.fedoraproject.org/en-US/project/#_what_is_fedora_all_about">mission of promoting free and open source software and content</a> is by developing the <a href="https://getfedora.org">Fedora software distribution</a>. So it’s not a surprise at all that a very large proportion of our community resources are spent on this task. This post summarizes how this software is “packaged” and the underlying tools such as <em>rpm</em> that make it all possible.</p> <p> <span id="more-28479"></span> </p> <h2>RPM: the smallest unit of software</h2> <p>The editions and flavors (<a href="https://spins.fedoraproject.org/">spins</a>/<a href="https://labs.fedoraproject.org/">labs</a>/<a href="https://silverblue.fedoraproject.org/">silverblue</a>) that users get to choose from are all very similar. They’re all composed of various software that is mixed and matched to work well together. What differs between them is the exact list of tools that goes into each. That choice depends on the use case that they target. The basic unit of all of these is an RPM package file.</p> <p>RPM files are archives that are similar to ZIP files or tarballs. In fact, they uses compression to reduce the size of the archive. However, along with files, RPM archives also contain metadata about the package. This can be queried using the <em>rpm</em> tool:</p> <pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px;height:300px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ rpm -q fpaste<br /> fpaste-0.3.9.2-2.fc30.noarch<br /> <br /> $ rpm -qi fpaste<br /> Name : fpaste<br /> Version : 0.3.9.2<br /> Release : 2.fc30<br /> Architecture: noarch<br /> Install Date: Tue 26 Mar 2019 08:49:10 GMT<br /> Group : Unspecified<br /> Size : 64144<br /> License : GPLv3+<br /> Signature : RSA/SHA256, Thu 07 Feb 2019 15:46:11 GMT, Key ID ef3c111fcfc659b9<br /> Source RPM : fpaste-0.3.9.2-2.fc30.src.rpm<br /> Build Date : Thu 31 Jan 2019 20:06:01 GMT<br /> Build Host : buildhw-07.phx2.fedoraproject.org<br /> Relocations : (not relocatable)<br /> Packager : Fedora Project<br /> Vendor : Fedora Project<br /> URL : https://pagure.io/fpaste<br /> Bug URL : https://bugz.fedoraproject.org/fpaste<br /> Summary : A simple tool for pasting info onto sticky notes instances<br /> Description :<br /> It is often useful to be able to easily paste text to the Fedora<br /> Pastebin at http://paste.fedoraproject.org and this simple script<br /> will do that and return the resulting URL so that people may<br /> examine the output. This can hopefully help folks who are for<br /> some reason stuck without X, working remotely, or any other<br /> reason they may be unable to paste something into the pastebin<br /> <br /> $ rpm -ql fpaste<br /> /usr/bin/fpaste<br /> /usr/share/doc/fpaste<br /> /usr/share/doc/fpaste/README.rst<br /> /usr/share/doc/fpaste/TODO<br /> /usr/share/licenses/fpaste<br /> /usr/share/licenses/fpaste/COPYING<br /> /usr/share/man/man1/fpaste.1.gz</div></div> </pre> <p>When an RPM package is installed, the <em>rpm</em> tools know exactly what files were added to the system. So, removing a package also removes these files, and leaves the system in a consistent state. This is why installing software using <em>rpm</em> is preferred over installing software from source whenever possible. </p> <h2>Dependencies</h2> <p>Nowadays, it is quite rare for software to be completely self-contained. Even <a href="https://src.fedoraproject.org/rpms/fpaste">fpaste</a>, a simple one file Python script, requires that the Python interpreter be installed. So, if the system does not have Python installed (highly unlikely, but possible), <em>fpaste</em> cannot be used. In packager jargon, we say that “Python is a <strong>run-time dependency</strong> of <em>fpaste</em>“.</p> <p>When RPM packages are built (the process of building RPMs is not discussed in this post), the generated archive includes all of this metadata. That way, the tools interacting with the RPM package archive know what else must must be installed so that fpaste works correctly:</p> <pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px;height:300px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ rpm -q --requires fpaste<br /> /usr/bin/python3<br /> python3<br /> rpmlib(CompressedFileNames) &lt;= 3.0.4-1<br /> rpmlib(FileDigests) &lt;= 4.6.0-1<br /> rpmlib(PayloadFilesHavePrefix) &lt;= 4.0-1<br /> rpmlib(PayloadIsXz) &lt;= 5.2-1<br /> <br /> $ rpm -q --provides fpaste<br /> fpaste = 0.3.9.2-2.fc30<br /> <br /> $ rpm -qi python3<br /> Name : python3<br /> Version : 3.7.3<br /> Release : 3.fc30<br /> Architecture: x86_64<br /> Install Date: Thu 16 May 2019 18:51:41 BST<br /> Group : Unspecified<br /> Size : 46139<br /> License : Python<br /> Signature : RSA/SHA256, Sat 11 May 2019 17:02:44 BST, Key ID ef3c111fcfc659b9<br /> Source RPM : python3-3.7.3-3.fc30.src.rpm<br /> Build Date : Sat 11 May 2019 01:47:35 BST<br /> Build Host : buildhw-05.phx2.fedoraproject.org<br /> Relocations : (not relocatable)<br /> Packager : Fedora Project<br /> Vendor : Fedora Project<br /> URL : https://www.python.org/<br /> Bug URL : https://bugz.fedoraproject.org/python3<br /> Summary : Interpreter of the Python programming language<br /> Description :<br /> Python is an accessible, high-level, dynamically typed, interpreted programming<br /> language, designed with an emphasis on code readability.<br /> It includes an extensive standard library, and has a vast ecosystem of<br /> third-party libraries.<br /> <br /> The python3 package provides the "python3" executable: the reference<br /> interpreter for the Python language, version 3.<br /> The majority of its standard library is provided in the python3-libs package,<br /> which should be installed automatically along with python3.<br /> The remaining parts of the Python standard library are broken out into the<br /> python3-tkinter and python3-test packages, which may need to be installed<br /> separately.<br /> <br /> Documentation for Python is provided in the python3-docs package.<br /> <br /> Packages containing additional libraries for Python are generally named with<br /> the "python3-" prefix.<br /> <br /> $ rpm -q --provides python3<br /> python(abi) = 3.7<br /> python3 = 3.7.3-3.fc30<br /> python3(x86-64) = 3.7.3-3.fc30<br /> python3.7 = 3.7.3-3.fc30<br /> python37 = 3.7.3-3.fc30</div></div> </pre> <h2>Resolving RPM dependencies</h2> <p>While <em>rpm</em> knows the required dependencies for each archive, it does not know where to find them. This is by design: <em>rpm</em> only works on local files and must be told exactly where they are. So, if you try to install a single RPM package, you get an error if <em>rpm</em> cannot find the package’s run-time dependencies. This example tries to install a package downloaded from the Fedora package set:</p> <pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px;height:300px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ ls<br /> python3-elephant-0.6.2-3.fc30.noarch.rpm<br /> <br /> $ rpm -qpi python3-elephant-0.6.2-3.fc30.noarch.rpm<br /> Name : python3-elephant<br /> Version : 0.6.2<br /> Release : 3.fc30<br /> Architecture: noarch<br /> Install Date: (not installed)<br /> Group : Unspecified<br /> Size : 2574456<br /> License : BSD<br /> Signature : (none)<br /> Source RPM : python-elephant-0.6.2-3.fc30.src.rpm<br /> Build Date : Fri 14 Jun 2019 17:23:48 BST<br /> Build Host : buildhw-02.phx2.fedoraproject.org<br /> Relocations : (not relocatable)<br /> Packager : Fedora Project<br /> Vendor : Fedora Project<br /> URL : http://neuralensemble.org/elephant<br /> Bug URL : https://bugz.fedoraproject.org/python-elephant<br /> Summary : Elephant is a package for analysis of electrophysiology data in Python<br /> Description :<br /> Elephant - Electrophysiology Analysis Toolkit Elephant is a package for the<br /> analysis of neurophysiology data, based on Neo.<br /> <br /> $ rpm -qp --requires python3-elephant-0.6.2-3.fc30.noarch.rpm<br /> python(abi) = 3.7<br /> python3.7dist(neo) >= 0.7.1<br /> python3.7dist(numpy) >= 1.8.2<br /> python3.7dist(quantities) >= 0.10.1<br /> python3.7dist(scipy) >= 0.14.0<br /> python3.7dist(six) >= 1.10.0<br /> rpmlib(CompressedFileNames) &lt;= 3.0.4-1<br /> rpmlib(FileDigests) &lt;= 4.6.0-1<br /> rpmlib(PartialHardlinkSets) &lt;= 4.0.4-1<br /> rpmlib(PayloadFilesHavePrefix) &lt;= 4.0-1<br /> rpmlib(PayloadIsXz) &lt;= 5.2-1<br /> <br /> $ sudo rpm -i ./python3-elephant-0.6.2-3.fc30.noarch.rpm<br /> error: Failed dependencies:<br /> python3.7dist(neo) >= 0.7.1 is needed by python3-elephant-0.6.2-3.fc30.noarch<br /> python3.7dist(quantities) >= 0.10.1 is needed by python3-elephant-0.6.2-3.fc30.noarch</div></div> </pre> <p>In theory, one could download all the packages that are required for <em>python3-elephant</em>, and tell <em>rpm</em> where they all are, but that isn’t convenient. What if <em>python3-neo</em> and <em>python3-quantities</em> have other run-time requirements and so on? Very quickly, the <strong>dependency chain</strong> can get quite complicated.</p> <h3>Repositories</h3> <p>Luckily, <em>dnf</em> and friends exist to help with this issue. Unlike <em>rpm</em>, <em>dnf</em> is aware of <strong>repositories</strong>. Repositories are collections of packages, with metadata that tells <em>dnf</em> what these repositories contain. All Fedora systems come with the default Fedora repositories enabled by default:</p> <pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo dnf repolist<br /> repo id repo name status<br /> fedora Fedora 30 - x86_64 56,582<br /> fedora-modular Fedora Modular 30 - x86_64 135<br /> updates Fedora 30 - x86_64 - Updates 8,573<br /> updates-modular Fedora Modular 30 - x86_64 - Updates 138<br /> updates-testing Fedora 30 - x86_64 - Test Updates 8,458</div></div> </pre> <p>There’s more information on <a href="https://docs.fedoraproject.org/en-US/quick-docs/repositories/">these repositories</a>, and how they <a href="https://docs.fedoraproject.org/en-US/quick-docs/adding-or-removing-software-repositories-in-fedora/">can be managed</a> on the Fedora quick docs. </p> <p><em>dnf</em> can be used to query repositories for information on the packages they contain. It can also search them for software, or install/uninstall/upgrade packages from them:</p> <pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo dnf search elephant<br /> Last metadata expiration check: 0:05:21 ago on Sun 23 Jun 2019 14:33:38 BST.<br /> ============================================================================== Name &amp; Summary Matched: elephant ==============================================================================<br /> python3-elephant.noarch : Elephant is a package for analysis of electrophysiology data in Python<br /> python3-elephant.noarch : Elephant is a package for analysis of electrophysiology data in Python<br /> <br /> $ sudo dnf list \*elephant\*<br /> Last metadata expiration check: 0:05:26 ago on Sun 23 Jun 2019 14:33:38 BST.<br /> Available Packages<br /> python3-elephant.noarch 0.6.2-3.fc30 updates-testing<br /> python3-elephant.noarch 0.6.2-3.fc30 updates</div></div> </pre> <h3>Installing dependencies</h3> <p>When installing the package using <em>dnf</em> now, it <em>resolves</em> all the required dependencies, then calls <em>rpm</em> to carry out the <em>transaction</em>:</p> <pre class="wp-block-code"> <div class="codecolorer-container text default" style="overflow:auto;border:1px solid #9F9F9F;width:435px;height:300px"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace">$ sudo dnf install python3-elephant<br /> Last metadata expiration check: 0:06:17 ago on Sun 23 Jun 2019 14:33:38 BST.<br /> Dependencies resolved.<br /> ==============================================================================================================================================================================================<br /> Package Architecture Version Repository Size<br /> ==============================================================================================================================================================================================<br /> Installing:<br /> python3-elephant noarch 0.6.2-3.fc30 updates-testing 456 k<br /> Installing dependencies:<br /> python3-neo noarch 0.8.0-0.1.20190215git49b6041.fc30 fedora 753 k<br /> python3-quantities noarch 0.12.2-4.fc30 fedora 163 k<br /> Installing weak dependencies:<br /> python3-igor noarch 0.3-5.20150408git2c2a79d.fc30 fedora 63 k<br /> <br /> Transaction Summary<br /> ==============================================================================================================================================================================================<br /> Install 4 Packages<br /> <br /> Total download size: 1.4 M<br /> Installed size: 7.0 M<br /> Is this ok [y/N]: y<br /> Downloading Packages:<br /> (1/4): python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch.rpm 222 kB/s | 63 kB 00:00<br /> (2/4): python3-elephant-0.6.2-3.fc30.noarch.rpm 681 kB/s | 456 kB 00:00<br /> (3/4): python3-quantities-0.12.2-4.fc30.noarch.rpm 421 kB/s | 163 kB 00:00<br /> (4/4): python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch.rpm 840 kB/s | 753 kB 00:00<br /> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br /> Total 884 kB/s | 1.4 MB 00:01<br /> Running transaction check<br /> Transaction check succeeded.<br /> Running transaction test<br /> Transaction test succeeded.<br /> Running transaction<br /> Preparing : 1/1<br /> Installing : python3-quantities-0.12.2-4.fc30.noarch 1/4<br /> Installing : python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch 2/4<br /> Installing : python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch 3/4<br /> Installing : python3-elephant-0.6.2-3.fc30.noarch 4/4<br /> Running scriptlet: python3-elephant-0.6.2-3.fc30.noarch 4/4<br /> Verifying : python3-elephant-0.6.2-3.fc30.noarch 1/4<br /> Verifying : python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch 2/4<br /> Verifying : python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch 3/4<br /> Verifying : python3-quantities-0.12.2-4.fc30.noarch 4/4<br /> <br /> Installed:<br /> python3-elephant-0.6.2-3.fc30.noarch python3-igor-0.3-5.20150408git2c2a79d.fc30.noarch python3-neo-0.8.0-0.1.20190215git49b6041.fc30.noarch python3-quantities-0.12.2-4.fc30.noarch<br /> <br /> Complete!</div></div> </pre> <p>Notice how dnf even installed <em>python3-igor</em>, which isn’t a direct dependency of <em>python3-elephant</em>. </p> <h2>DnfDragora: a graphical interface to DNF</h2> <p>While technical users may find <em>dnf</em> straightforward to use, it isn’t for everyone. <a href="https://src.fedoraproject.org/rpms/dnfdragora">Dnfdragora</a> addresses this issue by providing a graphical front end to <em>dnf</em>. </p> <figure class="wp-block-image"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2019/06/rpm-packages-explained.png" alt="" class="wp-image-28512" /><figcaption>dnfdragora (version 1.1.1-2 on Fedora 30) listing all the packages installed on a system.</figcaption></figure> <p>From a quick look, dnfdragora appears to provide all of <em>dnf</em>‘s main functions. </p> <p>There are other tools in Fedora that also manage packages. GNOME Software, and Discover are two examples. GNOME Software is focused on graphical applications only. You can’t use the graphical front end to install command line or terminal tools such as <em>htop</em> or <em>weechat</em>. However, GNOME Software does support the installation of <a href="https://fedoramagazine.org/getting-started-flatpak/">Flatpaks</a> and Snap applications which <em>dnf</em> does not. So, they are different tools with different target audiences, and so provide different functions. </p> <p>This post only touches the tip of the iceberg that is the life cycle of software in Fedora. This article explained what RPM packages are, and the main differences between using <em>rpm</em> and using <em>dnf</em>.</p> <p>In future posts, we’ll speak more about:</p> <ul> <li>The processes that are needed to create these packages</li> <li>How the community tests them to ensure that they are built correctly</li> <li>The infrastructure that the community uses to get them to community users in future posts. </li> </ul> </div> |