Blame doc/use_cases.rst

Packit Service 21c75c
..
Packit Service 21c75c
  Copyright (C) 2015  Red Hat, Inc.
Packit Service 21c75c
Packit Service 21c75c
  This copyrighted material is made available to anyone wishing to use,
Packit Service 21c75c
  modify, copy, or redistribute it subject to the terms and conditions of
Packit Service 21c75c
  the GNU General Public License v.2, or (at your option) any later version.
Packit Service 21c75c
  This program is distributed in the hope that it will be useful, but WITHOUT
Packit Service 21c75c
  ANY WARRANTY expressed or implied, including the implied warranties of
Packit Service 21c75c
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
Packit Service 21c75c
  Public License for more details.  You should have received a copy of the
Packit Service 21c75c
  GNU General Public License along with this program; if not, write to the
Packit Service 21c75c
  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
Packit Service 21c75c
  02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
Packit Service 21c75c
  source code or documentation are not subject to the GNU General Public
Packit Service 21c75c
  License and may only be used or replicated with the express permission of
Packit Service 21c75c
  Red Hat, Inc.
Packit Service 21c75c
Packit Service 21c75c
###############
Packit Service 21c75c
 DNF Use Cases
Packit Service 21c75c
###############
Packit Service 21c75c
Packit Service 21c75c
.. contents::
Packit Service 21c75c
Packit Service 21c75c
==============
Packit Service 21c75c
 Introduction
Packit Service 21c75c
==============
Packit Service 21c75c
Packit Service 21c75c
Every feature present in DNF should be based on a reasonable use case. All the
Packit Service 21c75c
supported use cases are supposed to be enumerated in this document.
Packit Service 21c75c
Packit Service 21c75c
In case you use DNF to achieve a goal which is not documented here, either you
Packit Service 21c75c
found an error in the documentation or you misuse DNF. In either case we would
Packit Service 21c75c
appreciate if you share the case with us so we can help you to use DNF in the
Packit Service 21c75c
correct way or add the case to the list. You can only benefit from such a
Packit Service 21c75c
report because then you can be sure that the behavior that you expect will not
Packit Service 21c75c
change without prior notice in the :doc:`release_notes` and that the behavior
Packit Service 21c75c
will be covered by our test suite.
Packit Service 21c75c
Packit Service 21c75c
.. IMPORTANT::
Packit Service 21c75c
Packit Service 21c75c
  Please consult every usage of DNF with our reference documentation to be sure
Packit Service 21c75c
  what are you doing. The examples mentioned here are supposed to be as simple
Packit Service 21c75c
  as possible and may ignore some minor corner cases.
Packit Service 21c75c
Packit Service 21c75c
.. WARNING::
Packit Service 21c75c
Packit Service 21c75c
  The list is not complete yet - the use cases are being added incrementally
Packit Service 21c75c
  these days.
Packit Service 21c75c
Packit Service 21c75c
=====================
Packit Service 21c75c
 General assumptions
Packit Service 21c75c
=====================
Packit Service 21c75c
Packit Service 21c75c
The user in question must have the appropriate permissions.
Packit Service 21c75c
Packit Service 21c75c
.. _install_use_case-label:
Packit Service 21c75c
Packit Service 21c75c
========================================================================================
Packit Service 21c75c
 Ensure that my system contains given mix of features (packages/files/providers/groups)
Packit Service 21c75c
========================================================================================
Packit Service 21c75c
Packit Service 21c75c
A system administrator has a list of features that has to be present in an
Packit Service 21c75c
operating system. The features must be provided by RPM packages in system
Packit Service 21c75c
repositories that must be accessible.
Packit Service 21c75c
Packit Service 21c75c
A feature may be for example a concrete version of a package
Packit Service 21c75c
(``hawkey-0.5.3-1.fc21.i686``), a pathname of a binary RPM file
Packit Service 21c75c
(``/var/lib/mock/fedora-21-i386/result/hawkey-0.5.3-2.20150116gitd002c90.fc21.i686.rpm``),
Packit Service 21c75c
an URL of a binary RPM file
Packit Service 21c75c
(``http://jenkins.cloud.fedoraproject.org/job/DNF/lastSuccessfulBuild/artifact/fedora-21-i386-build/hawkey-0.5.3-99.649.20150116gitd002c90233fc96893806836a258f14a50ee0cf47.fc21.i686.rpm``),
Packit Service 21c75c
a configuration file (``/etc/yum.repos.d/fedora-rawhide.repo``), a language
Packit Service 21c75c
interpreter (``ruby(runtime_executable)``), an extension (``python3-dnf``), a
Packit Service 21c75c
support for building modules for the current running kernel
Packit Service 21c75c
(``kernel-devel-uname-r = $(uname -r)``), an executable (``*/binaryname``) or a
Packit Service 21c75c
collection of packages specified by any available identifier (``kde-desktop``).
Packit Service 21c75c
Packit Service 21c75c
The most recent packages that provide the missing features and suit
Packit Service 21c75c
installation (that are not obsoleted and do not conflict with each other or
Packit Service 21c75c
with the other installed packages) are installed if the given feature is not
Packit Service 21c75c
present already. If any of the packages cannot be installed, the operation
Packit Service 21c75c
fails.
Packit Service 21c75c
Packit Service 21c75c
-----
Packit Service 21c75c
 CLI
Packit Service 21c75c
-----
Packit Service 21c75c
Packit Service 21c75c
::
Packit Service 21c75c
Packit Service 21c75c
    SPECS="hawkey-0.5.3-1.fc21.i686 @kde-desktop"  # Set the features here.
Packit Service 21c75c
Packit Service 21c75c
    dnf install $SPECS
Packit Service 21c75c
Packit Service 21c75c
-----------------
Packit Service 21c75c
 Plugins/CLI API
Packit Service 21c75c
-----------------
Packit Service 21c75c
Packit Service 21c75c
.. include:: examples/install_plugin.py
Packit Service 21c75c
   :code: python
Packit Service 21c75c
   :start-line: 16
Packit Service 21c75c
Packit Service 21c75c
If it makes a sense, the plugin can do the operation in appropriate hooks
Packit Service 21c75c
instead of registering a new command that needs to be called from the command
Packit Service 21c75c
line.
Packit Service 21c75c
Packit Service 21c75c
---------------
Packit Service 21c75c
 Extension API
Packit Service 21c75c
---------------
Packit Service 21c75c
Packit Service 21c75c
.. include:: examples/install_extension.py
Packit Service 21c75c
   :code: python
Packit Service 21c75c
   :start-line: 16
Packit Service 21c75c
Packit Service 21c75c
=========================================================================
Packit Service 21c75c
Get a list of available packages filtered by their relation to the system
Packit Service 21c75c
=========================================================================
Packit Service 21c75c
Packit Service 21c75c
A system user wants to obtain a list of available RPM packages for their
Packit Service 21c75c
consecutive automatic processing or for informative purpose only.
Packit Service 21c75c
The list of RPM packages is filtered by requested relation to the system
Packit Service 21c75c
or user provided <package-name-specs>. The obtained list of packages
Packit Service 21c75c
is based on available data supplied by accessible system repositories.
Packit Service 21c75c
Packit Service 21c75c
A relation to the system might be for example one of the following:
Packit Service 21c75c
Packit Service 21c75c
installed - packages already installed on the system
Packit Service 21c75c
Packit Service 21c75c
available - packages available in any accessible repository
Packit Service 21c75c
Packit Service 21c75c
extras - packages installed on the system not available in any known
Packit Service 21c75c
repository
Packit Service 21c75c
Packit Service 21c75c
obsoletes - installed packages that are obsoleted by packages in any
Packit Service 21c75c
accessible repository
Packit Service 21c75c
Packit Service 21c75c
recent - packages recently added into accessible repositories
Packit Service 21c75c
Packit Service 21c75c
upgrades - available packages upgrading some installed packages
Packit Service 21c75c
Packit Service 21c75c
-----
Packit Service 21c75c
CLI
Packit Service 21c75c
-----
Packit Service 21c75c
Packit Service 21c75c
::
Packit Service 21c75c
Packit Service 21c75c
    dnf list *dnf*
Packit Service 21c75c
    dnf list installed *debuginfo
Packit Service 21c75c
    dnf list available gtk*devel
Packit Service 21c75c
    dnf list extras
Packit Service 21c75c
    dnf list obsoletes
Packit Service 21c75c
    dnf list recent
Packit Service 21c75c
    dnf list upgrades
Packit Service 21c75c
Packit Service 21c75c
-----------------
Packit Service 21c75c
Plugins/CLI API
Packit Service 21c75c
-----------------
Packit Service 21c75c
Packit Service 21c75c
.. include:: examples/list_obsoletes_plugin.py
Packit Service 21c75c
   :code: python
Packit Service 21c75c
   :start-line: 16
Packit Service 21c75c
Packit Service 21c75c
---------------
Packit Service 21c75c
Extension API
Packit Service 21c75c
---------------
Packit Service 21c75c
Packit Service 21c75c
.. include:: examples/list_extras_extension.py
Packit Service 21c75c
   :code: python
Packit Service 21c75c
   :start-line: 16