3
�ft`� � @ s� d dl mZ d dl mZ d dlZd dlZd dlZd dlZd dlZd dl Z d dl
mZ d dlm
Z
ejd�ZG dd� dej�Zd d
� Zdd� Zd
d� ZdS )� )�absolute_import)�unicode_literalsN)�
basestring)�_�dnfc s0 e Zd Z� fdd�Zd dd�Zd
dd�Z� ZS )�Sackc s t t| �j||� d S )N)�superr �__init__)�self�args�kwargs)� __class__� �/usr/lib/python3.6/sack.pyr % s z
Sack.__init__Nr c C s8 |r
|| _ || _|d k r4|| _|dkr4tjtd�� d S )NFznallow_vendor_change is disabled. This option is currently not supported for downgrade and distro-sync commands)�installonly�installonly_limit�allow_vendor_change�loggerZwarningr )r
r r r r r r �
_configure( s zSack._configurec C s t jj| |�S )z'Factory function returning a DNF Query.)r �queryZQuery)r
�flagsr r r r 1 s z
Sack.query)Nr N)r )�__name__�
__module__�__qualname__r r r �
__classcell__r r )r
r r " s
r c C sT | j j}tjj|� ttjj| | j jd || j j t
jj| j j
tjj�| j jdkd�S )N�arch� )ZpkgclsZ
pkginitvalr �cachedirZrootdirZlogfileZlogdebug)Zconfr r �utilZ
ensure_dirr �packageZPackageZ
substitutionsZinstallroot�os�path�joinZlogdir�constZ
LOG_HAWKEYZlogfilelevel)�baser r r r �_build_sack7 s
r% c C s2 t | �}y|jdd� W n tk
r, Y nX |S )NF)Zbuild_cache)r% Zload_system_repo�IOError)r$ Zsackr r r �_rpmdb_sackB s r' c C s t | �S )z�
Returns a new instance of sack containing only installed packages (@System repo)
Useful to get list of the installed RPMs after transaction.
)r' )r$ r r r �
rpmdb_sackM s r( )Z
__future__r r Zdnf.utilr Zdnf.packageZ dnf.queryZloggingZhawkeyr Z
dnf.pycompr Zdnf.i18nr Z getLoggerr r r% r' r( r r r r �