MOON
Server: Apache
System: Linux s5.yayogua.com.py 6.12.0-124.55.3.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:54:02 EDT 2026 x86_64
User: w3com (1005)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //usr/lib/python3.12/site-packages/dnf-plugins/__pycache__/reposync.cpython-312.pyc
�

�}/i3=���ddlmZddlmZddlZddlZddlZddlZddlmZm	Z	ddl
mZddlZddl
Zd�ZGd�dejj �Zej$j&Gd	�d
ej(j*��Zy)�)�absolute_import)�unicode_literalsN)�_�logger)�OptionParserc���tjjtj��}tj
j
tj
j|||��S�N)�dnf�i18n�ucd�os�getcwd�path�realpath�join)�intermediate�target�cwds   �9/usr/lib/python3.12/site-packages/dnf-plugins/reposync.py�_pkgdirr#s@��

�(�(�,�,�r�y�y�{�
#�C�
�7�7���B�G�G�L�L��l�F�C�D�D�c�(��eZdZ�fd�Z�fd�Z�xZS)�RPMPayloadLocationc�v��tt|�||�tjj|�|_yr	)�superr�__init__r
r�dirname�package_dir)�self�pkg�progress�pkg_location�	__class__s    �rrzRPMPayloadLocation.__init__)s*���
� �$�0��h�?��7�7�?�?�<�8��rc���tt|��}tjj|j�|j|d<|S)N�dest)rr�_target_paramsr
�util�
ensure_dirr)r�tpr#s  �rr&z!RPMPayloadLocation._target_params-s?���
�%�t�
;�
=�������D�,�,�-��%�%��6�
��	r)�__name__�
__module__�__qualname__rr&�
__classcell__�r#s@rrr(s���9��rrc���eZdZdZed�Z�fd�Zed��Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�Z�xZS)�RepoSyncCommand)�reposyncz&download all packages from remote repoc�,��tt|�|�yr	)rr0r)r�clir#s  �rrzRepoSyncCommand.__init__9s���
�o�t�-�c�2rc�4�|jdddgtjdtd���|jddd	td
���|jddd	td
���|jdddd	td���|jdddd	td���|jdtd���|jdddd	td���|jddd	td���|jdddtd�� �|jd!dd	td"���|jd#dd	td$���|jd%d&dd	td'���|jd(dtd)�� �y)*Nz-az--arch�archesz[arch]z$download only packages for this ARCH)r%�default�action�metavar�helpz--deleteF�
store_truez5delete local packages no longer present in repository)r6r7r9z--download-metadatazdownload all the metadata.z-gz
--gpgcheckzBRemove packages that fail GPG signature checking after downloadingz-mz--downloadcompsz&also download and uncompress comps.xmlz--metadata-pathzXwhere to store downloaded repository metadata. Defaults to the value of --download-path.)r9z-nz
--newest-onlyz&download only newest packages per-repoz--norepopathz,Don't add the reponame to the download path.z-pz--download-pathz./z&where to store downloaded repositories)r6r9z
--remote-timezCtry to set local timestamps of local files by the one on the serverz--sourcezdownload only source packagesz-uz--urlsz:Just list urls of what would be downloaded, don't downloadz--safe-write-pathzOFilesystem path that is considered safe for writing. Defaults to download path.)�add_argumentr�_SplitCallbackr)�parsers r�
set_argparserzRepoSyncCommand.set_argparser<s������D�(��2�#/�#>�#>��!"�#I�!J�	�	L�	���J��l�!"�#Z�![�	�	]����1�5��!"�#?�!@�	�	B����D�,��l�!"�$7�"8�	�	9�	���D�"3�U�<�!"�#K�!L�	�	N����-�!"�$O�"P�	�	Q�	���D�/�5��!"�#K�!L�	�	N����N�E�,�!"�#Q�!R�	�	T����D�"3�T�!"�#K�!L�	�	N����O�U�<�!"�$;�"<�	�	=�	���J��l�!"�#B�!C�	�	E����D�(�E�,�!"�$4�"5�	�	6�	���/��!"�#t�!u�	�	wrc�J�|jj}d|_d|_|jj
}|jjrO|j�j�|jjD]}	||}|j��|jjr|j�|jj �Bt"j$j'|jj �|j_t)t+|j-���dkDr||jj.r(tjjt1d���|jj �(tjjt1d���|j-�D]#}|j2j5�d|_�%y#t$r#tjjd|z��wxYw)NTzUnknown repo: '%s'.�z1Can't use --norepopath with multiple repositoriesz6Can't use --safe-write-path with multiple repositoriesF)r3�demands�available_repos�sack_activation�base�repos�opts�repo�all�disable�KeyErrorr
�CliError�enable�source�enable_source_repos�safe_write_pathr
rr�len�list�iter_enabled�
norepopathr�_repo�expire�deltarpm)rrArE�repoidrGs     r�	configurezRepoSyncCommand.configure^s����(�(�"�"��"&���"&����	�	�����9�9�>�>��I�I�K���!��)�)�.�.��K� ��=�D����
�)��9�9����%�%�'��9�9�$�$�0�(*���(8�(8����9R�9R�(S�D�I�I�%��t�E�&�&�(�)�*�Q�.��y�y�#�#��g�g�&�&��I�J�L�L����*�*�6��g�g�&�&��N�O�Q�Q��&�&�(�D��J�J����!�D�M�)��% �K��'�'�*�*�+@�6�+I�J�J�K�s�	G6�6,H"c	��d|jj_d}|jjj	�D�]�}|j
jr|jjd�|j
jr�|j
jre|jj�D]G\}}|j|�}|rt|��%td�|z}tj |��In|j|�|j
j"r�|j
jr�t%|jj��}dD�cgc]}||vr||��
}}|rY|D]"}	|j|	�}|s�t|�n3td�}tj |�n|j'|�|j)|�}
|j
jr|j+|
�n�|j-|
�|j
j.r�|
D]�}|j1|�}t3j4|fd�|�|_|jj9|�\}
}|
dk7s�Vtj td�j;t<j>jA|�|��t=jB|�d}��|j
jDs���|jG||
����|s(tHjJjMtd	���ycc}w)
NTz%Failed to get mirror for metadata: %s)�group�group_gz�group_gz_zckz(Failed to get mirror for the group file.c��|Sr	�)�s�
local_paths  r�<lambda>z%RepoSyncCommand.run.<locals>.<lambda>�s��ZrrzRemoving {}: {}FzGPG signature check failed.)'rD�conf�	keepcacherErRrF�remote_timerT�setPreserveRemoteTime�download_metadata�urls�getMetadataLocations�remote_location�printrr�warning�
downloadcomps�dict�getcomps�get_pkglist�
print_urls�download_packages�gpgcheck�pkg_download_path�types�
MethodType�localPkg�package_signature_check�formatr
r�basename�unlink�delete�delete_old_local_packagesr
�
exceptions�Error)r�gpgcheck_okrG�md_type�md_location�url�msg�mdl�group_locations�group_location�pkglistr r`�result�errors               r�runzRepoSyncCommand.run�s���#'��	�	��� ����I�I�O�O�0�0�2�D��y�y�$�$��
�
�0�0��6��y�y�*�*��9�9�>�>�04�
�
�0O�0O�0Q�,���"�2�2�;�?���!�#�J�"#�$K�"L�w�"V�C�"�N�N�3�/�
1R��*�*�4�0��y�y�&�&��9�9�>�>��t�z�z�>�>�@�A�C�6[�':�6[�7�*1�S�.�(+�7�|�6[�$�':�'�.=�N�"&�"6�"6�~�"F�C�"� %�c�
� %�	/>�#$�$N�"O�C�"�N�N�3�/��M�M�$�'��&�&�t�,�G��y�y�~�~�����(��&�&�w�/��9�9�%�%�&��%)�%;�%;�C�%@�
�).�(8�(8�1;�G��)N���(,�	�	�(I�(I�#�(N�
���!�Q�;�"�N�N�1�->�+?�+F�+F� "��� 0� 0�� <�e�,E�F��I�I�j�1�*/�K� '��y�y����.�.�t�W�=�g3�h��.�.�&�&�q�)F�'G�H�H���G':s�,M
c��t|jjxs|jj|jjs|j
�Sd�S)N�)rrF�destdir�
download_pathrS�id�rrGs  r�repo_targetzRepoSyncCommand.repo_target�sN���t�y�y�(�(�C�D�I�I�,C�,C�&*�i�i�&:�&:�t�w�w�D�	D�@B�D�	Drc��|jjr*t|jj|j�S|j	|�Sr	)rF�
metadata_pathrr�r�r�s  r�metadata_targetzRepoSyncCommand.metadata_target�s;���9�9�"�"��4�9�9�2�2�D�G�G�<�<��#�#�D�)�)rc��|j|j�}tjj	tjj||j��}tjj|jjxs|d�}|j|�sNtjjtd�j||j|j|���|S)Nr�z^Download target '{0}' for location '{1}' of '{2}' package is outside of safe write path '{3}'.)r�rGr
rrr�locationrFrO�
startswithr
r}r~rrx�name)rr r�rsrOs     rrsz!RepoSyncCommand.pkg_download_path�s����&�&�s�x�x�0���G�G�,�,��G�G�L�L��c�l�l�3�5���'�'�,�,�t�y�y�'@�'@�'O�K�QS�T�� �+�+�O�<��.�.�&�&��9�:�:@�&�%�s�|�|�S�X�X��;P�Q�
Q�!� rc�
��t�fd�|D��}tj�j|��D]�\}}}|D]�}tjj||�}|j
d�s�5tjj|�s�U||vs�Z	tj|�tjtd�|�����y#t$r"tjtd�|�Y��wxYw)Nc3�@�K�|]}�j|����y�wr	)rs)�.0r rs  �r�	<genexpr>z<RepoSyncCommand.delete_old_local_packages.<locals>.<genexpr>�s�����N�g�s�t�5�5�c�:�g�s�z.rpmz[DELETED] %szfailed to delete file %s)�setr
�walkr�rr�endswith�isfilerzr�infor�OSErrorr�)	rrGr��downloaded_files�dirpath�dirnames�	filenames�filenamers	`        rr|z)RepoSyncCommand.delete_old_local_packages�s�����N�g�N�N��,.�G�G�D�4D�4D�T�4J�,K�(�G�X�y�%���w�w�|�|�G�X�6���$�$�V�,�������1E��#3�3�N��I�I�d�O�"�K�K��.�(9�4�@�&�-L�� '�N�"�L�L��+E�)F��M�N�s�4C�(D�Dc��|jj�}|r�|j|�}tjj|�tjj|d�}tjjj||��tjtd�|j�yy)Nz	comps.xml)r%z!comps.xml for repository %s saved)rT�
getCompsFnr�r
r'r(r
rr�yum�misc�
decompressrr�rr�)rrG�comps_fn�	dest_pathr%s     rrnzRepoSyncCommand.getcomps�s����:�:�(�(�*����,�,�T�2�I��H�H���	�*��7�7�<�<�	�;�7�D��G�G�L�L�#�#�H�4�#�8��K�K��=�>����H�rc�\�|j|�}|jj|�y)NT)r�rT�downloadMetadata)rrGr�s   rrfz!RepoSyncCommand.download_metadata�s'���*�*�4�0���
�
�#�#�K�0�rc�^�tjjs|j�S|j	�|jj
j
�}t�}i}i}|D]�}|j�}|j|�|j|j�i�j|j�g�j|�|D]O}|j|i�j|j�g�j|j���Q��|j|j|����j�}	t�}
|j�D�]\}}t�}
|
j!t#|j%�d��d�t�}|j'�D](}|D]!}|j|j���#�*|j|��j�D]3}dj)|�}|
j!t+|||���5|
D]+}||D]!}|
j|j���#�-��|	j-|j|
���}	|	S)a\
        return union of these queries:
        - the latest NEVRAs from non-modular packages
        - all packages from stream version with the latest package NEVRA
          (this should not be needed but the latest package NEVRAs might be
          part of an older module version)
        - all packages from the latest stream version
        )�nevra_strict)�pkg__neqT)�reverserz3{0.name}-{0.epoch}:{0.version}-{0.release}.{0.arch})r
rD�WITH_MODULES�latest�apply�_moduleContainer�getModulePackagesr��getArtifacts�update�
setdefault�
getNameStream�
getVersionNum�append�filter�items�add�sorted�keys�valuesrx�max�union)r�query�module_packages�
all_artifacts�module_dict�artifact_version�module_package�	artifacts�artifact�latest_query�latest_stream_artifacts�
namestream�version_dict�versions�stream_artifacts�modules�module�
latest_pkg�nevra�versions                    r�_get_latestzRepoSyncCommand._get_latest�sP���x�x�$�$��<�<�>�!�
���
��)�)�4�4�F�F�H����
�����-�N�&�3�3�5�I�� � ��+��"�"�>�#?�#?�#A�2�F�Q�Q��,�,�.��
4�4:�F�>�4J�%�� �+�+�H�b�9�D�D�"�0�0�2�B�8�8>��~�?[�?[�?]�8^�&�.��|�|��\�\�}�\�=�$�?�?E�v�x�	�
#&�%��(3�(9�(9�(;�$�J���u�H��L�L��� 1� 1� 3�T�B�1�E�F�"�u��'�.�.�0��%�F�$�+�+�F�,?�,?�,A�B�&�1�$�l�l�8H�l�I�P�P�R�
�M�T�T�U_�`�����S�!1�%�!8��!D�E�F�	S�$��*�7�3�F�+�2�2�6�3F�3F�3H�I�4�$�#)<�($�)�)�%�,�,�D[�,�*\�]���rc�l�|jjjtj��j�j
|j��}|jjr|j|�}|jjr|j
d��n<|jjr&|j
|jj��g}t�}|D]:}|j|�}||vs�|j|�|j!|��<|S)N��flags)�reponame�src)�arch)rD�sackr��hawkey�IGNORE_MODULAR_EXCLUDES�	available�filtermr�rF�newest_onlyr�rMr5r�rsr�r�)rrGr�r��
seen_pathsr r�s       rrozRepoSyncCommand.get_pkglist+s����	�	���$�$�6�+I�+I�$�J�T�T�V�^�^��W�W�_����9�9� � ��$�$�U�+�E��9�9����M�M�u�M�%�
�Y�Y�
�
��M�M�t�y�y�/�/�M�0����U�
��C� �2�2�3�7�M��J�.����s�#����}�-�	�
�rc
��|j}|jj}|�tjj�}tjj|jjtj��j�|d�}|D�cgc]}t|||j|���� }}|j|||dd�ycc}w)Nr�rF)rD�outputr!r
�callback�NullDownloadProgress�drpm�	DeltaInfor�r�r�r��	installedrrs�_download_remote_payloads)rr�rDr!r�r �payloadss       rrqz!RepoSyncCommand.download_packages>s����y�y���;�;�'�'�����|�|�8�8�:�H��x�x�!�!�$�)�)�/�/��8V�8V�/�"W�"a�"a�"c�"*�A�/�� '�(�&��'�s�H�d�6L�6L�S�6Q�R�&�	�(��&�&�x��x��u�M��(s�#Cc��|D]M}|j�}|rt|��!td�|jz}t	j
|��Oy)Nz$Failed to get mirror for package: %s)rirjrr�rrk)rr�r r�r�s     rrpzRepoSyncCommand.print_urlsIsD���C��%�%�'�C���c�
��>�?�#�(�(�J�����s�#�
r)r*r+r,�aliasesr�summaryr�staticmethodr>rXr�r�r�rsr|rnrfr�rorqrpr-r.s@rr0r04ss����G��8�9�G�3��w��w�B "�D8I�tD�*�!�"
N�I��
7�r�&	N�$rr0)�
__future__rrr�r
�shutilrt�dnfpluginscorerr�dnf.cli.option_parserrr
�dnf.clirrG�
RPMPayloadr�plugin�register_commandr3�Commandr0r^rr�<module>r�sq��*'�'�
�	�
��$�.�
��E�
	����,�,�	������[$�c�g�g�o�o�[$��[$r