ok

Mini Shell

Direktori : /lib/python3.6/site-packages/rhn/actions/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/rhn/actions/__pycache__/packages.cpython-36.pyc

3

%T�f.�@s�ddlZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ej
�ZdZddd	d
ddd
gZ
d!dd�Zd"dd�Zd#dd�Zd$dd
�Zd%dd�Zd&dd	�Zdd�Zd'dd
�Zd(dd�Zggdddfdd�Zdd�Zdd �ZdS))�N)�
up2dateLog)�config)�rpmUtils)�rhnPackageInfoz/var/lib/up2date/dbtimestamp�update�remove�refresh_list�
fullUpdate�checkNeedUpdate�runTransaction�verifycsj|rddifSt|t�s"ddifStjd|�tddd�}|jj�j���fd	d
�|D�}t||d|d�S)z0We have been told that we should remove packagesrzno-ops for caching�
z$Invalid arguments passed to functionzCalled remove_packagesTF)�load_system_repo�load_available_reposcsg|]}t�|��qS�)�_package_tup2obj)�.0�tup)�	installedr�/usr/lib/python3.6/packages.py�
<listcomp>:szremove.<locals>.<listcomp>)r�
allow_erasing�
cache_only)	�
isinstance�list�log�	log_debug�	_dnf_base�sack�queryr�_dnf_transaction)�package_listr�base�	to_remover)rrr-s


cCs�t|t�sddifStjd|�tddd�}|jj�j�}|jj�j�}d}g}g}�x"|D�]}t	|�dkrx|j
d�|\}	}
}}}
|
dkr�|dkr�|dkr�|
dkr�|j|	d	�r�tjd
|	�q\|dkr�d}|j|	|
d�j�}t
||�}|�sd
t|�}tjd|�|j
|�q\x`|D]N}|j|�}|dk�rHtjdt|��Pn|dk�rtjdt|��P�qW|j
|�q\W|�s�|�r�dddj|�ddd�f}n
ddif}|jj�|j�|St|||d�S)z:We have been told that we should retrieve/install packagesr
z$Invalid arguments passed to functionz
Called updateT)rrN��)�namezPackage %s is already installedr)r&�archz,Package %s is not available for installationzE: zPackage %s already installedz6More recent version of package %s is already installed� z-Failed: Packages failed to install properly:
�
�1�package_install_failure)�versionr&z$Requested packages already installed)�installr)rrrrrrrr�	available�len�append�filterZlatestr�_package_tup2strZlog_meZevr_cmp�join�_plugins�_unload�closer )r!rr"rr.�errZerrmsgs�
to_install�packager&r,�release�epochr'�pkgsZ
requested_pkg�pkgZpkg_cmp�retrrrr?s`











cCs�|rddifStddd�}|jj�j�}|jj�j�}g}g}xd|ddd�D]P}|\}}	t||�}
|	dkr~|
r~|j|
�qP|	dkrP|
rPt||�}|j|�qPW|r�|r�dd	ifSt|||d|d
�S)z� Run a transaction on a group of packages.
        This was historicaly meant as generic call, but
        is only called for rollback.
    rzno-ops for cachingT)rr�packagesN�e�iz6Requested package actions have already been performed.)r-rrr)rrrrr.rr0r )Ztransaction_datarr"rr.r8r#Zpackage_objectr9�actionr=�newrrrr�s&



cCstddd�}t|d|d�S)z$ Update all packages on the system. T)rr)�full_updater)rr )�forcerr"rrrr	�sc	Cs�|rddifSi}d}tj�}|dr.|d}d|}ytj|�d}Wndd|fSytjt�d}Wnd}YnX||dkr�dd	|fS|dkr�yttd
�}|j�Wndd|fStdd
�S)z� Check if the locally installed package list changed, if
        needed the list is updated on the server
        In case of error avoid pushing data to stay safe
    rzno-ops for cachingz/var/lib/rpm�dbpathz%s/Packages�zunable to stat the rpm database�
zNrpm database not modified since last update (or package list recently updated)zw+z!unable to open the timestamp file�)�rhnsd)rZinitUp2dateConfig�os�stat�LAST_UPDATE_FILE�openr6r)	rJr�datarFZcfgZRPM_PACKAGE_FILEZdbtimeZlast�filerrrr
�s4




c	CsR|rddifStjd�d}ytj�Wntd�ddifSt�ddifS)	z3 push again the list of rpm packages to the server rzno-ops for cachingzCalled refresh_rpmlistNz8ERROR: refreshing remote package list for System Profile�zError refreshing package listzrpmlist refreshed)rrrZupdatePackageProfile�print�touch_time_stamp)rJrr>rrrr�s


cCs^yttd�}|j�WnddifStj�}ytjt||f�WnddtifSdS)Nzw+rz!unable to open the timestamp filez6unable to set the time stamp on the time stamp file %s)rNrMr6�timerK�utime)Zfile_d�trrrrS�s

rScCsvtjd�|rddifSi}d|d<d|d<tj|�\}}||d<t|�rld|d<d|d<||d	<d
d|fSdd|fS)
NzCalled packages.verifyrzno-ops for cachingzpackages.verifyr&r,Zverify_infoz packages.verify.missing_packages�missing_packages�+z-packages requested to be verified are missingzpackages verified)rrrZverifyPackagesr/)r?rrOr>rWrrrr�s


TcCs6tj�}|jjs|j�|r$|j�|jddd�|S)NT)rr)�dnfZBaser4ZpluginsZinit_pluginsZread_all_reposZ	fill_sack)rrr"rrrrsrFcCs�z�y�|r|j�n8x|D]}|r|j|�qWx|D]}|r6|j|�q6W|j|�tjd�t|j�svtj	j
d��|jjr�tjddd�|jjD��|j|jj�|jj
r�tjddd�|jj
D��|s�|j�W�ntj	jk
�r }z&i}d|d	<d
|d<dd
t|�|fSd}~Xn�tj	jk
�rf}z&i}d|d	<d|d<ddt|�|fSd}~Xn�tj	jk
�r�}z&i}d|d	<d|d<ddt|�|fSd}~Xn@tj	j
k
�r�}zd}	dt|�}
i}|	|
|fSd}~XnXWd|jj�|j�XddifS)zE
    command is an function excpecting dnf.Base() as an argument
    zDependencies Resolvedzempty transactionzDownloading and installing: cSsg|]}t|��qSr)�str)r�prrrr-sz$_dnf_transaction.<locals>.<listcomp>z
Removing: cSsg|]}t|��qSr)rZ)rr[rrrr1sr*r,r+r&r(z/Failed: Packages failed to install properly: %sNrZrpmremoveerrors�z%sZfailed_deps�z9Failed: packages requested raised dependency problems: %s�z)Error while executing packages action: %szUpdate Succeeded)r^)Zupgrade_allZpackage_installZpackage_removeZresolverrr/ZtransactionrY�
exceptions�ErrorZinstall_setZdownload_packagesZ
remove_setZdo_transactionZMarkingErrorrZZ
DepsolveErrorr4r5r6)r"r-rrDrrr=r@rOZstatus�messagerrrr s^







r c	Cs�|dd�\}}}}t|�dkr(|dnd}d|i}|dk	rPt|�dkrP||d<|dk	rlt|�dkrl||d<|dk	r�t|�dkr�t|�|d<|dk	r�t|�dkr�||d<|jf|�j�}|r�|dSdS)N�r&rr,r:r;r')r/�intr1Zrun)	�qrr&r,r:r;r'rr<rrrrUsrcCsD|dd�\}}}}}|sd}d||||f}|r>|d|7}|fS)z6 Create a package name from an rhn package tuple.
    N�0z%s-%s:%s-%sz.%sr)Zpackage_tup�n�v�rr@�aZpkginforrrr2gsr2)N)N)N)rN)NN)NN)N)TT)rKrTZdnf.exceptionsrYZdnf.cliZup2date_clientrrrrZinitLogrrMZ
__rhnexport__rrrr	r
rrSrrr rr2rrrr�<module>s:

E
 

)


=

Zerion Mini Shell 1.0