MOON
Server: Apache
System: Linux server2.shieldcogroup.com 3.10.0-1160.119.1.el7.tuxcare.els12.x86_64 #1 SMP Fri Nov 8 05:49:38 UTC 2024 x86_64
User: jacom (1029)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //etc/leapp/repos.d/system_upgrade/common/libraries/repomaputils.pyc
�
��ic@sOddlmZddlmZmZmZdefd��YZd�ZdS(i����(tdefaultdict(tPESIDRepositoryEntrytRepoMapEntrytRepositoriesMappingtRepoMapDatacBsSeZdZd�Zd�Zd�Zd�Zd�Zd�Ze	d��Z
RS(s1.2.1cCsg|_i|_dS(N(trepositoriestmapping(tself((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyt__init__s	cCsa|jjtd|dd|dd|jdd�d|dd|dd|dd|��d	S(
s�
        Add new PESIDRepositoryEntry with given pesid from the provided dictionary.

        :param data: A dict containing the data of the added repository. The dictionary structure corresponds
                     to the repositories entries in the repository mapping JSON schema.
        :type data: Dict[str, str]
        :param pesid: PES id of the repository family that the newly added repository belongs to.
        :type pesid: str
        trepoidtchanneltrhuitt	repo_typetarcht
major_versiontpesidN(RtappendRtget(RtdataR((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pytadd_repositorys





cCs)g|jD]}|j|kr
|^q
S(sg
        Return the list of PESIDRepositoryEntry object matching the specified major versions.
        (RR(Rtvalid_major_versionstrepo((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pytget_repositoriesscCs,g|jD]}|j|kr
|j^q
S(sq
        Return the list of repository ID strings for repositories matching the specified major version.
        (RRR	(RRR((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pytget_version_repoids%scCsrdj||�}|jj|tt��}||j|<t|t�r]||j|�n||j|�dS(s
        Add a new mapping entry that is mapping the source pesid to the destination pesid(s),
        relevant in an IPU from the supplied source major version to the supplied target
        major version.

        :param str source_major_version: Specifies the major version of the source system
                                         for which the added mapping applies.
        :param str target_major_version: Specifies the major version of the target system
                                         for which the added mapping applies.
        :param str source_pesid: PESID of the source repository.
        :param Union[str|List[str]] target_pesid: A single target PESID or a list of target
                                                  PESIDs of the added mapping.
        s{}:{}N(	tformatRRRtsett
isinstancetlisttupdatetadd(Rtsource_major_versionttarget_major_versiontsource_pesidttarget_pesidtkeytrmap((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pytadd_mapping+s
c	Cs~dj||�}|jj|d�}|s1dSg}x@t|j��D],}|jtd|dt||���qJW|S(s�
        Return the list of RepoMapEntry objects for the specified upgrade path.

        IOW, the whole mapping for specified IPU.
        s{}:{}tsourcettargetN(RRRtNonetsortedtkeysRR(Rtsrc_major_versiontdst_major_versionR#R$tmap_listt	src_pesid((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pytget_mappingsCs*cCse|dtjkr5tdj|dtj���nt�}t�}xL|dD]@}|j|d�x&|dD]}|j||d�qtWqRWx�|dD]�}x�|dD]�}t|dt�s�tdj|���nxA|d	g|dD]*}||kr�td
j|���q�q�W|j	d|dd|dd
|d	d|d�q�Wq�W|S(Ntversion_formatsOThe obtained repomap data has unsupported version of format. Get {} required {}RRtentriesRR's5The target field of a mapping entry is not a list: {}R&s.The {} pesid is not related to any repository.RR R!R"(
RtVERSION_FORMATt
ValueErrorRRRRRRR%(Rtrepomaptexisting_pesidstrepo_familyRRtentryR((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pytload_from_dictRs6			


(t__name__t
__module__R2RRRRR%R/tstaticmethodR8(((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyRs						cCsVg}g}x.|D]&}|j|j�|j|j�qWtd|d|�}|S(s�
    Combine multiple RepositoryMapping messages into one.
    Needed because we might get more than one message if there are vendors present.
    RR(textendRRR(tmapping_listtcombined_mappingtcombined_repositoriestmsgtcombined_repomapping((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pytcombine_repomap_messages{s
	N(	tcollectionsRtleapp.modelsRRRtobjectRRB(((sX/usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyt<module>sw