Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/DistUpgrade/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyc


ϒOc@sFddlZejddeddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlmZmZddlmZddlmZddlmZmZdefd	YZd
efdYZdefd
YZdZeZdefdYZ defdYZ!dej"fdYZ#e$dkrBddl%Z%ddl&Z&ddl'Z'dGHe#e&j(de'j'e)Z*e*j+GHe%j,e*j-e*j.e*j/e*j0dge*j1GHe*j2ndS(iNtignoresapt API not stable yet(tPopentPIPE(tgettext(tngettext(t
inside_chroottestimate_kernel_size_in_boottCacheExceptioncBseZRS((t__name__t
__module__(((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR+stCacheExceptionLockingFailedcBseZRS((RR	(((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR
-stCacheExceptionDpkgInterruptedcBseZRS((RR	(((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR/scCs9t}|dkr+tjdd}n|d	7}|S(
Nis,estimate_kernel_size_in_boot() returned '0'?iiiixiii (Rtloggingtwarn(tsize((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_set_kernel_initrd_size4s	
	
tFreeSpaceRequiredcBs eZdZdZdZRS(s FreeSpaceRequired object:
    
    This exposes:
    - the total size required (size_total)
    - the dir that requires the space (dir)
    - the additional space that is needed (size_needed)
    cCs||_||_||_dS(N(t
size_totaltdirtsize_needed(tselfRRR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt__init__Fs		cCsd|j|j|jfS(Ns@FreeSpaceRequired Object: Dir: %s size_total: %s size_needed: %s(RRR(R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt__str__Js(RR	t__doc__RR(((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR>s	tNotEnoughFreeSpaceErrorcBseZdZdZRS(sO 
    Exception if there is not enough free space for this operation 
    
    cCs
||_dS(N(tfree_space_required_list(RR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRSs(RR	RR(((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRNstMyCachecBsNeZdZdZd:edZdZedZ	dZ
dZdZdZ
d	Zed
ZedZedZd
ZdZd:dZdZedZedZedZdZdZdZdZdZdZdZddZ ddZ!ddZ"ddZ#d Z$d!Z%d"Z&d#Z'd$Z(d%Z)d&Z*d'Z+d(Z,d)Z-d*Z.ed+Z/d,Z0d-Z1ed.Z2d/Z3d0Z4d1Z5d2Z6ed3Z7d4Z8d5Z9d6Z:d7Z;d8Z<e=d9Z>RS(;iicCsetjj||g|_g|_||_||_t|_t|_	||_
|j
jdd|_d|_
|ry!tj|jt|_Wqtk
r}dt|krt|nt|qXn|jdd|_tddgdtjd	j|_|j|jd
ddkrad
tj kratj!j"ddndS(NtDistrotMetaPkgsisdpkg --configure -atRemovalBlacklistFiletunames-rtstdoutitSourcestFromthardytRELEASE_UPGRADE_NO_RECOMMENDSsAPT::Install-Recommendsttrue(#tapttCacheRt
to_installt	to_removetviewtquirkstFalsetlocktpartialUpgradetconfigtgetlisttmetapkgst
_listsLocktapt_pkgt
PkgSystemLocktlockListsDirtTruetSystemErrortstrRR
tgetListFromFiletremoval_blacklistRRtcommunicatetstripRt_initAptLogtgettostenvirontConfigtset(RR.R)R*tprogressR,te((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR[s2								


+
cCsRxK|D]C}|jrqn|jjtjkr|jdtdtqqWdS(s! honor the dselect install state t	auto_insttauto_fixN(tis_installedt_pkgtselected_stateR2tSELSTATE_INSTALLtmark_installR+(Rtpkg((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_apply_dselect_upgrade{s

	cCset}xU|D]M}|jr|jj|jksJ|jj|jkr|j|jqqW|S(sB return the packages not downloadable packages in reqreinst state (RAtcandidateDownloadableRGt
inst_statet	ReInstReqt
HoldReInstReqtaddtname(Rt	reqreinstRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytreqReinstallPkgss	

cCs|j}t|dkrtddt|}tddt|dj|}|j||r|jddd	gt|}|jj||j	t
SntS(
s/ check for reqreinst state and offer to fix it isRemove package in bad statesRemove packages in bad statesThe 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?sThe 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?s, tdpkgs--removes--force-remove-reinstreq(RTtlenRtjointaskYesNoQuestiontreleaseLocktlisttgetTerminaltcalltgetLockR5R+(RR)RStheadertsummarytcmd((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytfixReqReinsts	

cCs|jjddd}tjj|s:tj|ntjjd|tjjddtj	tjj
|dtjtjBtj
Bd|_tj|jd	tjjtjjd
dtjjddd
S(s init logging, create log filetFilestLogDirs/var/log/dist-upgradesDir::LogsDir::Log::Terminalsapt-term.logsapt.logis
Log time: %s
sDebug::pkgProblemResolverR$sDebug::pkgDepCache::AutoInstallN(R.tgetWithDefaultR>tpathtexiststmakedirsR2R@RAtopenRWtO_RDWRtO_CREATtO_APPENDtlogfdtwritetdatetimetnow(Rtlogdir((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR<s	  cCst|dr2tj|jtj|jntjd|_tjd|_tj|jdtj|jddS(Nt
old_stdoutii(thasattrR>tcloseRqt
old_stderrtduptdup2Rl(R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_startAptResolverLogscCsDtjdtjdtj|jdtj|jddS(Nii(R>tfsyncRvRqRt(R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_stopAptResolverLogs

csfd}|S(s3 decorator to ensure that the apt output is logged cs/|dj||}|dj|S(Ni(RwRy(targstkwargstres(tf(s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytwrappers((R}R~((R}s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytwithResolverLogscCs>tj|j}tj}|j||j|j|jS(s< get the size of the packages that are required to download (R2tPackageManagert	_depcachetAcquiretget_archivest_listt_recordstfetch_needed(Rtpmtfetcher((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytrequiredDownloadscCs
|jjS(s9 get the size of the additional required space on the fs (Rtusr_size(R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytadditionalRequiredSpacescCs|jjdkS(s is the cache broken i(Rtbroken_count(R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytisBrokenscCsQtjjdd}tj||_|jdkrMd|}t|ndS(NsDir::State::ListsR,isCan not lock '%s' (R2R@tfind_dirtGetLockR1R
(RRRRC((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR4s

cCs/|jdkr+tj|jd|_ndS(Nii(R1R>Rs(R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytunlockListsDirscCsl|jtjj||}|j|rM|jrMttdn|tkrhtdndS(sf
        our own update implementation is required because we keep the lists
        dir lock
        sThe server may be overloadedsAapt.cache.update() returned False, but did not raise exception?!?N(	RR%R&tupdateR4trelease_file_download_errortIOErrort_R+(Rt	fprogressR|((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRs

cCs=tjd|jr#|jntjj|||dS(Nscache.commit()(RtinfoR,RYR%R&tcommit(RRt	iprogress((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRs
	
cCsN|jrJytjt|_WqJtk
rF}tjd|qJXndS(Nsfailed to SystemUnLock() (%s) (R,R2tPkgSystemUnLockR+R6Rtdebug(Rt
pkgSystemOnlyRC((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRYs	

cCsN|jsJytjt|_WqJtk
rF}tjd|qJXndS(Nsfailed to SystemLock() (%s) (R,R2R3R5R6RR(RRRC((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR]
s	

cCs[|r|jj|j}n|jj}|dkrTtjd|j|ftS|j	S(s* check if the given pkg can be downloaded s1no version information for '%s' (useCandidate=%s)N(
Rtget_candidate_verRGt
CurrentVertNoneRtwarningRRR+tdownloadable(RRKtuseCandidatetver((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRscCs|jo|jj|jS(s$ check if the pkg is auto-removable (RFRt
is_garbageRG(RRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytpkgAutoRemovables	cCs
|jjS(s^ try to fix broken dependencies on the system, may throw
            SystemError when it can't(Rt	FixBroken(R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt	fixBroken"scCstg|_g|_x[|jD]M}|js7|jrM|jj|jn|jr|jj|jqqWdS(s* create a snapshot of the current changes N(R'R(tget_changestmarked_installtmarked_upgradetappendRRt
marked_delete(RRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytcreate_snapshot's			cCs|jjdS(N(RtInit(R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytclear1scCstj|j}||jx%|jD]}||}|jq*Wx1|jD]&}||}|jdtdtqRWdS(s restore a snapshot RERDN(	R2tActionGroupRRR(tmark_deleteR'RJR+(RtactiongroupRRRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytrestore_snapshot4s


cCs|jjdd}x|D]}|j|rS||jrStjd|tSt}x=|jj|dD]&}||j|o||jM}qoW|rtjd|tSqWtjdtS(sm 
        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
        RRs>needServerMode(): run in 'desktop' mode, (because of pkg '%s')tKeyDependenciessGneedServerMode(): run in 'desktop' mode, (because of key deps for '%s')sYneedServerMode(): can not find a desktop meta package or key deps, running in server mode(R.R/thas_keyRFRRR+R5(RR0tkeyt
deps_foundRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytneedServerModeBs

$
cCs\|jrXytjd|jWqXtk
rT|jtdtdtSXntS(sY check if the cache is ok and if the required metapkgs
            are installed
        s$Have broken pkgs, trying to fix themsBroken packagessYour system contains broken packages that couldn't be fixed with this software. Please fix them first using synaptic or apt-get before proceeding.(	RRRRR6terrorRR+R5(RR)((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytsanityCheck`s	


tcCsjtjd||f|j|rf||j||jpK||jsftjd|tSntS(NsInstalling '%s' (%s)s Installing/upgrading '%s' failed(	RRRRJRRRR+R5(RRKtreason((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRJrscCsjtjd||f|j|rf||jrf||j||jsftjd|tSntS(NsUpgrading '%s' (%s)sUpgrading '%s' failed(	RRRRFtmark_upgradeRRR+R5(RRKR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR{s
cCs;tjd||f|j|r7||jndS(NsRemoving '%s' (%s)(RRRR(RRKR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytmark_removescCsGtjd||f|j|rC|jj||jtndS(NsPurging '%s' (%s)(RRRRRRGR5(RRKR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt
mark_purgescCs@|j|r<||jr<||jr<|j||ndS(N(RRFRRJ(RtpkgnameR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_keepInstalleds

cCsx-|jjddD]}|j|dqWxq|jD]f}|j|r:||jsi||jr:x4|jj|dD]}|j|d|qWq:q:W|jjdddkrtj	dxi|jjdd	D]R}xI|D]A}|j
r|jr|j|kr|j|j
d
|qqWqWx|jD]}|j|rB||jsq||jrBxr|jj|d	D]X}xO|D]G}|j
r|jr|j|kr|j|j
d||fqqWqWqBqBWndS(
s[ run after the dist-upgrade to ensure that certain
            packages are kept installed RtKeepInstalledPkgssDistro KeepInstalledPkgs rules%s KeepInstalledPkgs ruletOptionstwithNetworkR5s"Running KeepInstalledSection rulestKeepInstalledSections$Distro KeepInstalledSection rule: %ss %s KeepInstalledSection rule: %sN(R.R/RR0RRFRR=RRRMRtsectionRR(RRRRRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytkeepInstalledRules(


!"

!c
Csxd|jfd|jfd|jfd|jfgD]\}}x2|jjdd|D]}||d|q]Wxx|jD]m}|j|r||js||j	rx;|jj|d|D]}||d||fqWqqWq7W|j
s|jjd	nd
S(s- run after the upgrade was done in the cache tInstalltUpgradetRemovetPurgeRs
PostUpgrade%ssDistro PostUpgrade%s rules%s PostUpgrade%s ruletPostDistUpgradeCacheN(
RJRRRR.R/R0RRFRR-R*trun(RtruletactionRKR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytpostUpgradeRules 
 &	c		Cs7tjdt}|jjdd}|jjdd}|jjdd}x|D]}x|D]}d||f}x|D]}|jj|r|jj|r|j	r|jd||j
fkrtjd|jqntjd	|j|j|jqqWqiWq\Wtjd
||S(NsidentifyObsoleteKernels()t
KernelRemovaltVersiont	BaseNamestTypess%s-%s-s%s-%ssskipping running kernel %ssremoving obsolete kernel '%s's"identifyObsoleteKernels found '%s'(RRRAR.R=R/RRt
startswithtendswithRFRRQ(	Rtobsolete_kernelstversiont	basenamesttypesRKtbasetbasenamettype((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytidentifyObsoleteKernelss&
	


	cCsTtjdyddlm}Wn%tk
rH}tjd|tSXy|dd}xO|jD]3}||kre||jre|j	|dPqeqeWtj
dtS|j}tjd	|||krtjd
|tS||j
p||js(||jtj
d|tSWn$tk
rO}tjd|nXtS(
sS 
        this checks for nvidia hardware and checks what driver is needed
        snvidiaUpdate()i(tNvidiaDetections%NvidiaDetector can not be imported %stobsoletes./nvidia-obsolete.pkgssold nvidia drivers1no old nvidia driver installed, installing no newsnv.selectDriver() returned '%s's
no '%s' founds,installing %s as suggested by NvidiaDetectors$NvidiaDetection returned a error: %s(RRtNvidiaDetector.nvidiadetectorRtImportErrorRR+toldPackagesRFRRtselectDriverRRRRJR5t	Exception(RRRCtnvt	oldDrivertdriver((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytcheckForNvidias4

cCstddgdt}|j}|dkrAtjddS|jd}tdttj	|j
d}tjd	||S(
s7get the list of recommended kernels from base-installers/bin/shs./get_kernel_list.shRis/./get_kernel_list.sh returned non-zero exitcodeRcSst|dkS(Ni(RV(tx((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt<lambda>ss
s ./get_kernel_list.sh returns: %s(RRtwaitRR
R:tfiltertmaptstringR;tsplitR(RtpR|tkernels((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytgetKernelsFromBaseInstaller
s
	cCs@|j}x|D]}||kr<tjd|qn||js`tjd|qn||jsz||jrtjd|||jr||jr|j|dndSqWxx|D]p}|j	|dr|j
r'|jd\}}}d||f}|j	|d	n
tjd
dSqWdS(s use the get_kernel_list.sh script (that uses base-installer)
            to figure out what kernel is most suitable for the system
        s%s not available in caches%s not downloadables%s kernel already installeds$Upgrading kernel from base-installerNs(Selecting new kernel from base-installert-s%s-header-%ss0Selecting new kernel headers from base-installersno kernel-headers installed(RRRRMRFRt
is_upgradableRRRJt_has_kernel_headers_installedt	partition(RRtkerneltprefixtseptpostfixtheaders((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_selectKernelFromBaseInstallers0


		

cCs4x-|D]%}|jjdr|jrtSqWtS(Nslinux-headers-(RRRRFR5R+(RRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR;s

	cCstjd|jy|jjd\}}}Wn%tk
rZ}tjd|tSXtdgdtj	d}d|krtjdnt
jjd	r|j
n
tjd
tS(sd check for the running kernel and try to ensure that we have
            an updated version
        sKernel uname: '%s' Rs/Can't parse kernel uname: '%s' (self compiled?)tdmesgRisWARNING: NR_CPUS limitsUP kernel on SMP system!?!s./get_kernel_list.shs(skipping ./get_kernel_list.sh: not found(RRRRRRR+RRR:R>ReRfRR5(RRtbuildtflavourRCR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytcheckForKernelBs

cCsd}|jjdd}x|D]}|jjj|j}|ro|jdkrotjd|j	q"n|j
r"|jp|jr"|j	|kr"d|j	kr"|j
|kr"|j|j	d|q"q"WdS(	NtrequiredRtRemoveEssentialOkisPackage %s has no priority sett:s;priority in required set '%s' but not scheduled for install(R(R.R/t_pcacheRRRGtPriorityRRRRRMRFRtpriorityRJ(RtneedtremoveEssentialOkRKR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt
checkPriorityWs
	cCsud}xN|jrV|ddkr2|jn|jtjd|d7}q	W|jdt|jdS(Niig{Gz?itfinished(tlockedt
pulseProgresst
processEventsttimetsleepR5(RR)R,ti((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt	updateGUIls


cCsTtj}|jtjd|jd|j|f}|jy|jt|j	|j
trtj
dn
|j|j|j|j||s|j|n|jWntk
rj}|j|jtd|}|r|td7}n|td7}|j|jtd||jtjd|tSX|j|jg}x	|jD]}	|	jrqn|	jrDx|	jj D]}}
t!j"|
j#|	j$j%d	krxS|
j&D]E\}}|	j'j(j)|}
|
r|
j*r|j+|	j,PqqWqqWqn|	j-j.}t}x|D]}||j/O}q]W|s|j+|	j,qqWy0|j0j1d
d}|rtj2dtSWnt3j4k
r}nXt5|d	krP|j6tjd
dj||j|jtdtddj||jtStS(NttargetRzs5skipping kernel checks because we run inside a chrootsAn unresolvable problem occurred while calculating the upgrade:
%s

 This can be caused by:
 * Upgrading to a pre-release version of Ubuntu
 * Running the current pre-release version of Ubuntu
 * Unofficial software packages not provided by Ubuntu

s@This is most likely a transient problem, please try again later.sqIf none of this applies, then please report this bug using the command 'ubuntu-bug update-manager' in a terminal.sCould not calculate the upgradesDist-upgrade failed: '%s'iRtAllowUnauthenticatedsAllowUnauthenticated set!s$Unauthenticated packages found: '%s't s"Error authenticating some packagessIt 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.s
(7t	threadingtLocktacquiretThreadRR)tstarttupgradeR5R	RRRR
RRRt_keepBaseMetaPkgsInstalledt_installMetaPkgst_verifyChangesR6treleaseRWRRyRRwR+RRtmarked_downgradeRGtversion_listR2tversion_comparetver_strt	installedRt	file_listRRt
find_indext
is_trustedRRRt	candidatetoriginsttrustedR.t
getbooleanRtConfigParsert
NoOptionErrorRVtsort(RR)t
serverModeR-R,ttRCtdetailst	untrustedRKRtverFileItertindext	indexfileR(R)torigintb((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytdistUpgradews
$



	





	



		


	
	
cCsZ|jjdd}x|jD]}|jro|j|jrotjd|jtt	d|jn|jr"|j
jtkr"|j|kr"tjd|jtt	d|jq"q"W|jjdd}xu|D]m}|j
d\}}|j|r||j|kr||js<||jrtt	d	|qqWtS(
sx this function tests if the current changes don't violate
            our constrains (blacklisted removals etc)
        RRsHThe package '%s' is marked for removal but it's in the removal blacklistsJThe package '%s' is marked for removal but it is in the removal blacklist.sDThe package '%s' is marked for removal but it's an ESSENTIAL packages1The essential package '%s' is marked for removal.tBadVersionsRs*Trying to install blacklisted version '%s'(R.R/RRt_inRemovalBlacklistRRRRR6RRGt	EssentialR5RRtcandidateVersionRR(RRRKtbadVersionstbvRR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRs$


cCs|jjj|j}|dkr4dG|jGHtS|jdkrYd|jjGHtS|jj	d\}}|jj
j||ftS(s 
        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
        sNo candidate ver: sNo FileList for: %s iN(
RRRRGRRRR+R$tNametpopRtlookupR5(RRKRR}R3((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_lookupPkgRecordscCs>i}t}x|D]}|j|sEtjd|jqnx|jjjjdD]{}|j	dr^xc|t
djdD]E}|j}|j|st||<n||j
|jqWq^q^WqWxV|D]N}t}x)||D]}||jst}PqqW|r|j
|qqW|S(Ns&no PkgRecord found for '%s', skipping s
sTask:t,(RARARRRRRRtrecordRRRVR;RRQR5RFR+(Rttaskstinstalled_tasksRKtlinettaskR#R((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytinstalledTasks#s,	
 #

cCstjdx|D]}|js|jr2qn|j|t|jjdo`|jjjs}tj	d|j
qnx{|jjjjdD]a}|jdrxI|t
djdD]+}|j}||kr|jqqWqqWqWtS(Nsrunning installTasksRCscan not find Record for '%s's
sTask:RB(RRRRFRARrRRRCRRRRRRVR;RJR5(RRDRKRFRG((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytinstallTasks<s


$ cCs4x-|jjddD]}|j|dqWdS(NRtBaseMetaPkgss%base meta package keep installed rule(R.R/R(RR)RK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRMscs"fd}jjddx+jjddD]}|jq=WxD]}yOj|r|jr|jrtjd||jnWq\t	k
r}tj
d||fq\Xq\W|stjdxD]}t}x=jj|dD]&}|j|oG|jM}q%W|rtjd	|y|jWnQt	tfk
r}tj
d
||f|j
td|tdtSXtjd
||jfPqqWn|s|j
tdtdtStS(Ncs~xwD]o}j|r|}|jrO|jrOtjd|jn|jrb|jso|jrvtSqqWtS(s{ 
            internal helper that checks if at least one meta-pkg is 
            installed or marked install
            s(metapkg '%s' installed but marked_delete(	RRFRRRRRRR5R+(RRK(R0R(s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytmetaPkgInstalledSs


RRRJsMarking '%s' for upgrades Can't mark '%s' for upgrade (%s)s$none of the '%s' meta-pkgs installedRs!guessing '%s' as missing meta-pkgs$failed to mark '%s' for install (%s)sCan't install '%s's}It was impossible to install a required package. Please report this as a bug using 'ubuntu-bug update-manager' in a terminal.smarked_install: '%s' -> '%s'sCan't guess meta-packagesYour system does not contain a ubuntu-desktop, kubuntu-desktop, xubuntu-desktop or edubuntu-desktop 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.(R.R/RJRRFRRRRR6R
R5tKeyErrorRRR+R(RR)RKRKRRCR((RR0s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRQsF


	
$
	
cCsKxD|jD]9}tj|j|r
tjd||ftSq
WtS(Ns blacklist expr '%s' matches '%s'(R9tretcompiletmatchRRR5R+(RRtexpr((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR9s
c	Cs|j|jr'tjd|tS|j|rKtjd|tSxT|jjddD]=}|j|ra||j	|kratjd|tSqaW|j|st
Sy|jjdd}Wntj
k
r}t}nXtj|j}||jy||jd||jjxc|jD]U}|j|kst|j|kst|j|jr>tjd||jtSq>WWnDttfk
r}tjd	|t||f|jtSXt
S(
Ns skipping running kernel pkg '%s's#skipping '%s' (in removalBlacklist)RRs'skipping '%s' (in KeepInstalledSection)tPurgeObsoletestpurges,package '%s' has unwanted removals, skippings3_tryMarkObsoleteForRemoval failed for '%s' (%s: %s)(RRRRR+R9R.R/RRR5R*R+R,R2RRRt
markDeleteR)R
RRRRR6RLRtrepr(	RRtremove_candidatestforeign_pkgsRRRRCRRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyttryMarkObsoleteForRemovalsD"



 
cCsLt}x<|D]4}|jr|j|sD|j|jqDqqW|S(s1 get all package names that are not downloadable (RARFtanyVersionDownloadableRQRR(Rt
obsolete_pkgsRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_getObsoletesPkgss	
	cCs(x!|jjD]}|jr
tSq
WtS(sA helper that checks if any of the version of pkg is downloadable (RGR RR5R+(RRKR((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRXs	cCsOt}x?|D]7}|jr|jj|jr|j|jqqW|S(s1 get all package names that are not downloadable (RARFRRRGRQRR(Rtunused_dependenciesRK((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_getUnusedDependenciess
	
cst|jjdd}tjj|ratfdtdt|j	nt}xhD]`}|j
|sqqn||}|jsq|jj
|jsq|jrqqn|j|qqWt|S(s return list of installed and demoted packages 

            If a demoted package is a automatic install it will be skipped
        Rt	Demotionscsj|jS(N(RQR;(R(t	demotions(s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRscSs|jdS(Nt#(R(RF((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRs(RAR.R=R>ReRfRRRht	readlinesRRFRtis_auto_installedRGRRQRZ(Rtdemotions_filetinstalled_demotionstdemoted_pkgnameRK((R^s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytget_installed_demoted_packagess"			


	cCst}x|D]}|jr|j|rt}x_|jD]T}||jkrk|j|krkt}n||jkr>|j|kr>t}q>q>W|r|j|j	qqqW|S(sm get all packages that are installed from a foreign repo
            (and are actually downloadable)
        (
RARFRR5tcandidateOrigintarchiveR5R+RQRR(Rtallowed_origintfromDistttoDistRVRKtforeignR5((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt_getForeignPkgs	s	
	
cs_dtfdY}fd}gi}i}xtdD]t}y"|j\}}}	}
}}Wn-tk
r}
tjd||
fqDnX|krDj|qDqDWjdddtt	j
jd	}d
}t|drN|j
jdd
trN|j
jdd}tjj|sNtj|qNntjd|xdddd||dd
gD]}tjj|}||}tjj|rtj|}|tj|tj}ntjd|d}||kr1tjd|||f|||||<q~tjd||f|||<||||<q~W~tjd|d}xV|D]N}tjd|jr|jrtjd|jtf|t7}qqqWd}t|dra|j
jdd
tratjd|j
jdd}x6|D]+}|jsG|jr/||j j!7}q/q/Wnd}|rx<|D]4}|j"rt|js|j#rt||j$j!7}qtqtWtjd|nx||j%fd|j&fdd(fd|fd!d*fdd,f||fd|fgD]l\}}tjj|}tjd$||||||j'f||j'|8_'||j(|7_(qWi}x||D]t}||j'dkrt	j)t*t+||j'd%}t,t	j)||j(||||||<qqWt-|dkr[tj.d&g|D]}t/|^q,t0|j1ntS(-s
        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
        t	FreeSpacecBseZdZdZRS(s@ helper class that represents the free space on each mounted fs cSs||_d|_dS(Ni(tfreeR(RtinitialFree((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyR*s	(RR	RR(((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRm(scs(x!D]}|j|r|SqWdS(s return 'id' of a directory so that directories on the
                same filesystem get the same id (simply the mount_point)
            t/(R(tdtmount_point(tmounted(s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt
make_fs_id.s
s/proc/mountss-line '%s' in /proc/mounts not understood (%s)tcmpcSstt|t|S(N(RuRV(taR6((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRIstreversesDir::Cache::archivess/tmp/R.tAufstEnabledtRWDirscache aufs_rw_dir: %sRps/usrs/vars/boots/homesdirectory '%s' does not existsisDir %s mounted on %ssFree space on %s: %ssfs_free contains: '%s's%^linux-(image|image-debug)-[0-9.]*-.*s,%s (new-install) added with %s to boot spacegs*taking aufs overlay into space calculations&additional space for the snapshots: %si2is/tmpii
s dir '%s' needs '%s' of '%s' (%f)isNot enough free space: %sii iiPi(i(2tobjectRhRt
ValueErrorRRRR-R5R2R@RRrR.RdR+R=R>ReRfRgtrealpathtstatvfstF_BAVAILtF_FRSIZER
RMRORRRtKERNEL_INITRD_SIZERR'tinstalled_sizeRFRR#RRRnRt	SizeToStrtfloattabsRRVRR7Rtvalues(Rtsnapshots_in_useRmRttmnt_maptfs_freeRFtwhattwheretfstoptionsRvR6RCt
archivedirtaufs_rw_dirRqtfs_idtstRnt
space_in_bootRKtrequired_for_aufstrequired_for_snapshotsRRt
required_listt
free_at_leastR((Rss@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pytcheckFreeSpaces	"%

	


						(
&9*N(?RR	RORPRR5RRLtpropertyRTRaR<RwRyRRRRR4RRRRYR]RRRRRRRRRJRRRRRRRRRRRRR	RR7RRARHRIRRR9RWRZRXR\ReRlR+R(((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyRVsr 							
						
										(	
	$									K	3	
				t__main__tfoot.subuntu-desktop(3twarningstfilterwarningst
FutureWarningR%R2R>tos.pathRMRRR~RRnRR+t
subprocessRRtDistUpgradeGettextRRRtutilsRRRRR
RRRR{RRR&RRtsystDistUpgradeConfigParsertDistUpgradeViewtDistUpgradeConfigRtcRtexitRRRHRIRR(((s@/usr/lib/python2.7/dist-packages/DistUpgrade/DistUpgradeCache.pyt<module>sX		_