[c@sdZddkZddkZddkZddkZddkZddkZddkZddkl Z l Z l Z ddk Z ddk lZ ddkZddkZddkZddkZddkZddkZddkZddklZddklZddklZddkZddkZddklZlZd Z d ei!i"fd YZ#d ei$ei%fd YZ&de fdYZ'dZ(dS(s/ Command line interface yum class and related. iN(t OptionParsert OptionGroupt SUPPRESS_HELP(tproxy(tisMultiLibArch(t_(tRPMTransaction(t to_unicodetto_utf8cCstidIJtiddS(s" SIGQUIT handler for the yum cli. s&Quit signal sent - exiting immediatelyiN(tsyststderrtexit(tsignumtframe((s/usr/share/yum-cli/cli.pytsigquit1s tCliErrorcBseZdZddZRS(s3 Command line interface related Exception. tcCs tiii|||_dS(N(tyumtErrorst YumBaseErrort__init__targs(tselfR((s/usr/share/yum-cli/cli.pyR<s(t__name__t __module__t__doc__R(((s/usr/share/yum-cli/cli.pyR6st YumBaseClicBsjeZdZdZdZd'ddZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZedZdZdedZdZdZdZdZddZedZdZdZdZdZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(ed&Z)RS((sZThis is the base class for yum cli. Inherits from yum.YumBase and output.YumOutput cCstitittii|tii|ti ti d|_ ti d|_ h|_ |iti|iti|iti|iti|iti|iti|iti|iti|iti|iti|iti|iti|iti|iti|iti|iti|iti |iti!|iti"|iti#|iti$|iti%|iti&|iti'|iti(|iti)|iti*|iti+|iti,dS(Nsyum.clisyum.verbose.cli(-tsignaltSIGQUITRRtYumBaseRtoutputt YumOutputtloggingt basicConfigt getLoggertloggertverbose_loggertyum_cli_commandstregisterCommandt yumcommandstInstallCommandt UpdateCommandt InfoCommandt ListCommandt EraseCommandt GroupCommandtGroupListCommandtGroupInstallCommandtGroupRemoveCommandtGroupInfoCommandtMakeCacheCommandt CleanCommandtProvidesCommandtCheckUpdateCommandt SearchCommandtUpgradeCommandtLocalInstallCommandtResolveDepCommandt ShellCommandtDepListCommandtRepoListCommandt HelpCommandtReInstallCommandtDowngradeCommandtVersionCommandtHistoryCommandtCheckRpmdbCommandtDistroSyncCommandtLoadTransactionCommand(R((s/usr/share/yum-cli/cli.pyRDsH  cCsXxQ|iD]C}||ijo tiitd|n||i|ss %-14s %s is%s ( RtmisctuniqueR%tvaluesthasattrRUtsortt getSummaryREtAttributeErrortNotImplementedError(Rtusaget_[1]RWtcommandsRGtsummary((s/usr/share/yum-cli/cli.pyt _makeUsages#1 "!c Cs,h}tii}g|_x|D]}g}|idD]}||iq?~\}}|id} | djou|| } || d}| |jo$tii|| fGHt+d| i?| | i@fGHt+d| iA| | iBfGHqWt,i-dn|iCdj otEiF|iCd}nd}||_Gd|_Hx$|iGD]}|iHd|7_HqPWy|iIWn tJj ot,i-dnXtKiL|dS(sparses command line arguments, takes cli args: sets up self.conf and self.cmds as well as logger objects in base instancetbaseRaiis1Main config did not have a %s attr. before setoptsConfig Error: %sisOptions Error: %sRsGIgnored option -q, -v, -d or -e (probably due to merging: -yq != -y -q)t/s8Ignored option -c (probably due to merging -yc != -y -c)cSstidti|S(Ns%Y-%m-%d %H:%M(ttimetstrftimetgmtime(RW((s/usr/share/yum-cli/cli.pyt sm_ui_timescSstidti|S(Ns%Y-%m-%d(R}R~R(RW((s/usr/share/yum-cli/cli.pyt sm_ui_datestpatternsRt0s%s-%s.%ss %s:%s-%s.%ss%s%s%stboldtnormals Installed: %s-%s at %ss Built : %s at %ss Committed: %s at %si<syum s%s N(MtYumOptionParserRet optparsert firstParsetversionRt __version__RQtquiettFalsetverboseRzRqRoRiRmtgetattrtgetRoott debuglevelt errorleveltpreconftconffiletfntroott nopluginst init_pluginstpluginst TYPE_COREtTYPE_INTERACTIVEt plugin_typest _splitArgtdisablepluginstdisabled_pluginst enablepluginstenabled_pluginst releasevertconfR\R#twarningRRFtcriticalRR R t ValueErrort set_usagetruntsetupYumConfigtcmdstcachetrun_with_package_namestsortedtrpmdbtreturnPackagestepochtreleasetarchttermtMODERHt installtimetpackagert buildtimet committert committimet sleeptimeRLtrandomt randrangeRt cmdstringt parseCommandsRR}tsleep(RRtoptstoptRtpctmsgtet yum_progstdoneRRtpkgtverRHRtarg((s/usr/share/yum-cli/cli.pytgetOptionsConfigs     $              +      &            cCs|iidti|iitiid|i|iitiid|ii t |ii djo)t |i djo|ii |_ n|i |i_ t |i djo*|i itd|itn|i d|_|i d|_t |idjoM|iitiidx1|iD]"}|iitiid|qAWn|i|ijo0|i itd |itidtn|i|ii||i|id S( s{reads self.cmds and parses them out to make sure that the requested base command + argument makes any sense at allsYum Version: %ss COMMAND: %ssInstallroot: %siisYou need to give some commandsExt Commands: s %ss)No such command: %s. Please use %s --helpN(R$tdebugRRRMRNtDEBUG_4RRt installroottlenRcRR#RRRaRtbasecmdtextcmdsR%R targvtdoCheck(RR((s/usr/share/yum-cli/cli.pyR?s2 /   $ cCst|dpdS|ipdS|i}g}|D]}|di|q8~}|iddi|}|iid|dS(Nt_shell_history_cmdst Rs s shell-cmds(R\RtjoinRnthistorytwrite_addon_data(RtdataRbR((s/usr/share/yum-cli/cli.pyt_shell_history_writeas  * cCsbtid|}|i|_t|idjo|in |i|`|i|ifS(s*do a shell-like interface for yum commandsR{i( tshelltYumShellRRRtcmdlooptscripttresultt resultmsgs(Rtyumshell((s/usr/share/yum-cli/cli.pytdoShellns  cCs?d}tid}h}x|i|D]}|iddjot|idn tit|idd}|id|jo|||idqt}t}|i}|o|i|qqW|ii|p|i|n|i|||io:|i i p|i o|iitddSn|ii tiitd|i|d|i} t| djoud } | td 7} xI| D]A} tii | | } x"| D]} | d | | f7} qHWq%Wti!i"| n|i#|djodS|i i$ot%i%}|ii tiitd |i&}|ot}x+|D]#}|i'd oqnt}qW|otdGHn tdGHx|D]}t(|GHq?W|odtdgfSdgfS|ii)dt%i%|nt%i%}|ii tiitd|i i*p|ii+it,i-nt.|dt}|i/|i0}d!|_0|i2dd|ii3|}~t|djoUtd} x"|D]}| dt4|7} qgWti!i"| d|i5| n|ii tiitd|`|ii)dt%i%|t6i6t6i7t6i8t%i%}|i/|i2dd|ii9|ii:||_0t.|dt;i<t=|}|i i>djot|i?_;n|ii tiitd|i@d|}|ii)dt%i%||ii tii |iAt6i6t6i7tB|iCS("sntakes care of package downloading, checking, user confirmation and actually RUNNING the transactionis9Trying to run the transaction but nothing to do. Exiting.iRutusExiting on user CommandsDownloading Packages:tcallback_totalRsError Downloading Packages: s %s: %s sRunning rpm_check_debugsrpmlib(s'ERROR You need to update rpm to handle:s'ERROR with rpm_check_debug vs depsolve:isRPM needs to be updatedsrpm_check_debug time: %0.3fsRunning Transaction TestttesttkeepoldsTransaction Check Error: s %s s sTransaction Test SucceededsTransaction Test time: %0.3ftdisplayisRunning TransactiontcbsTransaction time: %0.3f(RuRN(DRttsInfoR$tinfoRtlistTransactiont isEnabledForRRNtINFO_1RMRtassumenot assumeyesR#twarnRRQt getMemberstts_statetpoRnttstclosetreportRemoveSizetreportDownloadSizet _promptWantedt userconfirmROt downloadPkgstdownload_callback_total_cbRYRZRRt gpgsigchecktrpm_check_debugR}t_run_rpm_check_debugt startswithRRtdiskspacechecktprobFilterFlagstrpmtRPMPROB_FILTER_DISKSPACERt initActionTst dsCallbackRLt populateTsRRRRRtSIG_DFLtchecktorderRtYumCliRPMCallBacktweakrefRRtrunTransactiontpostTransactionOutputRt return_code(Rtlstst downloadpkgstrmpkgststuff_to_downloadt install_onlyt remove_onlyttxmbrRtproblemsRRVterrorsterrortrcd_sttmsgst rpmlib_onlyRttt_stttestcbtdscbttserrorstdescrtts_stRt resultobject((s/usr/share/yum-cli/cli.pyt doTransactions              "               csx|D]}i|\}}|djoqq|djoiiio ii }tii o!| otii t dni |fdqtii |qWdS(sPerform GPG signature verification on the given packages, installing keys if possible Returns non-zero if execution should stop (user abort). Will raise YumBaseError if there's a problem iisTRefusing to automatically import keys when running unattended. Use "-y" to override.cs iS((R (RWtytz(R(s/usr/share/yum-cli/cli.pyRXos( t sigCheckPkgRRRR tstdintisattyRRRRtgetKeyForPackage(RtpkgsRRterrmsgtay((Rs/usr/share/yum-cli/cli.pyRXs   cCs|id|gdt}|i|i}ttd|}|oD|itddi|}|i i t i i t|ndS(s= If install argument doesn't match with case, tell the user. Rt ignore_casecSs|iS((RH(RW((s/usr/share/yum-cli/cli.pyRX{ss * Maybe you meant: s, N(tdoPackageListsRQt installedt availabletsettmapt fmtKeyValFillRRR$RMRRNROR(RRtmatchesR((s/usr/share/yum-cli/cli.pyt_maybeYouMeantwscCs| p|ddjodS|id|gdt}|ip|i o|i|odS|iid}|iid}|io-|iit i i t d|||dS|id|gdt }|i o7|io-|iit i i t d|||dSttd |i}|p|o,|iit i i t d |||n|o>|it d d i|}|iit i i |ndS( sr If the update/remove argument doesn't match with case, or due to not being installed, tell the user. it@NRR@RRs/Package(s) %s%s%s available, but not installed.cSs|iS((RH(RW((s/usr/share/yum-cli/cli.pyRXssNo package %s%s%s available.s * Maybe you meant: s, (RARRBRCtreturnInstalledPackagesByDepRRR$RMRRNRORRQRDRERFR(RRt always_outputRGthibegthiendR((s/usr/share/yum-cli/cli.pyt_checkMaybeYouMeants8      cCst|i}t}x|D]}|ido@tii|ptii |o|i d|gqny|i d|Wnti i j o"}|iitii|qti ij oP|iitiitd|iid||iid|i|qXt}qWt|i|jodtdgfS|pd td gfSd td gfS( s<Attempts to take the user specified list of packages/wildcards and install them, or if they are installed, update them to a newer version. If a complete version number if specified, attempt to upgrade (or downgrade if they have been removed) them to the specified versions.rpmtfilelisttpatternsNo package %s%s%s available.RRisPackage(s) to installis Nothing to doi(RRRtendswithRRYt re_remote_urltostpathtexistst localInstalltinstallRtGroupInstallErrorR$RMRNROt InstallErrorRRRRHRQ(RtuserlisttoldcountRRR((s/usr/share/yum-cli/cli.pyt installPkgss0 #  ic Csrt|i}t|djo|ing}xU|D]M}|ido7tii|ptii |o|i |q=q=Wt|djo8|i d|ddx|D]}|i |qWnx8|D]0}|id|d|p|i |qqWt|i|jo1t|i|}td|} d | gfSdtd gfSd S( s[take user commands and populate transaction wrapper with packages to be updatedis.rpmROt updateonlyiRPt update_tos%d packages marked for UpdateisNo Packages marked for UpdateN(RRtupdateRQRRYRRRSRTRURnRVtremoveRNR( RRZRR^R[t localupdatesRtRtchangeR((s/usr/share/yum-cli/cli.pyt updatePkgss.#cCsd}|o@|ddjo/|d}|d}|djo d}qMng}h}x0t|iid|D]}|||id |jo1|i| ijo|i| ijo t}PqqW|oq6n|i|id|iq6Wqn|i| ot}xg|ii| igD]M}|i| o t}q\|i| o|i|id |q\q\W|oqn|i|id | iq| i| oG| i\}}}}}|i|i d |d|d|d|q| i\}}}}}|i|i d |d|d|d|qW|o$t!dt"|}d|gfSdt!dgfSdS(s This does either upgrade/downgrade, depending on if the latest installed version is older or newer. We allow "selection" but not local packages (use tmprepo, or something). tdiffitfullt differentiRtnewesttpkgtupRt checksum_typet checksum_dataRPRHRRtrels3%d packages marked for Distribution Synchronizationis3No Packages marked for Distribution SynchronizationN(ReRdRf(#RRRRHRt obsoletestuptgetObsoletesTuplestextendR_tpkgSacktreturnNewestByNametkeysRRtPackageSackErrortverEQt searchNamestallowedMultipleInstallsR`t yumdb_infoRtsearchPkgTupleRhRiRjtpkgIdRQt reinstalltverGTRWtverLTt downgradeRR(RRZtleveltdupdatestipkgsRRlt obsoletingRBtapkgsR=tipkgnametipkgtapkgtnapkgtnayitfoundtntaRRwtrR((s/usr/share/yum-cli/cli.pytdistroSyncPkgss                ! //cCst|i}g}xK|D]C}|id|}|p|i|dtn|i|qW|o$tdt|}d|gfSdtdgfSdS(sctake user commands and populate a transaction wrapper with packages to be erased/removedRPRKs%d packages marked for removaliisNo Packages marked for removalN(RRR`RNRRoR(RRZR[tall_rmsRtrmsR((s/usr/share/yum-cli/cli.pyt erasePkgsYscCs t|i}x|D]}|ido:tii|ptii|o|i |qny|i d|Wqti i j oP|i itiitd|iid||iid|i|qXqWt|i|jodtdgfSdtd gfS( sAttempts to take the user specified list of packages/wildcards and downgrade them. If a complete version number if specified, attempt to downgrade them to the specified versions.rpmRPsNo package %s%s%s available.RRisPackage(s) to downgradeis Nothing to do(RRRQRRYRRRSRTRUtdowngradeLocalR}RtDowngradeErrorR$RMRNRORRRRH(RRZR[R((s/usr/share/yum-cli/cli.pyt downgradePkgsls$#  c Cst|i}t}x|D]}|ido:tii|ptii |o|i |qny|i d|t }Wqti ij o|i|dtqti ij o}x|iD]}d}d|ijo |ii}td|}ntd}|iitii||iid||iid |qWqti ij o3}tp td |iitii|qXqWt|i|jod td gfS|pd tdgfSdtdgfS(s^Attempts to take the user specified list of packages/wildcards and reinstall them. s.rpmRPRKRt from_repos (from %s)s)Installed package %s%s%s%s not available.RRs"Shouldn't happen, but just in caseisPackage(s) to reinstallis Nothing to doi(RRRRQRRYRRRSRTRUtreinstallLocalRzRQRtReinstallRemoveErrorRNtReinstallInstallErrort failed_pkgsRwRRR$RMRNRORRtReinstallErrortAssertionError( RRZR[RRRRtxmsgR((s/usr/share/yum-cli/cli.pyt reinstallPkgss@#     "cCst|djodtdgfSt}xg|D]_}|idp#|iitiid|q4n|i |d|}|o t }q4q4W|odtdgfSdtdgfS( slhandles installs/updates of rpms provided on the filesystem in a local dir (ie: not from a repo)isNo Packages Provideds.rpms,Skipping: %s, filename does not end in .rpm.R]isPackage(s) to installs Nothing to do( RRRRQR$RMRRNROt installLocalRQ(RROR]t installingRttxmbrs((s/usr/share/yum-cli/cli.pyRVs  cCsVdddddddg}d}t}t}t|djo|o(|ddjot}|idq|o(|ddjot}|idq|d|jo|id}qn|id |d |d t}|iio|i|i7_n|o|i|_ |i |_ n|o g|_n|o g|_ n|S( sReturns packages lists based on arguments on the cli.returns a GenericHolder instance with the following lists defined: available = list of packageObjects installed = list of packageObjects updates = tuples of packageObjects (updating, installed) extras = list of packageObjects obsoletes = tuples of packageObjects (obsoleting, installed) recent = list of packageObjects installed_available = that the available package list is present as .hidden_available when doing any of: all/available/installed RCRBtalltextrastupdatestrecentRlit pkgnarrowRR@( RRRQtpopRARtshowdupesfromreposRCtreinstall_availablethidden_availableRBthidden_installed(RRtinstalled_availabletspecialRtdone_hidden_availabletdone_hidden_installedtypl((s/usr/share/yum-cli/cli.pytreturnPkgListss4      c srddddg}ii}ttt}t}t}t}fd}tdjo"ddjoidniddgd |d t} x| D]\} } |joT|o't|tjoPnd GHn t}|t d }n|i | |i i | | qWi|d |d t} t}t|tjoad GHtdjot d } n t d} | i idi idfGHg} nx| D]\} } tt|joqn|o tt|joqn|jo7|o d GHn|t d}|i ni | | qW|oKt|tjo2d GHt di idi idfGHnx8D]0} | |joiit d| qqW|pdt dgfSd| fS(sgcli wrapper method for module search function, searches simple text tags in a package objectRHRdt descriptionturlcsQg}D]}|jo ||q q ~}i|di|GHdS(Ns, (t fmtSectionR(ttextRbRt used_keys(RrRR(s/usr/share/yum-cli/cli.pyt_print_match_sections2iiRtshowdupsRrRsN/S Matched: %ssE Name and summary matches %sonly%s, use "search all" for everything.sJ Full name and summary matches %sonly%s, use "search all" for everything.RRs Matched: %ssG Name and summary matches %smostly%s, use "search all" for everything.s!Warning: No matches found for: %ssNo Matches found(RRRERRDRRtsearchGeneratorRQRtaddR_t matchcallbackRRR#R(RRt searchlisttdupstokeystakeystmkeystposRtmatchingRt matched_valueRR((RrRRs/usr/share/yum-cli/cli.pytsearchst     $        #     - !c Csg}x|D]}|idoRtii|ptii|o,tii||i |}|i |nA|i i |g\}}}x||D]}|i |qW|i |} |i| q WdgfS(s}cli wrapper method for findDeps method takes a list of packages and returns a formatted deplist for that packages.rpmi(RQRRYRRRSRTRUtpackagest YumUrlPackageRRnRptmatchPackageNamestfindDepst depListOutput( RRR=RtthispkgtematchtmatchtunmatchRtresults((s/usr/share/yum-cli/cli.pytdeplistNs# c Cs|ii}t|i_|i}|i|d|dt}||i_t|djox|D]}d|jp|o|ddjoqbn|iitd|i i d||i i d|i i d||i i dqbWdd gfSdgfS( suse the provides methods in the rpmdb and pkgsack to produce a list of items matching the provides strings. This is a cli wrapper to the moduletcallbacktcallback_has_matchforit*R|sWarning: 3.0.x versions of yum would erroneously match against filenames. You can use "%s*/%s%s" and/or "%s*bin/%s%s" to get that behaviourRRsNo Matches found( RRRQtmatchcallback_verbosetsearchPackageProvidesRR#RRRR(RRtold_sdupRRR((s/usr/share/yum-cli/cli.pytprovidesbs$     % c Csx|D]}y|i|}Wn2tiij o |iitd|qXd|i|i|i |i |i f}|i i |qWdgfS(sBreturns a package (one per user arg) that provide the supplied argsNo Package Found for %ss%s:%s-%s-%s.%si(treturnPackageByDepRRRR#RRRRHRRRR$R(RRRRR((s/usr/share/yum-cli/cli.pyt resolveDepCli|s(cCsd}}}}}g}}} } } |itddig} |iiD]} | | iqU~ }|iiti i |d|jo|iiti i td|i \}}|i \}}|i \}} |i\}} |i\}}|iid|||||}||| | |}x|D]}|ii|qVW|gfSd|jo,|iitd|i \}}nd |jo,|iitd |i \}}nd |jo,|iitd |i \}} nd |jp d |jo,|iitd|i\}} nd|jp d |jo,|iitd|i\}} nd|jo,|iitd|i\}} nd|jo*|iitd|iidn|||||}||| | | }x'|D]}|iiti i |qUW|gfS(NisCleaning repos: RRsCleaning up EverythingtcleantheaderssCleaning up HeadersRsCleaning up PackagestmetadatasCleaning up xml metadatatdbcachesCleaning up database caches expire-caches!Cleaning up expire-cache metadataRsCleaning up cached rpmdb dataRsCleaning up plugins(RFRRtrepost listEnabledtidR$RMRRNROt cleanPackagest cleanHeaderst cleanMetadatat cleanSqlitet cleanRpmDBRRR#RtcleanExpireCache(RRZthdrcodetpkgcodetxmlcodetdbcodetexpccodet pkgresultst hdrresultst xmlresultst dbresultst expcresultsRbRWRtrpmcodet rpmresultstcodeR((s/usr/share/yum-cli/cli.pytcleanClis`9        c sd}t|djo,|ddjod}|idqEn|p d}nid|d|\}}fd}tx8|D]0}|ioqn|td|tqWtx8|D]0}|ipqn|td|tqWtx8|D]0}|ioqn|td |tqWtx8|D]0}|ipqVn|td |tqVWdtd gfS( NiiRUt uservisibleRcspiitii|nd|i}iitiio|d|i7}n|i o|d|i 7}niitiid|dS(Ns %ss (%s)s [%s]s%s( R$RMRRNROtui_nameRtDEBUG_3tgroupidtlangonly(tsectRR(RR(s/usr/share/yum-cli/cli.pyt_out_grps  sInstalled Groups:sInstalled Language Groups:sAvailable Groups:sAvailable Language Groups:tDone(RRRLt doGroupListsRRRRQ(RRZRRBRCRR((RRs/usr/share/yum-cli/cli.pytreturnGroupListssN          cCsuxh|D]`}t}x-|ii|D]}|i|t}q&W|p|iitd|qqWdgfS(s0returns complete information on a list of groupss!Warning: Group %s does not exist.i(Rtcompst return_groupstdisplayPkgsInGroupsRQR#R+R(RRZtstrngt group_matchedR((s/usr/share/yum-cli/cli.pytreturnGroupInfos  !c Cs!g}t}x|D]}t}x{|ii|D]g}t}y|i|i}Wn5tiij o#|i i t d|q2q2X|i |q2W|p |i i t d|qnt}qW|p+d}|o d}n|t dgfSdt dt|gfSdS(s2for each group requested do 'selectGroup' on them.s!Warning: Group %s does not exist.iisANo packages in any requested group available to install or updateis%d Package(s) to InstallN(RRRRQt selectGroupRRRt GroupsErrorR#RRRoR+R( Rt grouplistt pkgs_usedRt group_stringRRRt exit_status((s/usr/share/yum-cli/cli.pyt installGroupss0  cCsg}xf|D]^}y|i|}Wn5tiij o#|iitd|q q X|i|q W|pdtdgfSdtdt|gfSdS(s;Remove only packages of the named group(s). Do not recurse.sNo group named %s existsis!No packages to remove from groupsis%d Package(s) to removeN( t groupRemoveRRRR#RRRoR(RRRRR((s/usr/share/yum-cli/cli.pyt removeGroupsscCs|iio|ii otS|iiotSxI|iiD]8}|ip#|i djp|i |i jotSqBWtS(NR( RRRRt alwayspromptRQRRtisDepRRHR(RR(((s/usr/share/yum-cli/cli.pyR 2s   cCstii|iidS(s Print out command line usage N(R tstdouttwriteRt format_help(R((s/usr/share/yum-cli/cli.pyRaFscCstii|iidS(s Print out the shell usage N(R R R Rt get_usage(R((s/usr/share/yum-cli/cli.pyt shellUsageJscCs|ii}|iid|o'|iitiit d|t S|ii d|i }g}xl|D]d}t |it |ijo|i|qn|iitiit d|i |iqnqnWt|djox|D]}|i|o4|i |jo|i|ijotSqtSq|i|ot S|i|o |o|i|otSqqWn*|iitiit d|i tSt S(s:check if the package is reasonably installable, true/falseRs)Package %s is already installed, skippingRHs#Discarding non-comparable pkg %s.%sis;No other %s installed, adding to list for potential install(Rt exactarchlistRtcontainsR$RMRRNRRRt searchNevraRHRRRnRR{RQRtR|RvtDEBUG_1(RRRRtinstalledByKeyt comparabletinstpo((s/usr/share/yum-cli/cli.pyt _installableNs<  %N(*RRRRR&RLRTReRzRRRRRRR6RRHRQRNR\RRcRRRRRVRRRRRRRRRR R RaRR(((s/usr/share/yum-cli/cli.pyR@sJ '    "    & )' b   &  - [    3 2 "    RcBsheZdZdZdZdZedZd dZ dZ dZ dZ d Z RS( s\Subclass that makes some minor tweaks to make OptionParser do things the "yum way". cKsd|jo|d|_|d=n t|_ti||tid|_||_t|t d|_ |i |i |i dS(Ntutilssyum.clisPlugin Options( t_utilsRRRR R"R#R{RRtplugin_option_grouptadd_option_groupt_addYumBasicOptions(RR{tkwargs((s/usr/share/yum-cli/cli.pyRs     cCs4|i|iitd|tiddS(s?This method is overridden so that error output goes to logger. sCommand line error: %siN(t print_usageR#RRR R (RR((s/usr/share/yum-cli/cli.pyR+s cCsyytdd|}WnLtj o@}|iititdd|fIJtidnX|id|dS(Ns --nopluginss --versions-qs-vs--quiets --verboses-cs--configs-ds --debuglevels-es --errorlevels --installroots--disableplugins--enableplugins --releasevers--setopts$ %s: %s option requires an argumentsCommand line erroriRi(s --nopluginss --versions-qs-vs--quiets --verbose( s-cs--configs-ds --debuglevels-es --errorlevels --installroots--disableplugins--enableplugins --releasevers--setopt( t_filtercmdlineRR{RaR R RR t parse_args(RRR((s/usr/share/yum-cli/cli.pyRs   cCs:g}x-|D]%}|i|iddiq W|S(sR Split all strings in seq, at "," and whitespace. Returns a new list. t,R(RotreplaceRj(tseqtretR((s/usr/share/yum-cli/cli.pyRs #c Cs|p|i\}}n|id|\}}|iii||y`|ip|iiiot|ii_n|iod|ii_n|i od|ii_ n|i |ii_ |i |ii_ |iod|ii_n$|iipd|ii_n|iod|ii_n|io#|i||i|ii_n|iot|ii_n|iot|ii_n|idjottd n|idjo=|iiidjo#|iiid |iiiqnh dd6dd6dd6dd6dd6dd 6dd6dd6dd 6dd 6}|i|i|i|_|idjo|iiid |in|io|i|i}ng}||ii_ |i|i!|i_"x|ii"D]}}y/|iii!}|i#|||ii_!Wqt$i%i&j o3}|i'i(||ii)t*i+dqXqW|i,dj o|i,|ii_,n|ii-|ii.x|i/D]\} } yL| djo|ii/i0| n%| djo|ii/i1| nWqt$i%i&j o3}|i'i(||ii)t*i+dqXqW|i2o6t|i_3x'|ii/i4D]} t| _3qWnWnHtj o<}|i'i(td||ii)t*i+dnX||fS(NRitautotalwaystnevertttysif-ttytyestnotontoffs)--color takes one of: auto, always, nevertcolort1ttrueRtfalses --enablerepos --disablereposOptions Error: %s( NR&salwaysR(R)sif-ttyR*R+R,R-(5R!R{Rt setCmdLinettolerantRRQtrecheck_installed_requiresRRtdlonlyt downloadonlytdldirt downloaddirt cacheonlyRt setCacheDirRlRt_checkAbsInstallRoott skipbrokent skip_brokenRR.RLRRRtreinittgettdisableexcludesRtdisable_excludestexcludetcmdline_excludesRnRRRFR#RRaR R t rpmverbositytsetupProgressCallbackstsetupKeyImportCallbacksRt enableRepot disableRepot nogpgcheckt_override_sigchecksR( RRRRt_remapRARBt excludelistRRtrepoexpRy((s/usr/share/yum-cli/cli.pyRs         '             cCsU|ipdS|iddjodS|iitd|itiddS(NiR|s*--installroot must be an absolute path: %si(RR#RRR R (RR((s/usr/share/yum-cli/cli.pyR;(s  cCs|i||ioti|id|itio|id|i|_nF|idjo5ti|idtio|id|_qn|i}nd}|S(NR|s/etc/yum/yum.confs /etc/yum.conf(R;RRStaccessRtR_OK(RRR((s/usr/share/yum-cli/cli.pyR2s  $ cOs|ii|idS(N(R{RaR (RRtvaluetparserRR((s/usr/share/yum-cli/cli.pyt_wrapOptParseUsageBs cCs>d}|io t|d}|i|n|}d|_|iddddd|idtd d |_|id d dd dtd|idddddd dtd|idddddddtddd|idddddd dddtd!dd"|id#d$dd%dddtd&dd dd'|id(dd)dd dtd*|id+d,dd-dddtd.dd dd/|id0d1dddtd2dd3|id4d5dd6dd dtd7|id8d9dd:dd dtd;|id<d=dd>dd dtd?|id@ddAdd dtdB|idCdd dtdD|idEdtdFddG|idHddddId|ddJdgdtdKddL|idMddddId|ddJdgdtdNddL|idOdPdgddQdtdRddS|id0dTdgddQdtdUddL|idVdd dtdW|idXdd dtdY|idZdd dtd[|id0d\dd]dgddQdtd^dd_|id0d`ddadgddQdtdbdd_|idcdd ddddtde|id0dfddgdddtdh|id0diddjdddtdk|idlddmdd dtdn|idoddpdddtdq|id0drddsdgddQdtdtdS(uNcSs*td|i}|i||fdS(sCallback for the enablerepo and disablerepo option. Combines the values given for these options while preserving order from command line. sparser.values.%sN(tevaltdestRn(toptobjRRPRQRT((s/usr/share/yum-cli/cli.pyt repo_optcbGssYum Base Optionstresolves-hs--helptactionRthelpsshow this help message and exitR+s-ts --tolerantt store_truesbe tolerant of errorss-Cs --cacheonlyRTR9s2run entirely from system cache, don't update caches-cs--configRtdefaults/etc/yum/yum.confsconfig file locationtmetavars [config file]s-Rs --randomwaitRttypeRsmaximum command wait times [minutes]s-ds --debuglevelRsdebugging output levels [debug level]s--showduplicatesRs2show duplicates, in repos, in list/search commandss-es --errorlevelRserror output levels [error level]Rs--rpmverbositysdebugging output level for rpms[debug level name]s-qs--quietRsquiet operations-vs --verboseRsverbose operations-ys --assumeyesRsanswer yes for all questionss --assumenoRsanswer no for all questionss --versionsshow Yum version and exits --installrootsset install roots[path]s --enablerepotstringRs3enable one or more repositories (wildcards allowed)s[repo]s --disablerepos4disable one or more repositories (wildcards allowed)s-xs --excludeRns"exclude package(s) by name or globs [package]s--disableexcludess7disable exclude from main, for a repo or for everythings --obsoletess*enable obsoletes processing during updatess --nopluginssdisable Yum pluginss --nogpgchecksdisable gpg signature checkings--disablepluginRsdisable plugins by names[plugin]s--enablepluginRsenable plugins by names --skip-brokenR<s&skip packages with depsolving problemss--colorR.scontrol whether color is useds --releaseverRs5set value of $releasever in yum config and repo filess--downloadonlyR5sdon't update, just downloads --downloaddirR7s2specifies an alternate directory to store packagess--setoptRqs%set arbitrary config and repo options(RRRtconflict_handlert add_optionRRRRL(RRVR((s/usr/share/yum-cli/cli.pyRFs                       N(RRRRR+Rt staticmethodRRLRR;RRRR(((s/usr/share/yum-cli/cli.pyRs    q  cCsyg}t|}x`t|djoL|id}d|jo:|idd\}}||jo|i|qpq|djo|i|q||jo|i|q||jodt|djo t|n|id}|ddjo t|n|i||gqxB|D]:}t|djo!|i|o|i|q2q2WqW|S(sKeep only specific options from the command line argument list This function allows us to peek at specific command line options when using the optparse module. This is useful when some options affect what other options should be available. @param novalopts: A sequence of options to keep that don't take an argument. @param valopts: A sequence of options to keep that take a single argument. @param args: The command line arguments to parse (as per sys.argv[:1] @return: A list of strings containing the filtered version of args. Will raise ValueError if there was a problem parsing the command line. iRfis--t-i(tlistRRRjRnRRoR(t novaloptstvaloptsRtoutRRRtnext((s/usr/share/yum-cli/cli.pyR s2        #()RRSRR R}RR RtoptparseRRRRRRRRRt yum.Errorstyum.logginglevelstyum.misct yum.pluginst rpmUtils.archRRt yum.rpmtransRRR'tyum.i18nRRRRRRRRRRR (((s/usr/share/yum-cli/cli.pytsD                   G(