�
9_f�= � � � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl Z d dl
Z
d dl mZmZ ddl
mZ ddlmZ G d� de� Zy)� N)�PIPE�Popen� )�get_arch)�gettextc � � e Zd ZdZd� Zd� Zd� Zd� Zd� Zd� Z d� Z
d � Zd
� Zd� Z
d� Zd
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d � Z"d!� Z#d"� Z$d#� Z%d$� Z&d%� Z'd&� Z(d?d'�Z)d@d)�Z*d*� Z+d+� Z,d,� Z-dAd-�Z.d.� Z/d/� Z0d0� Z1d1� Z2d2� Z3d3� Z4d4� Z5d5� Z6dBd6�Z7dBd7�Z8dBd8�Z9d9� Z:d:� Z;d;� Z<d<� Z=d=� Z>d>� Z?y()C�DistUpgradeQuirksz�
This class collects the various quirks handlers that can
be hooked into to fix/work around issues that the individual
releases have
c �2 � || _ |j | _ || _ t ddgt d�� j � d j
� | _ t � | _ d| _
d | _ d| _ d | _
d | _ d | _ d| _ y )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�_did_change_font)�selfr r s �?/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeQuirks.py�__init__zDistUpgradeQuirks.__init__/ s� � �$����%�%��
�����G�T�?�4�.2�4�4?�K�M�!�E�EJ�U�W�
�
��J�� � !�����
�$)��!����!������ %��� c � � | j j rt j d� y| j j dd� }| j j dd� }d|z }t
| |d� }|�t j d|z � |� |�|��}t
| |d� }|�t j d|z � |� d|�|��}t
| |d� }|� t j d|z � |� yy) 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 modeN�Sources�To�From�%szquirks: running %s�from_)r �_partialUpgrade�logging�infor �get�getattr�debug)r �
quirksName�
to_release�from_release�funcname�funcs r �runzDistUpgradeQuirks.runB s� � �$ �?�?�*�*��L�L�D�E���[�[�_�_�Y��5�
��{�{���y�&�9�� �*�$���t�X�t�,�����M�M�.��9�:��F� (��4���t�X�t�,�����M�M�.��9�:��F�� #/�
�;���t�X�t�,�����M�M�.��9�:��F� r c �N � t j d� | j � y)z3 run before the apt cache is opened the first time zrunning Quirks.PreCacheOpenN)r' |