KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17
System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64
User : nobody ( 99)
PHP Version : 5.2.17
Disable Function : NONE
Directory :  /proc/21573/root/usr/lib/python2.4/site-packages/yum/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/21573/root/usr/lib/python2.4/site-packages/yum/__init__.pyc
m
Pc@sdZdkZdkZdkZdkZdkZdkZdkZdkZdk	Z	dk
Z
dkZ
dkZdk
Z
dkZeiiaeiiZydklZlZWn&ej
odklZlZnXdkZdkZdkZdkZdklZlZlZl Z dk!l"Z"dk#Zdk$Z$dk%Z%dk&l'Z'dk(Z(dk)l*Z*l+Z+dk,Z,dk-Z-dk.l/Z/l0Z0d	k1l2Z2d
k3l4Z4l5Z5dk6Z6dk7Z7dk8Z8dk9Z9dk:Z:dk;Z;e;i<dei=dk>l?Z?l@Z@lAZAlBZBlCZCd
kDTdkElFZFlGZGdklHZHdkIZIdk.lJZJdZKeLgZMeKiNdD]ZOeMePeOq}[MZQeJiRiSdeK7_SdfdYZTde6iUfdYZVdS(s
The Yum RPM software updater.
N(sParsingErrorsRawConfigParser(sParsingErrorsConfigParser(sgetCanonArchsarchDifferencescanCoinstallsisMultiLibArch(s
compareEVR(sRepoStorage(sConfigPreProcessors
varReplace(s
URLGrabbersURLGrabError(s
format_number(spackagesNewestByNameArchsListPackageSacktignore(s
parsePackagessYumAvailablePackagesYumLocalPackagesYumInstalledPackagescomparePoEVR(t*(sRPMTransactionsSimpleCliCallBack(s
to_unicode(sdefault_grabbers3.2.22t.s yum/t_YumPreBaseConfcBstZdZdZRS(sThis is the configuration interface for the YumBase configuration.
       So if you want to change if plugins are on/off, or debuglevel/etc.
       you tweak it here, and when yb.conf does it's thing ... it happens. cCsvd|_d|_t|_tif|_d|_	d|_
d|_d|_d|_
d|_d|_d|_dS(Ns/etc/yum/yum.conft/s/dev/log(tselftfntroottTruetinit_pluginstpluginst	TYPE_COREtplugin_typestNonet	optparsert
debuglevelt
errorleveltdisabled_pluginstenabled_pluginstsyslog_identtsyslog_facilityt
syslog_device(R((t0/usr/lib/python2.4/site-packages/yum/__init__.pyt__init__\s										(t__name__t
__module__t__doc__R(((RRWstYumBasecBstZdZdZdZdZdZddZddee	i
feeed	Zd
Z
eeddZd
ZeedZdZdZdZeeeeeedZdZdZdZdZedZeedZdZeedZeedZdZdZ dZ!dZ"d Z#d!Z$e%d"d#d$d%d&d'Z&e%d"d(d$d)d&d*Z'e%d"d+d$d,d&d-Z(e%d"d.d$d/d&d0Z)e%d"d1d$d2d&d3Z*e%d"d4d&d5Z+e%d"d6d$d7d&d8Z,e%d"d9d$d:d&d;Z-d<Z.d=Z/ed>Z0d?Z1d@Z2dAZ3dBZ4dCZ5dDZ6dEZ7dFZ8dGZ9dHZ:dIZ;dJZ<edKZ=dLZ>e?dMZ@edNZAdOdPdQZBdRZCdSZDdTZEeedUZFdVZGdWZHdXZIdYZJdZZKd[ZLd\ZMd]ZNd^ZOd_ZPd`eeedaZQdbZReedcZSeddZTeedeZUdeedfZVdgZWdhZXgediZYdjZZdkZ[dlZ\dmZ]dnZ^doZ_dpZ`dqZaeedrZbdsZcdtZdduZedvZfdwZgdxZhdyZiedzZjd{Zkd|Zleeed}Zmed~ZneedZoedZpedZqedZredZsdZtedZueedZvedZwdZxeeedZydZzdZ{dZ|edZ}edZ~dZgedZRS(sThis is a primary structure and base class. It houses the objects and
       methods needed to perform most things in yum. It is almost an abstract
       class in that you will need to add your own class above it for most
       real use.cCstii|d|_d|_d|_d|_d|_	d|_
d|_g|_t
id|_t
id|_t||_|ig|_d|_t|_dS(Nsyum.YumBasesyum.verbose.YumBase(tdepsolvetDepsolveRRR
t_conft_tsInfot_rpmdbt_upt_compst_pkgSackt	_lockfiletskipped_packagestloggingt	getLoggertloggertverbose_loggertRepoStoraget_repostdisablePluginst
localPackagestmediagrabberRtpreconf(R((RRqs 								
		cCs"|i|i|idS(N(Rtcloset
closeRpmDBtdoUnlock(R((Rt__del__s

cCs|io|iindS(N(RR+R0(R((RR0s
cCs
tiS(s/Factory method returning TransactionData objectN(ttransactioninfotTransactionData(R((Rt_transactionDataFactorysicCst|i_||i_dS(sndo a default setup for all the normal/necessary yum components,
           really just a shorthand for testingN(tFalseRR/R	tcachetconf(RR8((RtdoGenericSetupss/etc/yum/yum.confRcCstitdtiddt|doX||i_||i_	||i_
||i_||i_||i_
||i_n|iS(Ns9doConfigSetup() will go away in a future version of Yum.
t
stackleveliR/(twarningstwarnt_tErrorstYumFutureDeprecationWarningthasattrRRR/RR	RRRRR9(RRRR	RRRR((Rt
doConfigSetupsc	Ks|otidn|io|iSnti}|o=x:dD].}||jot|i	|||qGqGWn|i	i
}|i	i}|i	i}
|i	i
}|i	i}
|i	i}|i	i}|i	i}|i	i}	|i	i}|i	i}|i	i}|`	|djotii|o
d}nti||}|iotiia n|djo
||_n|djo
||_n|djo
||_n|djo
||_n|i"|i|i|i|i||
o0|i#o&|i$|
||i%|i&||	nti'||_|i#i(d
|i)i*|_*|i+ti,|i)_-|i.|i)i-|i)i/|i0i1dti||i#i(d|iS(s
        Parse and load Yum's configuration files and call hooks initialise
        plugins and logging. Uses self.preconf for pre-configuration,
        configuration. s2Use .preconf instead of passing args to _getConfigRRR	RRRRRRs/etc/yum/yum.confs
/etc/yum.conft
postconfigsConfig time: %0.3ftinitN(	sfnsrootsinit_pluginssplugin_typess	optparsers
debuglevels
errorlevelsdisabled_pluginssenabled_plugins(2tkwargsR<R=RRttimetconf_sttargtsetattrR/RRR	RRRRRRRRRtostpathtexiststconfigtreadStartupConfigtstartupconft
gaftonmodetyumti18nt
dummy_wrapperR>R
tdoLoggingSetupR
t
doPluginSetupt
pluginpathtpluginconfpathtreadMainConfigtrunR9tyumvartgetReposFromConfigtgeteuidtuidtdoFileLogSetuptlogfileR)tdebug(RRERRRORHRRRRRRRR	RRGR((Rt
_getConfigsj

#!











s/dev/logcCsti|||||dS(s
        Perform logging related setup.

        @param debuglevel: Debug logging level to use.
        @param errorlevel: Error logging level to use.
        N(t
logginglevelsRTRRRRR(RRRRRR((RRTscCsti||dS(N(Rbt
setFileLogR]R_(RR]R_((RR^scCs|djoti|d}nt|d|i}t	}y|i|Wn-tj
o!}t|}
ti|
nXx||iD]n}	|	ddgjoqnd}xW|	D]O}|tijoqn|tijoqn|djoqn|}PqW|o-|iid|	||	i|fqny|i||	}Wn4titifj
o}|ii|qnX||_||_ |o||oqny|i"i#|Wqtij
o}|ii|qXqWdS(s-read in repositories from a config .repo fileitvarstmaint	installeds-_.:s!Bad id for repo: %s, byte = %s %dN($trepo_ageR
RJtstattrepofntConfigPreProcessorRRZt
confpp_objtConfigParsertparsertreadfptParsingErrortetstrtmsgR?tConfigErrortsectionstsectiontbadtbytetstringt
ascii_letterstdigitsR(twarningtfindtreadRepoConfigtthisrepot	RepoErrortrepo_config_agetrepofiletvalidateR+tadd(RRiRgRRpRwRmR~RvRuRrRk((RtgetReposFromConfigFilesR
	

&		cCs|ii}|i|ii|x|iiD]}tii	|ii
d|o|ii
d|}ntii|oexbtt
i
d|D]C}ti|d}||jo
|}n|i|d|qWq/q/WdS(s5read in repositories from config main and .repo filesRs	%s/*.repoiRgN(RR9tconfig_file_ageRRtconfig_file_pathtreposdirRJRKRLtinstallroottisdirtsortedtglobRiRhtthisrepo_age(RRRiRR((RR[Ks
!

cCsti|}|i|||i|ip'||_|i	i
td|nt|i|_|ii
|_|ii|ii||_|S(sParse an INI file section for a repository.

        @param parser: ConfParser or similar to read INI file values from.
        @param section: INI file section to read.
        @return: YumRepository instance.
        s8Repository %r is missing name in configuration, using idN(tyumRepot
YumRepositoryRutrepotpopulateRmRR9tnameR(terrorR>t
to_unicodetcachedirtbasecachedirRZtupdatetcfg(RRmRuR((RR}cs
		cCsti|_dS(sDisable yum plugins
        N(R
tDummyYumPluginsR(R((RR,{scCsTt|itiottdnti||||||||_dS(sInitialise and enable yum plugins. 

        Note: _getConfig() will initialise plugins if instructed to. Only
        call this method directly if not calling _getConfig() or calling
        doConfigSetup(init_plugins=False).

        @param optparser: The OptionParser instance for this run (optional)
        @param plugin_types: A sequence specifying the types of plugins to load.
            This should be sequnce containing one or more of the
            yum.plugins.TYPE_...  constants. If None (the default), all plugins
            will be loaded.
        @param searchpath: A list of directories to look in for plugins. A
            default will be used if no value is specified.
        @param confpath: A list of directories to look in for plugin
            configuration files. A default will be used if no value is
            specified.
        @param disabled_plugins: Plugins to be disabled    
        @param enabled_plugins: Plugins to be enabled
        splugins already initialisedN(t
isinstanceRR
t
YumPluginstRuntimeErrorR>t
searchpathRRtconfpathRR(RRRRRRR((RRUs
cCs)titdtidd|iS(Ns8doRpmDBSetup() will go away in a future version of Yum.
R;i(R<R=R>R?R@Rt	_getRpmDB(R((RtdoRpmDBSetupscCs||idjoeti}|iitit	dt
id|ii
|_|iidti|n|iS(s@sets up a holder object for important information from the rpmdbsReading Local RPMDBRsrpmdb time: %0.3fN(RR R
RFtrpmdb_stR)tlogRbtDEBUG_4R>trpmsacktRPMDBPackageSackR9RR`(RR((RRs
"cCs1d|_d|_d|_d|_d|_dS(s>closes down the instances of the rpmdb we have wangling aroundN(R
RR t_tsRR!tcomps(R((RR1s				cCs|`d|_dS(N(RRR
(R((Rt	_deleteTsscCs/titdtidd|i|tS(Ns7doRepoSetup() will go away in a future version of Yum.
R;i(	R<R=R>R?R@Rt	_getReposR~R(RR~((RtdoRepoSetupscCsS|i|o>ti}|ii||iidti|n|iS(sB For each enabled repository set up the basics of the repository. srepo time: %0.3fN(	RR9tdoSetupRFtrepo_stR+R~R)R`(RR~RR((RRs"cCs|`t||_dS(N(RR+R*(R((Rt	_delReposscCs5titdtidd|id|d|S(Ns7doSackSetup() will go away in a future version of Yum.
R;itarchlistR~(	R<R=R>R?R@Rt	_getSacksRR~(RRR~((RtdoSackSetupscCs|idj	o|djo|iSn|djo
d}n|ii|}|iitdt	i	}|pti
i}nh}x|D]}d||<qW|iii||iid||iip|iiSn|ii|_|ii||i|djo|ii}nx(|D] }|i||i|qKW|iid|ii|i|iidt	i	||iS(szpopulates the package sacks for information from our repositories,
           takes optional archlist for archs to includetenabledsSetting up Package Sacksitwhichtexcludespkgsack time: %0.3fN(RR#R
R~trepost	findReposR)R`R>RFtsack_stRtrpmUtilstarchtgetArchListtarchdicttgetPackageSacktsetCompatArchstpopulateSacktexcludeArchstexcludePackagestlistEnabledRtincludePackagesR
RYtbuildIndexestcostExcludePackages(RRR~RRRRR((RRs@






cCsqd|_xa|iiiD]M}t|do|iqti	t
dt
dtiddqWdS(szreset the package sacks back to zero - making sure to nuke the ones
           in the repo objects, too - where it matterst
_resetSacks2repo object for repo %s lacks a _resetSack method
s%therefore this repo cannot be reset.
R;iN(
R
RR#RtvaluesRRARR<R=R>R?R@(RR((Rt	_delSacks
s	cCs)titdtidd|iS(Ns9doUpdateSetup() will go away in a future version of Yum.
R;i(R<R=R>R?R@Rt_getUpdates(R((Rt
doUpdateSetupscCs|io|iSn|iitdti}tii	|i
i|ii|_|i
idjod|i_n|i
ioIti}|iidt|i_|iidti|n|i
i|i_|i
i|i_ti}|ii|iidti||i
io;ti}|ii|iidti|nti}|ii|iidti||iid	ti||iS(snsetups up the update object in the base class and fills out the
           updates, obsoletes and others listssBuilding updates objectiitnewestsup:Obs Init time: %0.3fsup:simple updates time: %0.3fsup:obs time: %0.3fsup:condense time: %0.3fsupdates time: %0.3fN(RR!R)R`R>RFtup_stRtupdatestUpdatestrpmdbt
simplePkgListtpkgSackR9Rt	obsoletestobs_inittreturnObsoletesRtrawobsoletest	exactarcht
exactarchlisttup_pr_stt	doUpdatestobs_sttdoObsoletest
cond_up_sttcondenseUpdates(RRRRRR((RR$s4
*
"


"
cCs2titdtiddd|_|iS(Ns8doGroupSetup() will go away in a future version of Yum.
R;i(	R<R=R>R?R@R
RRt
_getGroups(R((RtdoGroupSetupIs	cCsO|djo5|io'x$|iiD]}t|_q'WqBn||_dS(N(	tvalR
RR+tlistGroupsEnabledRR7tgroups_addedR"(RRR((Rt
_setGroupsPs

c	CsS|io|iSnti}|iititdg}|i
ix|i
iD]}}|io|i|q`n|iptid|ny|i}Wntij
o	}q`X|i|q`W|ii}tid||_x|D]}|ioq	n|iititd||i}|d
j	o#|idot i!|}ny|ii"|WnMti#ti$fj
o5}td|t%|f}|i'i(|q	Xt)|_q	W|ii*djoti#tdn|ii+|i,i-|ii.d	ti||iS(screate the groups object that will store the comps metadata
           finds the repos with groups, gets their comps data and merge it
           into the group objectsGetting group metadatasRepository '%s' not yet setuptoverwrite_groupss%Adding group file from repository: %ss.gzs1Failed to add groups file for repository: %s - %sis%No Groups Available in any repositorysgroup time: %0.3fN(/RR"RFtgroup_stR)RRbRR>treposWithGroupsRRRRRtappendtreadyR?RtgetGroupLocationtgroupremotetRepoMDErrorRpR9Rt	overwriteRtCompst	getGroupst	groupfileR
tendswithtgziptopenRtGroupsErrortCompsExceptionRqRrR(tcriticalRt
compscounttcompileRRR`(	RRpRRRRRRRr((RRYsT







tfgetcCs
|iS(N(RR(R((Rt<lambda>stfsetcCst|d|S(NR+(RIRtvalue(RR((RRstfdelcCs
|iS(N(RR(R((RRscCs
|iS(N(RR(R((RRscCst|d|S(NR#(RIRR(RR((RRscCs
|iS(N(RR(R((RRscCs
|iS(N(RRa(R((RRscCst|d|S(NR(RIRR(RR((RRscCst|ddS(NR(RIRR
(R((RRscCs
|iS(N(RR(R((RRscCst|d|S(NR (RIRR(RR((RRscCst|ddS(NR (RIRR
(R((RRscCs
|iS(N(Rt
_getTsInfo(R((RRscCs
|i|S(N(Rt
_setTsInfoR(RR((RRscCs
|iS(N(Rt
_delTsInfo(R((RRscCs
|iS(N(Rt_getActionTs(R((RRscCs
|iS(N(RR(R((RRscCs
|iS(N(RR(R((RRscCst|d|S(NR!(RIRR(RR((RRscCst|ddS(NR!(RIRR
(R((RRscCs
|iS(N(RR(R((RRscCs
|i|S(N(RRR(RR((RRscCst|ddS(NR"(RIRR
(R((RRscCst}|io_x\|iiD]G}||iijo(d|ii|joq qgt	}q t	}q Wn|o9t
d}|ii
ti||iiddndS(sconvenience function to populate the repos with the filelist metadata
           it also is simply to only emit a log if anything actually gets populatedt	filelistss)Importing additional filelist informationtmdtypeN(R7t	necessaryRRRRRtsacktaddedRR>RrR)RRbtINFO_2R(RRRrR((RtdoSackFilelistPopulates

cCs|iiddodSnd	\}}t|do%|iid|iid}}n|t	d|||fdS(
s^ Output a message that the tool requires the yum-utils package,
            if not installed. Rs	yum-utilsNtttermtboldtnormals5The program %s%s%s is found in the yum-utils package.(RR(RRtcontainsthibegthiendRARtMODEtfuncR>tprog(RR
RR
R((RtyumUtilsMsgs%cCs|o\tid|iioCtd}|ii	||i
|ii	dtidn|i
idti}|i\}}|i|i
idd|d||iio|i|d	j\}}n|iidj	o|iiin|iid|i_|iiof|d	joYg|_ti}|i||\}}|i|i i!d
ti|n|i i!dti|||fS(
sgo through the packages in the transaction set, find them in the
           packageSack or rpmdb, and pack up the ts accordinglyt
yumlibpathsvThere are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.syum-complete-transactionit
preresolvetpostresolvetrescodetrestringisSkip-Broken time: %0.3fsDepsolve time: %0.3fN("tunfinished_transactions_checktmisctfind_unfinished_transactionsRR9t
persistdirR>RrR(RRRFtsleepR
RYtds_sttresolveDepsRRt_limit_installonly_pkgsttsInfotchangedRR
tdropCachedDataRttstskip_brokenR%tsb_stt_skipPackagesWithProblemst_printTransactionR)R`(RRRRRRrR"((RtbuildTransactions2 


	
"c	snd}dd}t}t|}d}xNt	idjo7|djo*|d7}i
itd|ii}ti}
t}xTiD]I\}
}}ii|
ip||||q||
||qWxf|D]^}
i|
}xF|D]>}|i||jo|idjo|q3q3WqW|pC|d7}|djoPqi
idii d	t!ni"t!\}}ti}|
|tjoC|d7}|djoPq>i
id
ii d	t!n|djoCi
idii d	t!i$i"\}}qEqEW|djoi
itd|i
i%td
g}|D]
}||q~}	|	i)x@|	D]8}
tdt*|
|
i+i,f}i
i%|qW|	_.ni
i%dd|fS||fS(s= Remove the packages with depsolve errors and depsolve again cs0|pdSni||||dS(N(tpoRt_getPackagesToRemovetdepTreettoRemovet_remove_from_sack(R&R(R)(RR*(Rt_removescsi|}xz|D]r}|idjo[|joNiidt	|i
i|ii|i
i|qqWdS(NRfs.SKIPBROKEN: removing %s from pkgSack & updates(Rt_getPackagesToRemoveAllArchR&tpkgstpkgtrepoidtremoved_from_sackR)R`RqRt
delPackagetuptpkgtupR(R&R.R-(R0R(RR*siisSkip-broken round %iRfisESKIPBROKEN: resetting already resovled packages (no packages to skip)thardsISKIPBROKEN: resetting already resovled packages (transaction not changed)s0SKIPBROKEN: sanity check the current transactionsSkip-broken took %i rounds s1
Packages skipped because of dependency problems:s    %s from %ss$Skip-broken could not solve problemsN(/R+R*tcounttsett
skipped_poR0Rt
orig_restringtloopingtlenRtpo_with_problemsRR)R`R>R$t
_buildDepTreeR(RtstartTsR)R&twpoterrRLR3t_skipFromTransactiontskippedtskipRR/t
resetResolvedRRtendTst_checkMissingObsoletedtinfot_[1]tptskipped_listtsortRqRtidRrR%(RRRRBR8R9RDR)R(RIR=R+RrR&R7RAR0R>R5R?R*RGRH((RR0R*RR#sz		#

	








!
"

cCsx|iD]}x`|iD]U}|ii|ip9|ii||i}|i
id||ifqqWx^|iD]S}|ii|ip7|i
id|i|f|ii
|iiq}q}Wq
WdS(s 
        If multiple packages is obsoleting the same package
        then the TS_OBSOLETED can get removed from the transaction
        so we must make sure that they, exist and else create them
        s+SKIPBROKEN: Added missing obsoleted %s (%s)s*SKIPBROKEN: Remove extra obsoleted %s (%s)N(RRttxmbrRR.RLR3taddObsoletedR&tobsR)R`tobsoleted_bytremove(RRLR.RN((RREYs

%
cCsg}tiio|tii}	|i\}}}}}x_|	D]F}|||||f}|ii|||||}
|i|
qDWn|i||S(s, get all compatible arch packages in pkgSackN(R-RRtisMultiLibArchRtarchsR&R3tntaRptvtrRRtsearchNevratmatchedtextendR(RR&RTR3RpRSRVR-RURRRX((RR,ls
c
Csg}tii}|i\}}}}}x||D]t}|||||f}|i
i|oFxC|i
i|D]+}	|	i}
|i|
}|i|quWq4q4W|S(N(RARRRRRR&R3RSRTRpRURVRRRLt
getMembersRLR.t_removePoFromTransactionRBRY(
RR&RTR3RARpRBRSRVRLR.RURR((RR@s	cCsrg}|ii|ioR|iidt||ii	|i|i
djp|i|qnn|S(Ns(SKIPBROKEN: removing %s from transactionRf(RBRRRLR&R3R)R`RqRPR/R(RR&RB((RR[scCsNh}xA|iD]6}x-|iD]"}|i|gi|iq WqW|S(s& create a dictionary with po and deps N(	R(RRRLt
depends_ontdept
setdefaultRR&(RR]RLR(((RR<s

$cCs@x9|iD]+\}}|GHx|D]}dG|GHq%Wq
WdS(Ns	(ttreet	iteritemsR.tlRH(RR_RHR.Ra((Rt
_printDepTrees
cCshtd<td<td<td<td<td<td<td<}|i
iti
d	t|ix|iD]v}d
||i|if}|i
iti
|x=|iD]2\}}d||f}|i
iti
|qWq{WdS(NRtinstallttrueinstallteraset	obsoletedt
obsoletingt	availabletupdateds+TSINFO: Current Transaction : %i member(s) s
  %-11s : %s s                   %s : %s(t	TS_UPDATEt
TS_INSTALLtTS_TRUEINSTALLtTS_ERASEtTS_OBSOLETEDt
TS_OBSOLETINGtTS_AVAILABLEt
TS_UPDATEDtstateRR)RRbtDEBUG_2R:RRLtoutput_stateR&Rrt	relatedtotrel(RRrRvRrRLR&((RR$sN	#

cCs|i|xX|ii|iD]A}x8|i|i	D]&}|i||i|||q:Wq#W|i|||dS(s2
        get the (related) pos to remove.
        N(
R)RR&RRRZR3RLRRR.t_getDepsToRemovetdeptree(RR&RxR)RLR.((RR's

cCsx|i|gD]n}xE|ii|iD].}x%|i	|i
D]}|i
|qFWq/W|i
||i|||qWdS(N(RxtgetR&R]RRRZR3RLRRR.R)RRw(RR&RxR)R]RLR.((RRws
c	Cs|iid|iio@tid}|o&yti|WqYd}qYXq]n|ii|i
d}|iioyti|WqqXnti
}d|_|d
jonIt|djo)td}|ii|d|_n
ti||iip|inxzdD]r}t||o\t||}yti|Wqtt fj
o#}|i"i#td|qXq.q.W|i$i%|iid	|S(s6takes an rpm callback object, performs the transactiontpretransiRsIWarning: scriptlet or other non-fatal errors occurred during transaction.it	ts_all_fnt
ts_done_fns$Failed to remove transaction file %st	posttransN(R{R|(&RR
RYR9t
reset_niceRJtnicetoniceR tcbtcallbackterrorsRt
GenericHoldertresultobjecttreturn_codeR
R:R>t	errstringR)R`R?tYumBaseErrort	keepcachetcleanUsedHeadersPackagestiRAtgetattrRtunlink_ftIOErrortOSErrorRpR(RRR(	RRRRpRRRRR((RtrunTransactionsJ

		


'
c
Csfh}x$|iiD]}d||i<qWt|djodSnd}h}xI|i	D]>}|i|ipg||i<n||ii
|qaWx|iD]}t|djoqn|i||dii}xn|dD]b}	|	ii|joItd|	|	iif}|iiti||	iii|	qqWqWdS(swexclude packages if they have an identical package in another repo
        and their repo.cost value is the greater oneiNcCsg|ii|iijodSn|ii|iijodSn|ii|iijodSndS(Niii(RTRtcosttb(RTR((Rt
_sort_by_costsisexcluding for cost: %s from %s(tcostsRRRRVRR:RtpkgdictRR&thas_keyR3RRR-RJRtlowcostR.R>RKRrR)RRbtDEBUG_3RR1(
RRRR-RRrRRVR&R.((RRs4	


cCsYd|iijodSn|p1d|iijodSn|ii}d}n4|i|iijodSn|i	}|i}t
|djodSn|p |iit
itdn#|iit
itd|i|ii|d|dt}x4|D],}|iid	||iii|qW|iit
id
dS(sremoves packages from packageSacks based on global exclude lists,
           command line excludes and per-repository excludes, takes optional 
           repo object to use.tallNReis)Excluding Packages in global exclude listsExcluding Packages from %stpatternstignore_casesExcluding %stFinished(RR9tdisable_excludesRRtexcludelistR
R/RKtgetExcludePkgListR:R)RRbRR>RR#treturnPackagesR7R-R&R`RR1(RRR&RR-R/((RR(s2
	 
c
Cs:|i}t|djodSn|ii|i}t	||dd\}}	}|i
ititd|ig}t||	}xH|D]@}||jo |i
itd|qq|i|qWx:|D]2}|i
itd||iii|qW|i
ititddS(	szremoves packages from packageSacks based on list of packages, to include.
           takes repoid as a mandatory argument.iNt	casematchis%Reducing %s to included packages onlysKeeping included package %ssRemoving unmatched package %sR(RtgetIncludePkgListtincludelistR:RRRRKtpkglistt
parsePackagest
exactmatchRXt	unmatchedR)RRbRR>RtrmlistR6tkeeplistR&R`RRR1(
RRRR&RRRRRRX((RRQs*
cCs|iidjodSn|ii}|d|}tii|}t	ti
}x|i||dpt
|d}yt|i}Wn tj
o|i|q\X|ti
joPnyti|dWn_tj
oS}|dtijo|i|qstd|}tid||q\Xtd||f}tid||q\W||_dS(	sAperform the yum locking, raise yum-based exceptions, not OSErrorsiNRiRVs#Unable to check if PID %s is activeis4Existing lock %s: another copy is running as pid %s.(RR9R]RRtlockfileRJRKtnormpathRqtgetpidtmypidt_lockRtfdtinttreadlinetoldpidt
ValueErrort_unlocktkillRRpterrnotESRCHR>RrR?t	LockErrorR$(RRRRRRRrRp((RtdoLockrs4cCst|dp|iidjodSn|dj	o|ii}|d|}n"|idjodSn
|i}|i	|d|_dS(sdo the unlock for yumR/iNR(
RARR9R]RR
RRR$R(RRR((RR2s#
	
RicCstii|}yTtii|pti|ddnti|titi	Bti
B|}Wn6t
j
o*}|itijp
|ndSn#Xti||ti|dSdS(Ntmodeiii(RJRKtdirnametfilenametlockdirRLtmakedirsRtO_EXCLtO_CREATtO_WRONLYRRRRrRtEEXISTtwritetcontentsR0(RRRRRRRr((RRs*
	
cCsti|dS(N(RRR(RR((RRscCs0t}t|tijo
|i}n||ijo
||_	n|i
p
t}n6t|ii|}|i|ijo
t}n|oti|d}t|i}||jo9|iio+|i|iioti|qn|otdtdq,tSntS(sverifies the package is what we expect it to be
           raiseError  = defaults to 0 - if 1 then will raise
           a URLGrabError if the file does not check out.
           otherwise it returns false for a failure, true for successiis(Package does not match intended downloadN( R7tfailedttypetfottypestInstanceTypeRR&tlocalPkgt	localpathtverifyLocalPkgRtYumLocalPackageRRt
readOnlyTStylpR3RJRhtcursizetlongtsizettotsizeRR8t
startswithRtunlinkt
raiseErrortURLGrabErrorR>(RRR&RRRRR((Rt	verifyPkgs*




cCspyti||}Wn-tij
o}tdt	dnX||jotdt	dndS(sHVerify the checksum of the file versus the 
           provided checksumisCould not perform checksumisPackage does not match checksumiN(RtchecksumtchecksumTypeRtfilesumR?t	MiscErrorRpRR>tcsum(RRRRRRp((RtverifyChecksums
csd}hd}|iidd|t}g}
d}x|D]}	t|	do|	i
djoqJn|	i}tii|or|i||	tp8|	iio't}||	td|	iiqq|iitd	|	fqJn|
i|	||	i7}|iip|ooSqJqJW|
i|tti d
o't!|
djoti i"|nt#i#}d}d}x|
D]}	|	i}|d7}tii|o|i||	to[|iitd	|	f||	i8}tti d
oti i"||qqntii'||	ijoti(|qn|i|	dfhf}
ti*|	ii+}|i-|i.t/|	ijoF||	td|	ii+t0|i-|i.t0|	ifqny|djo1|o)||	ijotii1|	i2}n)d
|t!|
tii1|	i2f}|	ii4|	d|
d|d|	ii5dj}||	i7}tti d
oti i"||nWn+t7i8j
o}||	t:|qX||	_;i<|	o|	=qqW|dj	oo||
||n|iidd|dS(NcCs|i}|i}|djo|djo|i|iSn|djodSn|djodSn||jodSn||jodSndS(Niii(tapot
getDiscNumRTtbpoRR
R(RRRTR((Rt	mediasorts



csi|gi|dS(N(RR^R&RRr(R&Rr(R(RtadderrorstpredownloadRitpkgtypetlocals4package fails checksum but caching is enabled for %ssusing local copy of %sttext_meter_total_sizeisKInsufficient space in download directory %s
    * free   %s
    * needed %ss(%s/%s): %st	checkfuncttextR8tnonetpostdownloadR(?RRRRR
RYRR7trepo_cachedtremote_pkgstremote_sizeR&RARRRRJRKRLRRR8RR>RKR)R`RRR9RJt
urlgrabbertprogressR:RRFtbeg_downloadRt
local_sizetgetsizeRRtstatvfstpkgdirtdirstattf_bavailtf_bsizeRt
format_numbertbasenametrelativepathRt
getPackagethttp_cachingtmylocalR?RRpRqRRtcallback_totalR
(RRRRRRRRRR&RRRpRRRRRRR((RRtdownloadPkgss	 
%


&

 ?%(
	cCst|tijo
|i}nyti|}|d}Wn@ti	t
fj
o+|otdt
dqdSnXt|}|i|ijo"|otddqdSndS(s/check the header out via it's naevr, internallyiisHeader is not complete.s'Header does not match intended downloadiN(RRRRRtrpmtreadHeaderListFromFilethlistthdrRt
IndexErrorRRR>tYumInstalledPackagetyipR3R&(RRR&RRRR((RtverifyHeaderms 
	c
Cst|do|idjodSnh}|i}	|ii|i	}tii
|	oRy|i|	|dd}Wn"tj
o}ti|	qX|	|_dSn+|iiotitd|in|io|ii|inyjtii
|ipti|in|i|dfhf}|i |d|d|i!d	j}Wn_tij
oP}|}yti|	Wn!t#j
o}ti|qXti|nX||_dSdS(
swdownload a header from a package object.
           output based on callback, raise yum.Errors.YumBaseError on problemsRRNRisKHeader not in local cache and caching-only mode enabled. Cannot download %sRR8R($RAR&RRtlocalHdrRRRtgetRepoR/RRJRKRLRtresultRRpRRthdrpathR9R8R?RR>t
dsCallbacktdownloadHeaderRthdrdirRRt	getHeaderRtsaved_repo_errorR(
RR&RRpRRRRRR((RRs@ 	

	c
Cst|do&|idjo|ii}d}n*|ii	|i
}|i}|i}|o'|i
i}tii||i}tii|i}|djod}d}	q|djo+|o
d}nd}td|}	q|djod}td|}	q|d	jo1|o
d}nd}d}td
|}	q|djod}td|}	qn
d}d}	||	fS(s
        Take a package object and attempt to verify GPG signature if required

        Returns (result, error_string) where result is:
            - 0 - GPG signature verifies ok or verification is not required.
            - 1 - GPG verification failed but installation of the right GPG key
                  might help.
            - 2 - Fatal GPG verifcation error, give up.
        RRiRiis"Public key for %s is not installedsProblem opening package %sis Public key for %s is not trustedisPackage %s is not signedN(RAR&RRR9tgpgchecktcheckt	hasgpgkeyRR
R/RtgpgkeyRRR Rt	miscutilstcheckSigRt	sigresultRJRKRtlocalfnRRrR>(
RR&RRR RRRRRr((RtsigCheckPkgsD	 
	







cCsg}x|iD]}|iitjoqn|iidjoqn|iii	|iipqn|ii|ii}t}x,|i
D]!}|idot}PqqW|o|i|iigq|i|ii|iigqWx|D]}tii|pqnyti|Wn1tj
o%}|iitd|qqX|ii t!i"td|qWdS(NRfsfile:sCannot remove %ss
%s removed(#tfilelistRRRLR&RrtTS_INSTALL_STATESR/RRRR7RtbaseurltuRRRYR	RRRJRKRLRRRRpR(R{R>R)RRbR(RRRRLRRRpR((RRs<

	)cCsdg}|i|ddS(NRRtheader(textsRt_cleanFiles(RR ((RtcleanHeaderss	cCsdg}|i|ddS(NRRtpackage(R RR!(RR ((Rt
cleanPackagess	cCsddg}|i|ddS(Ntsqlites
sqlite.bz2R(R RR!(RR ((RtcleanSqlitescCs(dddddg}|i|ddS(Nsxml.gztxmltcachecookiesmirrorlist.txttascRtmetadata(R RR!(RR ((Rt
cleanMetadatascCsddg}|i|ddS(NR(smirrorlist.txtRR*(R RR!(RR ((RtcleanExpireCache scCs-g}d}
xv|D]n}xe|iiD]T}t||}	ti
i|	o,ti
i
|	oti|	||}q)q)WqWx|D]z}yti|Wn4tj
o(}|iitd||qqX|iititd|||
d7}
qWtd|
|f}d|gfS(NisCannot remove %s file %ss%s file %s removedis%d %s files removed(RtremovedR textRRRRRtpathattrRKRJRLRRtgetFileListtitemRRRpR(RR>tfiletypeR)RRbRRr(RR R/R2RRR1R.RrRKR-Rp((RR!$s*&!Rc-Cs~|djo|ii}nti}g}g}g}(g}g}g}g}g} g})|}|djoh}h}x|iid|d|D]b}|||i<|oqn|i|if}||jp|i||o|||<qqW|i}|o|i id|d|}n?y|i i"d|d|}Wnt#i$j
o
g}nXx|D]}
|o2|
i|jo|(i&|
q(|i&|
qw|
i|
if}|
i|jo|(i&|
qw||jp|
i||o|i&|
qw|i&|
qwWn|djox|i'i(D]\}}!}$}*}|i i.d|d|!d|$d|*d	|}t0|d
jo8|i&|d|i1i2t3i4t5d|dqMt0|d
jo|i&|dqM|i1i2t3i4t5d
||!|$|*|qMWn|djo|iid|d|}n|djoN|o|i id|d|}n?y|i i"d|d|}Wnt#i$j
o
g}nXxT|D]}
|o8|ii6d|
o|(i&|
q|i&|
q|ii.|
id|
i}|ot8|dt9d},n|p|
i|,o|i&|
q|
i;|,o|(i&|
q|i&|
qWnn|djor|i i<d|d|}t=|}x6|iid|d|D]'}|i|jo|)i&|qqWn|djod
|i_
x|i'i>D]\}"}+|"\}}!}$}*}|i i.d|d|!d|*d	|d|$}|iiA|+d}&x.|D]&}|i&||i&||&fqWqdW|otC||d|\}'}}|'|}t=|}	g}#x;|D]3\}}&||	joqFn|#i&||&fqFW|#}n|pftI|}t=|}g}#x;|D]3\}}&||joqn|#i&||&fqW|#}q)n2|djo$tKiK}
|
|iid}h}%|o|i id|d|}n?y|i i"d|d|}Wnt#i$j
o
g}nXx`|D]X}tO|iP}||jo6|%iR|p|g|%|<q|%|i&|qqWx4|%D](}x|%|D]}| i&|q
WqWn||_||_	|(|_
||_||_||_
||_| |_|)|_|S(sBgenerates lists of packages, un-reduced, based on pkgnarrow optionRRRRRRtepochtverRviis,More than one identical match in sack for %ss*Nothing matches %s.%s %s:%s-%s from updateRfRhR&treversetextrasRRtrecentiQN(TtshowdupsR
RR9tshowdupesfromreposRRtyghRfRhtreinstall_availablet
old_availableRRtobsoletesTuplesR7R6Rtict	pkgnarrowtdinsttndinstRRRR&R3RRtkeytverGTRRtavailtreturnNewestByNameArchR?tPackageSackErrorR.RR2tgetUpdatesListRSRTRpRURVRWtmatchesR:R)RRbtDEBUG_1R>R	tipkgsRRtlatesttverEQRR6tgetObsoletesTuplestinstTupR-tsearchPkgTupletinstpoRRRXRtmatched_obsoletestnobsoletesTuplestpackagesNewestByNameArchtfiltRFtnowtrecentlimitt	ftimehashRtfiletimetftimeRtsometime(-RR?RR8RRARZRTR:RQR.R>RSRURRDRVRYRRVR<RXR&R-RhR@RHR=RRBRfRJR7RTR3RRRpRWRPRR;R6RURNRK((RtdoPackageLists:sD



!!
	$




-






									cCsh}x|D]}h||<|i}|i||}xq|D]i}|\}}}	|idoqAng}
x*|i|||	D]}|
i|qW|
||<qAWq
W|S(s
        Return the dependencies for a given package object list, as well
        possible solutions for those dependencies.
           
        Returns the deps as a dict of dicts::
            packageobject = [reqs] = [list of satisfying pkgs]
        srpmlib(N(tresultsR-R.trequirestreqsRJt
pkgresultstreqRVtfRURt
satisfiersRtwhatProvidesR&R(RR-R_RaR`R\R^RVR.RURbR&((RtfindDepss&
	

c	#s(g}x@D]8}ti|o|it|q
|i|q
Wh}
h}g}g}	x|D]}|	i|qhWghx1|D])}i|i||i<qWx3|iiiD]}|i|i||	qWd}||||iidt}|i|||~tid}|o
d}nh}xtt |D]}xt ||d|D]z\}
}}|o |
i&|
i'f|joqn|o|
||fVn|
|fV|pd||
i&|
i'f<qqWqWdS(sGenerator method to lighten memory load for some searches.
           This is the preferred search function to use. Setting keys to True
           will use the search keys that matched in the sorting, and return
           the search keys in the results. c	sx|D]\}}t}g}||jog||<nxyD]q}xhD]`}tt||}|o>|ii|djo"|i||i|qQqQWqDWt|djo||i|||fqqWdS(Nii(ttmpresR&R5R6ttmpkeyst	tmpvaluestsorted_liststreal_crit_lowertstfieldstfieldRRRtlowerR|RRtrcl2cR:(	ReRhR5RfRgRR&RlRj(RnRkRi(Rtresults2sorted_lists;s 	
#
tloweredicCs+ddit|dt|dfS(Ns%s%stii(tjoinRtxRq(Rs((RRZsRBiN((t
sql_fieldsRkRat
RPM_TO_SQLITERRtmatched_valuesRhRet	real_crittcriteriaRjRiRnRmRRtsacksRRRYt"searchPrimaryFieldsMultipleStringsRoRRR1toperatort
itemgettert	sort_functkeystyieldedtreversedRRR&tkstvsR8RR(RRkRxR8R~RRRiRRwR&RRoRvRtRaR}RnRhRRjRe((RkRiRnRtsearchGenerators\



!
cCstitdtiddh}|i||}x[|D]S\}}|o|||n|i|pg||<n||i|q>W|S(sSearch specified fields for matches to criteria
           optional callback specified to print out results
           as you go. Callback is a simple function of:
           callback(po, matched values list). It will 
           just return a dict of dict[po]=matched values listsosearchPackages() will go away in a future version of Yum.                      Use searchGenerator() instead. 
R;iN(R<R=R>R?R@RHRRRkRxt	match_genR&tmatched_stringsRRRY(RRkRxRRRRHR&((RtsearchPackagesjsc	Csh}x|D]}t|}ti|p+t}|ddjo
t}qt	}n=t	}|ddjoti|do
t}nt	}|pt	}|i|}nt}|ii|t}|iititdt|x|D]}|iititd|g}|o|i|n|o|o|i|n|om|of|iititdxG|i|i|iD]*}ti||o|i|qqWn|iititdx|iD]{\}
}\}}	}
ti%|
|||	|
ff}|p;ti|
|pti||o|i|quqqWt|djoI|o4|o|o||||q|||n|||<qqWq
Wddd	g}x|D]}ti|p+t}|ddjo
t}q@t	}n
t	}t	}|p|i*|}t	}x|D]}g}td
t|}|i|t|djoA|o,|o||||q|||n|||<qcqcWqt}|i,}x|D]}g}g}xe|D]]}t/||}|djoqnt2|t3i4jo|i5|q|i|qWx2|D]*}ti||o|i|qqWt|djo&|o|||n|||<qqWqW|S(NiRsSearching %d packagesssearching package %sssearching in file entriesssearching in provides entriesRtdirnamestprovides_namessProvides-match: %s(7RHtargsRHRRtre_globR7tisglobt	canBeFileRt
usedDepStringRtreturnPackagesByDeptwhereRt	searchAllR)RRbRIR>R:R&RsRgRtdirlistRt	ghostlisttthisfiletfnmatchtprovidestp_nametp_flagtp_etp_vtp_rtprco_tuple_to_stringtprovRtcallback_has_matchforttaglisttreturnInstalledPackagesByDepRrRt
searchlistttagRttagdataR
RRtListTypeRYR1(RRRRRRRRRHRRRR1RRRrR&RRRHRgRRRR((RtsearchPackageProvidess

&



!&


	
cCsg}g}|iidjotitdn|djo|ii
}n#|iidi
|d|}x|D]z}|io7|o|io|i|qq|i|q{|o|io|i|qq{|i|q{Wt|t|fS(sreturns two lists of groups, installed groups and available groups
           optional 'uservisible' bool to tell it whether or not to return
           only groups marked as uservisibleis3No group data available for configured repositoriest,tcase_sensitiveN(RfRhRRRR?RR>RR
tgroupstgrpst
return_groupsRrRtgrptuservisibletuser_visibleRR(RRRRRhRRfR((RtdoGroupListss*




c	Csg}|ii|}|ptitd|nx}|D]u}t
|_|i}xZ|iD]O}|id|dt
}|i|x!|D]}|ii|iqWqbWq@W|S(s1mark all the packages in this group to be removedsNo Group named %s existsRtsilence_warningsN(ttxmbrs_usedRRRtgrpidtthesegroupsR?RR>t	thisgroupRttoremovetpackagesR-R.RPttxmbrsRYRLRRtgroupid(	RRRRRRR-RLR.((RtgroupRemoves"		

cCs.|ii|}|ptitd|nx|D]}t	|_
|i}x|iD]}x|iD]}|ii|jo|iitjoy|ii|Wn;tj
o/|iititd|i|qlnXt|idjo|ii|iiqqlqlWq\Wq:WdS(s3unmark any packages in the group from being removedsNo Group named %s existss%package %s was not marked in group %siN(RRRRRR?RR>RR7RRR-R.RRLR&RRrRRRPRR)RRbRIR:R3(RRRRR-RLR.((Rt
groupUnremove/s,		

&cCs|ii|ptitd|ng}	|ii|}|ptitd|n|i
i}|o
|}nx=|D]5}
|
ioqnt|
_g}d|jo|i|
ind|jo|i|
ind|jo|i|
inx|D]}|iititd||
iy|id|}Wn1tij
o"}|iitd|qX|	i|x!|D]}|i!i"|
iqWqW|i
i#}
|d
j	o
|}
n|
ox|
i&i'D]\}}|i*|oy|id|}Wntij
o
qn)X||i+i,jog|i+i,|<n|	i|x;|D]3}|i!i"|
i|i+i,|i"|i-qWqn|i.i/d|}|ot0i1i2ou|i
i3djo^g}t0i1i5}|i"d	x/|D]'}|i1|jo|i"|q-q-W|}qfnt7|}|i+i,i8|pg|i+i,|<n|i+i,|i|qqWqqW|	S(s\mark all the packages in the group to be installed
           returns a list of transaction members it added to the transaction 
           set
           Optionally take:
           group_package_types=List - overrides self.conf.group_package_types
           enable_group_conditionals=Bool - overrides self.conf.enable_group_conditionals
        sNo Group named %s existst	mandatorytdefaulttoptionalsAdding package %s from group %sRs-No package named %s available to be installedtbesttnoarchN(9RRt	has_groupRR?RR>RRRR9tgroup_package_typest
package_typesRtselectedRR-RYtmandatory_packagestdefault_packagestoptional_packagesR.R)RRbRsRRcRtInstallErrorRpR`RLRRtenable_group_conditionalstgroup_conditionalsR
tconditional_packagesR`tcondreqtcondtisPackageInstalledRtconditionalsR&RRWRRRQtmultilib_policytusetlegitMultiArchesInSameLibRRSR(RRRRRRR.RRRRR-RRRRpRRL((RtselectGroupJs

	







'cCs|ii|ptitd|n|ii|}|ptitd|nx$|D]}t
|_x
|iD]}x|iD]}|ii|jo|iitjoy|ii|Wn;tj
o/|iititd|i|qnXt|idjoS|ii|iix:|iii|igD]}|ii|iqVWq{qqWqWqgWdS(s1de-mark all the packages in the group for installsNo Group named %s existss%package %s was not marked in group %siN( RRRRR?RR>RRRR7RRtpkgnameRRLR&RRrRRRPRR)RRbRIR:R3RRyR.(RRRRLRR.R((Rt
deselectGroups4	

&cCsx)|iD]}|i|jo|Sq
q
W|ii|}t|djo ti	t
dt|nt|djo|d}n|d}|S(sretrieves a packageObject from a pkgtuple - if we need
           to pick and choose which one is best we better call out
           to some method from here to pick the best pkgobj if there are
           more than one response - right now it's more rudimentary.is2Package tuple %s could not be found in packagesackiN(
RR-R&R3RROR-R:R?tDepErrorR>RqR(RR3R-R&R((RtgetPackageObjects
 
cCs9titdtidd|ii|d}|S(s;returns a YumInstallPackage object for the pkgtup specifiedsKgetInstalledPackageObject() will go away, use self.rpmdb.searchPkgTuple().
R;iiN(
R<R=R>R?R@RRROR3R&(RR3R&((RtgetInstalledPackageObjects
cCs|iid}tii|odSntii	d|ii
}|it
it
iB|idd}|i}~~|djodSnWtii|}tii|pti|nt|d}|i~dSdS(	sbchecks for the presence of gpg keys in the rpmdb
           returns 0 if no keys returns 1 if keyss/.gpgkeyschecked.yumiRRs
gpg-pubkeyitwN(RR9RtgpgkeyscheckedRJRKRLRttransactiontinitReadOnlyTransactionRtmytstpushVSFlagsRt_RPMVSF_NOSIGNATURESt_RPMVSF_NODIGESTStdbMatchtidxR5R~RtmydirRRRR0(RRR~RRRR((RtgpgKeyChecks&

c	Csg}t|tijo|\}}}n|}d}d}|ddjoc|i	}t|djo@|\}}}|t
jotitdnt
|}qn|i|||}|i}|S(s~Pass in a generic [build]require string and this function will 
           pass back the packages it finds providing that dep.iRisInvalid version flagN(R\Rt	depstringRt	TupleTypetdepnametdepflagstdepverR
tsplitt	dep_splitR:t
flagsymboltSYMBOLFLAGSR?RR>RRcRR(	RRRRR\RRRR((RR	s"
cCsy|i|}Wn,tij
otitd|nXt|}|i	|i
}|djotitd|n|S(sPass in a generic [build]require string and this function will 
           pass back the best(or first) package it finds providing that dep.sNo Package found for %sN(
RRRRR?RR>tListPackageSacktpst_bestPackageFromListRERR
(RRRRR((RtreturnPackageByDep#	s
cCst|tijo|\}}}n|}d}d}|ddjoc|i}t
|djo@|\}}}|tjot
itdnt|}qn|ii|||iS(sPass in a generic [build]require string and this function will 
           pass back the installed packages it finds providing that dep.iRisInvalid version flagN(RRRRRRRR
RRR:RRR?RR>RRtgetProvidesR~(RRRRRRR((RR3	s
cCsXt|djodSnt|djo|dSn|i|d}|ddS(stake list of package objects and return the best package object.
           If the list is empty, return None. 
           
           Note: this is not aware of multilib so make sure you're only
           passing it packages of a single arch group.iiN(R:RR
Rt_compare_providerstbestlist(RRR((RRM	scCsg}tii|}g}	g}g}x}|D]u}|i|joq1q1|idjo|i
|q1tiid|io|	i
|q1|i
|q1W|i
|	}|i
|}
|i
|}|o+|o$|
o|i|
ijo
d}
n|djo4|o|i
|n|
o|i
|
qn|oj|i
||g}
|
idjo|i
|q|o|i
|n|
o|i
|
qn\|
oG|i
|
|g}
|
idjo|i
|q|i
|
n|i
||S(sTakes a list of packages, returns the best packages.
           This function is multilib aware so that it will not compare
           multilib to singlelib packagesRRN(t
returnlistRRRtcompatArchListtmultiLibt	singleLibRRR&RRQRRtmultitsingletnotsingle_nameRR
R(RRRRRRR&RRRRRRR((RtbestPackagesFromList^	sP(


c
s|iiig}|iio|i}g}x6|D].}t
i|dp|i|qEqEW|o
|}nt
|djoH|d}g}|D]&}|d|djo||qq~}nt
|djoYd}|i||d}g}|D]!}|||p||q!q!~}nt
|djo)dd}	|i|	n|d}|i|}
|
SndS(s Given a package return the package it's obsoleted by and so
            we should install instead. Or None if there isn't one. iicCsI|\}}}
}}|\}	}}}}t|
||f|||fS(N(
Rstn1ta1te1tv1tr1tytn2ta2te2tv2tr2t
compareEVR(RsRRRRRRRRRRR((Rt	_sort_ver	scCsDt||}|pdSnt||}|pdSn||S(Ni(tarchDifferencetcarchRtres1Rtres2(R	RRRR
((Rt_sort_arch_i	sc
sm|\}	}}}}|\}
}}}}i||}|o|Sntii||}|S(N(RsRRRRRRRRRRRRR&RtretRtgetBestArch(
RsRRRR
RRRRRRRR(RR&(Rt
_sort_arch	sN(RR2tcheckForObsoleteR&R3tthispkgobsdictRRgtoobsoletingtopkgtuptcanCoinstallRRR:tfirstRGRRJRRRtobsoleting_pkgR
(
RR&RRRRGRRgR3RRRR((R&RRt_pkg2obspkg	s6


>	

9	
cCs|}t}xto||}|djo|odSn|djo|Sn||}|djo|Snt}||}||jodSqqWdS(s Generic comp. sci. test for looping, walk the list with two pointers
            moving one twice as fast as the other. If they are ever == you have
            a loop. If loop we return None, if no loop the last element. N(tnodetslowR7tdoneRt	next_functnextR
(RRRRRR((Rt
_test_loop	s"


cCs|ddjpt|d}g}xu|ii|D]a}y#|i|i	}|i|Wq;ti
ij
o#|iitd|q;q;Xq;W|S(sD Do groupinstall via. leading @ on the cmd line, for install/update.it@is!Warning: Group %s does not exist.N(tpatterntAssertionErrortgroup_stringt	tx_returnRRRtgroupRRRRYRQR?RR(RR>(RRR#RR"R!((Rt_at_groupinstall	s
cCs|ddjpt|d}g}y|i|}Wn2tii	j
o |i
itd|nX|i
||S(s; Do groupremove via. leading @ on the cmd line, for remove.iRisNo group named %s existsN(RR R!R"RRRRQR?RR(RR>RY(RRRR"R!((Rt_at_groupremove	s

cCs|ddjpt|d}|ii|}|ptit	d|nt
}x|D]}|i
|iqeW|ii|S(s8 Do downgrade of a group via. leading @ on the cmd line.iRisNo Group named %s existsN(RR RRRRRR?RR>R6tpkgnamesRRRRtsearchNames(RRRR&RR((Rt_at_groupdowngrade	s
	ccs[xT|iid|iD]:\}}|i|jo|ii	|d}|VqqWdS(s; Return the pkgs. that are obsoleted by the po we pass in. RiN(RR2tgetObsoletersTuplesR&Rtobstuptinst_tupR3RROt
installed_pkg(RR&R,R*R+((Rt_find_obsoletees
scGs?x8|D]0}||iijo|iii|qqWdS(sB Add all of the passed flags to the tsInfo.probFilterFlags array. N(tflagstflagRRtprobFilterFlagsR(RR.R/((Rt_add_prob_flags
s
cKsg}t}	|oGt|tpt|to|i|qti	t
dn?|pti	t
dn|ido+|dddjo|i|dSnt}	|dg}
|iid|
dt}|i||p|d}|iit
d|y|i|}Wn5tiij
o#}|iit
d	|qX|o*ti|o|i |d
t}n|o|i|qqnQ|i!|}|ii#d|dd|dd
|d
d|dd|d}|ot$i%i&o|	p|d
o|i'i(djoh}g}g}t$i%i,}|idxI|D]A}|i%|jod||i/<|i|qt|i|qtWx/|D]'}|i/|jo|i|qqW|}qqnt0|}h}xI|D]A}|i|i/p|g||i/<q||i/i|qWg}x*|i3D]}|i|i |qnW|}n|pd|jo&|i4id|dgdt}nd|jo|i4i#d|d}nto.x+|D]}|ii5t
d|q
Wn|ogSnti	t
dng}
xX|D]P}|i7i8d|i9ob|i7i:|i9t;oE|ii<t=i>t
d||
i|i7i?d|i9qcqn|i@iAi|i9o&|iBd|}|
i|qcn|iD||iE}|dj	o<|ii5t
d|i/|i/||iHd|qcn|i4iId|o=|i7i:|i9tJp |ii5t
d|qcqn|iK|pt}xS|i4i#d|i/d
|i%D]0}t}|i7i:|i9tJot}PqqW|p?|ii5t
d||iBd|}|
i|qcqnx|i4i#d|i/d
|i%D]o}|iN|o4|iOtPiQtPiRtPiS|i7iT|i9Pn|iU|o|iOtPiVPqqW|i9|i@iWd|i/joSxo|iX|D];}|i7iZ||}|i7i\|||
i|qQWqc|i7i]|}|
i|qcW|
S(stry to mark for install the item specified. Uses provided package 
           object, if available. If not it uses the kwargs and gets the best
           packages from the keyword options provided 
           returns the list of txmbr of the items it installs
           
           s0Package Object was not a package object instancesNothing specified to installRiRRRs3Checking for virtual provide or file-provide for %ssNo Match for argument: %sRRR3RR4tversionRvtreleaseRRis&Package %s installed and not availables"No package(s) available to installR3s)Package: %s  - already in transaction setR&s;Package %s is obsoleted by %s, trying to install %s insteads/Package %s already installed and latest versions;Package matching %s already installed. Checking for update.N(^R-R7twas_patternR&RtYumAvailablePackageRRR?RR>RERRR$RtpatsRRtmypkgsRYRHR)R`RRQRRpR(RRRRt_nevra_kwarg_parset
nevra_dictRWRRRQR9Rtpkgs_by_nameRt	not_addedRRR.RRSt	pkgbynametlstRRR{R"RRLR3tgetMembersWithStateRRRbRIRZR2t
updating_dictRRRRRR
RcR	tTS_REMOVE_STATEStallowedMultipleInstallstfoundtipkgRLR1RtRPMPROB_FILTER_REPLACEPKGtRPMPROB_FILTER_REPLACENEWFILEStRPMPROB_FILTER_REPLACEOLDFILESRPRCtRPMPROB_FILTER_OLDPACKAGEtgetObsoletesListR-t	obsoleteet
addObsoletingRLRMt
addInstall(RR&RER=R.RHR7RRR4R"R-R;R6RRIRLR<RpRBR:R9RCR((RRc
s 


	





!

"	
"
	"c
Cst|id}	t|id}x|	i|D]}|i	i
|}xz|D]r}xi||D]]}|id|pD|i|if}x*|ii|D]}|id|qWPqjqjWqYWq:WdS(s Check for any difference in the provides of the old and new update
            that is needed by the transaction. If so we "update" those pkgs
            too, to the latest version. RR&N(R6topkgt
returnPrcotoprovstnpkgtnprovst
differenceRRRtgetRequiresR^R.R`tinPrcoRangeRRtnaTupRRER(
RRLRORPR`RRTR^R.RN((Rt_check_new_update_provides
s cCst}x|ii|tgD]}d}xx|i	D]m}|i|o|d7}q5xF|ii
|iD]/}|ii|i
i|i|i
|qoWq5W|o
t}q|ii|i
iqW|S(s We return True if there is a newer package already in the
            transaction. If there is an older one, we remove it (and update any
            deps. that aren't satisfied by the newer pkg) and return False so
            we'll update to this newer pkg. iiN(R7RBRRR>R3RqRLR5t
updated_byR&t
available_pkgtverLERZtntxmbrRPRUR(RR3RWR5RYRLRBR&((Rt_newer_update_in_trans
s$

c$Ks)	g}|ob|oZ|iititd|i	i
}|ii
o|i	idd}ng}x|D]~\}}	|i|}
|ii|	d}|ii|
|}|ii||
|o|i|n|i|qtWxo|D]g\}}|iid|o#|iititd|q|i |i!d|i|qW|Sng}g}|o2|i$djo|i|qD|i|n|i%d	o|d	dd
jo|i&|d	Sn|d	}|p|ii)d|g}n|i*i)d|g}|o|og}y-|o|i,|}n|i-|}Wn5t.i/i0j
o#}|i2i3td|nX|o|i |q|i |ny7|o
g}n#|d	g}|i*i6d|}Wnt/i7j
o
g}nX|i ||o&|o|i2i3td
|qDn|i8|}!|ii:d|!dd|!dd|!dd|!dd|!d}|p|i*i:d|!dd|!dd|!dd|!dd|!d}t;|djo(|i<||}t=d|}qDn|ii
obx|D]{}|i	i>i?|i@g}g} |D]}| |i|q~ }x-tE|D]}
|i |iFd|
qWqXWx|D]}x|i	iHi?|i@gD]}
|iJ|
}#|ii||#}|o|i|n|i||ii|
o#|iititd|
q|ii|#|}|i|qWqWnxY|D]Q}xH|i	iLi?|i@gD]+}|i|}|ii|i@o&|iititd|i@q|i@|i	iNd|iOjo~x|iP|D]f}|iiR||}|o|i|n|ii|||ii|||i|q_Wq|iiR||}|o|i|n|i|qWqWx|D]}x|i	iSi?|i@gD]}|ii|o#|iititd|q8|iU||o#|iititd|q8|ii|d}|iiR||}|o|i|n|i|q8W|ii:d|iOd|iW}|o$|iY|otZ|d}nx|D]}"|ii|"i@o&|iititd|"i@qQ|iU|"i@|o&|iititd|"i@qQ|"i\|o>|iiR||"}|o|i|n|i|qQqQWqW|S(sutry to mark for update the item(s) specified. 
            po is a package object - if that is there, mark it for update,
            if possible
            else use **kwargs to match the package needing update
            if nothing is specified at all then attempt to update everything
            
            returns the list of txmbr of the items it marked for updatesUpdating EverythingRiiR3s>Not Updating Package that is already obsoleted: %s.%s %s:%s-%sR&RfRRRs%ssNo Match for argument: %sRR3RR4R2RvR3cCs|dS(Ni(Rs(Rs((RRrss,Package is already obsoleted: %s.%s %s:%s-%ss<Not Updating Package that is already updated: %s.%s %s:%s-%siN(]R"R&RERR)RRbRsR>R2tgetUpdatesTuplesRR9RRMRgRfRRRROR,RRJRLRMtrequiringPotsetAsDepRtnewtoldtisObsoletedRYRtinstpkgst	availpkgsR/RR$RHt	update_toRRt
depmatchesRRRQR?RRpR(RtmR6RERFR8R9RWR:Rtmaptobsoleted_dictRyR3tobs_tupsRGttuptobs_pkgsRSRcRWtobsoleting_dictRfRt
obsoleted_pkgtupdatesdicttupdatingRHRR-RIt	addUpdateR?RiRZtupdated_pkgRtpot_updatedRARRCtverLT($RR&R\RcRERqR_RbRiRfRRHRhRfRnR"RgRR^R6RiRaRWRIRLRRpR,RdRjReRpRGR9RCRl((RRs
&



"
*
!
#"!cKs|o|otidng}g}	|o
|g}	n|ido|dddjo|i|dSn|i	i
|dg\}}}|	i||	i||og}
|d}y|i|}
Wn5tiij
o#}|iitd|nX|
p|iitd|qN|	i|
qn|i|}|i	id|dd|dd	|d	d
|dd|d
}	t|	djo1|idtp|iitdqnx-|	D]%}|ii|}|i!|qW|S(stry to find and mark for remove the specified package(s) -
            if po is specified then that package object (if it is installed) 
            will be marked for removal.
            if no po then look at kwargs, if neither then raise an exceptionsNothing specified to removeRiRs%ssNo Match for argument: %sRR3RR4R2RvR3RsNo package matched to removeN("R&RER?tRemoveErrorR"R-RRR%RtmatchPackageNamesRpReRRYRdRHRRQRR(RR>R8R9RWR:RyR7R{RtaddEraseRLR(RR&RERpR"RHReRLRR-RdR9((RRPsF
"


cCsYg}g}g}g}
|py"td|iid|}Wn3t
ij
o$|ii
td||SnX|iititd|i|n|itiijo'|ii
td||i|Sn|iid|i}	t|	djo<|o$|iitd|i|SqG|i|nx|	D]w}|i|oh|i|i i!jo;|i|ijo|i||fq|
i|q|i||fqN|i"|o|i|ijojtii#|iptii#|io>|o&|iitd	|i|iqf|i|q|
i|qN|i$|o>|o&|iitd	|i|iq|i|qN|
i|qNWg}t|i i&djoBt'|t(d
||i i&dd\}}}||}n||jo!|ii,td
||SnxY|D]Q}|iititd|i|i-i||i.|i/d|q_Wxk|D]c\}}|iititd|i||i-i||i1i2||}
|i|
qWx0|
D](}|iititd|iq)W|S(sE
        handles installs/updates of rpms provided on the filesystem in a
        local dir (ie: not from a repo)

        Return the added transaction members.

        @param pkg: a path to an rpm file on disk.
        @param po: A YumLocalPackage
        @param updateonly: Whether or not true installs are valid.
        R RsCannot open file: %s. Skipping.sExamining %s: %ssGCannot add package %s to transaction. Not a compatible architecture: %sRisRPackage %s not installed, cannot update it. Run yum install to install it instead.sUPackage %s.%s not installed, cannot update it. Run yum install to install it instead.cCs|dS(Ni(Rs(Rs((RRlsRisExcluding %ssMarking %s to be installedR&sMarking %s as an update to %ss&%s: does not update installed package.N(4R"tinstallpkgst
updatepkgst
donothingpkgsR&RRRRR.R?RR(RR>R)RRbRRRRRRWRtinstalledByKeyR:t
updateonlyR{RR,RCR9RRLRQRAttoexcRRRfRRXRR`R-RYRctoldpoRRoRL(RR.R&RzR{RvR"RR|RyRLRXR,RxRRw((RtinstallLocals
"	?&&
cCsZ|py"td|iid|}Wn3tij
o$|ii	t
d|gSnX|iit
it
d|i|n|itiijo'|ii	t
d||igSng}t|iidjo5t|g|iidd\}}}||}n||jo!|iit
d	|gSn|id
|S(s
        handles reinstall of rpms provided on the filesystem in a
        local dir (ie: not from a repo)

        Return the added transaction members.

        @param pkg: a path to an rpm file on disk.
        @param po: A YumLocalPackage
        R RsCannot open file: %s. Skipping.sExamining %s: %ssGCannot add package %s to transaction. Not a compatible architecture: %siRisExcluding %sR&N(R&RRRRR.R?RR(RR>R)RRbRRRRRR{R:R9RRRRXRR`t	reinstall(RR.R&R{RRRX((RtreinstallLocals(	"	'
cKs,|itititig}|o |i|i	d|i
n|i|i	||pti
tdnt|}g}g}xR|D]I}|i|ioP|ii	|i
|i	|td|i}
|iiti|
qn|ii}	t|i_t|t o|i!d|}n:|i!d|i#d|i$d|i%d|i&d	|i'}|	|i_t|d
jo=|ii	|i
|i	||i(t)|iqn|i|qW|o+|o#ti*tddi+|n|i||S(sfSetup the problem filters to allow a reinstall to work, then
           pass everything off to installR3s2Problem in reinstall: no package matched to removes1Package %s is allowed multiple installs, skippingR&RRR4R3R3is6Problem in reinstall: no package %s matched to installs, N(,RR1RRDRERFttx_mbrsR&RYRPR3RER?tReinstallRemoveErrorR>R:ttemplentnew_membersRR1RARRrR)RRbRR9Rtold_conf_obsR7RRRctmembersRRR2R3R3RRqtReinstallInstallErrorRr(RR&RER1RRRRRRRr((RR~sN
 

#
cCsZ|py"td|iid|}Wn3tij
o$|ii	t
d|gSnX|iit
it
d|i|n|itiijo'|ii	t
d||igSng}t|iidjo5t|g|iidd\}}}||}n||jo!|iit
d	|gSn|id
|S(s
        handles downgrades of rpms provided on the filesystem in a
        local dir (ie: not from a repo)

        Return the added transaction members.

        @param pkg: a path to an rpm file on disk.
        @param po: A YumLocalPackage
        R RsCannot open file: %s. Skipping.sExamining %s: %ssGCannot add package %s to transaction. Not a compatible architecture: %siRisExcluding %sR&N(R&RRRRR.R?RR(RR>R)RRbRRRRRR{R:R9RRRRXRR`t	downgrade(RR.R&R{RRRX((RtdowngradeLocals(	"	'
cKs|o|otidnt}|o
|g}
n/d|jo|dddjo|i|d}
t	}qh|i
id|dgdt}
|
pr|d}|i
itd|y|i|}
Wqtiij
o#}|iitd|qXqhnQ|i|}|i
id	|d	d
|d
d|dd|d
d|d}
|
pd|jo&|iid|dgdt}
nd	|jo|iid	|d	}
n|
ogSntitdnt}g}x|
D]}|i|oc|i |i!f|jo*td|}|i
i#t$i%|n|i&|i |i!fqn|i'|qW|}
t}x|
D]}|i&|i qW|ii)t*|}h}h}x1|D])}|||i <|||i |i!f<qWh}xut/|
D]g}|i |i!f}	|	}|}|i |joA|	|jo4t3|i!||i i!p|i }|}qn||joM|	|jo,|o$td|}|ii|n|i&|	q,n|i4||oE|	|jo$td|}|ii|n|i&|	q,n|i&|	|	|jo|i5||	oq,n|||	<q,Wg}xx|D]p}|i |i!f}	|	|joqn|i7i8||	|}|pqn|i:t;i<|i=|qW|S(s Try to downgrade a package. Works like:
            % yum shell <<EOL
            remove  abcd
            install abcd-<old-version>
            run
            EOL sNothing specified to removeRiRRRs3Checking for virtual provide or file-provide for %ssNo Match for argument: %sRR3RR4R2RvR3s$No package(s) available to downgrades1Package %s is allowed multiple installs, skippings"No Match for available package: %ss%Only Upgrade available on package: %sN(>R&RER?tDowngradeErrorR7tdoing_group_pkgstapkgsRR(RRRRHR)R`R>RRQRRpR(RR8R9RWRR-R6t
warned_nasttapkgsR.RARRRrRRbRRRt
apkg_namesR'tlistRJtlatest_installed_natlatest_installed_ntdowngrade_apkgsRtnaRBtlatest_installedRtverGERXR"RtaddDowngradeRR1RRGRY(RR&RER.RHRRRR"RR-RrRRRRBRpRJRRRRR9((RR
s



'




		

	




!
cCsh}d|joS|d\}}}}}||d<||d<||d<||d<||d<|Sn|id|d<|id|d<|id|d<|id|d<|ddjo|id|d<n|id|d<|ddjo|id|d<n|S(	NR3RR3RR2R3R4Rv(	t
returndictRERSRTRpRURVRyR
(RRERTRpRURSRVR((RR8
s&





c
Cst}|iitd|yti|}	|djoti
|	dd}
netd|id|id|id|id|i}tii|i_|i
|	d	|id
}
Wn@tiij
o.}titdtt |nXti!|
dt"}g}x|D]}h}xFdD]>}|i'|ptitd|n||||<q5Wti(|d
i)|d<|i*|q"W|S(s
        Retrieve a key file
        @param keyurl: url to the key to retrieve
        Returns a list of dicts with all the keyinfo
        sRetrieving GPG key from %stlimiti't	bandwidthtretrytthrottletprogress_objtproxiesRs/gpgkeysGPG key retrieval failed: tmultipletkeyidt	timestamptuseridtfingerprinttraw_keys2GPG key parsing failed: key does not have value %sthexkeyidN(Rs	timestampsuseridRR(+R7t
key_installedRR(RFR>tkeyurlRtto_utf8turlRR
Rturlreadtrawkeyt
URLGrabberRtretriesRRt
proxy_dicttugtdefault_grabbertoptst
user_agentRKtgrabberRRpR?RRRqt
getgpgkeyinfoRt	keys_infoR~tkeyinfotthiskeyRt
keyIdToRPMVertupperR(
RRRRRR~RpRRFRRRR((Rt_retrievePublicKey
s:
			 *c	Cs~|ii|i}|i}t}|i
i}	x|D]}
|i|
|}x|D]}ti|	|d|ddjo+|iitd|
|dfqYn|iitd|dt|d|
idd	ft}
|iio
t}
n|oV|hd
|<d|d<d|d<d|
<d|d<d|d<}
n&|o|||d|d}
n|
ptitd
n|	i ti!|d}|djotitd|n|iitdt}|ptitd|i#qYqYWq:W|i$|\}}|djo&|iitdti|ndS(sb
        Retrieve a key for a package. If needed, prompt for if the key should
        be imported using askcb.
        
        @param po: Package object to retrieve the key of.
        @param askcb: Callback function to use for asking for verification.
                      Takes arguments of the po, the userid for the key, and
                      the keyid.
        @param fullaskcb: Callback function to use for asking for verification
                          of a key. Differs from askcb in that it gets passed
                          a dictionary so that we can expand the values passed.
        RRis)GPG key at %s (0x%s) is already installedRs#Importing GPG key 0x%s "%s" from %sRsfile://RR&RRsNot installing keyRsKey import failed (code %d)sKey imported successfullysThe GPG keys listed for the "%s" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.s+Import of key(s) didn't help, wrong key(s)?N(&RRR
R&R/RRtkeyurlsR7RRRR RRR~RFRtkeyInstalledR(R>RRtreplacetrcR9t	assumeyesRt	fullaskcbtaskcbR?RtpgpImportPubkeyt
procgpgkeyRRRterrmsg(RR&RRRFRR~RRR RRRR((RtgetKeyForPackage
sD	$$=

V
%
c
	Cs|i}t}x|D]}|i||}x|D]}|dt
i|ijo+|i
i	td||dfq5n|i
itd|dt|d|iddft}	|iio
t}	n^|oV|hd|<d|d<d|d<d	|<d
|d
<d|d<}	n|	ptitd|nt
i|d
|dd|i}|ptitdn|i
i	tdt}|ptitd|iq5q5WqWdS(sV
        Retrieve a key for a repository If needed, prompt for if the key should
        be imported using callback
        
        @param repo: Repository object to retrieve the key of.
        @param callback: Callback function to use for asking for verification
                          of a key. Takes a dictionary of key info.
        Rs(GPG key at %s (0x%s) is already importedRs#Importing GPG key 0x%s "%s" from %sRsfile://RRRRRsNot installing key for repo %sRtgpgdirsKey import failedsKey imported successfullysThe GPG keys listed for the "%s" repository are already installed but they are not correct for this package.
Check that the correct key URLs are configured for this repository.N(RRRR7RRRRR~RFRtreturn_keyids_from_pubringRR(R>RRRRR9RRRR?Rtimport_key_to_pubringRR(
RRRRFR~RRRRR((Rt
getKeyForRepos4	$=

V#c
siidjodSng}ii}ti|\}}x%iiD]}xi
iD]}|i|jp||iijo|idjoiid|i}t|iidjot|iid}|itxa|D]U}	|	i|	if||fjoqn|djoPn|i|	|d8}qWqeqhqhWqRWtd|dS(NiRRRicsii|S(N(RRRuRs(Rs(R(RRds(RR(RR9tinstallonly_limitRRRR Rt"get_running_kernel_version_releasetcur_kernel_vtcur_kernel_rtinstallonlypkgstinstpkgRRZReRR&Rtts_stateRWRfR:tnumleftRJtcomparePoEVRR2R3RRf(
RRRR RReRRfRR&((RRRGs.
3


cCs|pti}n|iti|i|}|djo$|iti	|i
||n|iti|i|d||iti|i|d|dS(s
        Process the current Transaction
        - Download Packages
        - Check GPG Signatures.
        - Run Test RPM Transaction
        - Run RPM Transaction
        
        callback.event method is called at start/end of each process.
        
        @param callback: callback object (must have an event method)
        @param rpmTestDisplay: Name of display class to use in RPM Test Transaction 
        @param rpmDisplay: Name of display class to use in RPM Transaction 
        tdisplayN(Rt	callbackstProcessTransNoOutputCallbackteventtPT_DOWNLOADRt_downloadPackagesR-R
tPT_GPGCHECKt_checkSignaturest
PT_TEST_TRANSt_doTestTransactiontrpmTestDisplaytPT_TRANSACTIONt_doTransactiont
rpmDisplay(RRRRR-((RtprocessTransactionfs

cCstdtd|ii}t|djodSn|i	t
i|y|i|}Wn(tj
otitdgnXt|djoktdg}xI|D]A}ti||}x%|D]}|id||fqWqWti|n|S(s/ Download the need packages in the Transaction cCs|iS(N(RsR&(Rs((RRscCs
|idjS(NRR(RR(RLR(RL((RRsis!Unable to find a suitable mirror.s3Errors were encountered while downloading packages.s%s: %sN(RftfilterRRRZtdlpkgsR:R
RRRtPT_DOWNLOAD_PKGSRtprobsRR?RR>terrstrRBRtuniqueRRRtYumDownloadError(RRRRRRBRR((RRs(cCsnxg|D]_}|i|\}}|djoqq|djo|i||iqti	|qWdS(s/ The the signatures of the downloaded packages iiN(
R-R&RRRRRt_askForGPGKeyImportR?tYumGPGCheckError(RR-RRR&R((RRs

cCstS(su 
        Ask for GPGKeyImport 
        This need to be overloaded in a subclass to make GPG Key import work
        N(R7(RR&RR((RRscCs|iio||iititd|i}|oItdg}
|
i||
itd|ii
ti|
qnh}	x'dgD]}t|i||	|<qWt|dt}|o
||_n|`|i|i}d|_|idd|ii|d|	}~t|djo;td	}x|D]}|d
|7}qRWti"|n|`||_dS(s Do the RPM test transaction sRunning rpm_check_debugs'ERROR with rpm_check_debug vs depsolve:sPlease report this error at %stdiskspacecheckttesttkeepoldiR9sTest Transaction Errors: s  %s
N(#RR9trpm_check_debugR)RRbRR>t_run_rpm_check_debugtmsgstretmsgsRYRtbugtracker_urlR?tYumRPMCheckErrorttsConftfeatureRtRPMTransactionRttestcbRR tinitActionTsR
tdscbR
t
populateTsRttserrorsR:RtdescrtYumTestTransactionError(RRRRRRRRRRRR((RRs@





		cCsn|i|idd|ii|iit|dt}|o
||_	n|i
d|dS(s do the RPM Transaction RiRRN(RRRR RtorderRtSimpleCliCallBackRRR(RRRR((RRs



cCsig}|i}d|_|idd|iix$|iiD]}|i
|qEW||_|S(NRi(R\RR
RR
RR RtproblemstprobR(RRR\R((RRs		
	c
Ksti|}||_|ii|_t	}|ido|do
t
}n|o\g}|o<x?|D]-}|o |it||iiqnqnWn|}||_n|o-|ot||ii}n||_n|id|iit	|_d|_|ii|_|ii|_|ii|_x?|iD]1}	t||	pqLnt||	||	qLW|ii ||ii!|i"|S(sadd and enable a repo with just a baseurl/mirrorlist and repoid
           requires repoid and at least one of baseurl and mirrorlist
           additional optional kwargs are:
           variable_convert=bool (defaults to true)
           and any other attribute settable to the normal repo setup
           ex: metadata_expire, enable_groups, gpgcheck, cachedir, etc
           returns the repo object it addedtvariable_convertR8iN(#RRR/tnewrepoRRR9RRRtvar_convertRERR7tbaseurlstreplacedRRt
varReplaceRZt
mirrorlisttsetupR8tenablegroupstmetadata_expireRt
repo_gpgcheckR~RBRARIRRt
enableRepoRK(
RR/RRRERRRRRB((Rtadd_enable_reposD	
(

		
(RRRRR3R0R6R:RR
RR
RBRaRTR^RR[R}R,RURRR1RRR7RRRRRRRRRRtpropertyRRR9RRR R2RRRR%R#RER,R@R[R<RbR$R'RwRRRRtYUM_PID_FILERR2RRRRRRRRRR"R$R&R+R,R!R[RdRRRRRRRRRRRRRRRRRRR$R%R(R-R1RcRURZRRPR}RR~RRR8RRRRRRRRRRRR
(((RRks				$	U
	9							
	:			%				:									
)	a												3	))	!%		*	x		.	8	$							!Ly"		[	!							8	4				
				5l%6%y	.G6	 			,
	
(WRRJtos.pathRtreRRRFRRR&tlogging.configR{Rtyum.i18nRQRRR>tP_tiniparse.compatRotRawConfigParserRltImportErrorR?RtrpmUtils.updatesRt
rpmUtils.archtgetCanonArchRRRQtrpmUtils.miscutilsRtrpmUtils.transactionRRMRR*RRmRjRR4Rturlgrabber.grabberRRturlgrabber.progressRtpackageSackRSRRR
RbRRR<tsimplefilterR@RRR5RRRt	constantstyum.rpmtransRRRRxRt__version__ttupleRGRtnumRt__version_info__RRRRR(:RR?RRRRRRRR
R{R5RRRRRRRR<R*RR%RbRRR4RRRRMRQRRjRRxRSRRRRRlR#R&RRRRRGR&RQRoRFRRRJRR((Rt?sn																		
			
			
						%
	
6

Anon7 - 2021