
Nc           @   s  d  d l  Z  e  j d d e  d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l Z d  d l Z d  d l Z d  d l m Z m Z m Z m Z m Z m Z m Z m Z d  d l m Z d  d l Z d  d l m Z d  d l m Z d  d l m Z d  d	 l  m! Z! d  d
 l" m# Z# m$ Z$ d  d l% Z% d  d l& Z& e% j' e& _' d  d l& m( Z( m) Z) d  d l* m+ Z+ m, Z, d  d l- m. Z/ d  d l- m0 Z0 d  d l. Z. d  d l m1 Z1 m2 Z2 m3 Z3 d  d l4 m5 Z5 d Z6 d e7 f d     YZ8 d e9 f d     YZ: e; d k rd  d l< m< Z< e	 j= d e	 j>  e<   Z? e: e?  Z@ e@ jA   e@ jB   n  d S(   iNt   ignores   apt API not stable yet(   t   country_mirrort   url_downloadablet   check_and_fix_xbitt   get_archt   iptables_activet   inside_chroott)   get_string_with_no_auth_from_source_entryt   is_child_of_process_name(   t   Template(   t   MyCache(   t   DistUpgradeConfig(   t   DistUpgradeQuirks(   t   AptCdrom(   t	   setupAufst   aufsOptionsAndEnvironmentSetup(   t   SourcesListt	   is_mirror(   t
   get_distrot   NoDistroTemplateException(   t   gettext(   t   ngettext(   t   CacheExceptionDpkgInterruptedt   CacheExceptionLockingFailedt   NotEnoughFreeSpaceError(   t
   run_apports   /var/run/reboot-requiredt   NoBackportsFoundExceptionc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR   M   s   t   DistUpgradeControllerc           B   sv  e  Z d  Z d' d' d  Z e d  Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z e d	  Z d
   Z d   Z d   Z e d' d  Z d   Z d   Z d   Z d   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" e# d   Z$ e# d!  Z% d"   Z& d#   Z' d$   Z( d%   Z) d&   Z* RS((   s3    this is the controller that does most of the work c         C   sH  d } | d  k r6 t j   } t j j | d  } n  | |  _ | |  _ t j d |  t j	 d  t
 j d | j j  | |  _ |  j j t d   d  |  _ |  j s |  j j d  k r t |  _ n |  j j |  _ | r | j } n d  } t | |  |  _ t |  |  _ d |  j j d d  |  _ |  j j d	  |  j j d	 d
 t |  j   t |  j |  j  |  j j d d  |  _  |  j j d d  |  _! |  j j d d  |  _" t#   |  _$ t j% j& d  st
 j d  t' j( j d d  n  t) |  _* t+ |  |  j  |  _, d t j% d <d t j% d <d t j% d <d t j   d t j% d f t j% d <t- d  |  j j. d d  } t' j( j d t |   t' j( j d t d,   t' j( j d! t d-   t' j( j d# d$  t' j( j d% d$  t' j( j d& d'  |  j j/ d( d)  |  _0 |  j j1 d d*  |  _2 d+ |  _3 d  S(.   Ns   /usr/share/locale/t   mos   update-managers   Using '%s' views   Reading cachet   .t   Filest	   BackupExtt   Optionst   withNetworkt   Sourcest   Fromt   Tot   ValidOrigint"   RELEASE_UPGRADE_NO_FORCE_OVERWRITEs   enable dpkg --force-overwrites   DPkg::Options::s   --force-overwritet   1t   RELEASE_UPGRADE_IN_PROGRESSt   PYCENTRAL_NO_DPKG_QUERYt   PYCENTRAL_FORCE_OVERWRITEs   %s:%ss	   /importedt   PATHs   ./imported/invoke-rc.dt   Networkt
   MaxRetriess   Acquire::Retriess   Dpkg::MaxArgsi@   i   s   Dpkg::MaxArgBytesi   s   Acquire::http::Timeoutt   20s   Acquire::ftp::Timeouts   Apt::Get::List-Cleanupt   falset   Distrot   ForcedObsoletest   ValidMirrorsi  i   i   (4   t   Nonet   ost   getcwdt   patht   joint   datadirt   optionsR   t   bindtextdomaint
   textdomaint   loggingt   debugt	   __class__R   t   _viewt   updateStatust   _t   cacheR#   t   Truet
   useNetworkt	   cdromPathR   t   aptcdromR   t   configt   gett   sources_backup_extt   add_sectiont   sett   strR   t   fromDistt   toDistt   originR   t   archt   environt   has_keyt   apt_pkgt   Configt   Falset   _partialUpgradeR   t   quirksR   t   getintt   getlistt   forced_obsoletest   getListFromFilet   valid_mirrorst   _aptCronJobPerms(   t   selft   distUpgradeViewR;   R:   t	   localedirt	   cdrompatht
   maxRetries(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   __init__T   sb    					
c         C   s  t  j d  |  j d  k r/ |  j j d  n |  j j   |  j j   y= t |  j	 |  j
 |  j |  j
 j   |  |  _ |  j |  _ Wn t k
 r} t  j d  d d d g } t j j d  d k r | j d	  n  |  j
 j   j |  t |  j	 |  j
 |  j |  j
 j    |  _ nP t k
 rn} t  j d
 |  |  j
 j t d  t d   t j d  n X|  j |  j _ t  j d t |  j   d  S(   Ns   openCache()t   PreCacheOpens-   dpkg interrupted, calling dpkg --configure -as   /usr/bin/dpkgs   --configures   -at   DEBIAN_FRONTENDt   noninteractives   --force-confolds   Cache can not be locked (%s)s   Unable to get exclusive locks   This usually means that another package management application (like apt-get or aptitude) already running. Please close that application first.i   s   /openCache(), new cache size %i(   R>   R?   RD   R5   RY   t   runt   releaseLockt   unlockListsDirR
   RI   RA   t   getOpCacheProgresst	   apt_cacheR   t   warningR6   RS   RJ   t   appendt   getTerminalt   callR   t   errorRC   t   syst   exitRX   t   partialUpgradet   len(   R`   t   lockt   et   cmd(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt	   openCache   s:    		c         C   s2   |  j  j d d  } |  j j j | k r. t St S(   s   
      Returns True if this view support upgrades over ssh.
      In theory all views should support it, but for savety
      we do only allow text ssh upgrades (see LP: #322482)
      t   Viewt
   SupportSSH(   RI   R[   RA   R@   R   RE   RW   (   R`   t	   supported(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _viewSupportsSSH   s    c      	   C   sj  t  j j d  } t  j j |  rft  j j d  rft d  rf|  j   s t j d  |  j	 j t
 d  t
 d   t j d  t Sd } |  j	 j t
 d	  t
 d
  |  } | t k r t j d  n  t j d d d | d t |  g  } | d k rft
 d  } t
 d  | } t   rMd | } | t
 d  | 7} n  |  j	 j | |  qfn  t S(   s    this will check for server mode and if we run over ssh.
            if this is the case, we will ask and spawn a additional
            daemon (to be sure we have a spare one around in case
            of trouble)
        s"   /var/run/release-upgrader-sshd.pids   /proct   sshds   upgrade over ssh not allloweds.   Upgrading over remote connection not supporteds   You are running the upgrade over a remote ssh connection with a frontend that does not support this. Please try a text mode upgrade with 'do-release-upgrade'.

The upgrade will abort now. Please try without ssh.i   i  s   Continue running under SSH?s  This session appears to be running under ssh. It is not recommended to perform a upgrade over ssh currently because in case of failure it is harder to recover.

If you continue, an additional ssh daemon will be started at port '%s'.
Do you want to continue?s   /usr/sbin/sshds   -os
   PidFile=%ss   -pi    s   Starting additional sshds   To make recovery in case of failure easier, an additional sshd will be started on port '%s'. If anything goes wrong with the running ssh you can still connect to the additional one.
s-   iptables -I INPUT -p tcp --dport %s -j ACCEPTs   If you run a firewall, you may need to temporarily open this port. As this is potentially dangerous it's not done automatically. You can open the port with e.g.:
'%s'(   R6   R8   R9   t   existst   isdirR   R~   R>   Rr   RA   RC   Rs   Rt   RW   t   askYesNoQuestiont
   subprocessRq   RN   R   t   informationRE   (   R`   t   pidfilet   portt   rest   summaryt   descrRy   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt	   _sshMagic   s>    				
	
		
c         C   s  d d l  m } d d l m } t } |  j d k sS |  j d k sS |  j d k r\ t } n  | d t d |  } x' | j r |  j j   t	 j
 d	  qt W| j d k r t j d
  t S|  j j   } | d | j d | d |  j d |  j  } | j   d S(   s    this is a helper that is run if we are started from a CD
            and we have network - we will then try to fetch a update
            of ourself
        i(   t   MetaReleaseCore(   t   DistUpgradeFetcherSelft   dappert   hardyt   lucidt   useDevelopmentReleaset   forceLTSg?s   No new dist foundt   new_distt   progressR;   t   viewN(   t   MetaReleaseR   R   RW   t   releaseRE   t   downloadingRA   t   processEventst   timet   sleepR   R5   R>   Rr   t   getFetchProgressR;   Ri   (   R`   R   R   R   t   mR   t   fetcher(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _tryUpdateSelf  s*    			c         C   s  t  j d  d d l m } m } t j j d  r|   } | j t	 d   y | j
 d d  } Wn# | k
 r t  j d |  t SXy t j d  } Wn% t k
 r } t  j d	 |  t SX| | t j j d
 |  f k rt  j d | | t j j d
 |  f  t Sn  t S(   s    sanity check that /usr/bin/python points to the default
            python version. Users tend to modify this symlink, which
            breaks stuff in obscure ways (Ubuntu #75557).
        s   _pythonSymlinkCheck runi(   t   SafeConfigParsert   NoOptionErrors!   /usr/share/python/debian_defaultst   DEFAULTs   default-versions+   no default version for python found in '%s's   /usr/bin/pythons   os.readlink failed (%s)s   /usr/bins<   python symlink points to: '%s', but expected is '%s' or '%s'(   R>   R?   t   ConfigParserR   R   R6   R8   R   t   readfpt   fileRJ   RW   t   readlinkt   OSErrorRr   R9   RE   (   R`   R   R   RI   t   expected_defaultt   fs_default_versionRx   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _pythonSymlinkCheck;  s&    	!)c      	   C   s/  t  j d d d g d t  j j   d j   |  _ } t j d |  | |  j k pd | |  j	 k s t j
 d | |  j f  |  j j
 t d  t d	 | |  j	 f   t j d
  n  |  j j d d t  rY|  j j d d  } t |  s&t j
 d  |  j j
 t d  t d   t St j d  |  j j t d  t d  |  n  |  j rS|  j j rSt j   d } t j d |  t j d t j | d   t j j | d  rt j j d | d  n  t j j | d  rt j j d | d  n  | d } t j j |  rSt j d |  t j  t j |  qSn  |  j!   |  j"   st j
 d  |  j j
 t d  t d   t j d
  n  y |  j#   Wn% t$ k
 r} t j
 d  |  t SX|  j% j& |  j  st S|  j% j'   |  _( |  j( rd! t j) d" <n d# t j) d" <|  j*   sIt j
 d$  t St j j d%  rt j
 d&  |  j j
 t d'  t d(   |  j+   n  |  j, r+|  j r+|  j j- d/ k r+|  j j/ t d)  t d*  d+  } | |  _0 |  j j d, d- t1 |  j0   t j d. |  | r+|  j2   q+n  t3 S(0   s:    initial cache opening, sanity checking, network checking t   lsb_releases   -cs   -st   stdouti    s   lsb-release: '%s's   Bad upgrade: '%s' != '%s' s   Can not upgrades=   An upgrade from '%s' to '%s' is not supported with this tool.i   t   Aufst   EnableFullOverlayt   RWDirs   aufs setup faileds   Sandbox setup faileds6   It was not possible to create the sandbox environment.s   running in aufs overlay modes   Sandbox modes   This upgrade is running in sandbox (test) mode. All changes are written to '%s' and will be lost on the next reboot.

*No* changes written to a systemdir from now until the next reboot are permanent.s
   /backportss   using backports in '%s' s   have: %ss   /*.udebs   /usr/bin/dpkgs   Dir::Bin::dpkgs   /usr/lib/apt/methodss   Dir::Bin::methodss   /etc/apt/apt.conf.d/01ubuntus   adding config '%s's%   pythonSymlinkCheck() failed, abortingsK   Your python install is corrupted. Please fix the '/usr/bin/python' symlink.s   openCache() failed: '%s't   servert   RELEASE_UPGRADE_MODEt   desktops   checkViewDepends() faileds   /usr/bin/debsig-verifys   debsig-verify is installeds$   Package 'debsig-verify' is installeds   The upgrade can not continue with that package installed.
Please remove it with synaptic or 'apt-get remove debsig-verify' first and run the upgrade again.s)   Include latest updates from the Internet?s  The upgrade system can use the internet to automatically download the latest updates and install them during the upgrade.  If you have a network connection this is highly recommended.

The upgrade will take longer, but when it is complete, your system will be fully up to date.  You can choose not to do this, but you should install the latest updates soon after upgrading.
If you answer 'no' here, the network is not used at all.t   YesR"   R#   s#   useNetwork: '%s' (selected by user)N(4   R   t   Popent   PIPEt   communicatet   stripR   R>   R?   RO   RP   Rr   RA   RC   Rs   Rt   RI   t   getWithDefaultRW   RJ   R   t   infoR   R;   t   havePrerequistsR6   R7   t   globR8   R   RU   RV   RM   t   ReadConfigFileR   R   Rz   t   SystemErrorRD   t   sanityCheckt   needServerModet
   serverModeRS   t   checkViewDependst   abortRH   R#   R5   R   RF   RN   R   RE   (   R`   R   t   aufs_rw_dirt   backportsdirt   confRx   R   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   prepareU  s    #	

	$			c         C   sQ   t  j d |  |  j s+ t  j d  t Sd | j | j f } t | t  j  S(   sf   
        helper that checks if a sources.list entry points to 
        something downloadable
        s   verifySourcesListEntry: %ss'   skiping downloadable check (no network)s   %s/dists/%s/Release(   R>   R?   RF   RE   t   urit   distR   (   R`   t   entryR   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _sourcesListEntryDownloadable  s    	c         C   sd  t  j d  |  j j d d  } |  j j d d t  sI d t j k r_ t  j d  t } n  | t	 k r|  j
 rx]|  j j d d  D]C} | |  j k s|  j | j st |  j | j j  d	 k s|  j | j r t |  j | j j  d
 k r |  j | j j d	 j d k r t  j d |  y* t   } | j |  j  | j d  Wnm t k
 rt  j d  d } | d |  j 7} | d |  j 7} | d |  j 7} t d d  j |  n XPq q Wn  |  j j d d  } |  j g g  | D] } d |  j | f ^ q} |  j g g  | D] } d |  j | f ^ q)}	 t |  _ t }
 i  |  _ x	|  j j D]} | j so| j rqon  | j j d  r| j  |  j k rt  j d |  t	 | _ qon{ | j j d  rLt! j" j# d  } t j$ j% d | t! j& | j  d | j  d f  sot  j d |  t	 | _ qoqon  d |  j } | j r| j j d  r| j  | k r|  j | _  d  g | _' t  j d! |  qon  | j r| j j d" |  j  rt  j d#  t	 | _ qon  | j rd$ | j k rt  j d%  xo d& t(   d' g D]W } t) j) |  } | | _ |  j | _  |  j* |  r,t  j+ d( |  | | _ Pq,q,Wn  t  j d) t, |   |  j- | j  } | s| rt	 } t	 } | j s'| j. d* k s'd+ | j k s'd, |  j | j  k s'd- | j k s'd. | j k r0t } n  | j  |	 k rct  j d/ t, |   |
 | O}
 n | j  | k r|
 | O}
 |	 | j/ | j   | _  t  j d0 t, |   n> | j. d* k rqon) t	 | _ t	 |  _ t  j d1 t, |   | j. d2 k rId3 | j k rI|  j0 d4 k s)|  j0 d5 k rIt  j d6 |  j0  d7 | _ n  x d8 |  j d9 |  j d, |  j g D] } |  j j1 | t2    | j rn| j  | k rn| j. d2 k rnx: | j' D], } | | k rqn  |  j | j3 |  qWqnqnWn  | so| j  |  j k r|  j | _  n  | j4 d: t5 d;  |  j 7_4 t	 | _ t	 |  _ t  j d< t, |   qoqoWx |  j j D] } | j s{| j s{| j. d* k s{| j j d  s{| j  |  j k rq{n  |  j j6 | j   r{|  j |  j |  j | j  } | r\t  j+ d= t, |   | j' j7 t |   t  j+ d> t, |   |  j | j  =q\q{q{W|
 S(?   Ns   rewriteSourcesList()R$   t
   Componentst   AllowThirdPartyt!   RELEASE_UPRADER_ALLOW_THIRD_PARTYs,   mirror check skipped, *overriden* via configR2   t   BaseMetaPkgsi    i   t   nows'   BaseMetaPkg '%s' has no candidateOrigint   mains\   get_distro().enable_component("man") failed, overwriting sources.list instead as last resorts"   # auto generated by update-managers7   deb http://archive.ubuntu.com/ubuntu %s main restricteds?   deb http://archive.ubuntu.com/ubuntu %s-updates main restrictedsA   deb http://security.ubuntu.com/ubuntu %s-security main restricteds   /etc/apt/sources.listt   wt   Pocketss   %s-%ss   cdrom:s,   disabled '%s' cdrom entry (dist == fromDist)s   Dir::State::listss   %s/%s%s_%s_%st   distst   Releases;   disabling cdrom source '%s' because it has no  Release files   %s-commercials   http://archive.canonical.comt   partners    transitioned commercial to '%s' s*   http://landscape.canonical.com/packages/%ss&   commenting landscape.canonical.com outs   old-releases.ubuntu.com/s-   upgrade from old-releases.ubuntu.com detecteds"   http://%sarchive.ubuntu.com/ubuntus    http://archive.ubuntu.com/ubuntus%   transition from old-release.u.c to %ss   examining: '%s's   deb-srcs   /security.ubuntu.coms   %s-securitys   /archive.canonical.coms   /extras.ubuntu.coms%   entry '%s' is already set to new dists   entry '%s' updated to new dists&   entry '%s' was disabled (unknown dist)t   debs   ports.ubuntu.comt   powerpct   sparcs-   moving %s source entry to 'ports.ubuntu.com' s%   http://ports.ubuntu.com/ubuntu-ports/s   %ss
   %s-updatest    s   disabled on upgrade to %ss(   entry '%s' was disabled (unknown mirror)s)   fixing components inconsistency from '%s's   to new entry '%s'(8   R>   R?   RI   R[   R   RW   R6   RS   Rn   RE   RF   RD   t	   candidateRv   t   originst   archiveR   t   get_sourcest   sourcest   enable_componentR   RP   t   opent   writeRO   t   sources_disabledt   found_componentst   listt   invalidt   disabledR   t
   startswithR   RU   RV   t   find_dirR8   R   t   URItoFileNamet   compsR   t   copyR   R   R   t   isMirrort   typet   indexRR   t
   setdefaultRM   t   addt   commentRC   RT   t   extend(   R`   t   mirror_checkt   sync_componentst   pkgnamet   distrot   st   pocketst   xt	   fromDistst   toDistst   foundToDistR   t   listdirt   cdistR   t
   test_entryt   validMirrort   validTot   dt   compt   component_diff(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   rewriteSourcesList  s   	 	$$		$	

	
				
		
" 		!$c         C   s%  t  j d  t d d  |  _ |  j d t  s{t  j d  |  j j t	 d  t	 d  |  j
 |  j f  } | rnt d d  |  _ |  j d t  rx|  j rxt	 d  } t	 d  |  j
 |  j f } |  j j | |  s |  j   n  t  j d	  d
 } d d g } |  j j d | |  j |  |  j j d | |  j d |  |  j j d d |  j d |  qxq{|  j   n  |  j j |  j  |  j j   y t j   } | j   Wn> t k
 rt  j d  |  j j t	 d  t	 d   t SX|  j r!|  j j t	 d  t	 d   n  t S(   Ns   updateSourcesList()t   matcherPathR   R   s   No valid mirror foundsV  While scanning your repository information no mirror entry for the upgrade was found. This can happen if you run a internal mirror or if the mirror information is out of date.

Do you want to rewrite your 'sources.list' file anyway? If you choose 'Yes' here it will update all '%s' to '%s' entries.
If you select 'No' the upgrade will cancel.s   Generate default sources?s   After scanning your 'sources.list' no valid entry for '%s' was found.

Should default entries for '%s' be added? If you select 'No', the upgrade will cancel.s!   generate new default sources.lists    http://archive.ubuntu.com/ubuntuR   t
   restrictedR   s   -updatess"   http://security.ubuntu.com/ubuntu/s	   -securitys<   Repository information invalid after updating (we broke it!)s   Repository information invalids   Upgrading the repository information resulted in a invalid file. Please report this as a bug using the command 'ubuntu-bug update-manager' in a terminal.s   Third party sources disableds   Some third party entries in your sources.list were disabled. You can re-enable them after the upgrade with the 'software-properties' tool or your package manager.(   R>   R?   R   R   R  RE   Rr   RA   R   RC   RO   RP   RW   RF   R   R   R   t   backupRK   t   saveRU   t
   SourceListt   read_main_listR   R   R   (   R`   R   t   primt   seconR   R   t   sourceslist(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   updateSourcesList  sN    			 	c         C   sc  t  j d  g  } g  } g  } g  } g  } x |  j D] } | j rW | j | j  q5 | j rs | j | j  q5 | j r | j | j  q5 | j r | j	 r | j | j  q5 | j r5 | j
 r5 | j | j  q5 q5 Wt  j d d j |   t  j d d j |   t  j d d j |   t  j d d j |   t  j d d j |   d  S(   Ns$   About to apply the following changess   Keep at same version: %sR   s   Upgradable, but held- back: %ss
   Remove: %ss   Install: %ss   Upgrade: %s(   R>   R?   RD   t   marked_installRo   t   namet   marked_upgradet   marked_deletet   is_installedt   is_upgradablet   marked_keepR9   (   R`   t   instt   upt   rmt   heldt   keept   pkg(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _logChanges  s,    	 	 	   c         C   si  t  j d  |  j j d  t |  j j  d k rb t  j d  |  j j |  j	  |  j
   n  t |  j j  d k r |  j j } t d d t |   } t d d t |   d	 j |  } |  j	 j | |  t S|  j j   |  _ |  j j |  j |  j |  j  |  _ |  j r+|  j j |  _ n  t  j d
 d j |  j   t  j d d j |  j   t S(   Nt   doPostInitialUpdatet   PostInitialUpdatei    s-   packages in reqReinstall state, trying to fixs   Package in inconsistent states   Packages in inconsistent states   The package '%s' is in an inconsistent state and needs to be reinstalled, but no archive can be found for it. Please reinstall the package manually or remove it from the system.s   The packages '%s' are in an inconsistent state and need to be reinstalled, but no archive can be found for them. Please reinstall the packages manually or remove them from the system.s   , s   Foreign: %sR   s   Obsolete: %s(   R>   R?   RY   Ri   Rv   RD   t   reqReinstallPkgsRn   t   fixReqReinstRA   Rz   R   R9   Rr   RW   t   _getObsoletesPkgst   obsolete_pkgst   _getForeignPkgsRQ   RO   RP   t   foreign_pkgsR   t   installedTaskst   tasksRE   (   R`   t	   reqreinstt   headerR   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR    s.    $	c         C   s"  t  j d |  |  j s+ t  j d  t S|  j j j   |  j j   } d } | d  k	 re | } n |  j
 j d d  } xe | | k  r y |  j j |  Wn= t t f k
 r } t  j d | | f  | d 7} q} n Xt SWt  j d  | r|  j j t d	  t d
  d |  n  t S(   Ns"   running doUpdate() (showErrors=%s)sB   doUpdate() will not use the network because self.useNetwork==falsei    R.   R/   sH   IOError/SystemError in cache.update(): '%s'. Retrying (currentRetry: %s)i   s   doUpdate() failed completelys   Error during updates   A problem occurred during the update. This is usually some sort of network problem, please check your network connection and retry.s   %s(   R>   R?   RF   RE   RD   t   _listR
  RA   R   R5   RI   RZ   t   updateR   t   IOErrorRr   RC   RW   (   R`   t
   showErrorst   forceRetriesR   t   currentRetryRd   Rx   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   doUpdate-  s0    		
	c         C   s   t  d  } t  d  } |  j j d d t  rA t j d  t S|  j   } y |  j j	 |  WnW t
 k
 r } x@ | j D]5 } |  j j | | | j | j | j | j f  q} Wt SXt S(   s:    this checks if we have enough free space on /var and /usrs   Not enough free disk spaces   The upgrade has aborted. The upgrade needs a total of %s free space on disk '%s'. Please free at least an additional %s of disk space on '%s'. Empty your trash and remove temporary packages of former installations using 'sudo apt-get clean'.t	   FreeSpacet	   SkipChecks,   free space check skipped via config override(   RC   RI   R   RW   R>   Rn   RE   t    _is_apt_btrfs_snapshot_supportedRD   t   checkFreeSpaceR   t   free_space_required_listRA   Rr   t
   size_totalt   dirt   size_needed(   R`   t   err_sumt   err_longt   with_snapshotsRx   t   required(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _checkFreeSpaceN  s     c         C   si  |  j  j t d   |  j j |  j  |  j |  j  s; t S|  j r` |  j j |  j	  s` t Sn  |  j j
   } |  j  j   |  j   |  j  j   |  j   s t S|  j  j   |  j j   |  _ t |  j  d k r.|  j j   t j d d j g  |  j D] } | j ^ q   t j d |  j  n  |  j  j   |  j  j t d  | |  j |  j j  } | S(   Ns   Calculating the changesi    s   demoted: '%s'R   s   found components: %ss!   Do you want to start the upgrade?(   RA   RB   RC   RD   t   distUpgradeR   RX   RW   t   installTasksR&  t   get_changesR   R  R<  t   get_installed_demoted_packagest   installed_demotionsRv   t   sortR>   R?   R9   R  R   t   confirmChangest   requiredDownload(   R`   t   changesR   R   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   askDistUpgradem  s0    !	
3c         C   sC   t  j j d  r? t j d t |  j   t  j d d  n  d  S(   Ns   /etc/cron.daily/apts   disabling apt cron job (%s)i  (   R6   R8   R   R>   R?   t   octR_   t   chmod(   R`   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _disableAptCronJob  s    c         C   s9   t  j j d  r5 t j d  t  j d |  j  n  d  S(   Ns   /etc/cron.daily/apts   enabling apt cron job(   R6   R8   R   R>   R?   RH  R_   (   R`   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _enableAptCronJob  s    c   
      C   s  |  j    d } |  j j   } |  j j d d d   } | r y! t j   d j d  d } Wn t	 j
 d  d } n X|  j j   j d | | f  n  |  j j d d	  } t } x | | k  rmy; t j |  j j  } t j |  } |  j j | |  Wnc t j j k
 r2}	 t	 j d
  t } Pn7 t k
 rh}	 t	 j d |	 | f  | d 7} q n Xt SW| r|  j j t d  t d   n3 t	 j d  |  j j t d  t d  d |	  |  j   |  j   d  S(   Ni    R2   t   SlideshowUrlRC   t   getdefaultlocalet   ens   %s#locale=%sR.   R/   s   user canceleds:   IOError in cache.commit(): '%s'. Retrying (currentTry: %s)i   s   Upgrade canceledsw   The upgrade will cancel now and the original system state will be restored. You can resume the upgrade at a later time.s+   giving up on fetching after maximum retriess   Could not download the upgradess   The upgrade has aborted. Please check your Internet connection or installation media and try again. All files downloaded so far have been kept.s   %s(   RI  RA   R   RI   R   R5   t   localeRL  t   splitR>   t	   exceptiont   getHtmlViewR   RZ   RW   RU   t   PackageManagerRD   t	   _depcachet   Acquiret   _fetch_archivest   aptt   FetchCancelledExceptionR   RE   R+  Rr   R   RC   RJ  R   (
   R`   R.  t	   fprogresst   urlt   langRd   t   user_canceledt   pmR   Rx   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   doDistUpgradeFetching  sH    
!
#
	
s   /etc/default/apportc         C   s   t  j d d d d g  d S(   s    enable apport t   servicet   apportt   starts   force_start=1N(   R   Rq   (   R`   t   fname(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   enableApport  s    c         C   sn   y d d l  } Wn t k
 r$ d SXy | j   } | j   } Wn t j d  t SXt j d |  | S(   s'    check if apt-btrfs-snapshot is usable iNs   failed to check btrfs supports!   apt btrfs snapshots supported: %s(   t   apt_btrfs_snapshott   ImportErrort   AptBtrfsSnapshott   snapshots_supportedR>   RP  RW   R?   (   R`   Rc  t	   apt_btrfsR   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR2    s    c         C   s_   |  j    s d Sd d l } | j   } d |  j } | j |  } t j d | | f  d S(   s2    create btrfs snapshot (if btrfs layout is there) Nis   release-upgrade-%s-s#   creating snapshot '%s' (success=%s)(   R2  Rc  Re  RP   t   create_btrfs_root_snapshotR>   R   (   R`   Rc  Rg  t   prefixR   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt    _maybe_create_apt_btrfs_snapshot  s    c   
      C   sk  |  j  j d d t  r% |  j   n  d } |  j j   } |  j j |  j  } |  j  j d d  } |  j	 s |  j
 j d  |  j   n  x| | k  r)y |  j j | |  Wnht k
 rV} t j d |  t j j d  rt d  j   } t j d	 |  d
 d g } x | D] } t |  j |  rt j d  |  j   t d  } | d t |  7} | t d  7} |  j j t d  |  |  j   qqWn  t d  } |  j	 st   s| t d |  7} qn  |  j j t d  |  d d d g }	 t j j d  d k r2|	 j d  n  |  j j    j! |	  |  j   t St" k
 r} t j d | | f  | d 7} q n t# k
 r} t j$ d  | j% d k r|  j   t d  } | d t |  7} | t d  7} |  j j t d  |  |  j   qn X|  j   t& SWt j d  |  j j t d  t d  d  |  |  j   d  S(!   NR2   t   EnableApporti    R.   R/   t   StartUpgrades#   SystemError from cache.commit(): %ss%   /var/run/update-manager-apt-exceptions   found exception: '%s's;   E:Internal Error, Could not perform immediate configurations    E:Couldn't configure pre-depend s-   detected preconfigure error, restorting states   Error during commits   
'%s'
s   Restoring original system states   Could not install the upgradessr   The upgrade has aborted. Your system could be in an unusable state. A recovery will run now (dpkg --configure -a).s   

Please report this bug using the command 'ubuntu-bug update-manager' in a terminal and include the files in /var/log/dist-upgrade/ in the bug report.
%st   dpkgs   --configures   -aRg   Rh   s   --force-confolds:   IOError in cache.commit(): '%s'. Retrying (currentTry: %s)i   s   cache.commit()i   s+   giving up on fetching after maximum retriess   Could not download the upgradessd   The upgrade has aborted. Please check your Internet connection or installation media and try again. s   %s('   RI   R   RW   Rb  RA   R   t   getInstallProgressRD   RZ   RX   RY   Ri   Rj  t   commitR   R>   Rr   R6   R8   R   R   t   readRN   R   R?   RJ  RC   R   R   RS   RJ   Ro   Rp   Rq   R+  R   RP  t   errnoRE   (
   R`   R.  RX  t	   iprogressRd   Rx   t   pre_configure_errorst   preconf_errort   msgRy   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   doDistUpgrade   sx    		
			



	c         C   s\  |  j    |  j j d  |  j j   } |  j j |  j |  j |  j  } t	 j
 d d j |   t	 j
 d d j |   xG |  j j d d  D]0 } | | k r t	 j d |  t   } Pq q W|  j j d d t  s t	 j
 d	  t Sxa |  j j d d
  D]J } |  j j |  r|  j | j r|  j j |  j j | d   qqW|  j j |  j j    t	 j
 d |  j  |  j r| |  j } n% t g  |  j D] } | j ^ q } | t |  j  O} |  j j   } t	 j
 d d j |   | t |  O} |  j j d d t  s<t	 j
 d  t   } n  t	 j
 d |  t	 j
 d  |  j j   } x t |  D]z \ } }	 | j | t  t! |   d  |	 |  j" k rv|  j j#   |  j j$ |	 | |  j"  st	 j
 d |	  qqvqvWt	 j
 d  | j%   |  j j&   }
 t	 j
 d d j g  |
 D] } | j ^ q0  t' d  } t' d  t' d  g } t! |
  d k r2|  j j( | |
 g  d | t)  r2|  j j*   } |  j j+ |  j  } y |  j j, | |  Wq2t- t. f k
 r.} t	 j d |  |  j j t' d  t' d  d |  q2Xn  |  j j d  |  j/ sX|  j0   n  t S(   Nt   PostUpgrades   Obsolete: %sR   s   Foreign: %sR2   R   sX   the BaseMetaPkg '%s' is in the obsolete list, something is wrong, ignoring the obsoletest   RemoveObsoletess   Skipping obsolete Removalt   MetaPkgsR3   s   forced_obsoletes: %ss   Unused dependencies: %ss0   Skipping RemoveObsoletes as stated in the configs   remove_candidates: '%s's    Start checking for obsolete pkgsg      Y@s:   '%s' scheduled for remove but not safe to remove, skippings!   Finish checking for obsolete pkgss1   The following packages are marked for removal: %ss   Remove obsolete packages?t   _Keept   _Removei    s,   cache.commit() in doPostUpgrade() failed: %ss   Error during commits[   A problem occurred during the clean-up. Please see the below message for more information. s   %st   PostCleanup(1   Rz   RY   Ri   RD   R!  R#  RQ   RO   RP   R>   R?   R9   RI   R[   Rr   RM   R   RE   RT   R  R\   R   t   identifyObsoleteKernelsRF   R"  RA  R  t   _getUnusedDependenciesRA   Rl   t	   enumerateR*  t   floatRv   R$  R   t   tryMarkObsoleteForRemovalt   doneR?  RC   RC  RW   R   Rn  Ro  R   R+  RX   t   runPostInstallScripts(   R`   t   now_obsoletet   now_foreignR  t   remove_candidatest   pt   unused_dependenciesR   t   iR   RE  R   t   actionsRX  Rr  Rx   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   doPostUpgrade]  sv    
!	"&	%!
0!		c         C   s   x |  j  j d d  D] } t j j |  sE t j d |  q n  t j d |  y- t |  |  j	 j
   j | g d t Wq t k
 r } t j d | | f  q Xq Wd S(   s}    
        scripts that are run in any case after the distupgrade finished 
        whether or not it was successfull
        R2   t   PostInstallScriptss!   PostInstallScript: '%s' not founds   Running PostInstallScript: '%s't   hiddens(   got error from PostInstallScript %s (%s)N(   RI   R[   R6   R8   R   R>   Rn   R?   R   RA   Rp   Rq   RE   t	   ExceptionRr   (   R`   t   scriptRx   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR    s    
#c         C   s   t  j d  t |  d  r2 |  j j |  j  n  t |  d  rW |  j j |  j  n  |  j j	 t
 d   |  j j   |  j   t j d  d S(   s2    abort the upgrade, cleanup (as much as possible) s   abort calledR   RH   s   Restoring original system statei   N(   R>   R?   t   hasattrR   t   restore_backupRK   RH   t   restoreBackupRA   RB   RC   R   Rz   Rs   Rt   (   R`   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR     s    
c   	      C   s   x t  j |  D] } t j d |  x | D] } | d } | d } | d } |  j j |  sy t j d |  t S|  j | } | j } | d k r. t  j
 | | |  t k r. t Sq. Wq Wt j d |  t S(   s+    check if a given depends can be satisfied s   checking: '%s' i    i   i   s   _checkDep: '%s' not in caches   depends '%s' is not satisfiedN(   RU   t   ParseDependsR>   R?   RD   RT   Rr   RW   t   installedVersionR5   t   CheckDepRE   (	   R`   t   depstrt   or_groupt   dept   depnamet   vert   operR  t   instver(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt	   _checkDep  s     


	c         C   s   t  j d  t } |  j j d d  } | j |  j j |  j j j d   xj | D]b } t  j d |  | |  j	 |  M} | sT |  j j
 t d  t d |   t j d  qT qT W| S(   s     check if depends are satisfied s   checkViewDepends()R{   t   Dependss   depends: '%s's!   Required depends is not installeds/   The required dependency '%s' is not installed. i   (   R>   R?   RE   RI   R[   R   RA   R@   R   R  Rr   RC   Rs   Rt   (   R`   R   t   dependsR  (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR     s    
c         C   s#  |  j  j d d  } d } t j j d d  } |  j  j d d  } x | | k  r |  j d t  |  j   x= | D]5 } |  j	 j
 |  su t j d	 |  t |  qu qu W|  j |  r Pn  t j d
  t j j d d  | d 7} qH W| | k rt j d  t St j j d |  t S(   Nt   PreRequistst   Packagesi    s   Acquire::http::No-CacheR1   R.   R/   R,  s   Can not find backport '%s's>   setting a cache control header to turn off caching temporarilyt   truei   s+   pre-requists item is NOT trusted, giving up(   RI   R[   RU   RV   t   findRZ   R/  RW   Rz   RD   RT   R>   Rr   R   t   _allBackportsAuthenticatedR?   RM   RE   (   R`   t   backportslistR  t   noCacheRd   R   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _verifyBackports  s*    
c         C   s   t  j j d t  t k r, t j d  t Sy# |  j j d d  } | rN t SWn t	 j
 k
 re n XxP | D]H } |  j | } | j s t Sx% | j j D] } | j r Pq q Wt Sqm Wt S(   Ns   APT::Get::AllowUnauthenticatedsI   skip authentication check because of APT::Get::AllowUnauthenticated==trueR2   t   AllowUnauthenticated(   RU   RV   t   find_bRW   RE   R>   Rn   RI   t
   getbooleanR   R   RD   R   R   t   trusted(   R`   R  t   bR   R  t   cand(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR     s$    		c         C   s   | j  d  } xj |  j D]_ } | j  d  } t | |  rA t S| j d  d } | j |  r t j d |  t Sq Wt S(   s     check if uri is a known mirror t   /s   //i   s)   found apt-cacher/apt-torrent style uri %s(	   t   rstripR^   R   RE   RO  t   endswithR>   R?   RW   (   R`   R   t   mirrort   mirror_host_part(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR   6  s    c         C   s   d } t  d d  } x | j D] } | j s | j r= q n  | j d k r |  j | j  r | j j d  r | j j d  r d | j |  j f } | | k r | | 7} q n  | r | j d k r d | j	 k r | d | j |  j f 7} q q W| S(	   s7    get sources.list snippet lines for the current mirror t    R  R   R   s   http://security.ubuntu.coms   http://archive.ubuntu.coms*   deb %s %s-backports main/debian-installer
R   (
   R   R   R   R   R   R   R   R   RO   R   (   R`   t   dumbt   linesR   R   t   new_line(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _getPreReqMirrorLinesF  s     !c         C   s   t  j d |  t | d  } |  j |  } xP t |  D]B } t |  } | j d |  } | j |  t  j d |  q< W| j   t S(   s9    add prerequists based on template into the path outfile s*   writing prerequists sources.list at: '%s' R   R  s   adding '%s' prerequists(	   R>   R?   R   R  R	   t   safe_substituteR   t   closeRE   (   R`   t   templatet   outR  t   outfilet   mirrorlinest   linet   outline(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   _addPreRequistsSourcesListY  s    
c         C   s  t  j d  t } t j j t j   d  } t j j |  sP t j |  n  |  j	 j
 d d  } |  j rd|  j rdt  j d  t j j |  j j d t j j d   } t   } xh t j | d  D]S } t  j d	 | | f  | j t j j |  j d
  d  t j | |  q Wt |  | k sWt  j d t |  | f  t S|  j |  Sd } |  j	 j d | d |  j  r| d |  j } n  |  j	 j d |  } t j j |  st  j d |  t St j j t j j d  |  }	 t j j t j j d  |  }
 |  j | |
  y |  j    Wn_ t! k
 r} |  j | |
 d t y |  j    Wn$ t! k
 r} t  j" d |  n Xt SXt j j d  } t j   } t j j t j j | d   st j t j j | d   n  t j# |  t j j d |  x | D] } |  j$ | } |  j$ j% j& | j'  } | stt  j d |  t j( |	  t S| j) d k rt  j d |  t j( |	  t St  j d |  | j+ d t  q!Wt j, |  j- j.    } t j/ |  j$ j%  } y t } |  j$ j0 | |  Wn* t1 k
 r@} t  j d |  t } n X| t k r]t  j" d  n  t j( |	  t j j d |  t j# |  |  j |  S(   s5    download the backports specified in DistUpgrade.cfg s   getRequiredBackports()t	   backportsR  R  s#   Searching for pre-requists on CDROMs*   dists/stable/main/dist-upgrader/binary-%s/s   APT::Architectures   *_*.udebs   copying pre-req '%s' to '%s'RC   i    s%   Expected backports: '%s' but got '%s'R   s   -%ss   sourceslist not found '%s's   Dir::Etc::sourcepartsR  s   no backport for '%s' founds   Dir::Cache::archivest   partials   No candidate for '%s's   No ver.FileList for '%s's   marking '%s' for installt   auto_fixs   _fetchArchives returned '%s's+   _fetchArchives for backports returned FalseN(2   R>   R?   RE   R6   R8   R9   R7   R   t   mkdirRI   R[   RH   RF   Rc   RU   RV   R  RM   R   R   t   basenameRO  t   shutilR   Rr   RW   t   setupRequiredBackportst
   has_optionRR   RJ   R   R  R  R   Rn   t   chdirRD   RS  t   GetCandidateVert   _pkgt   unlinkt   FileListR5   t   mark_installt
   GetAcquireRA   R   t   GetPackageManagert   _fetchArchivesR+  (   R`   R   R   R  R  t
   found_pkgst   udebt   conf_optiont   prereq_templatet   outpathR  Rx   t   cachedirt   cwdR   R  R  R   R\  (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   getRequiredBackportsh  s    	& !!!
c         C   sT  t  j  | d  s$ t j d  t SxO t  j  | d  D]: } t j d |  t j d | | f  d k r8 t Sq8 W| d t j d <| d t j	 d t j	 d	 f t j d
 <d | d t j d f t j d <t j
   t j d d  t j d g } |  j r| j d  n | j d  t t j d  t j t j d | t j  d S(   s,    setup the required backports in a evil way s   /*.udebs.   no backports found in setupRequiredBackports()s   extracting udeb '%s' s   dpkg-deb -x %s %si    s   /usr/libt   LD_LIBRARY_PATHs#   /usr/lib/python%s.%s/site-packages/i   t
   PYTHONPATHs   %s:%ss   /usr/binR-   s   /var/log/dist-upgrade/main.logs&   /var/log/dist-upgrade/main_pre_req.logs   --have-prerequistss   --with-networks   --without-networkN(   R   R>   Rr   RW   R?   R6   t   systemRS   Rs   t   version_infot   shutdownR  R   t   argvRF   Ro   R   t   execve(   R`   R   R   t   args(    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR    s(    )

		c      	   C   s#  |  j  j t d   |  j  j t j  |  j   sq t j d  |  j  j t d  t d   t	 j
 d  n  |  j j d  r |  j r |  j j t k r t j d  |  j   s |  j  j t d  t d	   |  j   q n  |  j d
 t d d  |  j   |  j   s|  j   n  |  j  j t j  |  j  j t d   |  j   sa|  j   n  |  j r|  j j |  j  r|  j  j t d  t d   t	 j
 d  n  |  j   s|  j   n  |  j  j t d   |  j   |  j j   |  _ |  j j   x |  j j  d d  D]t } |  j j! |  sP|  j j" |  j |  rt j d |  |  j  j t d  t d  |  |  j   qqW|  j  j t d   |  j#   s|  j   n  |  j  j t j$  |  j  j t d   |  j%   s|  j   n  |  j  j t j&  |  j  j t d   |  j'   st|  j(   |  j  j) t d  t d   t	 j
 d  n  |  j  j t j*  |  j  j t d   |  j+   |  j r|  j j,   n  |  j  j t j-  |  j  j t d   t.   r|  j  j/   rt0 j1 d  t	 j
 d  n  t2 S(   Ns   Checking package managers   self.prepared() faileds   Preparing the upgrade faileds   Preparing the system for the upgrade failed. Please report this using the command 'ubuntu-bug update-manager' in a terminal and include the files in /var/log/dist-upgrade/ in the bug report.i   R  s   need backportss$   Getting upgrade prerequisites faileds  The system was unable to get the prerequisites for the upgrade. The upgrade will abort now and restore the original system state.

Please report this as a bug using the command 'ubuntu-bug update-manager' in a terminal and include the files in /var/log/dist-upgrade/ in the bug report.R,  R-  s   Updating repository informations   Failed to add the cdroms+   Sorry, adding the cdrom was not successful.R2   R   s@   No '%s' available/downloadable after sources.list rewrite+updates   Invalid package informations  After your package information was updated the essential package '%s' can not be found anymore.
This indicates a serious error, please report this bug using the command 'ubuntu-bug update-manager' in a terminal and include the files in /var/log/dist-upgrade/ in the bug report.s   Calculating the changest   Fetchingt	   Upgradings   Upgrade completesK   The upgrade has completed but there were errors during the upgrade process.s   Searching for obsolete softwares   System upgrade is complete.s   /sbin/rebooti    (3   RA   RB   RC   t   setStept   DistUpgradeViewt   STEP_PREPARER   R>   Rr   Rs   Rt   RI   t   has_sectionR;   R   RW   R?   R  R   R/  Rz   R  t   STEP_MODIFY_SOURCESR  RH   R   RK   RD   R   R   RY   t+   ensure_recommends_are_installed_on_desktopsR[   RT   t   anyVersionDownloadableRF  t
   STEP_FETCHR]  t   STEP_INSTALLRv  R  R   t   STEP_CLEANUPR  t   comment_out_cdrom_entryt   STEP_REBOOTR   t   confirmRestartR   R   RE   (   R`   R  (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   fullUpgrade  s    	
	
	

	
c         C   s   |  j  j   |  j   S(   N(   RA   R   R  (   R`   (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyRi     s    c         C   s  d d l  m } m } m } m } m } m } |  j j |  |  j j	 |  |  j j	 |  t
 |  _ |  j   |  j   s t S|  j   s t S|  j j |  |  j j t d   |  j   s t S|  j j |  |  j j t d   |  j   s|  j j t d  t d   t S|  j j |  |  j   s[|  j j t d  t d   t St j j t  r|  j j   rt j d  qn |  j j t d  t d   t
 S(	   s,    partial upgrade mode, useful for repairing i(   R  R  R  R  R  R  R  R  s   Upgrade completesK   The upgrade has completed but there were errors during the upgrade process.s   /sbin/reboots"   The partial upgrade was completed.(   t   DistUpgrade.DistUpgradeViewR  R  R  R  R  R  RA   R  t   hideStepRE   RX   R   R  RW   RF  RB   RC   R]  Rv  R   R  R6   R8   R   t   REBOOT_REQUIRED_FILER  R   R   (   R`   R  R  R  R  R  R  (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   doPartialUpgrade  s>    .	
N(+   R   R   t   __doc__R5   Re   RE   Rz   R~   R   R   R   R   R   R  R  R  R  R/  R<  RF  RI  RJ  R]  Rb  R2  Rj  Rv  R  R  R   R  R   R  R  R   RW   R  R  R  R  R  Ri   R  (    (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyR   Q   sL   \'		;			p		P		%!		'			C		
	]	b								o			t   __main__(   t   DistUpgradeViewTextt   level(C   t   warningst   filterwarningst   FutureWarningRV  RU   Rs   R6   R   RN  R>   R  R   R   R   R   t   utilsR   R   R   R   R   R   R   R   t   stringR	   R  t   DistUpgradeCacheR
   t   DistUpgradeConfigParserR   R   t   DistUpgradeAptCdromR   t   DistUpgradeAufsR   R   t   distinfoR  t   DistInfoR   R   R   R   R   t   DistUpgradeGettextR   RC   R   R   R   R   t   DistUpgradeApportR   R  R  R   t   objectR   R   R  t   basicConfigt   DEBUGt   vt   dcRI  RJ  (    (    (    sE   /usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeController.pyt   <module>   s^   :      k	
