File: //etc/leapp/repos.d/system_upgrade/common/libraries/repomaputils.pyc
�
��ic @ sO d d l m Z d d l m Z m Z m Z d e f d � � YZ d � Z d S( i����( t defaultdict( t PESIDRepositoryEntryt RepoMapEntryt RepositoriesMappingt RepoMapDatac B sS e Z d Z d � Z d � Z d � Z d � Z d � Z d � Z e d � � Z
RS( s 1.2.1c C s g | _ i | _ d S( N( t repositoriest mapping( t self( ( sX /usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyt __init__ s c C sa | j j t d | d d | d d | j d d � d | d d | d d | d d | � � 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
t repoidt channelt rhuit t repo_typet archt
major_versiont pesidN( R t appendR t get( R t dataR ( ( sX /usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyt add_repository s
c C s) g | j D] } | j | k r
| ^ q
S( sg
Return the list of PESIDRepositoryEntry object matching the specified major versions.
( R R ( R t valid_major_versionst repo( ( sX /usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyt get_repositories s c C s, g | j D] } | j | k r
| j ^ q
S( sq
Return the list of repository ID strings for repositories matching the specified major version.
( R R R ( R R R ( ( sX /usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyt get_version_repoids% s c C sr d j | | � } | j j | t t � � } | | j | <t | t � r] | | j | � n | | j | � d S( 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( t formatR R R t sett
isinstancet listt updatet add( R t source_major_versiont target_major_versiont source_pesidt target_pesidt keyt rmap( ( sX /usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyt add_mapping+ s
c C s~ d j | | � } | j j | d � } | s1 d Sg } x@ t | j � � D], } | j t d | d t | | � � � qJ W| S( s�
Return the list of RepoMapEntry objects for the specified upgrade path.
IOW, the whole mapping for specified IPU.
s {}:{}t sourcet targetN( R R R t Nonet sortedt keysR R ( R t src_major_versiont dst_major_versionR# R$ t map_listt src_pesid( ( sX /usr/share/leapp-repository/repositories/system_upgrade/common/libraries/repomaputils.pyt get_mappingsC s *c C se | d t j k r5 t d j | d t j � � � n t � } t � } xL | d D]@ } | j | d � x&