File: //lib/python3/dist-packages/DistUpgrade/__pycache__/DistUpgradeQuirks.cpython-38.pyc
U
٪zc�� � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlm Z m
Z
ddlmZ ddl
mZ G dd� de�ZdS )� N)�PIPE�Popen� )�get_arch)�gettextc @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zd8d9� Zd:d;� Z d<d=� Z!d>d?� Z"d@dA� Z#dadCdD�Z$dbdFdG�Z%dHdI� Z&dJdK� Z'dLdM� Z(dcdOdP�Z)dQdR� Z*dSdT� Z+dUdV� Z,dWdX� Z-dYdZ� Z.d[d\� Z/d]d^� Z0d_d`� Z1dES )d�DistUpgradeQuirksz�
This class collects the various quirks handlers that can
be hooked into to fix/work around issues that the individual
releases have
c C sd || _ |j| _|| _tddgtdd��� d �� | _t� | _ d| _
d | _d| _d | _
d | _d | _d S )N�unamez-rT��stdout�universal_newlinesr F)�
controller�_view�configr r �communicate�stripr r �arch�extra_snap_space�_poke�_snapstore_reachable�
_snap_list�
_from_version�_to_version)�selfr r � r �?/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeQuirks.py�__init__- s
��
zDistUpgradeQuirks.__init__c C s� | j jrt�d� dS | j�dd�}| j�dd�}d| }t| |d�}|dk rbt�d| � |� d||f }t| |d�}|dk r�t�d| � |� d ||f }t| |d�}|dk r�t�d| � |� dS )
a�
Run the specific quirks handler, the follow handlers are supported:
- PreCacheOpen: run *before* the apt cache is opened the first time
to set options that affect the cache
- PostInitialUpdate: run *before* the sources.list is rewritten but
after an initial apt-get update
- PreDistUpgradeCache: run *right before* the dist-upgrade is
calculated in the cache
- PostDistUpgradeCache: run *after* the dist-upgrade was calculated
in the cache
- StartUpgrade: before the first package gets installed (but the
download is finished)
- PostUpgrade: run *after* the upgrade is finished successfully and
packages got installed
- PostCleanup: run *after* the cleanup (orphaned etc) is finished
z)not running quirks in partialUpgrade modeNZSourcesZToZFrom�%szquirks: running %sz%s%sz from_%s%s)r Z_partialUpgrade�logging�infor �get�getattr�debug)r Z
quirksNameZ
to_releaseZfrom_release�funcname�funcr r r �run? s(
zDistUpgradeQuirks.runc C s t �d� dS )z3 run before the apt cache is opened the first time zrunning Quirks.PreCacheOpenN)r r! �r r r r �PreCacheOpenm s zDistUpgradeQuirks.PreCacheOpenc C sf t �d� | �� | �� | jj}| �|� d|krBt �d� dS |d jrT| �� | j rb| �
� dS )z2 run after the apt cache is opened the first time z%running Quirks.focalPostInitialUpdate�snapd�'package required for Quirk not in cacheN)r r! �_get_from_and_to_version�_test_and_fail_on_i386r �cache�_test_and_warn_if_ros_installed�is_installed�_checkStoreConnectivityr �_calculateSnapSizeRequirements�r r+ r r r �focalPostInitialUpdater s
z(DistUpgradeQuirks.focalPostInitialUpdatec C sD t �d� | jj}d|kr(t �d� d S |d jr@| jr@| �� d S )Nzrunning Quirks.focalPostUpgrader'