Mini Shell

Direktori : /usr/lib64/python3.6/site-packages/pyanaconda/payload/__pycache__/
Upload File :
Current File : //usr/lib64/python3.6/site-packages/pyanaconda/payload/__pycache__/image.cpython-36.opt-1.pyc

3

C��e� �@sddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZmZddlmZddlmZddlmZddlmZmZdd	lmZdd
lmZddlmZddl m!Z!e!e"�Z#ej$j%�Z&ddd�Z'dd�Z(dd�Z)dd�Z*dd�Z+dd�Z,dd�Z-dd�Z.dS)�N)�Size)�isys)�errorHandler�ERROR_RAISE�InvalidImageSizeError�MissingImageError)�DEVICE_TREE)�STORAGE)�MountFilesystemError)�
DeviceData�DeviceFormatData)�utils)�InstallTreeMetadata)�DiscInfo)�get_module_logger�/mnt/install/cdimagec#Csytj|�Wntk
r"dSXt}tjj|d�}tjj|�rh|jd�rhtjj|�g}tjj	|�}n
tj
|�}�x�|D�]�}tjj||�}tjd|�t
j|�s�qztjd||�ytjj||ddd�Wntk
r�wzYnXtj|tj��stjj|�qztjd	�t�}y|j|�|j}Wn2tk
�rX}	ztjd
|	�wzWYdd}	~	XnXtjd|�||k�r�tjd||�tjj|�qzt|��s�tjd
|�tjj|�qztj|�tjd�r�tjd|�td|�}
tj|
�tk�r�|
�tj d|�tjj|�|SWdS)a�Find the first iso image in path.

    :param str path: path to the directory with iso image(s); this also supports pointing to
        a specific .iso image
    :param str mount_path: path for mounting the ISO when checking it is valid

    FIXME once payloads are modularized:
      - this should move somewhere else
      - mount_path should lose the legacy default

    :return: basename of the image - file name without path
    :rtype: str or None
    Nz	.discinfoz.isozChecking %szMounting %s on %s�iso9660�ro)�fstype�optionszReading .discinfoz".discinfo file can't be loaded: %sz
discArch = %sz8Architectures mismatch in find_first_iso_image: %s != %sz*%s doesn't have a valid repodata, skippingiz%s appears to be corruptedz$size is not a multiple of 2048 byteszFound disc at %s)!�os�stat�OSError�_arch�path�join�isfile�endswith�basename�dirname�listdir�log�debugrZ
isIsoImage�blivet�util�mount�access�R_OKZumountr�load�arch�	Exception�warning�_check_repodata�ST_SIZErr�cbr�info)r�
mount_pathr)Z
discinfo_path�files�fnZwhatZ	disc_infoZ	disc_archZex�exn�r4�/usr/lib64/python3.6/image.py�find_first_iso_image/sd







r6cCsbt�}|j|�stjd�|j�}|s6|j�}t|�}|sHtjd�dS|j�rTdStjd�dS)Nz!Can't read install tree metadata!z'There is no usable repository availableFTz'There is no valid repository available.)	rZ	load_filer!r+Zget_base_repo_metadataZget_metadata_repos�#_search_for_install_root_repositoryr"Zis_valid)r0Zinstall_tree_metaZrepo_mdZrepo_mdsr4r4r5r,�s



r,cCs x|D]}|jdkr|SqWdS)N�.)Z
relative_path)ZreposZrepor4r4r5r7�s

r7cCs�x�tjj|�r|}n@t|�}|dkr@t�}tj|�tkr|�nqtjjd||f�}yt	j
j||ddd�Wn0tk
r�t�}tj|�tkr�|�nwYqXPqWdS)Nz%s/%srr)rr)
rrrr6rrr.r�normpathr#r$r%r)ZisodirZtreeZimager3r4r4r5�
mountImage�s$r:cCs�tjt�}x~|j�D]r}tj�}zVytj||�Wntk
rHwYnXzddl	m
}||�sbwWdtj||�XWdtj
|�X|SWdS)z�Find a device with a valid optical install media.

    Return the first device containing a valid optical install
    media for this product.

    FIXME: This is duplicated in SetUpCdromSourceTask.run

    :return: a device name or None
    r)�is_valid_install_diskN)r	�	get_proxyrZFindOpticalMedia�tempfileZmkdtemp�
payload_utilsZmount_devicer
Z(pyanaconda.modules.payloads.source.utilsr;Zunmount_devicer�rmdir)�device_treeZdevZ
mountpointr;r4r4r5�find_optical_install_media�s 

rAcCstjt�}|j�S)z�Find potential HDISO sources.

    Return a generator yielding Device instances that may have HDISO install
    media somewhere. Candidate devices are simply any that we can mount.

    :return: a list of device names
    )r	r<rZFindMountablePartitions)r@r4r4r5�find_potential_hdiso_sources�s
rBcCsztj|j|��}tj|j|��}tj|j|jd��}|jjdd�jdd�|j	t
|j�|j|jjd�pt|jjd�ptdd�S)	z�Get info about a potential HDISO source.

    :param device_tree: a proxy of a device tree
    :param device_name: a device name
    :return: a dictionary with a device info
    r�model��_� �labelZuuid)rCr�size�formatrG)
rZfrom_structureZ
GetDeviceDatarZ
GetFormatData�parentsZattrs�get�replacerrrH�description)r@Zdevice_nameZdevice_dataZformat_dataZ	disk_datar4r4r5�get_hdiso_source_info�srNcCsdjf|�S)z�Get a description of a potential HDISO source.

    :param device_info: a dictionary with a device info
    :return: a string with a device description
    z({model} {path} ({size}) {format} {label})rI)Zdevice_infor4r4r5�get_hdiso_source_descriptionsrO)r)/rZos.pathrr=Zblivet.utilr#Zblivet.archZblivet.sizerZ
pyanacondarZpyanaconda.errorsrrrrZ+pyanaconda.modules.common.constants.objectsrZ,pyanaconda.modules.common.constants.servicesr	Z(pyanaconda.modules.common.errors.storager
Z,pyanaconda.modules.common.structures.storagerrZpyanaconda.payloadr
r>Z(pyanaconda.payload.install_tree_metadatarZproductmd.discinforZpyanaconda.anaconda_loggersr�__name__r!r)Zget_archrr6r,r7r:rArBrNrOr4r4r4r5�<module>s4

T"