+
    j                     Z   ^ RI t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIHtHt ^RIHt ^RIHt ^RIHt  ! R R]4      t ! R R	]4      t ! R
 R]4      t ! R R]4      tR t]! 4       w  tt ! R R]4      t ! R R]4      t ! R R] P>                  4      t R# )    N)PopenPIPE)gettext)ngettext)inside_chrootc                       ] tR t^(tRtR# )CacheException N__name__
__module____qualname____firstlineno____static_attributes__r
       >/usr/lib/python3/dist-packages/DistUpgrade/DistUpgradeCache.pyr	   r	   (       r   r	   c                       ] tR t^,tRtR# )CacheExceptionLockingFailedr
   Nr   r
   r   r   r   r   ,   r   r   r   c                       ] tR t^0tRtR# )CacheExceptionDpkgInterruptedr
   Nr   r
   r   r   r   r   0   r   r   r   c                   2   a a ] tR t^4t oV 3R ltRtVtV ;t# )PackageRemovalDeniedExceptionc                :  < Wn         \        R 4      P                  V P                   4      p\        P                  ! R4      P                  V P                   4      '       d,   V\        R4      P                  V P                   4      ,          p\        SV `  V4       R# )zHThe package {} is marked for removal but it is in the removal deny list.z^postgresql-[0-9]*$z

To prevent data loss, postgresql packages are not removed automatically during the upgrade. If you are certain you no longer need {}, you can manually remove it and try the upgrade again.N)package_formatrecompilematchsuper__init__)selfr   msg	__class__s   && r   r"   &PackageRemovalDeniedException.__init__5   s    2
 &
 	 ::,-33DLLAA1-
 fT\\"#C 	r   )r   )r   r   r   r   r"   r   __classdictcell____classcell__)r%   __classdict__s   @@r   r   r   4   s      r   r   c                    ^ p ^ p\         P                  ! 4       ^,          p\        P                  ! RV,          4       F  pVRV,          8X  d)   V\         P                  P	                  V4      ,          pK9  VP                  R4      ^ 8  g-   VP                  R4      ^ 8  g   VP                  R4      ^ 8  d   K}  V \         P                  P	                  V4      ,          p K  	  V ^ 8X  d   \        P                  ! R4       R	p V^ 8X  d   \        P                  ! R4       R
pV R,          p RpVR,          V8  d
   VR,          pW,          pW3# )zbestimate the amount of space used by the kernel and initramfs in /boot,
including a safety margin
z
/boot/*%s*z/boot/initrd.img-%sz
initrd.imgz.bakz.dpkg-z>estimate_kernel_initrd_size_in_boot() returned '0' for kernel?z>estimate_kernel_initrd_size_in_boot() returned '0' for initrd?g?i   i  
i   )osunameglobpathgetsizefindloggingwarning)kernelinitrdkverfinitrd_buffers        r   #estimate_kernel_initrd_size_in_bootr8   I   s    FF88:a=DYY|d*+%,,bggooa((F ff\"a'166&>Q+>!Q&bggooa((F , {L	N{L	N
kFM}}$
F=r   c                   0   a  ] tR t^mt o RtR tR tRtV tR# )FreeSpaceRequiredzFreeSpaceRequired object:

This exposes:
- the total size required (size_total)
- the dir that requires the space (dir)
- the additional space that is needed (size_needed)
c                *    Wn         W n        W0n        R # N)
size_totaldirsize_needed)r#   r=   r>   r?   s   &&&&r   r"   FreeSpaceRequired.__init__u   s    $&r   c                Z    R V P                   : RV P                  : RV P                  : 2# )zFreeSpaceRequired Object: Dir: z size_total: z size_needed: )r>   r=   r?   r#   s   &r   __str__FreeSpaceRequired.__str__y   s1    UYU]U]_c_n_npt  qA  qA  B  	Br   )r>   r?   r=   N)	r   r   r   r   __doc__r"   rC   r   r'   r)   s   @r   r:   r:   m   s     'B Br   r:   c                   *   a  ] tR t^}t o RtR tRtV tR# )NotEnoughFreeSpaceErrorzA
Exception if there is not enough free space for this operation

c                    Wn         R # r<   free_space_required_list)r#   rK   s   &&r   r"    NotEnoughFreeSpaceError.__init__   s    (@%r   rJ   Nr   r   r   r   rE   r"   r   r'   rF   s   @r   rH   rH   }   s     A Ar   rH   c                     a  ] tR t^t o ^t^tR5R lt]R 4       tR t	R t
R tR tR t]R	 4       t]R
 4       t]R 4       t]R 4       tR tR tR6R ltR tR tR tR7R ltR tR tR tR tR tR tR8R ltR8R lt R8R lt!R8R lt"R t#R t$R  t%R! t&R" t'R# t(R$ t)]R% 4       t*R& t+R' t,]R( 4       t-R) t.R* t/R+ t0R, t1R- t2]R. 4       t3R/ t4R0 t5R1 t6R2 t7R9R3 lt8R4t9V t:R# ):MyCacheNc                ,   . V n         . V n        W n        W0n        R V n        R V n        Wn        V P                  P                  RR4      V n        W`n	        Wpn
        RV n        V'       d.    \        P                  ! 4        V P                  4        RV n        \&        P(                  P+                  W4       VP-                  RR4      V n        V P                  P1                  V R 4      V n        \5        RR.\6        RR	7      P9                  4       ^ ,          P;                  4       V n        V P?                  4        \        P                  PA                  R
R4       R#   \         d,   pR\!        T4      9   d   \#        T4      h\%        T4      hRp?ii ; i)FDistroMetaPkgsTzdpkg --configure -aNRemovalDenylistFiler,   z-r)stdoutuniversal_newlinesz"APT::AutoRemove::SuggestsImportantfalse)!
to_install	to_removeviewquirkslockpartialUpgradeconfiggetlistmetapkgs	from_distto_dist
_listsLockapt_pkgpkgsystem_locklock_lists_dirSystemErrorstrr   r   aptCacher"   getListFromFileremoval_denylist_get_linux_metapackagelinux_metapackager   r   communicatestripr,   _initAptLogset)	r#   r^   rZ   r[   progressr\   ra   rb   es	   &&&&&&&& r   r"   MyCache.__init__   sH    		#++HjA"5&&(##% 	 			4* & 6 6xAV W!%!C!CD%!PGT?4.244?KM!EEJUW 	
?I  5(CF27::1!44	5s   ,,E F(&FFc                Z   \        4       pV  F  pVP                  '       d   VP                  P                  '       d   K3  VP                  P                  V P
                  8X  g(   VP                  P                  V P                  8X  g   K  VP                  VP                  4       K  	  V# )zAreturn the packages not downloadable packages in reqreinst state )	rr   	candidatedownloadable_pkg
inst_state	ReInstReqHoldReInstReqaddname)r#   	reqreinstpkgs   &  r   req_reinstall_pkgsMyCache.req_reinstall_pkgs   ss     E	C]]]#--*D*D*D$$6$$(:(::chh'  r   c                   V P                   p\        V4      ^ 8  d   \        RR\        V4      4      p\        RR\        V4      4      RP                  V4      ,          pVP	                  W44      '       dV   V P                  4        . RO\        V4      ,           pVP                  4       P                  V4       V P                  4        R# R# )	z.check for reqreinst state and offer to fix it zRemove package in bad statezRemove packages in bad statezThe package '%s' is in an inconsistent state and needs to be reinstalled, but no archive can be found for it. Do you want to remove this package now to continue?zThe packages '%s' are in an inconsistent state and need to be reinstalled, but no archives can be found for them. Do you want to remove these packages now to continue?, TF)z/usr/bin/dpkgz--removez--force-remove-reinstreq)
r   lenr   joinaskYesNoQuestionrelease_locklistgetTerminalcallget_lock)r#   rZ   r   headersummarycmds   &&    r   fix_req_reinstMyCache.fix_req_reinst   s    ++	y>A;<!)n.F   2
 +
  #9~
/ 2691E
FG $$V55!!#ORVW`Raa  "'',r   c                   V P                   P                  RRR4      p\        P                  P	                  V4      '       g   \        P
                  ! V4       \        P                   P                  RV4       \        P                   P                  RR4       \        P                  ! \        P                  P                  VR4      \        P                  \        P                  ,          \        P                  ,          R4      V n        \        P                  P                  4       pR	V,          p\        P                   ! V P                  VP#                  R
4      4       \        P                   P                  RR4       \        P                   P                  RR4       \        P                   P                  RR4       R# )zinit logging, create log fileFilesLogDirz/var/log/dist-upgradezDir::LogzDir::Log::Terminalzapt-term.logzapt.logi  zLog time: %s
zutf-8zDebug::pkgProblemResolvertruezDebug::pkgDepCache::MarkerzDebug::pkgDepCache::AutoInstallN)r^   getWithDefaultr+   r.   existsmakedirsrd   rr   openr   O_RDWRO_CREATO_APPENDlogfddatetimenowwriteencode)r#   logdirr   r   s   &   r   rq   MyCache._initAptLog   s   ++GX,CEww~~f%%KK:v./@WWRWW\\&)<YY3bkkA5J
##%!C'
V]]734 	6?7@<fEr   c                   \        V R 4      '       dA   \        P                  ! V P                  4       \        P                  ! V P                  4       \        P
                  ! ^4      V n        \        P
                  ! ^4      V n        \        P                  ! V P                  ^4       \        P                  ! V P                  ^4       R# )
old_stdoutN)hasattrr+   closer   
old_stderrdupdup2r   rB   s   &r   _startAptResolverLogMyCache._startAptResolverLog   sq    4&&HHT__%HHT__%&&)&&)


A


Ar   c                    \         P                  ! ^4       \         P                  ! ^4       \         P                  ! V P                  ^4       \         P                  ! V P                  ^4       R# )   N)r+   fsyncr   r   r   rB   s   &r   _stopAptResolverLogMyCache._stopAptResolverLog   s<    


#
#r   c                   a  V 3R lpV# )z2decorator to ensure that the apt output is logged c                  t   < V ^ ,          P                  4        S! V / VB pV ^ ,          P                  4        V# )r   )r   r   )argskwargsresr6   s   *, r   wrapper(MyCache.withResolverLog.<locals>.wrapper   s7    G((*T$V$CG'')Jr   r
   )r6   r   s   f r   withResolverLogMyCache.withResolverLog   s    	
 r   c                    \         P                  ! V P                  4      p\         P                  ! 4       pVP	                  W P
                  V P                  4       VP                  # )z;get the size of the packages that are required to download )rd   PackageManager	_depcacheAcquireget_archives_list_recordsfetch_needed)r#   pmfetchers   &  r   required_downloadMyCache.required_download  sF     ##DNN3//#
T]];###r   c                .    V P                   P                  # )z8get the size of the additional required space on the fs )r   usr_sizerB   s   &r   additional_required_space!MyCache.additional_required_space  s     ~~&&&r   c                T     V P                   P                  #   \         d     ^ # i ; i)z;get the extra size needed to install the snap replacements )r[   extra_snap_spaceAttributeErrorrB   s   &r   #additional_required_space_for_snaps+MyCache.additional_required_space_for_snaps  s+    
	 ;;/// 		s    ''c                4    V P                   P                  ^ 8  # )zis the cache broken )r   broken_countrB   s   &r   	is_brokenMyCache.is_broken!  s     ~~**Q..r   c                    \         P                  P                  R 4      R,           p\         P                  ! V4      V n        V P                  ^ 8  d   RV,          p\        V4      hR# )zDir::State::Listsr\   zCan not lock '%s' N)rd   r^   find_dirr   rc   r   )r#   r~   rt   s   &  r   rf   MyCache.lock_lists_dir'  sT    ~~&&':;fD!**40??Q$t+A-a00 r   c                z    V P                   ^ 8  d*   \        P                  ! V P                   4       RV n         R# R# )r   NrW   )rc   r+   r   rB   s   &r   unlock_lists_dirMyCache.unlock_lists_dir-  s*    ??QHHT__% DO r   c                   V P                  4        \        P                  P                  W4      pV P	                  4        V'       d'   VP
                  '       d   \        \        R4      4      hVR8X  d   \        R4      hR# )zN
our own update implementation is required because we keep the lists
dir lock
zThe server may be overloadedFzAapt.cache.update() returned False, but did not raise exception?!?N)r   ri   rj   updaterf   release_file_download_errorIOErrorr   )r#   	fprogressr   s   && r   r   MyCache.update1  si    
 	iit/>>> !:;<<%<]^^ r   c                    \         P                  ! R 4       V P                  '       d   V P                  4        \        P
                  P                  WV4       R# )zcache.commit()N)r1   infor\   r   ri   rj   commit)r#   r   	iprogresss   &&&r   r   MyCache.commit@  s8    %&999		)4r   c                    V P                   '       d     \        P                  ! 4        R V n         R# R#   \         d)   p\        P
                  ! RT,          4        Rp?R# Rp?ii ; i)Fzfailed to SystemUnLock() (%s) N)r\   rd   pkgsystem_unlockrg   r1   debugr#   rt   s   & r   r   MyCache.release_lockF  sR    999D((*!	   D>BCCD   4 A'A""A'c                    V P                   '       g     \        P                  ! 4        R V n         R# R#   \         d)   p\        P
                  ! RT,          4        Rp?R# Rp?ii ; i)Tzfailed to SystemLock() (%s) N)r\   rd   re   rg   r1   r   r   s   & r   r   MyCache.get_lockN  sR    yyyB&&( 	   B<q@AABr   c                   V'       d'   V P                   P                  VP                  4      pMVP                  P                  pVR8X  d,   \        P
                  ! RVP                  : RV: R24       R# VP                  # )z)check if the given pkg can be downloaded Nzno version information for 'z' (useCandidate=)F)r   get_candidate_verry   current_verr1   r2   r~   rx   )r#   r   useCandidatevers   &&& r   rx   MyCache.downloadableV  s[    ..22388<C((&&C$;OOSVS[S[]ijkr   c                6    V P                   P                  4       # )zQtry to fix broken dependencies on the system, may throw
SystemError when it can't)r   
fix_brokenrB   s   &r   r   MyCache.fix_brokena  s     ~~((**r   c                T   . V n         . V n        V P                  4        F  pVP                  '       g   VP                  '       d&   V P                   P                  VP                  4       VP                  '       g   K`  V P                  P                  VP                  4       K  	  R# )z)create a snapshot of the current changes N)rX   rY   get_changesmarked_installmarked_upgradeappendr~   marked_delete)r#   r   s   & r   create_snapshotMyCache.create_snapshotf  sr    ##%C!!!S%7%7%7&&sxx0   %%chh/	 &r   c                :    V P                   P                  4        R # r<   )r   initrB   s   &r   clearMyCache.clearp  s    r   c                   \         P                  ! V P                  4      pV V P                  4        V P                   F  pW,          pVP                  4        K  	  V P                   F  pW,          pVP                  RRR7       K   	  R# )zrestore a snapshot F)auto_fix	auto_instN)rd   ActionGroupr   r  rY   mark_deleterX   mark_install)r#   actiongroupr~   r   s   &   r   restore_snapshotMyCache.restore_snapshots  sm    ))$..9 	

NND*COO # OOD*Ceu= $r   c                   V P                   P                  RR4      pV F  pW 9   d9   W,          P                  '       d!   \        P                  ! RV,          4        R# RpV P                   P                  VR4       F(  pY4V 9   ;'       d    W,          P                  ,          pK*  	  V'       g   K  \        P                  ! RV,          4        R# 	  \        P                  ! R4       R# )	a+  
This checks if we run on a desktop or a server install.

A server install has more freedoms, for a desktop install
we force a desktop meta package to be install on the upgrade.

We look for a installed desktop meta pkg and for key
dependencies, if none of those are installed we assume
server mode
rQ   rR   z@need_server_mode(): run in 'desktop' mode, (because of pkg '%s')FTKeyDependencieszIneed_server_mode(): run in 'desktop' mode, (because of key deps for '%s')z[need_server_mode(): can not find a desktop meta package or key deps, running in server mode)r^   r_   is_installedr1   r   )r#   r`   key
deps_foundr   s   &    r   need_server_modeMyCache.need_server_mode  s     ;;&&x<C{ty555`cffg J{{**30ABTkDDdi.D.DD
 Cziloop  	str   c                    V P                   '       d*    \        P                  ! R4       V P                  4        R# R#   \         d)    TP                  \        R4      \        R4      4        R# i ; i)zDcheck if the cache is ok and if the required metapkgs
are installed
z$Have broken pkgs, trying to fix themzBroken packageszYour system contains broken packages that couldn't be fixed with this software. Please fix them first using synaptic or apt-get before proceeding.FT)r   r1   r   r   rg   errorr   )r#   rZ   s   &&r   coherence_checkMyCache.coherence_check  sh     >>>
DE!   

1./!" $@ "AB s   &> /A10A1c                   \         P                  ! R V: RV: R24       W9   dh   W,          P                  ! R/ VB  W,          P                  '       g8   W,          P                  '       g    \         P
                  ! RV,          4       R# R# )zInstalling '' (r   z Installing/upgrading '%s' failedFTr
   )r1   r   r  r   r   r  r#   r   reasonflagss   &&&,r   r  MyCache.mark_install  s^    V<=;I""+U+I,,,	0H0H0H@3FGr   c                   \         P                  ! R V: RV: R24       W9   df   W,          P                  '       dN   W,          P                  4        W,          P                  '       g    \         P
                  ! RV,          4       R# R# )zUpgrading 'r  r   zUpgrading '%s' failedFT)r1   r   r  mark_upgrader   r  r#   r   r  s   &&&r   r  MyCache.mark_upgrade  sY    sF;<;49111I""$9+++5;<r   c                    \         P                  ! R V: RV: R24       W9   d   W,          P                  ! R/ VB  R# R# )z
Removing 'r  r   Nr
   )r1   r   r  r  s   &&&,r   mark_removeMyCache.mark_remove  s0    c6:;;I!!*E* r   c                    \         P                  ! R V: RV: R24       W9   d/   V P                  P                  W,          P                  R4       R# R# )z	Purging 'r  r   TN)r1   r   r   r  ry   r  s   &&&r   
mark_purgeMyCache.mark_purge  s7    S&9:;NN&&ty~~t< r   c                    W9   dH   W,          P                   '       d.   W,          P                  '       d   V P                  W4       R # R # R # R # r<   )r  r   r  )r#   pkgnamer  s   &&&r   _keep_installedMyCache._keep_installed  s@    O***+++g. , + r   c           	        V P                   P                  RR4       F  pV P                  VR4       K  	  V P                   Fy  pW 9   g   K  W,          P                  '       g   W,          P
                  '       g   K=  V P                   P                  VR4       F  pV P                  VRV,          4       K  	  K{  	  \        P                  ! R4       V P                   P                  RR4       F  pV  F  pVP                  '       g   K  VP                  P                  '       g   K5  VP                  '       g   KI  VP                  P                  V8X  g   Kf  V P                  VP                  RV,          4       K  	  K  	  V P                   F  pW 9   g   K  W,          P                  '       g   W,          P
                  '       g   K=  V P                   P                  VR4       F  pV  F  pVP                  '       g   K  VP                  P                  '       g   K5  VP                  '       g   KI  VP                  P                  V8X  g   Kf  V P                  VP                  V: RV: 24       K  	  K  	  K  	  R	# )
zNrun after the dist-upgrade to ensure that certain
packages are kept installed rQ   KeepInstalledPkgszDistro KeepInstalledPkgs rulez%s KeepInstalledPkgs rulez"Running KeepInstalledSection rulesKeepInstalledSectionz$Distro KeepInstalledSection rule: %sz KeepInstalledSection rule: N)r^   r_   r)  r`   r  r   r1   r   rw   rx   r   sectionr~   )r#   r(  r  r.  r   s   &    r   keep_installed_ruleMyCache.keep_installed_rule  s    {{**85HIG  *IJ J ==C{	 6 6 6 $	 8 8 8#{{2238KLG((2MPS2ST  M ! 	:;{{**85KLGMMMcmm&@&@&@)))--8((3Y\c3cd	  M ==C{	 6 6 6 $	 8 8 8#{{2238NOG#MMMcmm.H.H.H # 1 1 1MM11W< 00adfm;no	  $  P !r   c                b    V P                   '       g   V P                  P                  4        R# R# )z-run before the upgrade was done in the cache N)r]   r[   PreDistUpgradeCacherB   s   &r   pre_upgrade_ruleMyCache.pre_upgrade_rule  s%     """KK++- #r   c           
     b   RV P                   3RV P                  3RV P                  3RV P                  33 F  w  rV P                  P                  RRV,          4       F  pV! VRV,          4       K  	  V P                   Fw  pW@9   g   K  W,          P                  '       g   W,          P                  '       g   K=  V P                  P                  VRV,          4       F  pV! W4: RV: R	24       K  	  Ky  	  K  	  V P                  '       g   V P                  P                  4        R
# R
# )z,run after the upgrade was done in the cache InstallUpgradeRemovePurgerQ   zPostUpgrade%szDistro PostUpgrade%s rulez PostUpgradez ruleN)r  r  r"  r%  r^   r_   r`   r  r   r]   r[   PostDistUpgradeCache)r#   ruleactionr   r  s   &    r   post_upgrade_ruleMyCache.post_upgrade_rule  s     )4+<+<= )4+<+<= ($*:*:; '9;NT
 {{**8_t5KLs7$>? M}};DI$:$:$:$(I$<$<$<#{{223$8NOssD$IJ  P %; """KK,,. #r   c                   \         P                  ! RV P                  ,          4        V P                  P                  R4      w  p p\        R.\        R7      P                  4       ^ ,          pRT9   d   \         P                  ! R	4       R
#   \         d)   p\         P
                  ! RT,          4        Rp?R# Rp?ii ; i)zOcheck for the running kernel and try to ensure that we have
an updated version
zKernel uname: '%s' -z/Can't parse kernel uname: '%s' (self compiled?)NFdmesg)rT   s   WARNING: NR_CPUS limitzUP kernel on SMP system!?!T)	r1   r   r,   split	Exceptionr2   r   r   ro   )r#   versionr   rt   rA  s   &    r   checkForKernelMyCache.checkForKernel  s     	+djj89	"jj..s3OWa
 wi-99;A>$-MM67  	OOMPQQR	s   B CB<<Cc                   RpV P                   P                  RR4      pV  EF6  pVP                  P                  P	                  VP
                  4      pV'       d;   VP                  ^ 8X  d*   \        P                  ! RVP                  ,          4       Ku  VP                  '       g   K  VP                  P                  '       g   K  VP                  '       d   K  VP                  '       d   K  VP                  V9   d   K  RVP                  9   d   K  VP                  P                  V9   g   EK  V P                  VP                  RV,          4       EK9  	  R# )requiredrQ   RemoveEssentialOkzPackage %s has no priority set:z;priority in required set '%s' but not scheduled for installN)rH  )r^   r_   _pcacher   r   ry   priorityr1   r  r~   rw   rx   r  r   r  )r#   needremoveEssentialOkr   r   s   &    r   checkPriorityMyCache.checkPriority  s     KK//:MNC++''99#((CCs||q(>IJ#--"<"<"<%%%);););HH 11388O&&$.!!#((,ilp,pq r   c                   ^ pVP                  4       '       dP   V^,          ^ 8X  d   VP                  4        VP                  4        \        P                  ! R4       V^,          pKe  VP                  RR7       VP                  4        R# )r   g{Gz?T)finishedN)lockedpulseProgressprocessEventstimesleep)r#   rZ   r\   is   &&& r   	updateGUIMyCache.updateGUI1  sg    kkmm2v{""$ JJtFAD)r   c                   \         P                  ! 4       pVP                  4        \         P                  ! V P                  V P
                  V3R 7      pVP                  4         V P                  4        V P                  V4       V'       g   V P                  V4       V P                  R4       V P                  4        V P                  4        \        4       '       d   \        P                  ! R4       MV P!                  4        V P#                  4        V P%                  4        V P&                  '       d2   \)        \+        R4      RP-                  R V  4       4      ,          4      h TP=                  4        TP-                  4        . p
. pT P?                  4        EFo  pTP@                  '       d   K  TPB                  '       d   TPE                  TPF                  4       TPH                  PJ                   F  p\L        PN                  ! TPP                  TPR                  PT                  4      ^ 8  g   K?  TPV                   Fd  w  rTPX                  PZ                  P]                  T4      pT'       g   K4  TP^                  '       d   KH  T
PE                  TPF                  4        K  	  K  	  EK  TP`                  Pb                  pRpT F  pTTPd                  ,          pK  	  T'       d   EKT  T
PE                  TPF                  4       EKr  	   T Pf                  Pi                  RR4      pT'       d   \        P                  ! R4       R#  \o        T4      ^ 8  d=   TPq                  4        \        P8                  ! RRP-                  T4      ,          4       \o        T
4      ^ 8  d   T
Pq                  4        \        P8                  ! RRP-                  T
4      ,          4       T P7                  4        TP9                  \+        R4      \+        R4      R
P-                  T
4      4       T P;                  4        R# R#   \(        \.        3 EdF   p\+        R4      pT P1                  4       pT'       d   T\+        R4      ,          pM\3        T\.        4      '       d   T\5        T4      R,           ,          pMWT'       d,   T\+        R	4      ,          pTR
P-                  T4      ,          pM$T\+        R4      ,          pT\+        R4      ,          pT P7                  4        TP9                  \+        R4      T4       \5        T4      p	\        P8                  ! RT	4       T P;                  4         Rp?TP=                  4        TP-                  4        R# Rp?ii ; i  TP=                  4        TP-                  4        i ; i  \j        Pl                   d     ELi ; i))targetr   Tz5skipping kernel checks because we run inside a chrootz!Broken packages after upgrade: %sr   c              3      "   T F6  qP                   '       g   VP                  '       g   K(  VP                  x  K8  	  R # 5ir<   )is_inst_brokenis_now_brokenr~   ).0ps   & r   	<genexpr>&MyCache.distUpgrade.<locals>.<genexpr>d  s?       URei`am}m}m}  BC  BQ  BQU[UVU[U[eis
   %A A zBAn unresolvable problem occurred while calculating the upgrade.

 z@This is most likely a transient problem, please try again later.z

zThis may be caused by unofficial packages installed on the system. Please try replacing the following packages with official versions from the Ubuntu archive, and then try the upgrade again.


zIf none of this applies, then please report this bug using the command 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal. zIf you want to investigate this yourself the log files in '/var/log/dist-upgrade' will contain details about the upgrade. Specifically, look at 'main.log' and 'apt.log'.zCould not calculate the upgradezDist-upgrade failed: '%s'NFrQ   AllowUnauthenticatedzAllowUnauthenticated set!z!Packages to downgrade found: '%s' z$Unauthenticated packages found: '%s'z"Error authenticating some packageszIt was not possible to authenticate some packages. This may be a transient network problem. You may want to try again later. See below for a list of unauthenticated packages.)9	threadingLockacquireThreadrY  rZ   startr3  _keepBaseMetaPkgsInstalled_installMetaPkgsupgraderO  r/  r   r1   r2   rE  r=  _verifyChangesr   rg   r   r   r   foreign_packages
isinstancerh   r   r  r   releaser   r   marked_downgrader   r~   ry   version_listrd   version_comparever_str	installedrD  	file_listrK  r   
find_index
is_trustedrw   originstrustedr^   
getbooleanconfigparserNoOptionErrorr   sort)r#   rZ   
serverModer]   r\   trt   detailsrp  	error_msg	untrusted	downgrader   r   verFileIterindex	indexfiler{  r|  originbs   &&&&                 r   distUpgradeMyCache.distUpgrade<  s    ~~DNN$))T9KL		O	!!# ++D1%%d+ LL   $$&  WX##% ""$ !~~~!!$G"H499  URei  UR  LR  #R  S  S \ LLNFFH 		##%C   ###  *8800C..S]]%:%:<>?@47MM0[(+(9(9(D(D[(QI(y1E1E1E ) 0 0 : %	 5B	 1 mm++GG!6>>) " 7  *- &0	&&x1GHA ;< 
 y>ANNMM=((9-. /y>ANNMM@((9-. / $$&JJq=> = > yy+- %%'I :; (	 9 :G  $446 1 7 8 8 A<==3q6F?*!11  499%566 1 e f f1 O P P
 $$&JJq:;WEAIMM5yA %%' LLNFFHY(	V LLNFFHD )) 		sQ   %CQ 91Q #W  8W  VA-VB,V-V VV "V= WWc                \   \         P                  P                  R4      pV P                  P                  RR4      pV P	                  4        EF  pVP
                  '       dX   V P                  VP                  4      '       d7   \        P                  ! RVP                  4       \        VP                  4      hVP
                  '       g   K  VP                  P                  R8X  g   K  VP                  P                  VR39   g   K  VP                  V9   d   K  \        P                  ! RVP                  4       \        \!        R4      VP                  ,          4      h	  V P                  P                  RR	4      pV F  pVP#                  R
4      w  rgW`9   g   K  W,          P$                  '       g   K8  W,          P$                  P&                  V8X  g   K[  W,          P(                  '       g   W,          P*                  '       g   K  \        \!        R4      V,          4      h	  R# )zdthis function tests if the current changes don't violate
our constraints (deny listed removals etc)
zAPT::ArchitecturerQ   rI  zHThe package '%s' is marked for removal but it's in the removal deny listTallzDThe package '%s' is marked for removal but it's an ESSENTIAL packagez1The essential package '%s' is marked for removal.BadVersionsr   z*Trying to install deny listed version '%s')rd   r^   r0   r_   r   r   _inRemovalDenylistr~   r1   r   r   ry   	essentialrw  architecturerg   r   rB  rw   rD  r   r   )r#   	main_archrN  r   badVersionsbvr(  r   s   &       r   ro  MyCache._verifyChanges  s    NN''(;<	 KK//:MN##%C   T%<%<SXX%F%Fhjmjrjrs3CHH==   HH&&$.MM..9e2DD$55dfifnfno!!$W"X[^[c[c"cdd & kk))(MBBXXc]NWDM$;$;$;''//36------!!$P"QTV"VWW  r   c                   VP                   P                  P                  VP                  4      pVf   \	        RVP
                  4       R# VP                  f-   \	        RV P                  P                  4       ,          4       R# VP                  P                  ^ 4      w  r4VP                   P                  P                  W434       R# )z
helper to make sure that the pkg._records is pointing to the right
location - needed because python-apt 0.7.9 dropped the python-apt
version but we can not yet use the new version because on upgrade
the old version is still installed
zNo candidate ver: FzNo file_list for: %s T)
rK  r   r   ry   printr~   rx  popr   lookup)r#   r   r   r6   r  s   &&   r   _lookupPkgRecordMyCache._lookupPkgRecord  s     kk##55chh?;&1== )DIINN,<<===$$Q'##QJ/r   c                   / p\        4       pV  F  pV P                  V4      '       g*   \        P                  ! R VP                  ,          4       KC  VP
                  P                  P                  P                  R4       F  pVP                  R4      '       g   K  V\        R4      R P                  R4       FF  pVP                  4       pWQ9  d   \        4       W&   W,          P                  VP                  4       KH  	  K  	  K  	  V Fo  pRpV P                  P                  RR4      pWW9   d   RpW,           F  pW,          P                  '       d   K  Rp M	  V'       g   K^  VP                  V4       Kq  	  V# )	z&no PkgRecord found for '%s', skipping rd  Task:N,TrQ   IgnoredTasksF)rr   r  r1   r   r~   rK  r   recordrB  
startswithr   rp   r}   r^   r_   r  )	r#   tasksinstalled_tasksr   linetaskrw  ignored_tasksr(  s	   &        r   installedTasksMyCache.installedTasks  s7   %C((--FQR,,3399$???7++!%c'lm!4 ; ;C @#zz|,*-%EK1	 !A @	  DI KK//.IM$!	 ;;}111 %I ' y##D)  r   c                   \         P                  ! R 4       V  EFK  pVP                  '       g   VP                  '       d   K*  V P	                  V4       \        VP                  P                  R4      '       d'   VP                  P                  P                  '       g*   \         P                  ! RVP                  ,          4       K  VP                  P                  P                  P                  R4       Fh  pVP                  R4      '       g   K  V\        R4      R P                  R4       F+  pVP                  4       pWA9   g   K  VP                  4        K-  	  Kj  	  EKN  	  R# )zrunning installTasksr  zcan not find Record for '%s'rd  r  Nr  T)r1   r   r   r  r  r   rK  r   r  r2   r~   rB  r  r   rp   r  )r#   r  r   r  r  s   &&   r   installTasksMyCache.installTasks  s    ,-C!!!S%5%5%5!!#&CKK00(;;@T@T@[@[@[ > IJ,,3399$???7++!%c'lm!4 ; ;C @#zz|=,,. !A @  r   c                p    V P                   P                  R R4       F  pV P                  VR4       K  	  R# )rQ   BaseMetaPkgsz%base meta package keep installed ruleN)r^   r_   r)  )r#   rZ   r   s   && r   rl  "MyCache._keepBaseMetaPkgsInstalled'  s/    ;;&&x@C  &MN Ar   c           	     <  a a VV 3R  lpS P                   P                  RR4      oS P                   P                  RR4       FF  pS V,          P                  4        \        P                  ! S 4      P                  S V,          4       KH  	  S F  p VS 9   d   S V,          P                  '       d~   S V,          P                  '       dc   \        P                  ! RV,          4       S V,          P                  4        \        P                  ! S 4      P                  S V,          4       K  K  K  K  	  V! 4       '       g   \        P                  ! R	S,          4       S F  pR
pS P                   P                  VR4       F)  pYcS 9   ;'       d    S V,          P                  ,          pK+  	  V'       g   KX  \        P                  ! RV,          4        S V,          P                  4        \        P                  ! RT: RS T,          P                   : R24        M	  V! 4       '       gK   RP#                  S^ R 4      pVP                  \        R4      \        R4      VSR,          3,          4       R# R
#   \         d,   p\        P                  ! RT: RT: R24        Rp?EK  Rp?ii ; i  \        \        3 dW   p\        P                  ! RT: RT: R24       TP                  \        R4      T,          \        R4      4        Rp? R# Rp?ii ; i)c                 T  < S F  p V S9   g   K  SV ,          pVP                   '       d:   VP                  '       d(   \        P                  ! RVP                  ,          4       VP                   '       d   VP                  '       d   SV ,          P
                  '       g   K   R# 	  R# )zU
internal helper that checks if at least one meta-pkg is
installed or marked install
z(metapkg '%s' installed but marked_deleteTF)r  r   r1   r   r~   r   )r  r   r`   r#   s     r   metaPkgInstalled2MyCache._installMetaPkgs.<locals>.metaPkgInstalled-  s~    
  $;s)C'''C,=,=,=&PSVS[S[&[\)))#2C2C2C9333#   r   rQ   rR   r  zMarking '%s' for upgradezCan't mark 'z' for upgrade (r   Nz$none of the '%s' meta-pkgs installedTr  z!guessing '%s' as missing meta-pkgzfailed to mark 'z' for install (zCan't install '%s'zIt was impossible to install a required package. Please report this as a bug using 'ubuntu-bug ubuntu-release-upgrader-core' in a terminal.Fzmarked_install: 'z' -> ''r   zCan't guess meta-packagezYour system does not contain a %s or %s package and it was not possible to detect which version of Ubuntu you are running.
 Please install one of the packages above first using synaptic or apt-get before proceeding.rW   )r^   r_   r  ri   ProblemResolverprotectr  is_upgradabler1   r   r  rg   r2   KeyErrorr  r   r   r   )	r#   rZ   r  r   r  rt   r  	meta_pkgsr`   s	   f&      @r   rm  MyCache._installMetaPkgs+  s   	  ;;&&x< ;;&&x@CI""$%--d3i8 A C
O4KI***I+++MM"<s"BCI**,''-55d3i@ , +     !!MM@8KL!
;;..s4EFC+"H"H$s)2H2HHJ G:MM"E"KL%S	..0 MMCcIaIa"bc'  *  !!		(1R.1IJJq34 6 7 #HRL123 S  O c1 MNNO  (2 	%'*A'/ 0

1%9#:S#@#$ &3 $45  %	%s>   I;2I;A I;J4;J1J,,J14LA
LLc                    V P                    FP  p\        P                  ! V4      P                  V4      '       g   K0  \        P
                  ! R V: RV: R24        R# 	  R# )zdenylist expr 'z' matches 'r  TF)rl   r   r   r    r1   r   )r#   r(  exprs   && r   r  MyCache._inRemovalDenylisty  sJ    ))Dzz$%%g..#W. /	 *
 r   c                   W9   d    \         P                  ! R V,          4       R# VP                  V P                  4      '       d    \         P                  ! RV,          4       R# WP                  8X  d    \         P                  ! RV,          4       R# V P                  V4      '       d    \         P                  ! RV,          4       R# V P                  P                  RR4       Ff  pW9   g   K  W,          P                  '       g   K%  W,          P                  P                  V8X  g   KH  \         P                  ! RV,          4        R# 	  R# )	zskipping foreign pkg '%s'Fz skipping running kernel pkg '%s'z skipping kernel metapackage '%s'z"skipping '%s' (in removalDenylist)rQ   r-  z'skipping '%s' (in KeepInstalledSection)T)
r1   r   endswithr,   rn   r  r^   r_   rw  r.  )r#   r(  foreign_pkgsr.  s   &&& r   isRemoveCandidateMyCache.isRemoveCandidate  s    "MM5?@DJJ''MM<wFG,,,MM<wFG""7++MM>HI{{**85KLGDM$;$;$;M++33w>G'QR	 M r   c           
        W9  d   R # W9  d   R#  V P                   P                  RR4      pV'       d   V P	                  4         W,          P                  WTR7       V P                  P                  4        V'       dm   W9   d   R# V P                  4        FP  pVP                  V9  g   K  \        P                  ! RV: RVP                  : R24       V P                  4         R # 	  R#   \        P                   d    R p Li ; i  \        \        3 dP   p\        P                  ! RT: R	\!        T4      : R
T: R24       T'       d   T P                  4         Rp?R # Rp?ii ; i)FTrQ   PurgeObsoletes)purger  z	package 'z ' produces an unwanted removal 'z', skippingz'_tryMarkObsoleteForRemoval failed for 'r  : r   N)r^   r}  r~  r  r   r  rZ   rU  r   r~   r1   r   r
  rg   r  r2   repr)r#   r(  remove_candidatesforced_obsoletesr  r  r   rt   s   &&&&&   r   tryMarkObsoleteForRemoval!MyCache.tryMarkObsoleteForRemoval  s$   
 +	KK**85EFE   "	M%%E%EII##%.++-Cxx'88dkmpmumu&vw--/$	 . 3 )) 	E	( X& 	OOU\^bcd^eghij%%'		s=   C/ A D 	!D /:D +D /D	D	E,AE''E,c                    \        4       pV  FK  pVP                  '       g   K  V P                  V4      '       d   K0  VP                  VP                  4       KM  	  V# z0get all package names that are not downloadable )rr   r  anyVersionDownloadabler}   r~   )r#   obsolete_pkgsr   s   &  r   _getObsoletesPkgsMyCache._getObsoletesPkgs  sL    C
 22377!%%chh/  r   c                j    VP                   P                   F  pVP                  '       g   K   R# 	  R# )z@helper that checks if any of the version of pkg is downloadable TF)ry   rt  rx   )r#   r   r   s   && r   r  MyCache.anyVersionDownloadable  s*    88((C ) r   c                    \        4       pV  F_  pVP                  '       g   K  V P                  P                  VP                  4      '       g   KD  VP                  VP                  4       Ka  	  V# r  )rr   r  r   
is_garbagery   r}   r~   )r#   unused_dependenciesr   s   &  r   _getUnusedDependenciesMyCache._getUnusedDependencies  sR    !eCDNN$=$=chh$G$G#''1  #"r   c                l   \        4       pV  EF"  pVP                  '       d   VP                  '       g   K*  V P                  V4      '       d   VP                  P                  P
                   F  w  r4VP                  '       d   K  VP                  R8X  d[   VP                  P                  V P                  4      '       d   KW  VP                  P                  V P                  4      '       d   K  W1VP                  &    K  	  K  V P                  V4      '       g   EK  RWP                  &   EK%  	  V# )a\  
Check for packages that do not have 'Ubuntu' as their origin.
Return this as a dict with <package name> -> <package file>.

If an installed package has a candidate that is not downloadable,
but *some* version of the package is downloadable, consider that
package foreign. In such cases, the package will have a value of None
in the returned dict.
UbuntuN)dictr  rw   rx   _candrx  
not_sourcer  archiver  ra   rb   r~   r  )r#   foreignr   pkg_file_indexs   &    r   rp  MyCache.foreign_packages  s     &C$$$  %%*---*=*=*G*G&X***  !83$,,77GG$,,77EE -5) +H  ,,S11 %)!1 4 r   c                  a  ! R R\         4      pV3R lp. o/ p/ p\        R4      ;_uu_ 4       pV F2  p VP                  4       w  rrrT	S9   d   K!  SP                  T	4       K4  	  RRR4       SP                  \        R	R
7       \        P                  P                  R4      pRRRRVRR3 EF  p\        P                  P                  V4      pV! V4      p\        P                  P                  V4      '       d5   \        P                   ! V4      pVP"                  VP$                  ,          pM\        P&                  ! RV,          4       ^ pVV9   d9   \        P
                  ! RV: RVV,          : 24       WTV,          ,          W_&   K  \        P
                  ! RV: RV: 24       WV&   V! V4      W_&   EK  	  ?\        P
                  ! RV,          4       ^ pV  F  p\(        P*                  ! RVP,                  4      '       g   K,  VP.                  '       g   VP0                  '       g   KR  \        P
                  ! VP,                  : R\2        : R24       V^,          pK  	  V\2        ,          V^,           \4        ,          ,           pRpV'       d~   V  FZ  pVP6                  '       g   K  VP0                  '       g   VP8                  '       g   K=  VVP:                  P<                  ,          pK\  	  \        P
                  ! RV,          4       WP>                  3RV P@                  3RV PB                  3RRV3R R!RV33 F  w  ppV^ 8  d   K  \        P                  P                  V4      p\        P
                  ! RVVVV,          VV,          PD                  3,          4       VV,          ;PD                  V,          un"        VV,          ;PF                  V,          un#        K  	  / pV EF  pVV,          PD                  ^ 8  g   K  \        PH                  ! \K        \M        VV,          PD                  4      ^,           4      4      p\O        V\P        4      '       d%   VPS                  \T        PV                  ! 4       4      p\        PH                  ! VV,          PF                  4      p\O        V\P        4      '       d%   VPS                  \T        PV                  ! 4       4      p\Y        VV! V4      V4      VV! V4      &   EK  	  \        V4      ^ 8  dY   \        PZ                  ! RV Uu. uF  p\]        V4      NK  	  up,          4       \_        \a        VPc                  4       4      4      hR	#   \         d,   p\        P
                  ! RT: RT: R24        Rp?EK  Rp?ii ; i  + '       g   i     ELZ; iu upi )"z
this checks if we have enough free space on /var, /boot and /usr
with the given cache

Note: this can not be fully accurate if there are multiple
      mountpoints for /usr, /var, /boot
c                   *   a  ] tR tRt o RtR tRtV tR# ))MyCache.checkFreeSpace.<locals>.FreeSpacei  z?helper class that represents the free space on each mounted fs c                     Wn         ^ V n        R# )r   NfreerM  )r#   initialFrees   &&r   r"   2MyCache.checkFreeSpace.<locals>.FreeSpace.__init__  s    '		r   r  NrM   rF   s   @r   	FreeSpacer    s     N r   r  c                P   < S F  pV P                  V4      '       g   K  Vu # 	  R# )zoreturn 'id' of a directory so that directories on the
same filesystem get the same id (simply the mount_point)
/)r  )dmount_pointmounteds   & r   
make_fs_id*MyCache.checkFreeSpace.<locals>.make_fs_id  s)      '<<,,&&  ' r   z/proc/mountszline 'z"' in /proc/mounts not understood (r   NT)r  reversezDir::Cache::archivesr  /usrz/varz/bootz/homez/tmp/zdirectory '%s' does not existszDir z mounted on zFree space on r  zfs_free contains: '%s'z%^linux-(image|image-debug)-[0-9.]*-.*z (new-install) added with z to boot spaceg        z&additional space for the snapshots: %sz dir '%s' needs '%s' of '%s' (%f)zNot enough free space: %s)r  i   )z/tmpi  P )r  i   )2objectr   rB  
ValueErrorr1   r   r   r  r   rd   r^   r   r+   r.   realpathr   statvfsf_bavailf_frsizer2   r   r    r~   r   r   KERNEL_SIZEINITRD_SIZEr  r   rw  installed_sizer   r   r   r  rM  size_to_strfloatabsrq  bytesdecodelocalegetpreferredencodingr:   r  rh   rH   r   values)r#   snapshots_in_user  r  mnt_mapfs_freemountsr  r   whereoptionsar  rt   
archivedirr  fs_idstr  kernel_countr   space_in_bootrequired_for_snapshotsr>   sizerequired_listfree_at_leastfree_neededrX  r  s   &&                           @r   checkFreeSpaceMyCache.checkFreeSpace  s   	 		 .!!V37::<0Qq1 'NN5)  " 	d+^^,,-CD
vvw
GWMA  #AqMEww~~a  ZZ]{{R[[0 @1 DE '%.2 3$U^4
 $( )!"&t_
# N$ .89
 C xx?JJ %%%);););MMTWT\T\^i"jk A%L  &3(1,;< "%$$$'''3+<+<+<*cmm.J.JJ*  MMBE[[\ ()?)?@#T%C%CD#T%M%MN2$m41/#%;<KS$ ax''""3'CMM<T7SV<Y`adYeYjYj?kklCL%CL%%* Cs|  1$ ' 3 3E#gcl>O>O:PQR:R4S TmU33$1$8$8335%7M%11'#,2C2CDk511"-"4"4335#7K
 2C;PZ[^P_an1ojo.   }!MM58WAQ8WWX)$}/C/C/E*FGGO " MMUY[\"]^	 "!!R 9Xs@   V:VV:V:<W
V7	V2	+V:2V7	7V::W	)rc   r^   ra   rn   r\   r   r`   r   r   r]   r[   rl   rb   rX   rY   r,   rZ   )NTNNr<   )T) )F);r   r   r   r   r{   r|   r"   propertyr   r   rq   r   r   r   r   r   r   r   rf   r   r   r   r   r   rx   r   r   r  r
  r  r  r  r  r"  r%  r)  r/  r3  r=  rE  rO  rY  r  ro  r  r  r  rl  rm  r  r  r  r  r  r  rp  r  r   r'   rF   s   @r   rO   rO      s    IM(JT 	 	6F$$ $ $ ' '   / /
1!_5DB	 +
0><$+
=
/p@./$ r*	 M M^8$  6"OL\. % %N#&PL Lr   rO   )!ri   rd   r-   r  r+   r   r1   rV  r   rg  r~  
subprocessr   r   DistUpgradeGettextr   r   r   utilsr   rC  r	   r   r   r   r8   r  r  r  r:   rH   rj   rO   r
   r   r   <module>r     s   ,     	 	      " , (  	Y 		. 		N 	I * B ?@ [B B An AJcii Jr   