Blame doc/use_cases.rst

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