Current File : /home/mmdealscpanel/yummmdeals.com/conf.tar
sssd.conf000064400000000324150330162000006354 0ustar00[sssd]
services = nss, pam
domains = shadowutils

[nss]

[pam]

[domain/shadowutils]
id_provider = proxy
proxy_lib_name = files

auth_provider = proxy
proxy_pam_target = sssd-shadowutils

proxy_fast_alias = True
__init__.py000064400000003671150401432030006654 0ustar00# conf.py
# dnf configuration classes.
#
# Copyright (C) 2012-2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#


"""
The configuration classes and routines in yum are splattered over too many
places, hard to change and debug. The new structure here will replace that. Its
goal is to:

* accept configuration options from all three sources (the main config file,
  repo config files, command line switches)
* handle all the logic of storing those and producing related values.
* returning configuration values.
* optionally: asserting no value is overridden once it has been applied
  somewhere (e.g. do not let a new repo be initialized with different global
  cache path than an already existing one).

"""

from __future__ import absolute_import
from __future__ import unicode_literals

from dnf.conf.config import PRIO_DEFAULT, PRIO_MAINCONFIG, PRIO_AUTOMATICCONFIG
from dnf.conf.config import PRIO_REPOCONFIG, PRIO_PLUGINDEFAULT, PRIO_PLUGINCONFIG
from dnf.conf.config import PRIO_COMMANDLINE, PRIO_RUNTIME

from dnf.conf.config import BaseConfig, MainConf, RepoConf

Conf = MainConf
__pycache__/substitutions.cpython-36.opt-1.pyc000064400000003552150401432030015275 0ustar003

��gj
�@sLddlZddlZddlZddlmZejd�Zejd�ZGdd�de	�Z
dS)�N)�_z^DNF_VAR_[A-Za-z0-9_]+$Zdnfcs.eZdZ�fdd�Zdd�Zd
dd�Z�ZS)�
Substitutionscstt|�j�|j�dS)N)�superr�__init__�_update_from_env)�self)�	__class__��#/usr/lib/python3.6/substitutions.pyr"szSubstitutions.__init__cCs\dd�tdd�D�}xBtjj�D]4\}}tj|�rD|||dd�<q ||kr |||<q WdS)NcSsg|]}d|�qS)zDNF%dr	)�.0Znumr	r	r
�
<listcomp>'sz2Substitutions._update_from_env.<locals>.<listcomp>r�
�)�range�os�environ�items�ENVIRONMENT_VARS_RE�match)rZnumericvars�key�valr	r	r
r&s
zSubstitutions._update_from_env�/etc/yum/vars/�/etc/dnf/vars/cCs�x|D�]�}g}y"tjj||jd��}tj|�}Wntk
rJwYnXx�|D]�}tjj||�}d}tjj|�r�y<t|��}	|	j�}WdQRX|r�|ddkr�|dd�}Wn@tt	t
fk
r�}
ztjt
d�j||
��wRWYdd}
~
XnX|dk	rR|||<qRWqWdS)N�/��
z2Error when parsing a variable from file '{0}': {1}���r)r�path�join�lstrip�listdir�OSError�isfile�open�readline�IOError�UnicodeDecodeError�loggerZwarningr�format)rZinstallrootZvarsdirZ	vars_pathZfsvarsZ
dir_fsvarsZfsvar�filepathr�fp�er	r	r
�update_from_etc.s*

zSubstitutions.update_from_etc�rr)r-)�__name__�
__module__�__qualname__rrr,�
__classcell__r	r	)rr
rsr)Zloggingr�reZdnf.i18nr�compilerZ	getLoggerr'�dictrr	r	r	r
�<module>s

__pycache__/config.cpython-36.opt-1.pyc000064400000035047150401432030013607 0ustar003

�ft`�O�@s<ddlmZddlmZddlmZddlmZmZddlm	Z	m
Z
ddlZddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZddlZddlZddlZddlZddlZejjjZejjjZejjjZejjj Z!ejjj"Z#ejjj$Z%ejjj&Z'ejjj(Z)ejjj*Z+ej,d�Z-Gdd	�d	e.�Z/Gd
d�de/�Z0Gdd
�d
e/�Z1dS)�)�absolute_import)�unicode_literals)�misc)�ucd�_)�
basestring�urlparseN�dnfcs~eZdZdZddd�Zdd�Z�fdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
efdd�Ze
fdd�Zdd�Zedd��Z�ZS)�
BaseConfigzlBase class for storing configuration definitions.

       Subclass when creating your own definitions.

    NcCs||jd<||_dS)N�_config)�__dict__�_section)�self�config�section�parser�r�/usr/lib/python3.6/config.py�__init__<s
zBaseConfig.__init__cCszd|jkrtdj|j|���t|j|�}|dkr4dSy|�j�}Wn tk
rb}zdSd}~XnXt|t	�rvt
|�S|S)Nrz!'{}' object has no attribute '{}')r�AttributeError�format�	__class__�getattrr�getValue�	Exception�
isinstance�strr)r�name�option�valueZexrrr�__getattr__@s

zBaseConfig.__getattr__cs:t|j|d�}|dkr(tt|�j||�S|j||t�dS)N)rr�superr
�__setattr__�
_set_value�PRIO_RUNTIME)rrrr)rrrr"NszBaseConfig.__setattr__c
Cstg}|jd|j�|jrjxN|jj�D]@}y|jj�}Wntk
rPd}YnX|jd|j|f�q&Wdj|�S)Nz[%s]�z%s: %s�
)	�appendr
r�optBinds�second�getValueString�RuntimeError�first�join)r�out�optBindrrrr�__str__Us
zBaseConfig.__str__cCst|j|d�}|dk	S)N)rr)rr�methodrrr�_has_optionaszBaseConfig._has_optioncCs$t|j|d�}|dkrdS|�j�S)N)rrr)rrr1rrr�
_get_valueeszBaseConfig._get_valuecCs$t|j|d�}|dkrdS|�j�S)N)rrZgetPriority)rrr1rrr�
_get_prioritykszBaseConfig._get_prioritycCst|j|d�}|dkr&td|d��|�}|dkr\y|j||�Wntk
rXYnXn�yrt|t�srt|t�r�|j|tjj	|��nDt|tjj
�s�t|tjj�r�t|t�r�|j|t
|��n|j||�WnHtk
�r}z*tjjtd�|t|�ft|�d��WYdd}~XnXdS)zSSet option's value if priority is equal or higher
           than current priority.NzOption "z" does not existszError parsing '%s': %s)�	raw_error)rrr�setr�list�tuple�libdnf�conf�VectorStringZ
OptionBoolZOptionChildBool�int�boolr+r	�
exceptions�ConfigErrorrr)rrr�priorityr1r�errrr#qs*
zBaseConfig._set_valuecCs�|j|�r�x�|j|�D]�}|j||�}|s4|dkr8d}t|j|�r�y|jj�j|�j||�Wq�tk
r�}z,t	j
td�t|�t|�t|�t
|��WYdd}~Xq�Xq|dkr�t||�r�t|||�qt	jtd�t|�t|�t|��qWdS)z+Set option values from an INI file section.�Noner%z,Invalid configuration value: %s=%s in %s; %sN�archz+Unknown configuration option: %s = %s in %s)�
hasSectionZoptionsZgetSubstitutedValue�hasattrrr(�at�	newStringr+�logger�errorrrr�setattr�debug)rrr�filenamer@rrrArrr�	_populate�s 

0zBaseConfig._populatecCshd|jg}|jrZxF|jj�D]8}y|jd|j|jj�f�Wqtk
rTYqXqWdj|�dS)z]Return a string representing the values of all the
           configuration options.
        z[%s]z%s = %sr&)	r
rr(r'r,r)r*r+r-)r�outputr/rrr�dump�s
zBaseConfig.dumpcCs�tjj�}|j|�|j|�sHx(|j�D]}tjjj||�|kr(|}q(Wx6|j�D]*\}}t|t	�rndj
|�}|j|||�qRW|j|d�dS)z�
        filename   - name of config file (.conf or .repo)
        section_id - id of modified section (e.g. main, fedora, updates)
        substitutions - instance of base.conf.substitutions
        modify     - dict of modified options
        � FN)
r9r:�ConfigParser�readrDZgetData�
substitute�itemsrr7r-ZsetValue�write)rLZ
section_id�
substitutionsZmodifyrZsectrrrrr�write_raw_configfile�s	




zBaseConfig.write_raw_configfile)NNN)�__name__�
__module__�__qualname__�__doc__rr r"r0r2r3r4r$r#�PRIO_DEFAULTrMrO�staticmethodrW�
__classcell__rr)rrr
5s
r
cs�eZdZdZd%�fdd�	Zdd�Zedd	��Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejd d��Zdefd!d"�Zed#d$��Z�ZS)&�MainConfz?Configuration option definitions for dnf.conf's [main] section.�mainNcstjj�}tt|�j|||�|jdtjj	gt
�|jdtjjgt
�tjjj
�|_tj�|_|jj�jt
tjj�tjj�r�tjj}d}nVytj�}}WnDttfk
r�}z$td�jt|��}tjj|��WYdd}~XnX|jj �jt
|�|jj!�jt
|�g|_"dS)NZ
pluginpathZpluginconfpathz/var/logzCould not set cachedir: {})#r9r:�
ConfigMainr!r_rr#r	�constZ
PLUGINPATHr\ZPLUGINCONFPATHrVZ
Substitutions�hawkeyZdetect_archrCrZsystem_cachedirr6ZSYSTEM_CACHEDIR�utilZ	am_i_rootrZgetCacheDir�IOError�OSErrorrrrr>�Error�cachedir�logdir�	tempfiles)rrrrrhrirA�msg)rrrr�s$


zMainConf.__init__cCsx|jD]}tj|�qWdS)N)rj�os�unlink)r�	file_namerrr�__del__�szMainConf.__del__cCsLd}x$|jd�D]}tjj|�r|}PqW|sH|jd�d}tjj|�|S)zReturns the value of reposdirNZreposdirr)r3rl�path�existsr	rdZ
ensure_dir)rZ	myrepodirZrdirrrr�get_reposdir�szMainConf.get_reposdirc	Cs�|j|�}|j|�}t|t�r�tj|�}|ddkrF|j||j|�n�tjj	�}t
jdd�\}}|jj
|�zdy|jd||�Wn>tk
r�}z"tjjtd�j|t|����WYdd}~XnX|j|||�Wdtj|�XdS)	z�
        In case the option value is a remote URL, download it to the temporary location
        and use this temporary file instead.
        r�filer%zdnf-downloaded-config-)�prefixNz9Configuration file URL "{}" could not be downloaded:
  {})rsr%)r4r3rrrr#rpr9ZrepoZ
Downloader�tempfileZmkstemprjr'ZdownloadURLr+r	r>r?rrrrl�close)	r�optname�prio�val�locationZ
downloaderZtemp_fdZ	temp_pathrArrr�_check_remote_file�s"




 zMainConf._check_remote_filecs��jd���dkr�S�j|�}|tkr,�S�j|�}t|t�s�t�fdd�|D��r��j|tjj	�fdd�|D��|��Sn4t
jjt
jj
�|jd���r��j|�j|�|��SdS)z�
        Return root used as prefix for option (installroot or "/"). When specified from commandline
        it returns value from conf.installroot
        �installroot�/c3s*|]"}tjjtjj�|jd���VqdS)r}N)rlrprqr-�lstrip)�.0�p)r|rr�	<genexpr>*sz6MainConf._search_inside_installroot.<locals>.<genexpr>csg|]}�j|��qSr)�_prepend_installroot_path)rr�)rrr�
<listcomp>-sz7MainConf._search_inside_installroot.<locals>.<listcomp>)r3r4�PRIO_COMMANDLINErr�anyr#r9r:r;rlrprqr-r~r�)rrwrxryr)r|rr�_search_inside_installroots$



z#MainConf._search_inside_installrootcCs,|j|�}|j|j|��}|j|||�dS)N)r4r�r3r#)rrwrx�new_pathrrr�prepend_installroot6s
zMainConf.prepend_installrootcCs,tjj|jd�|jd��}tjjj||j	�S)Nr|r})
rlrpr-r3r~r9r:rQrSrV)rrpZ	root_pathrrrr�<sz"MainConf._prepend_installroot_pathcCs`ddddddddd	d
dddd
dddddddddddddg}�x|D�]}t||d�}|dk	ob|gkrB|j|��r$d}|jr�y|jj�j|�j�}Wntk
r�YnX|�rtjj	}||j
|�kr�|j
|�}xR|D]6}|r�|j||j|�|g|�q�|j|gtjj	�q�Wn|j||tjj	�qBt
||��r>t|||�qBtjtd�t|�t|��qBWt|dd�dk�r�|jddtjj	�t
|d��r\x�|jj�D]�\}}x�|D]�}	t
|j|��r"y|jj�j|�jt	|	�WnJtk
�r}
z,tjjtd �||	t|
�ft|
�d!��WYdd}
~
XnXn.t
||��r<t|||	�ntd"�}tj||��q�W�q�WdS)#z%Configure parts of CLI from the opts Zplugins�version�config_file_path�
debuglevelZ
errorlevelr|ZbestZ	assumeyesZassumenoZclean_requirements_on_remove�gpgcheckZshowdupesfromreposZ
ip_resolveZrpmverbosityZdisable_excludesZcolorZdownloadonly�exclude�excludepkgs�skip_brokenZtsflagsrC�basearchZ
ignorearchZ	cacheonlyZcommentNFz%Unknown configuration option: %s = %sZlocalpkg_gpgcheck�main_setoptsz4Error parsing --setopt with key '%s', value '%s': %s)r5z1Main config did not have a %s attr. before setopt)rr2rr(rFZgetAddValuer+r	r:r�r4r#r3rErJrH�warningrrr�rTrGr>r?r)r�optsZconfig_argsrrZappendValueZadd_priority�item�valuesryrArkrrr�_configure_from_options@s\




.z MainConf._configure_from_optionscCsPd}|dk	rL|gkrL|j|�r2|j||tjj�ntjtd�t|�t|��dS)Nr�z%Unknown configuration option: %s = %s)	r2r#r	r:r�rHr�rr)rZpkgsrrrr�exclude_pkgss

zMainConf.exclude_pkgscCs(|jd�}|r$|jd||jd��dS)z Adjust conf options interactionsr��strictN)r3r#r4)rZskip_broken_valrrr�_adjust_conf_options�s
zMainConf._adjust_conf_optionscCs|jjd�S)N�
releasever)rV�get)rrrrr��szMainConf.releasevercCs,|dkr|jjdd�dSt|�|jd<dS)Nr�)rV�popr)rryrrrr��scCs|jjd�S)NrC)rVr�)rrrrrC�sz
MainConf.archcCsb|dkr|jjdd�dS|tjjj�krFtd�}tjj|j	d|���||jd<tjj
|�|_
dS)NrCzIncorrect or unknown "{}": {})rVr�r	�rpm�
_BASEARCH_MAP�keysrr>rgrr�)rryrkrrrrC�s
cCs|jjd�S)Nr�)rVr�)rrrrr��szMainConf.basearchcCsT|dkr|jjdd�dS|tjjj�krFtd�}tjj|j	d|���||jd<dS)Nr�zIncorrect or unknown "{}": {})
rVr�r	r�r�r�rr>rgr)rryrkrrrr��scCs�|dkr|jd�}tjj�}y|j|�Wndtk
rd}ztjjt	d�||f��WYdd}~Xn,t
k
r�}ztj|�WYdd}~XnX|j
||j||�|jd||�dS)Nr�zParsing file "%s" failed: %s)r3r9r:rQrRr+r	r>r?rrerHr�rMr
r#)rrLr@rrArrrrR�s

(z
MainConf.readcCs|jd�tjjkS)Nr�)r3r	rbZ
VERBOSE_LEVEL)rrrr�verbose�szMainConf.verbose)r`N)rXrYrZr[rro�propertyrrr{r�r�r�r�r�r�r��setterrCr�r\rRr�r^rr)rrr_�s&?
r_cs*eZdZdZd�fdd�	Zdd�Z�ZS)�RepoConfz4Option definitions for repository INI file sections.NcsP|r
|jntjj�}tt|�jtjj|�||�||_|rL|jj	�j
t|�dS)N)rr9r:rar!r�rZ
ConfigRepoZ_mainConfigRefHolderrr6r\)r�parentrrZ
mainConfig)rrrr�s
zRepoConf.__init__cCst|dd�dkr0xd	D]}|j|dtjj�qWt|di�}x�|j�D]�\}}tj|j|�s^qFx�|j�D]�\}}x�|D]�}t|j	|�r�y|j	j
�j|�jt|�WnLt
k
r�}	z0tjjtd�|j||t|	�ft|	�d��WYdd}	~	XnXqvtd�}
tj|
|j|�qvWqhWqFWdS)
zConfigure repos from the opts. r�NF�
repo_gpgcheck�repo_setoptsz7Error parsing --setopt with key '%s.%s', value '%s': %s)r5z-Repo %s did not have a %s attr. before setopt)r�r�)rr#r	r:r�rT�fnmatchr
rErr(rFrGr+r>r?rrrHr�)rr�rwr�ZrepoidZsetoptsrr�ryrArkrrrr��s$

2z RepoConf._configure_from_options)NN)rXrYrZr[rr�r^rr)rrr��s	r�)2Z
__future__rrZdnf.yumrZdnf.i18nrrZ
dnf.pycomprrr�Zdnf.conf.substitutionsr	Z	dnf.constZdnf.exceptionsZdnf.utilrcZloggingrlZlibdnf.confr9Zlibdnf.reporur:ZOptionZPriority_EMPTYZ
PRIO_EMPTYZPriority_DEFAULTr\ZPriority_MAINCONFIGZPRIO_MAINCONFIGZPriority_AUTOMATICCONFIGZPRIO_AUTOMATICCONFIGZPriority_REPOCONFIGZPRIO_REPOCONFIGZPriority_PLUGINDEFAULTZPRIO_PLUGINDEFAULTZPriority_PLUGINCONFIGZPRIO_PLUGINCONFIGZPriority_COMMANDLINEr�ZPriority_RUNTIMEr$Z	getLoggerrH�objectr
r_r�rrrr�<module>s@









__pycache__/config.cpython-36.pyc000064400000035047150401432030012650 0ustar003

�ft`�O�@s<ddlmZddlmZddlmZddlmZmZddlm	Z	m
Z
ddlZddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZddlZddlZddlZddlZddlZejjjZejjjZejjjZejjj Z!ejjj"Z#ejjj$Z%ejjj&Z'ejjj(Z)ejjj*Z+ej,d�Z-Gdd	�d	e.�Z/Gd
d�de/�Z0Gdd
�d
e/�Z1dS)�)�absolute_import)�unicode_literals)�misc)�ucd�_)�
basestring�urlparseN�dnfcs~eZdZdZddd�Zdd�Z�fdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
efdd�Ze
fdd�Zdd�Zedd��Z�ZS)�
BaseConfigzlBase class for storing configuration definitions.

       Subclass when creating your own definitions.

    NcCs||jd<||_dS)N�_config)�__dict__�_section)�self�config�section�parser�r�/usr/lib/python3.6/config.py�__init__<s
zBaseConfig.__init__cCszd|jkrtdj|j|���t|j|�}|dkr4dSy|�j�}Wn tk
rb}zdSd}~XnXt|t	�rvt
|�S|S)Nrz!'{}' object has no attribute '{}')r�AttributeError�format�	__class__�getattrr�getValue�	Exception�
isinstance�strr)r�name�option�valueZexrrr�__getattr__@s

zBaseConfig.__getattr__cs:t|j|d�}|dkr(tt|�j||�S|j||t�dS)N)rr�superr
�__setattr__�
_set_value�PRIO_RUNTIME)rrrr)rrrr"NszBaseConfig.__setattr__c
Cstg}|jd|j�|jrjxN|jj�D]@}y|jj�}Wntk
rPd}YnX|jd|j|f�q&Wdj|�S)Nz[%s]�z%s: %s�
)	�appendr
r�optBinds�second�getValueString�RuntimeError�first�join)r�out�optBindrrrr�__str__Us
zBaseConfig.__str__cCst|j|d�}|dk	S)N)rr)rr�methodrrr�_has_optionaszBaseConfig._has_optioncCs$t|j|d�}|dkrdS|�j�S)N)rrr)rrr1rrr�
_get_valueeszBaseConfig._get_valuecCs$t|j|d�}|dkrdS|�j�S)N)rrZgetPriority)rrr1rrr�
_get_prioritykszBaseConfig._get_prioritycCst|j|d�}|dkr&td|d��|�}|dkr\y|j||�Wntk
rXYnXn�yrt|t�srt|t�r�|j|tjj	|��nDt|tjj
�s�t|tjj�r�t|t�r�|j|t
|��n|j||�WnHtk
�r}z*tjjtd�|t|�ft|�d��WYdd}~XnXdS)zSSet option's value if priority is equal or higher
           than current priority.NzOption "z" does not existszError parsing '%s': %s)�	raw_error)rrr�setr�list�tuple�libdnf�conf�VectorStringZ
OptionBoolZOptionChildBool�int�boolr+r	�
exceptions�ConfigErrorrr)rrr�priorityr1r�errrr#qs*
zBaseConfig._set_valuecCs�|j|�r�x�|j|�D]�}|j||�}|s4|dkr8d}t|j|�r�y|jj�j|�j||�Wq�tk
r�}z,t	j
td�t|�t|�t|�t
|��WYdd}~Xq�Xq|dkr�t||�r�t|||�qt	jtd�t|�t|�t|��qWdS)z+Set option values from an INI file section.�Noner%z,Invalid configuration value: %s=%s in %s; %sN�archz+Unknown configuration option: %s = %s in %s)�
hasSectionZoptionsZgetSubstitutedValue�hasattrrr(�at�	newStringr+�logger�errorrrr�setattr�debug)rrr�filenamer@rrrArrr�	_populate�s 

0zBaseConfig._populatecCshd|jg}|jrZxF|jj�D]8}y|jd|j|jj�f�Wqtk
rTYqXqWdj|�dS)z]Return a string representing the values of all the
           configuration options.
        z[%s]z%s = %sr&)	r
rr(r'r,r)r*r+r-)r�outputr/rrr�dump�s
zBaseConfig.dumpcCs�tjj�}|j|�|j|�sHx(|j�D]}tjjj||�|kr(|}q(Wx6|j�D]*\}}t|t	�rndj
|�}|j|||�qRW|j|d�dS)z�
        filename   - name of config file (.conf or .repo)
        section_id - id of modified section (e.g. main, fedora, updates)
        substitutions - instance of base.conf.substitutions
        modify     - dict of modified options
        � FN)
r9r:�ConfigParser�readrDZgetData�
substitute�itemsrr7r-ZsetValue�write)rLZ
section_id�
substitutionsZmodifyrZsectrrrrr�write_raw_configfile�s	




zBaseConfig.write_raw_configfile)NNN)�__name__�
__module__�__qualname__�__doc__rr r"r0r2r3r4r$r#�PRIO_DEFAULTrMrO�staticmethodrW�
__classcell__rr)rrr
5s
r
cs�eZdZdZd%�fdd�	Zdd�Zedd	��Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zedd��Zejdd��Zedd��Zejdd��Zedd��Zejd d��Zdefd!d"�Zed#d$��Z�ZS)&�MainConfz?Configuration option definitions for dnf.conf's [main] section.�mainNcstjj�}tt|�j|||�|jdtjj	gt
�|jdtjjgt
�tjjj
�|_tj�|_|jj�jt
tjj�tjj�r�tjj}d}nVytj�}}WnDttfk
r�}z$td�jt|��}tjj|��WYdd}~XnX|jj �jt
|�|jj!�jt
|�g|_"dS)NZ
pluginpathZpluginconfpathz/var/logzCould not set cachedir: {})#r9r:�
ConfigMainr!r_rr#r	�constZ
PLUGINPATHr\ZPLUGINCONFPATHrVZ
Substitutions�hawkeyZdetect_archrCrZsystem_cachedirr6ZSYSTEM_CACHEDIR�utilZ	am_i_rootrZgetCacheDir�IOError�OSErrorrrrr>�Error�cachedir�logdir�	tempfiles)rrrrrhrirA�msg)rrrr�s$


zMainConf.__init__cCsx|jD]}tj|�qWdS)N)rj�os�unlink)r�	file_namerrr�__del__�szMainConf.__del__cCsLd}x$|jd�D]}tjj|�r|}PqW|sH|jd�d}tjj|�|S)zReturns the value of reposdirNZreposdirr)r3rl�path�existsr	rdZ
ensure_dir)rZ	myrepodirZrdirrrr�get_reposdir�szMainConf.get_reposdirc	Cs�|j|�}|j|�}t|t�r�tj|�}|ddkrF|j||j|�n�tjj	�}t
jdd�\}}|jj
|�zdy|jd||�Wn>tk
r�}z"tjjtd�j|t|����WYdd}~XnX|j|||�Wdtj|�XdS)	z�
        In case the option value is a remote URL, download it to the temporary location
        and use this temporary file instead.
        r�filer%zdnf-downloaded-config-)�prefixNz9Configuration file URL "{}" could not be downloaded:
  {})rsr%)r4r3rrrr#rpr9ZrepoZ
Downloader�tempfileZmkstemprjr'ZdownloadURLr+r	r>r?rrrrl�close)	r�optname�prio�val�locationZ
downloaderZtemp_fdZ	temp_pathrArrr�_check_remote_file�s"




 zMainConf._check_remote_filecs��jd���dkr�S�j|�}|tkr,�S�j|�}t|t�s�t�fdd�|D��r��j|tjj	�fdd�|D��|��Sn4t
jjt
jj
�|jd���r��j|�j|�|��SdS)z�
        Return root used as prefix for option (installroot or "/"). When specified from commandline
        it returns value from conf.installroot
        �installroot�/c3s*|]"}tjjtjj�|jd���VqdS)r}N)rlrprqr-�lstrip)�.0�p)r|rr�	<genexpr>*sz6MainConf._search_inside_installroot.<locals>.<genexpr>csg|]}�j|��qSr)�_prepend_installroot_path)rr�)rrr�
<listcomp>-sz7MainConf._search_inside_installroot.<locals>.<listcomp>)r3r4�PRIO_COMMANDLINErr�anyr#r9r:r;rlrprqr-r~r�)rrwrxryr)r|rr�_search_inside_installroots$



z#MainConf._search_inside_installrootcCs,|j|�}|j|j|��}|j|||�dS)N)r4r�r3r#)rrwrx�new_pathrrr�prepend_installroot6s
zMainConf.prepend_installrootcCs,tjj|jd�|jd��}tjjj||j	�S)Nr|r})
rlrpr-r3r~r9r:rQrSrV)rrpZ	root_pathrrrr�<sz"MainConf._prepend_installroot_pathcCs`ddddddddd	d
dddd
dddddddddddddg}�x|D�]}t||d�}|dk	ob|gkrB|j|��r$d}|jr�y|jj�j|�j�}Wntk
r�YnX|�rtjj	}||j
|�kr�|j
|�}xR|D]6}|r�|j||j|�|g|�q�|j|gtjj	�q�Wn|j||tjj	�qBt
||��r>t|||�qBtjtd�t|�t|��qBWt|dd�dk�r�|jddtjj	�t
|d��r\x�|jj�D]�\}}x�|D]�}	t
|j|��r"y|jj�j|�jt	|	�WnJtk
�r}
z,tjjtd �||	t|
�ft|
�d!��WYdd}
~
XnXn.t
||��r<t|||	�ntd"�}tj||��q�W�q�WdS)#z%Configure parts of CLI from the opts Zplugins�version�config_file_path�
debuglevelZ
errorlevelr|ZbestZ	assumeyesZassumenoZclean_requirements_on_remove�gpgcheckZshowdupesfromreposZ
ip_resolveZrpmverbosityZdisable_excludesZcolorZdownloadonly�exclude�excludepkgs�skip_brokenZtsflagsrC�basearchZ
ignorearchZ	cacheonlyZcommentNFz%Unknown configuration option: %s = %sZlocalpkg_gpgcheck�main_setoptsz4Error parsing --setopt with key '%s', value '%s': %s)r5z1Main config did not have a %s attr. before setopt)rr2rr(rFZgetAddValuer+r	r:r�r4r#r3rErJrH�warningrrr�rTrGr>r?r)r�optsZconfig_argsrrZappendValueZadd_priority�item�valuesryrArkrrr�_configure_from_options@s\




.z MainConf._configure_from_optionscCsPd}|dk	rL|gkrL|j|�r2|j||tjj�ntjtd�t|�t|��dS)Nr�z%Unknown configuration option: %s = %s)	r2r#r	r:r�rHr�rr)rZpkgsrrrr�exclude_pkgss

zMainConf.exclude_pkgscCs(|jd�}|r$|jd||jd��dS)z Adjust conf options interactionsr��strictN)r3r#r4)rZskip_broken_valrrr�_adjust_conf_options�s
zMainConf._adjust_conf_optionscCs|jjd�S)N�
releasever)rV�get)rrrrr��szMainConf.releasevercCs,|dkr|jjdd�dSt|�|jd<dS)Nr�)rV�popr)rryrrrr��scCs|jjd�S)NrC)rVr�)rrrrrC�sz
MainConf.archcCsb|dkr|jjdd�dS|tjjj�krFtd�}tjj|j	d|���||jd<tjj
|�|_
dS)NrCzIncorrect or unknown "{}": {})rVr�r	�rpm�
_BASEARCH_MAP�keysrr>rgrr�)rryrkrrrrC�s
cCs|jjd�S)Nr�)rVr�)rrrrr��szMainConf.basearchcCsT|dkr|jjdd�dS|tjjj�krFtd�}tjj|j	d|���||jd<dS)Nr�zIncorrect or unknown "{}": {})
rVr�r	r�r�r�rr>rgr)rryrkrrrr��scCs�|dkr|jd�}tjj�}y|j|�Wndtk
rd}ztjjt	d�||f��WYdd}~Xn,t
k
r�}ztj|�WYdd}~XnX|j
||j||�|jd||�dS)Nr�zParsing file "%s" failed: %s)r3r9r:rQrRr+r	r>r?rrerHr�rMr
r#)rrLr@rrArrrrR�s

(z
MainConf.readcCs|jd�tjjkS)Nr�)r3r	rbZ
VERBOSE_LEVEL)rrrr�verbose�szMainConf.verbose)r`N)rXrYrZr[rro�propertyrrr{r�r�r�r�r�r�r��setterrCr�r\rRr�r^rr)rrr_�s&?
r_cs*eZdZdZd�fdd�	Zdd�Z�ZS)�RepoConfz4Option definitions for repository INI file sections.NcsP|r
|jntjj�}tt|�jtjj|�||�||_|rL|jj	�j
t|�dS)N)rr9r:rar!r�rZ
ConfigRepoZ_mainConfigRefHolderrr6r\)r�parentrrZ
mainConfig)rrrr�s
zRepoConf.__init__cCst|dd�dkr0xd	D]}|j|dtjj�qWt|di�}x�|j�D]�\}}tj|j|�s^qFx�|j�D]�\}}x�|D]�}t|j	|�r�y|j	j
�j|�jt|�WnLt
k
r�}	z0tjjtd�|j||t|	�ft|	�d��WYdd}	~	XnXqvtd�}
tj|
|j|�qvWqhWqFWdS)
zConfigure repos from the opts. r�NF�
repo_gpgcheck�repo_setoptsz7Error parsing --setopt with key '%s.%s', value '%s': %s)r5z-Repo %s did not have a %s attr. before setopt)r�r�)rr#r	r:r�rT�fnmatchr
rErr(rFrGr+r>r?rrrHr�)rr�rwr�ZrepoidZsetoptsrr�ryrArkrrrr��s$

2z RepoConf._configure_from_options)NN)rXrYrZr[rr�r^rr)rrr��s	r�)2Z
__future__rrZdnf.yumrZdnf.i18nrrZ
dnf.pycomprrr�Zdnf.conf.substitutionsr	Z	dnf.constZdnf.exceptionsZdnf.utilrcZloggingrlZlibdnf.confr9Zlibdnf.reporur:ZOptionZPriority_EMPTYZ
PRIO_EMPTYZPriority_DEFAULTr\ZPriority_MAINCONFIGZPRIO_MAINCONFIGZPriority_AUTOMATICCONFIGZPRIO_AUTOMATICCONFIGZPriority_REPOCONFIGZPRIO_REPOCONFIGZPriority_PLUGINDEFAULTZPRIO_PLUGINDEFAULTZPriority_PLUGINCONFIGZPRIO_PLUGINCONFIGZPriority_COMMANDLINEr�ZPriority_RUNTIMEr$Z	getLoggerrH�objectr
r_r�rrrr�<module>s@









__pycache__/read.cpython-36.pyc000064400000006411150401432030012307 0ustar003

�ft`��@s~ddlmZddlmZddlmZmZddlZddlZ	ddl
ZddlZddlZddl
Z
ddlZe
jd�ZGdd�de�ZdS)�)�absolute_import)�unicode_literals)�_�ucdN�dnfc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
RepoReadercCs||_||_dS)N)�conf�opts)�selfrr	�r�/usr/lib/python3.6/read.py�__init__$szRepoReader.__init__ccs�x|j|jj�D]
}|VqWg}x8|jjD],}x&tjtjj|d��D]}|j|�qFWq,W|j	dd�d�xT|D]L}yx|j|�D]
}|Vq�WWqrt
jjk
r�t
jtd�|�YqrXqrWdS)Nz*.repocSstjj|dd��S)N����)r�utilZ
split_path)�xrrr�<lambda>5sz%RepoReader.__iter__.<locals>.<lambda>)�keyz'Warning: failed loading '%s', skipping.)�
_get_reposrZconfig_file_path�reposdir�glob�os�path�join�append�sortr�
exceptions�ConfigError�logger�warningr)r
�rZrepo_configsrr�repofnrrr�__iter__(s


zRepoReader.__iter__c	Cs^tjjj||jj�}tjj|�}|dk	rl||krJtd�j	|||||�}ntd�j	||||�}tj
j|��tjj||j�}y|j
|||tjj�WnZtk
r�}z>||kr�td�j	|||�}ntd�j	||�}tj
j|��WYdd}~XnX|jd�tjjk�r8||k�r td�j	||�}ntd�j	|�}tj|�t|j�|_|jj|jj�||_|S)	z)Build a repository using the parsed data.Nz&Bad id for repo: {} ({}), byte = {} {}z!Bad id for repo: {}, byte = {} {}z.Repository '{}' ({}): Error parsing config: {}z)Repository '{}': Error parsing config: {}�namez@Repository '{}' ({}) is missing name in configuration, using id.z;Repository '{}' is missing name in configuration, using id.)�libdnfr�ConfigParserZ
substitute�
substitutionsr�repoZrepo_id_invalidr�formatrrZRepoZ	_populateZPRIO_REPOCONFIG�
ValueErrorZ
_get_priorityZPRIO_DEFAULTrrrr#Z_substitutions�updateZcfg)	r
�parserZid_r!Zsubstituted_idZinvalid�msgr'�errr�_build_repo?s8




zRepoReader._build_repoccs|jj}tjj�}|j|�y|j|�Wndtk
rd}ztjj	t
d�j||���WYdd}~Xn,tk
r�}zt
j|�WYdd}~XnXx�|j�D]x}|dkr�q�y|j|t|�|�}Wn:tjjtjj	fk
r�}zt
j|�w�WYdd}~XnX||_|j|j�|Vq�WdS)z4Parse and yield all repositories from a config file.zParsing file "{}" failed: {}N�main)rr&r$r%ZsetSubstitutions�read�RuntimeErrorrrrrr(�IOErrorrrZgetDatar.rZ	RepoErrorZrepofileZ_configure_from_optionsr	)r
r!Zsubstsr+r-ZsectionZthisreporrrrhs(

(
zRepoReader._get_reposN)�__name__�
__module__�__qualname__r
r"r.rrrrrr#s)r)Z
__future__rrZdnf.i18nrrZdnf.confrZlibdnf.confr$Zdnf.exceptionsZdnf.reporZloggingrZ	getLoggerr�objectrrrrr�<module>s
__pycache__/__init__.cpython-36.pyc000064400000002207150401432030013132 0ustar003

�ft`��@spdZddlmZddlmZddlmZmZmZddlmZm	Z	m
Z
ddlmZmZddlm
Z
mZmZeZdS)	aL
The configuration classes and routines in yum are splattered over too many
places, hard to change and debug. The new structure here will replace that. Its
goal is to:

* accept configuration options from all three sources (the main config file,
  repo config files, command line switches)
* handle all the logic of storing those and producing related values.
* returning configuration values.
* optionally: asserting no value is overridden once it has been applied
  somewhere (e.g. do not let a new repo be initialized with different global
  cache path than an already existing one).

�)�absolute_import)�unicode_literals)�PRIO_DEFAULT�PRIO_MAINCONFIG�PRIO_AUTOMATICCONFIG)�PRIO_REPOCONFIG�PRIO_PLUGINDEFAULT�PRIO_PLUGINCONFIG)�PRIO_COMMANDLINE�PRIO_RUNTIME)�
BaseConfig�MainConf�RepoConfN)�__doc__Z
__future__rrZdnf.conf.configrrrrrr	r
rrr
rZConf�rr�/usr/lib/python3.6/__init__.py�<module>#s__pycache__/__init__.cpython-36.opt-1.pyc000064400000002207150401432030014071 0ustar003

�ft`��@spdZddlmZddlmZddlmZmZmZddlmZm	Z	m
Z
ddlmZmZddlm
Z
mZmZeZdS)	aL
The configuration classes and routines in yum are splattered over too many
places, hard to change and debug. The new structure here will replace that. Its
goal is to:

* accept configuration options from all three sources (the main config file,
  repo config files, command line switches)
* handle all the logic of storing those and producing related values.
* returning configuration values.
* optionally: asserting no value is overridden once it has been applied
  somewhere (e.g. do not let a new repo be initialized with different global
  cache path than an already existing one).

�)�absolute_import)�unicode_literals)�PRIO_DEFAULT�PRIO_MAINCONFIG�PRIO_AUTOMATICCONFIG)�PRIO_REPOCONFIG�PRIO_PLUGINDEFAULT�PRIO_PLUGINCONFIG)�PRIO_COMMANDLINE�PRIO_RUNTIME)�
BaseConfig�MainConf�RepoConfN)�__doc__Z
__future__rrZdnf.conf.configrrrrrr	r
rrr
rZConf�rr�/usr/lib/python3.6/__init__.py�<module>#s__pycache__/substitutions.cpython-36.pyc000064400000003552150401432030014336 0ustar003

��gj
�@sLddlZddlZddlZddlmZejd�Zejd�ZGdd�de	�Z
dS)�N)�_z^DNF_VAR_[A-Za-z0-9_]+$Zdnfcs.eZdZ�fdd�Zdd�Zd
dd�Z�ZS)�
Substitutionscstt|�j�|j�dS)N)�superr�__init__�_update_from_env)�self)�	__class__��#/usr/lib/python3.6/substitutions.pyr"szSubstitutions.__init__cCs\dd�tdd�D�}xBtjj�D]4\}}tj|�rD|||dd�<q ||kr |||<q WdS)NcSsg|]}d|�qS)zDNF%dr	)�.0Znumr	r	r
�
<listcomp>'sz2Substitutions._update_from_env.<locals>.<listcomp>r�
�)�range�os�environ�items�ENVIRONMENT_VARS_RE�match)rZnumericvars�key�valr	r	r
r&s
zSubstitutions._update_from_env�/etc/yum/vars/�/etc/dnf/vars/cCs�x|D�]�}g}y"tjj||jd��}tj|�}Wntk
rJwYnXx�|D]�}tjj||�}d}tjj|�r�y<t|��}	|	j�}WdQRX|r�|ddkr�|dd�}Wn@tt	t
fk
r�}
ztjt
d�j||
��wRWYdd}
~
XnX|dk	rR|||<qRWqWdS)N�/��
z2Error when parsing a variable from file '{0}': {1}���r)r�path�join�lstrip�listdir�OSError�isfile�open�readline�IOError�UnicodeDecodeError�loggerZwarningr�format)rZinstallrootZvarsdirZ	vars_pathZfsvarsZ
dir_fsvarsZfsvar�filepathr�fp�er	r	r
�update_from_etc.s*

zSubstitutions.update_from_etc�rr)r-)�__name__�
__module__�__qualname__rrr,�
__classcell__r	r	)rr
rsr)Zloggingr�reZdnf.i18nr�compilerZ	getLoggerr'�dictrr	r	r	r
�<module>s

__pycache__/read.cpython-36.opt-1.pyc000064400000006411150401432030013246 0ustar003

�ft`��@s~ddlmZddlmZddlmZmZddlZddlZ	ddl
ZddlZddlZddl
Z
ddlZe
jd�ZGdd�de�ZdS)�)�absolute_import)�unicode_literals)�_�ucdN�dnfc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
RepoReadercCs||_||_dS)N)�conf�opts)�selfrr	�r�/usr/lib/python3.6/read.py�__init__$szRepoReader.__init__ccs�x|j|jj�D]
}|VqWg}x8|jjD],}x&tjtjj|d��D]}|j|�qFWq,W|j	dd�d�xT|D]L}yx|j|�D]
}|Vq�WWqrt
jjk
r�t
jtd�|�YqrXqrWdS)Nz*.repocSstjj|dd��S)N����)r�utilZ
split_path)�xrrr�<lambda>5sz%RepoReader.__iter__.<locals>.<lambda>)�keyz'Warning: failed loading '%s', skipping.)�
_get_reposrZconfig_file_path�reposdir�glob�os�path�join�append�sortr�
exceptions�ConfigError�logger�warningr)r
�rZrepo_configsrr�repofnrrr�__iter__(s


zRepoReader.__iter__c	Cs^tjjj||jj�}tjj|�}|dk	rl||krJtd�j	|||||�}ntd�j	||||�}tj
j|��tjj||j�}y|j
|||tjj�WnZtk
r�}z>||kr�td�j	|||�}ntd�j	||�}tj
j|��WYdd}~XnX|jd�tjjk�r8||k�r td�j	||�}ntd�j	|�}tj|�t|j�|_|jj|jj�||_|S)	z)Build a repository using the parsed data.Nz&Bad id for repo: {} ({}), byte = {} {}z!Bad id for repo: {}, byte = {} {}z.Repository '{}' ({}): Error parsing config: {}z)Repository '{}': Error parsing config: {}�namez@Repository '{}' ({}) is missing name in configuration, using id.z;Repository '{}' is missing name in configuration, using id.)�libdnfr�ConfigParserZ
substitute�
substitutionsr�repoZrepo_id_invalidr�formatrrZRepoZ	_populateZPRIO_REPOCONFIG�
ValueErrorZ
_get_priorityZPRIO_DEFAULTrrrr#Z_substitutions�updateZcfg)	r
�parserZid_r!Zsubstituted_idZinvalid�msgr'�errr�_build_repo?s8




zRepoReader._build_repoccs|jj}tjj�}|j|�y|j|�Wndtk
rd}ztjj	t
d�j||���WYdd}~Xn,tk
r�}zt
j|�WYdd}~XnXx�|j�D]x}|dkr�q�y|j|t|�|�}Wn:tjjtjj	fk
r�}zt
j|�w�WYdd}~XnX||_|j|j�|Vq�WdS)z4Parse and yield all repositories from a config file.zParsing file "{}" failed: {}N�main)rr&r$r%ZsetSubstitutions�read�RuntimeErrorrrrrr(�IOErrorrrZgetDatar.rZ	RepoErrorZrepofileZ_configure_from_optionsr	)r
r!Zsubstsr+r-ZsectionZthisreporrrrhs(

(
zRepoReader._get_reposN)�__name__�
__module__�__qualname__r
r"r.rrrrrr#s)r)Z
__future__rrZdnf.i18nrrZdnf.confrZlibdnf.confr$Zdnf.exceptionsZdnf.reporZloggingrZ	getLoggerr�objectrrrrr�<module>s
config.py000064400000047737150401432030006375 0ustar00# dnf configuration classes.
#
# Copyright (C) 2016-2017 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#

from __future__ import absolute_import
from __future__ import unicode_literals

from dnf.yum import misc
from dnf.i18n import ucd, _
from dnf.pycomp import basestring, urlparse

import fnmatch
import dnf.conf.substitutions
import dnf.const
import dnf.exceptions
import dnf.pycomp
import dnf.util
import hawkey
import logging
import os
import libdnf.conf
import libdnf.repo
import tempfile

PRIO_EMPTY = libdnf.conf.Option.Priority_EMPTY
PRIO_DEFAULT = libdnf.conf.Option.Priority_DEFAULT
PRIO_MAINCONFIG = libdnf.conf.Option.Priority_MAINCONFIG
PRIO_AUTOMATICCONFIG = libdnf.conf.Option.Priority_AUTOMATICCONFIG
PRIO_REPOCONFIG = libdnf.conf.Option.Priority_REPOCONFIG
PRIO_PLUGINDEFAULT = libdnf.conf.Option.Priority_PLUGINDEFAULT
PRIO_PLUGINCONFIG = libdnf.conf.Option.Priority_PLUGINCONFIG
PRIO_COMMANDLINE = libdnf.conf.Option.Priority_COMMANDLINE
PRIO_RUNTIME = libdnf.conf.Option.Priority_RUNTIME

logger = logging.getLogger('dnf')


class BaseConfig(object):
    """Base class for storing configuration definitions.

       Subclass when creating your own definitions.

    """

    def __init__(self, config=None, section=None, parser=None):
        self.__dict__["_config"] = config
        self._section = section

    def __getattr__(self, name):
        if "_config" not in self.__dict__:
            raise AttributeError("'{}' object has no attribute '{}'".format(self.__class__, name))
        option = getattr(self._config, name)
        if option is None:
            return None
        try:
            value = option().getValue()
        except Exception as ex:
            return None
        if isinstance(value, str):
            return ucd(value)
        return value

    def __setattr__(self, name, value):
        option = getattr(self._config, name, None)
        if option is None:
            # unknown config option, store to BaseConfig only
            return super(BaseConfig, self).__setattr__(name, value)
        self._set_value(name, value, PRIO_RUNTIME)

    def __str__(self):
        out = []
        out.append('[%s]' % self._section)
        if self._config:
            for optBind in self._config.optBinds():
                try:
                    value = optBind.second.getValueString()
                except RuntimeError:
                    value = ""
                out.append('%s: %s' % (optBind.first, value))
        return '\n'.join(out)

    def _has_option(self, name):
        method = getattr(self._config, name, None)
        return method is not None

    def _get_value(self, name):
        method = getattr(self._config, name, None)
        if method is None:
            return None
        return method().getValue()

    def _get_priority(self, name):
        method = getattr(self._config, name, None)
        if method is None:
            return None
        return method().getPriority()

    def _set_value(self, name, value, priority=PRIO_RUNTIME):
        """Set option's value if priority is equal or higher
           than current priority."""
        method = getattr(self._config, name, None)
        if method is None:
            raise Exception("Option \"" + name + "\" does not exists")
        option = method()
        if value is None:
            try:
                option.set(priority, value)
            except Exception:
                pass
        else:
            try:
                if isinstance(value, list) or isinstance(value, tuple):
                    option.set(priority, libdnf.conf.VectorString(value))
                elif (isinstance(option, libdnf.conf.OptionBool)
                      or isinstance(option, libdnf.conf.OptionChildBool)
                      ) and isinstance(value, int):
                    option.set(priority, bool(value))
                else:
                    option.set(priority, value)
            except RuntimeError as e:
                raise dnf.exceptions.ConfigError(_("Error parsing '%s': %s")
                                                 % (value, str(e)),
                                                 raw_error=str(e))

    def _populate(self, parser, section, filename, priority=PRIO_DEFAULT):
        """Set option values from an INI file section."""
        if parser.hasSection(section):
            for name in parser.options(section):
                value = parser.getSubstitutedValue(section, name)
                if not value or value == 'None':
                    value = ''
                if hasattr(self._config, name):
                    try:
                        self._config.optBinds().at(name).newString(priority, value)
                    except RuntimeError as e:
                        logger.error(_('Invalid configuration value: %s=%s in %s; %s'),
                                     ucd(name), ucd(value), ucd(filename), str(e))
                else:
                    if name == 'arch' and hasattr(self, name):
                        setattr(self, name, value)
                    else:
                        logger.debug(
                            _('Unknown configuration option: %s = %s in %s'),
                            ucd(name), ucd(value), ucd(filename))

    def dump(self):
        # :api
        """Return a string representing the values of all the
           configuration options.
        """
        output = ['[%s]' % self._section]

        if self._config:
            for optBind in self._config.optBinds():
                # if not opt._is_runtimeonly():
                try:
                    output.append('%s = %s' % (optBind.first, optBind.second.getValueString()))
                except RuntimeError:
                    pass

        return '\n'.join(output) + '\n'

    @staticmethod
    def write_raw_configfile(filename, section_id, substitutions, modify):
        # :api
        """
        filename   - name of config file (.conf or .repo)
        section_id - id of modified section (e.g. main, fedora, updates)
        substitutions - instance of base.conf.substitutions
        modify     - dict of modified options
        """
        parser = libdnf.conf.ConfigParser()
        parser.read(filename)

        # b/c repoids can have $values in them we need to map both ways to figure
        # out which one is which
        if not parser.hasSection(section_id):
            for sect in parser.getData():
                if libdnf.conf.ConfigParser.substitute(sect, substitutions) == section_id:
                    section_id = sect

        for name, value in modify.items():
            if isinstance(value, list):
                value = ' '.join(value)
            parser.setValue(section_id, name, value)

        parser.write(filename, False)


class MainConf(BaseConfig):
    # :api
    """Configuration option definitions for dnf.conf's [main] section."""
    def __init__(self, section='main', parser=None):
        # pylint: disable=R0915
        config = libdnf.conf.ConfigMain()
        super(MainConf, self).__init__(config, section, parser)
        self._set_value('pluginpath', [dnf.const.PLUGINPATH], PRIO_DEFAULT)
        self._set_value('pluginconfpath', [dnf.const.PLUGINCONFPATH], PRIO_DEFAULT)
        self.substitutions = dnf.conf.substitutions.Substitutions()
        self.arch = hawkey.detect_arch()
        self._config.system_cachedir().set(PRIO_DEFAULT, dnf.const.SYSTEM_CACHEDIR)

        # setup different cache and log for non-privileged users
        if dnf.util.am_i_root():
            cachedir = dnf.const.SYSTEM_CACHEDIR
            logdir = '/var/log'
        else:
            try:
                cachedir = logdir = misc.getCacheDir()
            except (IOError, OSError) as e:
                msg = _('Could not set cachedir: {}').format(ucd(e))
                raise dnf.exceptions.Error(msg)

        self._config.cachedir().set(PRIO_DEFAULT, cachedir)
        self._config.logdir().set(PRIO_DEFAULT, logdir)

        # track list of temporary files created
        self.tempfiles = []

    def __del__(self):
        for file_name in self.tempfiles:
            os.unlink(file_name)

    @property
    def get_reposdir(self):
        # :api
        """Returns the value of reposdir"""
        myrepodir = None
        # put repo file into first reposdir which exists or create it
        for rdir in self._get_value('reposdir'):
            if os.path.exists(rdir):
                myrepodir = rdir
                break

        if not myrepodir:
            myrepodir = self._get_value('reposdir')[0]
            dnf.util.ensure_dir(myrepodir)
        return myrepodir

    def _check_remote_file(self, optname):
        """
        In case the option value is a remote URL, download it to the temporary location
        and use this temporary file instead.
        """
        prio = self._get_priority(optname)
        val = self._get_value(optname)
        if isinstance(val, basestring):
            location = urlparse.urlparse(val)
            if location[0] in ('file', ''):
                # just strip the file:// prefix
                self._set_value(optname, location.path, prio)
            else:
                downloader = libdnf.repo.Downloader()
                temp_fd, temp_path = tempfile.mkstemp(prefix='dnf-downloaded-config-')
                self.tempfiles.append(temp_path)
                try:
                    downloader.downloadURL(None, val, temp_fd)
                except RuntimeError as e:
                    raise dnf.exceptions.ConfigError(
                        _('Configuration file URL "{}" could not be downloaded:\n'
                          '  {}').format(val, str(e)))
                else:
                    self._set_value(optname, temp_path, prio)
                finally:
                    os.close(temp_fd)

    def _search_inside_installroot(self, optname):
        """
        Return root used as prefix for option (installroot or "/"). When specified from commandline
        it returns value from conf.installroot
        """
        installroot = self._get_value('installroot')
        if installroot == "/":
            return installroot
        prio = self._get_priority(optname)
        # don't modify paths specified on commandline
        if prio >= PRIO_COMMANDLINE:
            return installroot
        val = self._get_value(optname)
        # if it exists inside installroot use it (i.e. adjust configuration)
        # for lists any component counts
        if not isinstance(val, str):
            if any(os.path.exists(os.path.join(installroot, p.lstrip('/'))) for p in val):
                self._set_value(
                    optname,
                    libdnf.conf.VectorString([self._prepend_installroot_path(p) for p in val]),
                    prio
                )
                return installroot
        elif os.path.exists(os.path.join(installroot, val.lstrip('/'))):
            self._set_value(optname, self._prepend_installroot_path(val), prio)
            return installroot
        return "/"

    def prepend_installroot(self, optname):
        # :api
        prio = self._get_priority(optname)
        new_path = self._prepend_installroot_path(self._get_value(optname))
        self._set_value(optname, new_path, prio)

    def _prepend_installroot_path(self, path):
        root_path = os.path.join(self._get_value('installroot'), path.lstrip('/'))
        return libdnf.conf.ConfigParser.substitute(root_path, self.substitutions)

    def _configure_from_options(self, opts):
        """Configure parts of CLI from the opts """
        config_args = ['plugins', 'version', 'config_file_path',
                       'debuglevel', 'errorlevel', 'installroot',
                       'best', 'assumeyes', 'assumeno', 'clean_requirements_on_remove', 'gpgcheck',
                       'showdupesfromrepos', 'plugins', 'ip_resolve',
                       'rpmverbosity', 'disable_excludes', 'color',
                       'downloadonly', 'exclude', 'excludepkgs', 'skip_broken',
                       'tsflags', 'arch', 'basearch', 'ignorearch', 'cacheonly', 'comment']

        for name in config_args:
            value = getattr(opts, name, None)
            if value is not None and value != []:
                if self._has_option(name):
                    appendValue = False
                    if self._config:
                        try:
                            appendValue = self._config.optBinds().at(name).getAddValue()
                        except RuntimeError:
                            # fails if option with "name" does not exist in _config (libdnf)
                            pass
                    if appendValue:
                        add_priority = dnf.conf.PRIO_COMMANDLINE
                        if add_priority < self._get_priority(name):
                            add_priority = self._get_priority(name)
                        for item in value:
                            if item:
                                self._set_value(name, self._get_value(name) + [item], add_priority)
                            else:
                                self._set_value(name, [], dnf.conf.PRIO_COMMANDLINE)
                    else:
                        self._set_value(name, value, dnf.conf.PRIO_COMMANDLINE)
                elif hasattr(self, name):
                    setattr(self, name, value)
                else:
                    logger.warning(_('Unknown configuration option: %s = %s'),
                                   ucd(name), ucd(value))

        if getattr(opts, 'gpgcheck', None) is False:
            self._set_value("localpkg_gpgcheck", False, dnf.conf.PRIO_COMMANDLINE)

        if hasattr(opts, 'main_setopts'):
            # now set all the non-first-start opts from main from our setopts
            # pylint: disable=W0212
            for name, values in opts.main_setopts.items():
                for val in values:
                    if hasattr(self._config, name):
                        try:
                            # values in main_setopts are strings, try to parse it using newString()
                            self._config.optBinds().at(name).newString(PRIO_COMMANDLINE, val)
                        except RuntimeError as e:
                            raise dnf.exceptions.ConfigError(
                                _("Error parsing --setopt with key '%s', value '%s': %s")
                                % (name, val, str(e)), raw_error=str(e))
                    else:
                        # if config option with "name" doesn't exist in _config, it could be defined
                        # only in Python layer
                        if hasattr(self, name):
                            setattr(self, name, val)
                        else:
                            msg = _("Main config did not have a %s attr. before setopt")
                            logger.warning(msg, name)

    def exclude_pkgs(self, pkgs):
        # :api
        name = "excludepkgs"

        if pkgs is not None and pkgs != []:
            if self._has_option(name):
                self._set_value(name, pkgs, dnf.conf.PRIO_COMMANDLINE)
            else:
                logger.warning(_('Unknown configuration option: %s = %s'),
                               ucd(name), ucd(pkgs))

    def _adjust_conf_options(self):
        """Adjust conf options interactions"""

        skip_broken_val = self._get_value('skip_broken')
        if skip_broken_val:
            self._set_value('strict', not skip_broken_val, self._get_priority('skip_broken'))

    @property
    def releasever(self):
        # :api
        return self.substitutions.get('releasever')

    @releasever.setter
    def releasever(self, val):
        # :api
        if val is None:
            self.substitutions.pop('releasever', None)
            return
        self.substitutions['releasever'] = str(val)

    @property
    def arch(self):
        # :api
        return self.substitutions.get('arch')

    @arch.setter
    def arch(self, val):
        # :api

        if val is None:
            self.substitutions.pop('arch', None)
            return
        if val not in dnf.rpm._BASEARCH_MAP.keys():
            msg = _('Incorrect or unknown "{}": {}')
            raise dnf.exceptions.Error(msg.format("arch", val))
        self.substitutions['arch'] = val
        self.basearch = dnf.rpm.basearch(val)

    @property
    def basearch(self):
        # :api
        return self.substitutions.get('basearch')

    @basearch.setter
    def basearch(self, val):
        # :api

        if val is None:
            self.substitutions.pop('basearch', None)
            return
        if val not in dnf.rpm._BASEARCH_MAP.values():
            msg = _('Incorrect or unknown "{}": {}')
            raise dnf.exceptions.Error(msg.format("basearch", val))
        self.substitutions['basearch'] = val

    def read(self, filename=None, priority=PRIO_DEFAULT):
        # :api
        if filename is None:
            filename = self._get_value('config_file_path')
        parser = libdnf.conf.ConfigParser()
        try:
            parser.read(filename)
        except RuntimeError as e:
            raise dnf.exceptions.ConfigError(_('Parsing file "%s" failed: %s') % (filename, e))
        except IOError as e:
            logger.warning(e)
        self._populate(parser, self._section, filename, priority)

        # update to where we read the file from
        self._set_value('config_file_path', filename, priority)

    @property
    def verbose(self):
        return self._get_value('debuglevel') >= dnf.const.VERBOSE_LEVEL


class RepoConf(BaseConfig):
    """Option definitions for repository INI file sections."""

    def __init__(self, parent, section=None, parser=None):
        mainConfig = parent._config if parent else libdnf.conf.ConfigMain()
        super(RepoConf, self).__init__(libdnf.conf.ConfigRepo(mainConfig), section, parser)
        # Do not remove! Attribute is a reference holder.
        # Prevents premature removal of the mainConfig. The libdnf ConfigRepo points to it.
        self._mainConfigRefHolder = mainConfig
        if section:
            self._config.name().set(PRIO_DEFAULT, section)

    def _configure_from_options(self, opts):
        """Configure repos from the opts. """

        if getattr(opts, 'gpgcheck', None) is False:
            for optname in ['gpgcheck', 'repo_gpgcheck']:
                self._set_value(optname, False, dnf.conf.PRIO_COMMANDLINE)

        repo_setopts = getattr(opts, 'repo_setopts', {})
        for repoid, setopts in repo_setopts.items():
            if not fnmatch.fnmatch(self._section, repoid):
                continue
            for name, values in setopts.items():
                for val in values:
                    if hasattr(self._config, name):
                        try:
                            # values in repo_setopts are strings, try to parse it using newString()
                            self._config.optBinds().at(name).newString(PRIO_COMMANDLINE, val)
                        except RuntimeError as e:
                            raise dnf.exceptions.ConfigError(
                                _("Error parsing --setopt with key '%s.%s', value '%s': %s")
                                % (self._section, name, val, str(e)), raw_error=str(e))
                    else:
                        msg = _("Repo %s did not have a %s attr. before setopt")
                        logger.warning(msg, self._section, name)
substitutions.py000064400000005152150401432030010050 0ustar00# substitutions.py
# Config file substitutions.
#
# Copyright (C) 2012-2016 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#

import logging
import os
import re

from dnf.i18n import _

ENVIRONMENT_VARS_RE = re.compile(r'^DNF_VAR_[A-Za-z0-9_]+$')
logger = logging.getLogger('dnf')


class Substitutions(dict):
    # :api

    def __init__(self):
        super(Substitutions, self).__init__()
        self._update_from_env()

    def _update_from_env(self):
        numericvars = ['DNF%d' % num for num in range(0, 10)]
        for key, val in os.environ.items():
            if ENVIRONMENT_VARS_RE.match(key):
                self[key[8:]] = val  # remove "DNF_VAR_" prefix
            elif key in numericvars:
                self[key] = val

    def update_from_etc(self, installroot, varsdir=("/etc/yum/vars/", "/etc/dnf/vars/")):
        # :api

        for vars_path in varsdir:
            fsvars = []
            try:
                dir_fsvars = os.path.join(installroot, vars_path.lstrip('/'))
                fsvars = os.listdir(dir_fsvars)
            except OSError:
                continue
            for fsvar in fsvars:
                filepath = os.path.join(dir_fsvars, fsvar)
                val = None
                if os.path.isfile(filepath):
                    try:
                        with open(filepath) as fp:
                            val = fp.readline()
                        if val and val[-1] == '\n':
                            val = val[:-1]
                    except (OSError, IOError, UnicodeDecodeError) as e:
                        logger.warning(_("Error when parsing a variable from file '{0}': {1}").format(filepath, e))
                        continue
                if val is not None:
                    self[fsvar] = val
read.py000064400000012213150401432030006020 0ustar00# read.py
# Reading configuration from files.
#
# Copyright (C) 2014-2017 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
# Public License for more details.  You should have received a copy of the
# GNU General Public License along with this program; if not, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.  Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#

from __future__ import absolute_import
from __future__ import unicode_literals
from dnf.i18n import _, ucd
import dnf.conf
import libdnf.conf
import dnf.exceptions
import dnf.repo
import glob
import logging
import os

logger = logging.getLogger('dnf')


class RepoReader(object):
    def __init__(self, conf, opts):
        self.conf = conf
        self.opts = opts

    def __iter__(self):
        # get the repos from the main yum.conf file
        for r in self._get_repos(self.conf.config_file_path):
            yield r

        # read .repo files from directories specified by conf.reposdir
        repo_configs = []
        for reposdir in self.conf.reposdir:
            for path in glob.glob(os.path.join(reposdir, "*.repo")):
                repo_configs.append(path)

        # remove .conf suffix before calling the sort function
        # also split the path so the separators are not treated as ordinary characters
        repo_configs.sort(key=lambda x: dnf.util.split_path(x[:-5]))

        for repofn in repo_configs:
            try:
                for r in self._get_repos(repofn):
                    yield r
            except dnf.exceptions.ConfigError:
                logger.warning(_("Warning: failed loading '%s', skipping."),
                               repofn)

    def _build_repo(self, parser, id_, repofn):
        """Build a repository using the parsed data."""

        substituted_id = libdnf.conf.ConfigParser.substitute(id_, self.conf.substitutions)

        # Check the repo.id against the valid chars
        invalid = dnf.repo.repo_id_invalid(substituted_id)
        if invalid is not None:
            if substituted_id != id_:
                msg = _("Bad id for repo: {} ({}), byte = {} {}").format(substituted_id, id_,
                                                                         substituted_id[invalid],
                                                                         invalid)
            else:
                msg = _("Bad id for repo: {}, byte = {} {}").format(id_, id_[invalid], invalid)
            raise dnf.exceptions.ConfigError(msg)

        repo = dnf.repo.Repo(substituted_id, self.conf)
        try:
            repo._populate(parser, id_, repofn, dnf.conf.PRIO_REPOCONFIG)
        except ValueError as e:
            if substituted_id != id_:
                msg = _("Repository '{}' ({}): Error parsing config: {}").format(substituted_id,
                                                                                 id_, e)
            else:
                msg = _("Repository '{}': Error parsing config: {}").format(id_, e)
            raise dnf.exceptions.ConfigError(msg)

        # Ensure that the repo name is set
        if repo._get_priority('name') == dnf.conf.PRIO_DEFAULT:
            if substituted_id != id_:
                msg = _("Repository '{}' ({}) is missing name in configuration, using id.").format(
                    substituted_id, id_)
            else:
                msg = _("Repository '{}' is missing name in configuration, using id.").format(id_)
            logger.warning(msg)
        repo.name = ucd(repo.name)
        repo._substitutions.update(self.conf.substitutions)
        repo.cfg = parser

        return repo

    def _get_repos(self, repofn):
        """Parse and yield all repositories from a config file."""

        substs = self.conf.substitutions
        parser = libdnf.conf.ConfigParser()
        parser.setSubstitutions(substs)
        try:
            parser.read(repofn)
        except RuntimeError as e:
            raise dnf.exceptions.ConfigError(_('Parsing file "{}" failed: {}').format(repofn, e))
        except IOError as e:
            logger.warning(e)

        # Check sections in the .repo file that was just slurped up
        for section in parser.getData():

            if section == 'main':
                continue

            try:
                thisrepo = self._build_repo(parser, ucd(section), repofn)
            except (dnf.exceptions.RepoError, dnf.exceptions.ConfigError) as e:
                logger.warning(e)
                continue
            else:
                thisrepo.repofile = repofn

            thisrepo._configure_from_options(self.opts)

            yield thisrepo
alt_php.ini000064400000001662150463275050006710 0ustar00;---apcu---
extension=apcu.so

;---bcmath---
extension=bcmath.so

;---dom---
extension=dom.so

;---fileinfo---
extension=fileinfo.so

;---gd---
extension=gd.so

;---imagick---
extension=imagick.so

;---imap---
extension=imap.so

;---intl---
extension=intl.so

;---mbstring---
extension=mbstring.so

;---mysqlnd---
extension=mysqlnd.so

;---nd_mysqli---
extension=nd_mysqli.so

;---opcache---
zend_extension=/opt/alt/php81/usr/lib64/php/modules/opcache.so

;---pdo---
extension=pdo.so

;---pdo_mysql---
extension=pdo_mysql.so

;---pdo_pgsql---
extension=pdo_pgsql.so

;---pdo_sqlite---
extension=pdo_sqlite.so

;---pgsql---
extension=pgsql.so

;---phar---
extension=phar.so

;---posix---
extension=posix.so

;---soap---
extension=soap.so

;---sockets---
extension=sockets.so

;---tidy---
extension=tidy.so

;---xmlreader---
extension=xmlreader.so

;---xmlwriter---
extension=xmlwriter.so

;---xsl---
extension=xsl.so

;---zip---
extension=zip.so