404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@13.59.26.63: ~ $
3

�gt`*0�@s�ddlmZddlmZddlmZmZddlmZddlZddl	Zddl
ZddlZddlZddl
ZddlZddlZddlZddlZejjGdd�dejj��ZdS)�)�absolute_import)�unicode_literals)�_�logger)�OptionParserNcs�eZdZdgZed�Z�fdd�Zedd��Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zd dd�Zd!dd�Zedd��Zdd�Zdd�Z�ZS)"�DownloadCommandZdownloadz%Download package to current directorycs tt|�j|�d|_d|_dS)N)�superr�__init__�opts�parser)�self�cli)�	__class__��/usr/lib/python3.6/download.pyr	+szDownloadCommand.__init__c	Cs�|jddtd�d�|jddtd�d�|jd	dtd
�d�|jddtd�d�|jd
ddgtjdtd�d�|jddtd�d�|jddtd�d�|jddddtd�d�|jddddd d!ggtd"�d#�dS)$N�packages�+zpackages to download)�nargs�helpz--source�
store_truezdownload the src.rpm instead)�actionrz--debuginfoz'download the -debuginfo package insteadz
--debugsourcez)download the -debugsource package insteadz--archz
--archlist�archesz[arch]z5limit  the  query to packages of given architectures.)�dest�defaultr�metavarrz	--resolvez(resolve and download needed dependenciesz	--alldepsz^when running with --resolve, download all dependencies (do not exclude already installed ones)z--urlz--urls�urlzJprint list of urls where the rpms can be downloaded instead of downloading)rrrz--urlprotocols�append�http�httpsZrsync�ftpz4when running with --url, limit to specific protocols)r�choicesrr)�add_argumentrrZ_SplitCallback)rrrr�
set_argparser0s*
zDownloadCommand.set_argparsercCs�|jj}d|_d|_|jjr*|jjr*d|_|jjr>|j	j
j�|jjsN|jj
rZ|j	j
j�|jjrr|jj|j	j_ntjjtj��|j	j_dS)NTF)r
�demandsZsack_activationZavailable_reposr
�resolveZalldepsZload_system_repo�source�baseZreposZenable_source_repos�	debuginfo�debugsourceZenable_debug_repos�destdir�conf�dnf�i18n�ucd�os�getcwd)rr#rrr�	configureKszDownloadCommand.configurecCs|jjr.|jjr.|jjr.|j|jj�}nXg}|jjrN|j|j|jj��|jjrj|j|j|jj��|jjr�|j|j	|jj��|jj
r�xd|D]\}|jtj
kr�|j|jjd�}|r�t|�q�td�|j}|jjjr�tjj|��tj|�q�WdS|j|�dS)zExecute the util action here.)�schemesz$Failed to get mirror for package: %sN)r
r%r'r(�_get_pkg_objs_rpmsr�extend�_get_pkg_objs_source�_get_pkg_objs_debuginfo�_get_pkg_objs_debugsourcer�repoid�hawkey�CMDLINE_REPO_NAMEZremote_locationZurlprotocols�printr�namer&r*�strictr+�
exceptions�ErrorrZwarning�
_do_downloads)r�pkgs�pkgr�msgrrr�run^s.





zDownloadCommand.runcCsi}x"|D]}|jt|�g�j|�q
Wg}g}xP|j�D]D}dd�|D�}|r`|j|d�q:|jdd�d�|j|d�q:W|r�|jj||jjj�|r�x^|D]V}|j	�}t
jj|jj
jt
jj|��}	t
jj|	�r�t
jj||	�r�q�tj||jj
j�q�Wtdd�||D��}
|
S)z=
        Perform the download for a list of packages
        cSsg|]}|jtjkr|�qSr)r7r8r9)�.0rArrr�
<listcomp>�sz1DownloadCommand._do_downloads.<locals>.<listcomp>rcSs|jj|jjfS)N)ZrepoZpriorityZcost)�xrrr�<lambda>�sz/DownloadCommand._do_downloads.<locals>.<lambda>)�keycSsg|]}|j��qSr)�localPkg)rDrArrrrE�s)�
setdefault�strr�values�sortr&Zdownload_packages�output�progressrIr.�path�joinr*r)�basename�exists�samefile�shutil�copy�sorted)rr@Zpkg_dictrAZto_downloadZcmdlineZpkg_listZpkgs_cmdline�src�dstZ	locationsrrrr?�s.

zDownloadCommand._do_downloadscCs"|jjr|j|�}n
|j|�}|S)zc
        Return a list of dnf.Package objects that represent the rpms
        to download.
        )r
r$�_get_packages_with_deps�
_get_packages)r�	pkg_specsr@rrrr2�s
z"DownloadCommand._get_pkg_objs_rpmscCs*|j|�}|j|�}t|j|dd��}|S)zj
        Return a list of dnf.Package objects that represent the source
        rpms to download.
        T)r%)r2�_get_source_packages�setr[)rr\r@�source_pkgsrrrr4�s

z$DownloadCommand._get_pkg_objs_sourcec	Cs�t�}|jjj�j�}xh|j|�D]Z}xT|j|jgD]D}|j|t	|j
�|j|j|j
d�}|s^q4x|D]}|j|�qdWPq4Wq"W|S)zm
        Return a list of dnf.Package objects that represent the debuginfo
        rpms to download.
        )r;�epoch�version�release�arch)r^r&�sack�query�	availabler[Z
debug_nameZsource_debug_name�filter�intr`rarbrc�add)rr\�dbg_pkgs�qrAZdbg_name�
dbg_available�prrrr5�s 


z'DownloadCommand._get_pkg_objs_debuginfocCsht�}|jjj�j�}xL|j|�D]>}|j|jt|j	�|j
|j|jd�}x|D]}|j
|�qNWq"W|S)zo
        Return a list of dnf.Package objects that represent the debugsource
        rpms to download.
        )r;r`rarbrc)r^r&rdrerfr[rgZdebugsource_namerhr`rarbrcri)rr\rjrkrArlrmrrrr6�s

z)DownloadCommand._get_pkg_objs_debugsourceFcCs�|r
|jn|j}g}x||D]t}y|j||��Wqtjjk
r�}z<tjtjj	|��|j
jjr|tjt
d��tjj|��WYdd}~XqXqWttj|��}|S)z Get packages matching pkg_specs.zExiting due to strict setting.N)�_get_query_source�
_get_queryrr+r=�PackageNotFoundErrorr�errorr,r-r&r*r<rr>�list�	itertools�chain)rr\r%�funcZqueries�pkg_spec�er@rrrr[�s

"zDownloadCommand._get_packagesc	Cs�|j|�}t|�}x�|D]�}tj|jj�}|j|�|j�}|r^|j|j	��|j|j
��qtd�g}tj
dj|dd�|D���tj
tjj|j���tjj��qW|S)z-Get packages matching pkg_specs and the deps.zError in resolve of packages:z
    cSsg|]}t|��qSr)rK)rDrArrrrEsz;DownloadCommand._get_packages_with_deps.<locals>.<listcomp>)r[r^r8ZGoalr&rdZinstallrC�updateZ
list_installsZ
list_upgradesrrrqrQr+�utilZ_format_resolve_problemsZ
problem_rulesr=r>)	rr\r%r@Zpkg_setrAZgoalZrcrBrrrrZ�s



z'DownloadCommand._get_packages_with_depscCszt�}xj|D]b}|jr8|j|j�tjdt|�|j�q|jdkrZ|jd|j|jf�qtj	t
d�t|��qWt|�S)z4Get list of source rpm names for a list of packages.z  --> Package : %s Source : %srXz
%s-%s.src.rpmzNo source rpm defined for %s)r^Z	sourcerpmrir�debugrKrcr;Zevr�inforrr)r@r_rArrrr]s

z$DownloadCommand._get_source_packagescCs�tjjj|�d}|o|dk}|s8|jd�rdtjj|�rd|jj|g|jj	j
d�}|jjj�j
|d�Stjj|�}|j|jj|jjd	�}|j�}|j
d
d�}|jjr�|j|jjd�}t|j��dkr�td
�|}tjj|��|S)z#Return a query to match a pkg_spec.rrr�filerz.rpm)rO)rA)Zwith_srcT)Zlatest_per_arch_by_priority)rczNo package %s available.)rrr|r)r+ZpycompZurlparse�endswithr.rP�isfiler&Zadd_remote_rpmsrNrOrdreZfilterm�subject�SubjectZget_best_queryr
r%rfrrg�lenrCrr=rp)rrvr1Zis_urlr@�subjrkrBrrrroszDownloadCommand._get_querycCsd|dd�}tjj|�}x.|j�D]"}|j|jj�j�}|r"|j�Sq"Wt	d�|}tj
j|��dS)z/Return a query to match a source rpm file name.N�zNo package %s available.���)r+rr�Zget_nevra_possibilitiesZto_queryr&rdrfZlatestrr=rp)rrvr�Z	nevra_objZ	tmp_queryrBrrrrn,sz!DownloadCommand._get_query_source)F)F)�__name__�
__module__�__qualname__�aliasesrZsummaryr	�staticmethodr"r0rCr?r2r4r5r6r[rZr]rorn�
__classcell__rr)rrr%s #!


r)Z
__future__rrZdnfpluginscorerrZdnf.cli.option_parserrr+Zdnf.cliZdnf.exceptionsZdnf.i18nZdnf.subjectZdnf.utilr8rsr.rUZpluginZregister_commandr
ZCommandrrrrr�<module>s

Filemanager

Name Type Size Permission Actions
builddep.cpython-36.opt-1.pyc File 7.27 KB 0644
builddep.cpython-36.pyc File 7.27 KB 0644
changelog.cpython-36.opt-1.pyc File 4.08 KB 0644
changelog.cpython-36.pyc File 4.08 KB 0644
config_manager.cpython-36.opt-1.pyc File 7.09 KB 0644
config_manager.cpython-36.pyc File 7.09 KB 0644
copr.cpython-36.opt-1.pyc File 20.2 KB 0644
copr.cpython-36.pyc File 20.2 KB 0644
debug.cpython-36.opt-1.pyc File 10.56 KB 0644
debug.cpython-36.pyc File 10.56 KB 0644
debuginfo-install.cpython-36.opt-1.pyc File 5.93 KB 0644
debuginfo-install.cpython-36.pyc File 5.93 KB 0644
download.cpython-36.opt-1.pyc File 9.29 KB 0644
download.cpython-36.pyc File 9.29 KB 0644
generate_completion_cache.cpython-36.opt-1.pyc File 3 KB 0644
generate_completion_cache.cpython-36.pyc File 3 KB 0644
groups_manager.cpython-36.opt-1.pyc File 8.45 KB 0644
groups_manager.cpython-36.pyc File 8.45 KB 0644
needs_restarting.cpython-36.opt-1.pyc File 9.88 KB 0644
needs_restarting.cpython-36.pyc File 9.88 KB 0644
repoclosure.cpython-36.opt-1.pyc File 4.31 KB 0644
repoclosure.cpython-36.pyc File 4.31 KB 0644
repodiff.cpython-36.opt-1.pyc File 7.55 KB 0644
repodiff.cpython-36.pyc File 7.55 KB 0644
repograph.cpython-36.opt-1.pyc File 2.72 KB 0644
repograph.cpython-36.pyc File 2.72 KB 0644
repomanage.cpython-36.opt-1.pyc File 6.37 KB 0644
repomanage.cpython-36.pyc File 6.37 KB 0644
reposync.cpython-36.opt-1.pyc File 10.19 KB 0644
reposync.cpython-36.pyc File 10.19 KB 0644
spacewalk.cpython-36.opt-1.pyc File 9.79 KB 0644
spacewalk.cpython-36.pyc File 9.79 KB 0644
system_upgrade.cpython-36.opt-1.pyc File 22.48 KB 0644
system_upgrade.cpython-36.pyc File 22.48 KB 0644
universal_hooks.cpython-36.opt-1.pyc File 5.86 KB 0644
universal_hooks.cpython-36.pyc File 5.86 KB 0644