2018-08-13 23:43:20 +00:00
<!DOCTYPE html>
<!-- [if IE 8]><html class="no - js lt - ie9" lang="en" > <![endif] -->
<!-- [if gt IE 8]><! --> < html class = "no-js" lang = "en" > <!-- <![endif] -->
< head >
< meta charset = "utf-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2021-03-04 00:36:38 +00:00
< title > pylorax.api.dnfbase — Lorax 35.0 documentation< / title >
2018-08-13 23:43:20 +00:00
2019-03-27 23:44:14 +00:00
< script type = "text/javascript" src = "../../../_static/js/modernizr.min.js" > < / script >
2018-08-13 23:43:20 +00:00
2019-03-27 23:44:14 +00:00
< script type = "text/javascript" id = "documentation_options" data-url_root = "../../../" src = "../../../_static/documentation_options.js" > < / script >
2020-09-08 18:59:15 +00:00
< script src = "../../../_static/jquery.js" > < / script >
< script src = "../../../_static/underscore.js" > < / script >
< script src = "../../../_static/doctools.js" > < / script >
< script src = "../../../_static/language_data.js" > < / script >
2019-03-27 23:44:14 +00:00
< script type = "text/javascript" src = "../../../_static/js/theme.js" > < / script >
2018-08-13 23:43:20 +00:00
2019-03-27 23:44:14 +00:00
2018-08-13 23:43:20 +00:00
2019-03-27 23:44:14 +00:00
2018-11-13 17:53:31 +00:00
< link rel = "stylesheet" href = "../../../_static/css/theme.css" type = "text/css" / >
2018-08-13 23:43:20 +00:00
< link rel = "stylesheet" href = "../../../_static/pygments.css" type = "text/css" / >
< link rel = "index" title = "Index" href = "../../../genindex.html" / >
< link rel = "search" title = "Search" href = "../../../search.html" / >
< / head >
< body class = "wy-body-for-nav" >
< div class = "wy-grid-for-nav" >
< nav data-toggle = "wy-nav-shift" class = "wy-nav-side" >
< div class = "wy-side-scroll" >
2019-03-27 23:44:14 +00:00
< div class = "wy-side-nav-search" >
2018-08-13 23:43:20 +00:00
< a href = "../../../index.html" class = "icon icon-home" > Lorax
< / a >
< div class = "version" >
2021-03-04 00:36:38 +00:00
35.0
2018-08-13 23:43:20 +00:00
< / div >
< div role = "search" >
< form id = "rtd-search-form" class = "wy-form" action = "../../../search.html" method = "get" >
< input type = "text" name = "q" placeholder = "Search docs" / >
< input type = "hidden" name = "check_keywords" value = "yes" / >
< input type = "hidden" name = "area" value = "default" / >
< / form >
< / div >
< / div >
< div class = "wy-menu wy-menu-vertical" data-spy = "affix" role = "navigation" aria-label = "main navigation" >
< ul >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../intro.html" > Introduction to Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../intro.html#before-lorax" > Before Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../lorax.html" > Lorax< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../livemedia-creator.html" > livemedia-creator< / a > < / li >
2018-10-24 17:07:32 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../composer-cli.html" > composer-cli< / a > < / li >
2019-11-05 22:36:46 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../mkksiso.html" > mkksiso< / a > < / li >
2018-08-13 23:43:20 +00:00
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../product-images.html" > Product and Updates Images< / a > < / li >
< li class = "toctree-l1" > < a class = "reference internal" href = "../../../modules.html" > src< / a > < / li >
< / ul >
< / div >
< / div >
< / nav >
< section data-toggle = "wy-nav-shift" class = "wy-nav-content-wrap" >
< nav class = "wy-nav-top" aria-label = "top navigation" >
< i data-toggle = "wy-nav-top" class = "fa fa-bars" > < / i >
< a href = "../../../index.html" > Lorax< / a >
< / nav >
< div class = "wy-nav-content" >
< div class = "rst-content" >
< div role = "navigation" aria-label = "breadcrumbs navigation" >
< ul class = "wy-breadcrumbs" >
< li > < a href = "../../../index.html" > Docs< / a > » < / li >
< li > < a href = "../../index.html" > Module code< / a > » < / li >
< li > < a href = "../../pylorax.html" > pylorax< / a > » < / li >
< li > pylorax.api.dnfbase< / li >
< li class = "wy-breadcrumbs-aside" >
< / li >
< / ul >
< hr / >
< / div >
< div role = "main" class = "document" itemscope = "itemscope" itemtype = "http://schema.org/Article" >
< div itemprop = "articleBody" >
< h1 > Source code for pylorax.api.dnfbase< / h1 > < div class = "highlight" > < pre >
< span > < / span > < span class = "c1" > #< / span >
< span class = "c1" > # Copyright (C) 2017-2018 Red Hat, Inc.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # This program is free software; you can redistribute it and/or modify< / span >
< span class = "c1" > # it under the terms of the GNU General Public License as published by< / span >
< span class = "c1" > # the Free Software Foundation; either version 2 of the License, or< / span >
< span class = "c1" > # (at your option) any later version.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # This program is distributed in the hope that it will be useful,< / span >
< span class = "c1" > # but WITHOUT ANY WARRANTY; without even the implied warranty of< / span >
< span class = "c1" > # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the< / span >
< span class = "c1" > # GNU General Public License for more details.< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # You should have received a copy of the GNU General Public License< / span >
< span class = "c1" > # along with this program. If not, see < http://www.gnu.org/licenses/> .< / span >
< span class = "c1" > #< / span >
< span class = "c1" > # pylint: disable=bad-preconf-access< / span >
< span class = "kn" > import< / span > < span class = "nn" > logging< / span >
< span class = "n" > log< / span > < span class = "o" > =< / span > < span class = "n" > logging< / span > < span class = "o" > .< / span > < span class = "n" > getLogger< / span > < span class = "p" > (< / span > < span class = "s2" > " lorax-composer" < / span > < span class = "p" > )< / span >
< span class = "kn" > import< / span > < span class = "nn" > dnf< / span >
< span class = "kn" > import< / span > < span class = "nn" > dnf.logging< / span >
2020-09-08 18:59:15 +00:00
< span class = "kn" > from< / span > < span class = "nn" > glob< / span > < span class = "kn" > import< / span > < span class = "n" > glob< / span >
2018-08-13 23:43:20 +00:00
< span class = "kn" > import< / span > < span class = "nn" > os< / span >
< span class = "kn" > import< / span > < span class = "nn" > shutil< / span >
2020-09-08 18:59:15 +00:00
< span class = "kn" > from< / span > < span class = "nn" > threading< / span > < span class = "kn" > import< / span > < span class = "n" > Lock< / span >
2018-10-04 23:55:20 +00:00
< span class = "kn" > import< / span > < span class = "nn" > time< / span >
2018-08-13 23:43:20 +00:00
2020-09-08 18:59:15 +00:00
< span class = "kn" > from< / span > < span class = "nn" > pylorax< / span > < span class = "kn" > import< / span > < span class = "n" > DEFAULT_PLATFORM_ID< / span >
< span class = "kn" > from< / span > < span class = "nn" > pylorax.sysutils< / span > < span class = "kn" > import< / span > < span class = "n" > flatconfig< / span >
2018-08-13 23:43:20 +00:00
2018-10-04 23:55:20 +00:00
< div class = "viewcode-block" id = "DNFLock" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.dnfbase.DNFLock" > [docs]< / a > < span class = "k" > class< / span > < span class = "nc" > DNFLock< / span > < span class = "p" > (< / span > < span class = "nb" > object< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Hold the dnf.Base object and a Lock to control access to it.< / span >
< span class = "sd" > self.dbo is a property that returns the dnf.Base object, but it *may* change< / span >
< span class = "sd" > from one call to the next if the upstream repositories have changed.< / span >
< span class = "sd" > " " " < / span >
2020-09-08 18:59:15 +00:00
< span class = "k" > def< / span > < span class = "fm" > __init__< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ,< / span > < span class = "n" > conf< / span > < span class = "p" > ,< / span > < span class = "n" > expire_secs< / span > < span class = "o" > =< / span > < span class = "mi" > 6< / span > < span class = "o" > *< / span > < span class = "mi" > 60< / span > < span class = "o" > *< / span > < span class = "mi" > 60< / span > < span class = "p" > ):< / span >
2018-10-04 23:55:20 +00:00
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _conf< / span > < span class = "o" > =< / span > < span class = "n" > conf< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _lock< / span > < span class = "o" > =< / span > < span class = "n" > Lock< / span > < span class = "p" > ()< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > =< / span > < span class = "n" > get_base_object< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _conf< / span > < span class = "p" > )< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _expire_secs< / span > < span class = "o" > =< / span > < span class = "n" > expire_secs< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _expire_time< / span > < span class = "o" > =< / span > < span class = "n" > time< / span > < span class = "o" > .< / span > < span class = "n" > time< / span > < span class = "p" > ()< / span > < span class = "o" > +< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _expire_secs< / span >
< span class = "nd" > @property< / span >
< span class = "k" > def< / span > < span class = "nf" > lock< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Check for repo updates (using expiration time) and return the lock< / span >
< span class = "sd" > If the repository has been updated, tear down the old dnf.Base and< / span >
< span class = "sd" > create a new one. This is the only way to force dnf to use the new< / span >
< span class = "sd" > metadata.< / span >
< span class = "sd" > " " " < / span >
< span class = "k" > if< / span > < span class = "n" > time< / span > < span class = "o" > .< / span > < span class = "n" > time< / span > < span class = "p" > ()< / span > < span class = "o" > > < / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _expire_time< / span > < span class = "p" > :< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > lock_check< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _lock< / span >
< span class = "nd" > @property< / span >
< span class = "k" > def< / span > < span class = "nf" > lock_check< / span > < span class = "p" > (< / span > < span class = "bp" > self< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Force a check for repo updates and return the lock< / span >
< span class = "sd" > Use this method sparingly, it removes the repodata and downloads a new copy every time.< / span >
< span class = "sd" > " " " < / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _expire_time< / span > < span class = "o" > =< / span > < span class = "n" > time< / span > < span class = "o" > .< / span > < span class = "n" > time< / span > < span class = "p" > ()< / span > < span class = "o" > +< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _expire_secs< / span >
< span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > update_cache< / span > < span class = "p" > ()< / span >
< span class = "k" > return< / span > < span class = "bp" > self< / span > < span class = "o" > .< / span > < span class = "n" > _lock< / span > < / div >
2018-08-13 23:43:20 +00:00
< div class = "viewcode-block" id = "get_base_object" > < a class = "viewcode-back" href = "../../../pylorax.api.html#pylorax.api.dnfbase.get_base_object" > [docs]< / a > < span class = "k" > def< / span > < span class = "nf" > get_base_object< / span > < span class = "p" > (< / span > < span class = "n" > conf< / span > < span class = "p" > ):< / span >
< span class = "sd" > " " " Get the DNF object with settings from the config file< / span >
< span class = "sd" > :param conf: configuration object< / span >
< span class = "sd" > :type conf: ComposerParser< / span >
< span class = "sd" > :returns: A DNF Base object< / span >
< span class = "sd" > :rtype: dnf.Base< / span >
< span class = "sd" > " " " < / span >
< span class = "n" > cachedir< / span > < span class = "o" > =< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > abspath< / span > < span class = "p" > (< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " cache_dir" < / span > < span class = "p" > ))< / span >
< span class = "n" > dnfconf< / span > < span class = "o" > =< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > abspath< / span > < span class = "p" > (< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " dnf_conf" < / span > < span class = "p" > ))< / span >
< span class = "n" > dnfroot< / span > < span class = "o" > =< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > abspath< / span > < span class = "p" > (< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " dnf_root" < / span > < span class = "p" > ))< / span >
< span class = "n" > repodir< / span > < span class = "o" > =< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > abspath< / span > < span class = "p" > (< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " repo_dir" < / span > < span class = "p" > ))< / span >
< span class = "c1" > # Setup the config for the DNF Base object< / span >
< span class = "n" > dbo< / span > < span class = "o" > =< / span > < span class = "n" > dnf< / span > < span class = "o" > .< / span > < span class = "n" > Base< / span > < span class = "p" > ()< / span >
< span class = "n" > dbc< / span > < span class = "o" > =< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > conf< / span >
< span class = "c1" > # TODO - Handle this< / span >
< span class = "c1" > # dbc.logdir = logdir< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > installroot< / span > < span class = "o" > =< / span > < span class = "n" > dnfroot< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isdir< / span > < span class = "p" > (< / span > < span class = "n" > dnfroot< / span > < span class = "p" > ):< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > makedirs< / span > < span class = "p" > (< / span > < span class = "n" > dnfroot< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > isdir< / span > < span class = "p" > (< / span > < span class = "n" > repodir< / span > < span class = "p" > ):< / span >
< span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > makedirs< / span > < span class = "p" > (< / span > < span class = "n" > repodir< / span > < span class = "p" > )< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > cachedir< / span > < span class = "o" > =< / span > < span class = "n" > cachedir< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > reposdir< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "n" > repodir< / span > < span class = "p" > ]< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > install_weak_deps< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > prepend_installroot< / span > < span class = "p" > (< / span > < span class = "s1" > ' persistdir' < / span > < span class = "p" > )< / span >
2018-10-04 23:55:20 +00:00
< span class = "c1" > # this is a weird ' AppendOption' thing that, when you set it,< / span >
< span class = "c1" > # actually appends. Doing this adds ' nodocs' to the existing list< / span >
< span class = "c1" > # of values, over in libdnf, it does not replace the existing values.< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > tsflags< / span > < span class = "o" > =< / span > < span class = "p" > [< / span > < span class = "s1" > ' nodocs' < / span > < span class = "p" > ]< / span >
2018-08-13 23:43:20 +00:00
< span class = "k" > if< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get_default< / span > < span class = "p" > (< / span > < span class = "s2" > " dnf" < / span > < span class = "p" > ,< / span > < span class = "s2" > " proxy" < / span > < span class = "p" > ,< / span > < span class = "kc" > None< / span > < span class = "p" > ):< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > proxy< / span > < span class = "o" > =< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " dnf" < / span > < span class = "p" > ,< / span > < span class = "s2" > " proxy" < / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > has_option< / span > < span class = "p" > (< / span > < span class = "s2" > " dnf" < / span > < span class = "p" > ,< / span > < span class = "s2" > " sslverify" < / span > < span class = "p" > )< / span > < span class = "ow" > and< / span > < span class = "ow" > not< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > getboolean< / span > < span class = "p" > (< / span > < span class = "s2" > " dnf" < / span > < span class = "p" > ,< / span > < span class = "s2" > " sslverify" < / span > < span class = "p" > ):< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > sslverify< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
2019-10-16 21:01:30 +00:00
< span class = "c1" > # If the system repos are enabled read the dnf vars from /etc/dnf/vars/< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > has_option< / span > < span class = "p" > (< / span > < span class = "s2" > " repos" < / span > < span class = "p" > ,< / span > < span class = "s2" > " use_system_repos" < / span > < span class = "p" > )< / span > < span class = "ow" > or< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > getboolean< / span > < span class = "p" > (< / span > < span class = "s2" > " repos" < / span > < span class = "p" > ,< / span > < span class = "s2" > " use_system_repos" < / span > < span class = "p" > ):< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > substitutions< / span > < span class = "o" > .< / span > < span class = "n" > update_from_etc< / span > < span class = "p" > (< / span > < span class = "s2" > " /" < / span > < span class = "p" > )< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " dnf vars: < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > substitutions< / span > < span class = "p" > )< / span >
2018-08-13 23:43:20 +00:00
< span class = "n" > _releasever< / span > < span class = "o" > =< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > get_default< / span > < span class = "p" > (< / span > < span class = "s2" > " composer" < / span > < span class = "p" > ,< / span > < span class = "s2" > " releasever" < / span > < span class = "p" > ,< / span > < span class = "kc" > None< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > _releasever< / span > < span class = "p" > :< / span >
< span class = "c1" > # Use the releasever of the host system< / span >
< span class = "n" > _releasever< / span > < span class = "o" > =< / span > < span class = "n" > dnf< / span > < span class = "o" > .< / span > < span class = "n" > rpm< / span > < span class = "o" > .< / span > < span class = "n" > detect_releasever< / span > < span class = "p" > (< / span > < span class = "s2" > " /" < / span > < span class = "p" > )< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " releasever = < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > _releasever< / span > < span class = "p" > )< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > releasever< / span > < span class = "o" > =< / span > < span class = "n" > _releasever< / span >
2018-09-06 17:37:53 +00:00
< span class = "c1" > # DNF 3.2 needs to have module_platform_id set, otherwise depsolve won' t work correctly< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > os< / span > < span class = "o" > .< / span > < span class = "n" > path< / span > < span class = "o" > .< / span > < span class = "n" > exists< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/os-release" < / span > < span class = "p" > ):< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > warning< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/os-release is missing, cannot determine platform id, falling back to < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > DEFAULT_PLATFORM_ID< / span > < span class = "p" > )< / span >
< span class = "n" > platform_id< / span > < span class = "o" > =< / span > < span class = "n" > DEFAULT_PLATFORM_ID< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > os_release< / span > < span class = "o" > =< / span > < span class = "n" > flatconfig< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/os-release" < / span > < span class = "p" > )< / span >
< span class = "n" > platform_id< / span > < span class = "o" > =< / span > < span class = "n" > os_release< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "s2" > " PLATFORM_ID" < / span > < span class = "p" > ,< / span > < span class = "n" > DEFAULT_PLATFORM_ID< / span > < span class = "p" > )< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Using < / span > < span class = "si" > %s< / span > < span class = "s2" > for module_platform_id" < / span > < span class = "p" > ,< / span > < span class = "n" > platform_id< / span > < span class = "p" > )< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > module_platform_id< / span > < span class = "o" > =< / span > < span class = "n" > platform_id< / span >
2018-10-04 23:55:20 +00:00
< span class = "c1" > # Make sure metadata is always current< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > metadata_expire< / span > < span class = "o" > =< / span > < span class = "mi" > 0< / span >
< span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > metadata_expire_filter< / span > < span class = "o" > =< / span > < span class = "s2" > " never" < / span >
2018-08-13 23:43:20 +00:00
< span class = "c1" > # write the dnf configuration file< / span >
< span class = "k" > with< / span > < span class = "nb" > open< / span > < span class = "p" > (< / span > < span class = "n" > dnfconf< / span > < span class = "p" > ,< / span > < span class = "s2" > " w" < / span > < span class = "p" > )< / span > < span class = "k" > as< / span > < span class = "n" > f< / span > < span class = "p" > :< / span >
< span class = "n" > f< / span > < span class = "o" > .< / span > < span class = "n" > write< / span > < span class = "p" > (< / span > < span class = "n" > dbc< / span > < span class = "o" > .< / span > < span class = "n" > dump< / span > < span class = "p" > ())< / span >
< span class = "c1" > # dnf needs the repos all in one directory, composer uses repodir for this< / span >
< span class = "c1" > # if system repos are supposed to be used, copy them into repodir, overwriting any previous copies< / span >
< span class = "k" > if< / span > < span class = "ow" > not< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > has_option< / span > < span class = "p" > (< / span > < span class = "s2" > " repos" < / span > < span class = "p" > ,< / span > < span class = "s2" > " use_system_repos" < / span > < span class = "p" > )< / span > < span class = "ow" > or< / span > < span class = "n" > conf< / span > < span class = "o" > .< / span > < span class = "n" > getboolean< / span > < span class = "p" > (< / span > < span class = "s2" > " repos" < / span > < span class = "p" > ,< / span > < span class = "s2" > " use_system_repos" < / span > < span class = "p" > ):< / span >
< span class = "k" > for< / span > < span class = "n" > repo_file< / span > < span class = "ow" > in< / span > < span class = "n" > glob< / span > < span class = "p" > (< / span > < span class = "s2" > " /etc/yum.repos.d/*.repo" < / span > < span class = "p" > ):< / span >
< span class = "n" > shutil< / span > < span class = "o" > .< / span > < span class = "n" > copy2< / span > < span class = "p" > (< / span > < span class = "n" > repo_file< / span > < span class = "p" > ,< / span > < span class = "n" > repodir< / span > < span class = "p" > )< / span >
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > read_all_repos< / span > < span class = "p" > ()< / span >
2019-03-27 23:44:14 +00:00
< span class = "c1" > # Remove any duplicate repo entries. These can cause problems with Anaconda, which will fail< / span >
< span class = "c1" > # with space problems.< / span >
< span class = "n" > repos< / span > < span class = "o" > =< / span > < span class = "nb" > sorted< / span > < span class = "p" > (< / span > < span class = "nb" > list< / span > < span class = "p" > (< / span > < span class = "n" > r< / span > < span class = "o" > .< / span > < span class = "n" > id< / span > < span class = "k" > for< / span > < span class = "n" > r< / span > < span class = "ow" > in< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > iter_enabled< / span > < span class = "p" > ()))< / span >
< span class = "n" > seen< / span > < span class = "o" > =< / span > < span class = "p" > {< / span > < span class = "s2" > " baseurl" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span > < span class = "s2" > " mirrorlist" < / span > < span class = "p" > :< / span > < span class = "p" > [],< / span > < span class = "s2" > " metalink" < / span > < span class = "p" > :< / span > < span class = "p" > []}< / span >
< span class = "k" > for< / span > < span class = "n" > source_name< / span > < span class = "ow" > in< / span > < span class = "n" > repos< / span > < span class = "p" > :< / span >
< span class = "n" > remove< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span >
< span class = "n" > repo< / span > < span class = "o" > =< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "o" > .< / span > < span class = "n" > get< / span > < span class = "p" > (< / span > < span class = "n" > source_name< / span > < span class = "p" > ,< / span > < span class = "kc" > None< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > repo< / span > < span class = "ow" > is< / span > < span class = "kc" > None< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > warning< / span > < span class = "p" > (< / span > < span class = "s2" > " repo < / span > < span class = "si" > %s< / span > < span class = "s2" > vanished while removing duplicates" < / span > < span class = "p" > ,< / span > < span class = "n" > source_name< / span > < span class = "p" > )< / span >
< span class = "k" > continue< / span >
< span class = "k" > if< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > baseurl< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > baseurl< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ]< / span > < span class = "ow" > in< / span > < span class = "n" > seen< / span > < span class = "p" > [< / span > < span class = "s2" > " baseurl" < / span > < span class = "p" > ]:< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Removing duplicate repo: < / span > < span class = "si" > %s< / span > < span class = "s2" > baseurl=< / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > source_name< / span > < span class = "p" > ,< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > baseurl< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ])< / span >
< span class = "n" > remove< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > seen< / span > < span class = "p" > [< / span > < span class = "s2" > " baseurl" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > baseurl< / span > < span class = "p" > [< / span > < span class = "mi" > 0< / span > < span class = "p" > ])< / span >
< span class = "k" > elif< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > mirrorlist< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > mirrorlist< / span > < span class = "ow" > in< / span > < span class = "n" > seen< / span > < span class = "p" > [< / span > < span class = "s2" > " mirrorlist" < / span > < span class = "p" > ]:< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Removing duplicate repo: < / span > < span class = "si" > %s< / span > < span class = "s2" > mirrorlist=< / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > source_name< / span > < span class = "p" > ,< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > mirrorlist< / span > < span class = "p" > )< / span >
< span class = "n" > remove< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > seen< / span > < span class = "p" > [< / span > < span class = "s2" > " mirrorlist" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > mirrorlist< / span > < span class = "p" > )< / span >
< span class = "k" > elif< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > metalink< / span > < span class = "p" > :< / span >
< span class = "k" > if< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > metalink< / span > < span class = "ow" > in< / span > < span class = "n" > seen< / span > < span class = "p" > [< / span > < span class = "s2" > " metalink" < / span > < span class = "p" > ]:< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Removing duplicate repo: < / span > < span class = "si" > %s< / span > < span class = "s2" > metalink=< / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "n" > source_name< / span > < span class = "p" > ,< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > metalink< / span > < span class = "p" > )< / span >
< span class = "n" > remove< / span > < span class = "o" > =< / span > < span class = "kc" > True< / span >
< span class = "k" > else< / span > < span class = "p" > :< / span >
< span class = "n" > seen< / span > < span class = "p" > [< / span > < span class = "s2" > " metalink" < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > append< / span > < span class = "p" > (< / span > < span class = "n" > repo< / span > < span class = "o" > .< / span > < span class = "n" > metalink< / span > < span class = "p" > )< / span >
< span class = "k" > if< / span > < span class = "n" > remove< / span > < span class = "p" > :< / span >
< span class = "k" > del< / span > < span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > repos< / span > < span class = "p" > [< / span > < span class = "n" > source_name< / span > < span class = "p" > ]< / span >
2018-08-13 23:43:20 +00:00
< span class = "c1" > # Update the metadata from the enabled repos to speed up later operations< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > info< / span > < span class = "p" > (< / span > < span class = "s2" > " Updating repository metadata" < / span > < span class = "p" > )< / span >
< span class = "k" > try< / span > < span class = "p" > :< / span >
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > fill_sack< / span > < span class = "p" > (< / span > < span class = "n" > load_system_repo< / span > < span class = "o" > =< / span > < span class = "kc" > False< / span > < span class = "p" > )< / span >
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > read_comps< / span > < span class = "p" > ()< / span >
2018-10-04 23:55:20 +00:00
< span class = "n" > dbo< / span > < span class = "o" > .< / span > < span class = "n" > update_cache< / span > < span class = "p" > ()< / span >
2018-08-13 23:43:20 +00:00
< span class = "k" > except< / span > < span class = "n" > dnf< / span > < span class = "o" > .< / span > < span class = "n" > exceptions< / span > < span class = "o" > .< / span > < span class = "n" > Error< / span > < span class = "k" > as< / span > < span class = "n" > e< / span > < span class = "p" > :< / span >
< span class = "n" > log< / span > < span class = "o" > .< / span > < span class = "n" > error< / span > < span class = "p" > (< / span > < span class = "s2" > " Failed to update metadata: < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "p" > ,< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > raise< / span > < span class = "ne" > RuntimeError< / span > < span class = "p" > (< / span > < span class = "s2" > " Fetching metadata failed: < / span > < span class = "si" > %s< / span > < span class = "s2" > " < / span > < span class = "o" > %< / span > < span class = "nb" > str< / span > < span class = "p" > (< / span > < span class = "n" > e< / span > < span class = "p" > ))< / span >
< span class = "k" > return< / span > < span class = "n" > dbo< / span > < / div >
< / pre > < / div >
< / div >
< / div >
< footer >
< hr / >
< div role = "contentinfo" >
< p >
2018-11-13 17:53:31 +00:00
© Copyright 2018, Red Hat, Inc.
2018-08-13 23:43:20 +00:00
< / p >
< / div >
Built with < a href = "http://sphinx-doc.org/" > Sphinx< / a > using a < a href = "https://github.com/rtfd/sphinx_rtd_theme" > theme< / a > provided by < a href = "https://readthedocs.org" > Read the Docs< / a > .
< / footer >
< / div >
< / div >
< / section >
< / div >
< script type = "text/javascript" >
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
2019-03-27 23:44:14 +00:00
< / script >
2018-08-13 23:43:20 +00:00
< / body >
< / html >