v_c@sdZddlZddlZddlZddlZddlmZddlmZmZddlm Z ddl Zddl Z ddl Z ddl Z ddlZddlmZmZmZmZddlZddlZddlZddlZddlZddlZddlmZddlmZdd lmZm Z d Z!d Z"d Z#d Z$dZ%dZ&dZ'dZ(dZ)dZ*gdZ+dfdYZ,de,fdYZ-de,fdYZ.de,fdYZ/ddZ0dZ1d Z2d!e,fd"YZ3d#e3fd$YZ4d%e,fd&YZ5d'e,fd(YZ6d)e,fd*YZ7d+e,fd,YZ8d-e,fd.YZ9d/e,fd0YZ:d1e,fd2YZ;d3e,fd4YZ<d5e,fd6YZ=d7e,fd8YZ>d9e,fd:YZ?d;e,fd<YZ@d=e,fd>YZAd?e,fd@YZBdAe,fdBYZCdCe,fdDYZDdEe,fdFYZEdGe,fdHYZFdIe,fdJYZGdKe,fdLYZHdMe,fdNYZIdOe,fdPYZJeZKdQe,fdRYZLdSe,fdTYZMdUe,fdVYZNdWe,fdXYZOdS(Ys< Classes for subcommands of the yum command line interface. iN(t logginglevels(t_tP_(tmisc(t utf8_widthtutf8_width_fillt to_unicodet exception2msg(t updateinfo(t parsePackages(t LibLVMErrort lvmerr2strcCsj||jkr|jdS|j|}|jdj|}|jjtd|jj|dS(Nthelps Mini usage: (tyum_cli_commandstusaget _makeOutputtloggertcriticalR(tbasetbasecmdtcmdttxt((s!/usr/share/yum-cli/yumcommands.pyt_err_mini_usage/s  cCs8|jjdkr4|jjtdtjndS(sVerify that the program is being run by the root user. :param base: a :class:`yum.Yumbase` object. :raises: :class:`cli.CliError` is,You need to be root to perform this command.N(tconftuidRRRtclitCliError(R((s!/usr/share/yum-cli/yumcommands.pyt checkRootUID8scCs|jr dS|jsxw|jjD]c}|jsA|jr)|j r)td}|jj ||jj td|t j q)q)WndS(sVerify that there are gpg keys for the enabled repositories in the rpm database. :param base: a :class:`yum.Yumbase` object. :raises: :class:`cli.CliError` Ns  You have enabled checking of packages via GPG keys. This is a good thing. However, you do not have any GPG public keys installed. You need to download the keys for packages you wish to install and install them. You can do that by running the command: rpm --import public.gpg.key Alternatively you can specify the url to the key you would like to use for a repository in the 'gpgkey' option in a repository section and yum will install it for you. For more information contact your distribution or package provider. sProblem repository: %s( t_override_sigcheckst gpgKeyChecktrepost listEnabledtgpgcheckt repo_gpgchecktgpgkeyRRRRR(Rtrepotmsg((s!/usr/share/yum-cli/yumcommands.pyt checkGPGKeyBs   cCsIt|dkrE|jjtd|t||tjndS(s/Verify that *extcmds* contains the name of at least one package for *basecmd* to act on. :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* :raises: :class:`cli.CliError` is(Error: Need to pass a list of pkgs to %sN(tlenRRRRRR(RRtextcmds((s!/usr/share/yum-cli/yumcommands.pytcheckPackageArg`s   cCsdd}d|krd}nt||kr`|jjtd|t||tjndS(s0Verify that *extcmds* contains the name of at least two packages for *basecmd* to act on. :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* :raises: :class:`cli.CliError` is--is'Error: Need at least two packages to %sN(R&RRRRRR(RRR'tmin_args((s!/usr/share/yum-cli/yumcommands.pytcheckSwapPackageArgos     cCst|dkrE|jjtd|t||tjn|jj|ddt dt }|s|jjtd|t||tjnt|dkrg|D]}|j r|^q}nt|dkrJdj g|D]}|j ^q}|jjtd ||ft||tjn|dj s|jj |dj|jjtd |dj nd S( s/Verify that *extcmds* contains the name of at least one package for *basecmd* to act on. :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* :raises: :class:`cli.CliError` is/Error: Need to pass a repoid. and command to %sit name_matcht ignore_cases0Error: Need to pass a single valid repoid. to %sis, sAError: Need to pass only a single valid repoid. to %s, passed: %ss'Repo %s has been automatically enabled.N(R&RRRRRRRt findRepostTruet isEnabledtjointui_idt enableRepotidtverbose_loggertinfo(RRR'Rtr((s!/usr/share/yum-cli/yumcommands.pytcheckRepoPackageArgs.    "   (%    cCsEt|dkrA|jjtdt||tjndS(sVerify that *extcmds* contains the name of at least one item for *basecmd* to act on. Generally, the items are command-line arguments that are not the name of a package, such as a file name passed to provides. :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* :raises: :class:`cli.CliError` isError: Need an item to matchN(R&RRRRRR(RRR'((s!/usr/share/yum-cli/yumcommands.pyt checkItemArgs  cCsEt|dkrA|jjtdt||tjndS(s-Verify that *extcmds* contains the name of at least one group for *basecmd* to act on. :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* :raises: :class:`cli.CliError` is%Error: Need a group or list of groupsN(R&RRRRRR(RRR'((s!/usr/share/yum-cli/yumcommands.pyt checkGroupArgs  cCsd}t|d krG|jjtd d j|tjnxM|D]E}||krN|jjtd |t||tjqNqNWd S(sLVerify that *extcmds* contains at least one argument, and that all arguments in *extcmds* are valid options for clean. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* :raises: :class:`cli.CliError` theaderstpackagestmetadatatdbcachetpluginss expire-cachetrpmdbtallis#Error: clean requires an option: %ss, s!Error: invalid clean argument: %rN(R:spackagesR<R=R>s expire-cachesrpmdbsall(R&RRRR0RRR(RRR't VALID_ARGSR((s!/usr/share/yum-cli/yumcommands.pyt checkCleanArgs     cCst|dkr+|jjtdnt|dkr|jjtd|dtjj|ds|jjtd|d|j t j qn)|jjtd|j t j dS(svVerify that the arguments given to 'yum shell' are valid. yum shell can be given either no argument, or exactly one argument, which is the name of a file. :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* :raises: :class:`cli.CliError` isNo argument to shellisFilename passed to shell: %ss2File %s given as argument to shell does not exist.s5Error: more than one file given as argument to shell.N( R&R4tdebugRtostpathtisfileRRRRR(RRR'((s!/usr/share/yum-cli/yumcommands.pyt checkShellArgs         cCs|jjrdSxE|D]=}|jdrtjj|sStjj|rdSqW|j |jjrudSt d}|j j |t jdS(sVerify that there is at least one enabled repo. :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* :raises: :class:`cli.CliError`: Ns.rpmsThere are no enabled repos. Run "yum repolist all" to see the repos you have. To enable Red Hat Subscription Management repositories: subscription-manager repos --enable To enable custom repositories: yum-config-manager --enable (RRtendswithtyumRt re_remote_urlRDREtexiststpkgSackRRRRR(Rtpossible_local_filestlfileR$((s!/usr/share/yum-cli/yumcommands.pytcheckEnabledRepos ! t YumCommandcBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( sAn abstract base class that defines the methods needed by the cli to execute a specific command. Subclasses must override at least :func:`getUsage` and :func:`getSummary`. cCst|_t|_dS(N(tFalsetdone_command_oncethidden(tself((s!/usr/share/yum-cli/yumcommands.pyt__init__s cGs2|js%|jjtj||nt|_dS(sm Output *msg* the first time that this method is called, and do nothing on subsequent calls. This is to prevent duplicate messages from being printed for the same command. :param base: a :class:`yum.Yumbase` object :param msg: the message to be output :param *args: additional arguments associated with the message N(RRR4R5RtINFO_2R.(RTRR$targs((s!/usr/share/yum-cli/yumcommands.pyt doneCommands cCsgS(sReturn a list of strings that are the names of the command. The command can be called from the command line by using any of these names. :return: a list containing the names of the command ((RT((s!/usr/share/yum-cli/yumcommands.pytgetNames,scCs tdS(suReturn a usage string for the command, including arguments. :return: a usage string for the command N(tNotImplementedError(RT((s!/usr/share/yum-cli/yumcommands.pytgetUsage5scCs tdS(szReturn a one line summary of what the command does. :return: a one line summary of what the command does N(RZ(RT((s!/usr/share/yum-cli/yumcommands.pyt getSummary<scCsdS(s Verify that various conditions are met so that the command can run. :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being checked for :param extcmds: a list of arguments passed to *basecmd* N((RTRRR'((s!/usr/share/yum-cli/yumcommands.pytdoCheckCscCsdtdgfS(sExecute the command :param base: a :class:`yum.Yumbase` object. :param basecmd: the name of the command being executed :param extcmds: a list of arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage is Nothing to do(R(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyt doCommandMscCstS(sEReturn whether a transaction set must be set up before the command can run :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise (R.(RTRRR'((s!/usr/share/yum-cli/yumcommands.pytneedTs]s cCsdS(sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write twrite((RTRRR'((s!/usr/share/yum-cli/yumcommands.pytcacheRequirementys( t__name__t __module__t__doc__RURXRYR[R\R]R^R_Ra(((s!/usr/share/yum-cli/yumcommands.pyRPs     tInstallCommandcBs;eZdZdZdZdZdZdZRS(sUA class containing methods needed by the cli to execute the install command. cCsddddgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command tinstalls install-ns install-nas install-nevra((RT((s!/usr/share/yum-cli/yumcommands.pyRYscCs tdS(sbReturn a usage string for this command. :return: a usage string for this command s PACKAGE...(R(RT((s!/usr/share/yum-cli/yumcommands.pyR[scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s,Install a package or packages on your system(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\scCs5t|t|t|||t||dS(sVerify that conditions are met so that this command can run. These include that the program is being run by the root user, that there are enabled repositories with gpg keys, and that this command is called with appropriate arguments. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RR%R(RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]s  cCs)|j|td|j|d|S(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage sSetting up Install ProcessR(RXRt installPkgs(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR^s(RbRcRdRYR[R\R]R^(((s!/usr/share/yum-cli/yumcommands.pyRes    t UpdateCommandcBs;eZdZdZdZdZdZdZRS(sTA class containing methods needed by the cli to execute the update command. cCs ddgS(sReturn a list containing the names of this command. This command can by called from the command line by using any of these names. :return: a list containing the names of this command tupdates update-to((RT((s!/usr/share/yum-cli/yumcommands.pyRYscCs tdS(sbReturn a usage string for this command. :return: a usage string for this command s [PACKAGE...](R(RT((s!/usr/share/yum-cli/yumcommands.pyR[scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s+Update a package or packages on your system(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\scCs%t|t|t||dS(svVerify that conditions are met so that this command can run. These include that there are enabled repositories with gpg keys, and that this command is being run by the root user. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RR%RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]s  cCsB|j|td|j|d|dk}tj||S(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage sSetting up Update Processt update_tos update-to(RXRt updatePkgsRt remove_txmbrs(RTRRR'tret((s!/usr/share/yum-cli/yumcommands.pyR^s (RbRcRdRYR[R\R]R^(((s!/usr/share/yum-cli/yumcommands.pyRhs    tDistroSyncCommandcBs;eZdZdZdZdZdZdZRS(sZA class containing methods needed by the cli to execute the distro-synch command. cCs dddgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command sdistribution-synchronizations distro-synct distupgrade((RT((s!/usr/share/yum-cli/yumcommands.pyRYscCs tdS(sbReturn a usage string for this command. :return: a usage string for this command s [PACKAGE...](R(RT((s!/usr/share/yum-cli/yumcommands.pyR[ scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s?Synchronize installed packages to the latest available versions(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\scCs%t|t|t||dS(suVerify that conditions are met so that this command can run. These include that the program is being run by the root user, and that there are enabled repositories with gpg keys. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RR%RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]s  cCsB|j|tdd|j_|j|}tj||S(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage s/Setting up Distribution Synchronization Processi(RXRRt obsoletestdistroSyncPkgsRRl(RTRRR'Rm((s!/usr/share/yum-cli/yumcommands.pyR^%s   (RbRcRdRYR[R\R]R^(((s!/usr/share/yum-cli/yumcommands.pyRns     tcCst|jdt|jt|}t|jdt|j}t|j}|jdkr|t|jd7}nxWd|fd|fd|ffD]4\}}||j|d|||cd7tj|SdkrWj|Str. dkrvj|Sdkrj|Sdkrj|dt}tj|Sdkrj |Sdkrj |dt }|\}}}} x'| D]} j j | j| jqWx]|D]U} t} x-jj| jD]} | j| jqcWj j| j| q>Wj jd d d j|gfSd krj |dt }|\}}}} xN|D]F}jj|j} | sqntj _|jj| j qWxN|D]F}jj!|j"} | spqIntj _|j#j| jqIWj jd d d j|gfSd3krt$|dkrddgfSj |d gdt }|\}}}} |d2ks1t$|dkr>ddgfS|d } dk}xkjj&d|dD]P} | rd| j'krqnn| j"| j'_(| j#j| jtj _qnWj jd dd j|dgfSdkrNx8jj&d|D]!} d| j'kr| j'`(qqWd dd j|gfSd4kr9j |dt }|\}}}} |sddgfSdk}xY|D]Q} xHjj| j#D]1} | rd| j'krqn| j"| j'_(qWqW|rd dd j|gfSd dd j|gfSnd5kr~t$|dkrdddgfSj |d gdt }|\}}}} |d2kst$|dkrdd gfS|d } dk}j |ddt }x.|dD]"} |j j| j| j|qW|rSx-|d D]} | j| _)tj _q.Wnj jd d!d j|dgfSd"krj |d gdt }|\}}}} |d2krdd#gfSx#|D]} d2| _)tj _qWj jd d$d j|gfSd6kr4j |dt }|\}}}} |sddd gfSd&k}xw|D]o} d jt*| j}xNj j+|D]:} | r| j)d2k rqn| j| _)tj _qWqwWj j|rd d'd j|gfSd d(d j|gfSnd7kr fd,}x*j j j,D]}j j-|qeWx,jD]!} d| j'kr| j'`(qqWjj.jj/d-tfd.t ff}xT|D]L\}}jj!|} | d2kr qn|r( t| _0n|| qWx6jj1D]%} | j|kra qF n|| qF Wj jd d/gfSd0kr. j |dt }|\}}}} x!|D]} j j2| jq Wx!|D]} j j-| j"q Wj jd d1d j|gfSnd2S(8sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage RRR5RfRRs mark-installR,isMarked install: t,smark-blacklistsMarked upgrade blacklist: s mark-packagessmark-packages-forceiisNo group or package givensNo group matchedtpatternst group_membersMarked packages: sunmark-packagessUnMarked packages: smark-packages-syncsmark-packages-sync-forcesMarked packages-sync-force: sMarked packages-sync: s mark-groupssmark-groups-forcesNo environment or group givensNo environment matchedsMarked groups: s unmark-groupssNo groups matchedsUnMarked groups: smark-groups-syncsmark-groups-sync-forcesMarked groups-sync-force: sMarked groups-sync: s mark-convertsmark-convert-whitelistsmark-convert-blacklistcs|js dSg}xQjj|jD]:}d|jkrDq)n|j|j_|j|jq)Wdkrj j |j|nj j |j|jdS(NRsmark-convert-whitelist( RR?t searchNamesR;RtgroupidRRRwRt add_group(tgrpt pkg_namesR(RR(s!/usr/share/yum-cli/yumcommands.pyt _convert_grps  tcoreRs&Converted old style groups to objects.s mark-removesMarked remove: N(s mark-packagessmark-packages-force(smark-packages-syncsmark-packages-sync-force(s mark-groupssmark-groups-force(smark-groups-syncsmark-groups-sync-force(s mark-convertsmark-convert-whitelistsmark-convert-blacklist(3RRtreturnGroupSummarytreturnGroupListsR.treturnGroupInfot installGroupsRRlt removeGroupst_groupReturnGroupsRQRtadd_environmentt environmentidt allgroupsRR?RR;taddRwRRtsaveR0tcompstreturn_environmenttevgidtchangedt grp_namesRiRt return_grouptgidRR&RtreturnPackagesRRt environmentRt return_groupsRt del_grouptcompilet simplePkgListRt get_groupstdel_environment(RTRRR'RmtgRGtigrpstgrpstievgrpstevgrpstevgrpRRRtievgrptigrptforceR'RR)t special_gidstforce_installed((RRs!/usr/share/yum-cli/yumcommands.pyR^sJ                                                                    cCsN|j||\}}|dkr(tS|jdsF|jdrJtStS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise RR5RRRR(slistsinfosremovessummary(RRQRR.(RTRRR'R((s!/usr/share/yum-cli/yumcommands.pyR_s  cCs,|j||\}}|dkr(tStS(sdReturn whether a transaction set for removal only must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a remove-only transaction set is needed, False otherwise R(sremove(RR.RQ(RTRRR'R((s!/usr/share/yum-cli/yumcommands.pyRs  cCsN|j||\}}|dkr(dS|jdsF|jdrJdSdS( sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write RR5Rsread-only:pastRRR`(slistsinfossummary(RR(RTRRR'R((s!/usr/share/yum-cli/yumcommands.pyRas  (RbRcRdRRYR[R\RRR]R^R_RRa(((s!/usr/share/yum-cli/yumcommands.pyRs"       C  tMakeCacheCommandcBsDeZdZdZdZdZdZdZdZRS(sWA class containing methods needed by the cli to execute the makecache command. cCsdgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command t makecache((RT((s!/usr/share/yum-cli/yumcommands.pyRY,scCsdS(sbReturn a usage string for this command. :return: a usage string for this command Rr((RT((s!/usr/share/yum-cli/yumcommands.pyR[4scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command sGenerate the metadata cache(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\;scCst|dS(s$Verify that conditions are met so that this command can run; namely that there is an enabled repository. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]Bsc Cs|jjtd|jjtdt}|rQ|ddkrQt}ntrx2|jjD]!}d|_|sgd|_qgqgW|j dd|jj |r|jj ddd d n|jj dd d d id d 6dd6dd6dd6}x|jj D]{}xr|j jD]a}||krDq,n||jks,|j| rgq,ntj|j|||d|jq,WqWndtdgfS(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage s*Making cache files for all metadata files.s=This may take a while depending on the speed of this computeritfasts group:allRtmdtypeR<t cacheonlyiR@s groups.xmltgroup_gzspkgtags.sqlitetpkgtagssupdateinfo.xmlRsprestodelta.xmlt prestodeltatcachedsMetadata Cache Created(RRCRRQR.Rtsorttmetadata_expiretmdpolicyRtdoSetupt populateSackRtrepoXMLt fileTypest retrievedRtrepo_gen_decompresst retrieveMDtcache(RTRRR'R?R#t fname_maptMD((s!/usr/share/yum-cli/yumcommands.pyR^Ls:       cCstS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise (RQ(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR_s ( RbRcRdRYR[R\R]R^R_(((s!/usr/share/yum-cli/yumcommands.pyR='s    ;t CleanCommandcBsMeZdZdZdZdZdZdZdZdZ RS(sSA class containing methods needed by the cli to execute the clean command. cCsdgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command tclean((RT((s!/usr/share/yum-cli/yumcommands.pyRYscCsdS(sbReturn a usage string for this command. :return: a usage string for this command s<[headers|packages|metadata|dbcache|plugins|expire-cache|all]((RT((s!/usr/share/yum-cli/yumcommands.pyR[scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command sRemove cached data(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\scCst|||t|dS(syVerify that conditions are met so that this command can run. These include that there is at least one enabled repository, and that this command is called with appropriate arguments. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RBRO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]s cCsd|j_|j|S(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage i(RRPtcleanCli(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR^s cCstS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise (RQ(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR_s cCsdS(sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write sread-only:past((RTRRR'((s!/usr/share/yum-cli/yumcommands.pyRas( RbRcRdRYR[R\R]R^R_Ra(((s!/usr/share/yum-cli/yumcommands.pyRSs     tProvidesCommandcBsDeZdZdZdZdZdZdZdZRS(sVA class containing methods needed by the cli to execute the provides command. cCs ddgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command tprovidest whatprovides((RT((s!/usr/share/yum-cli/yumcommands.pyRYscCsdS(sbReturn a usage string for this command. :return: a usage string for this command t SOME_STRING((RT((s!/usr/share/yum-cli/yumcommands.pyR[scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s*Find what package provides the given value(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\scCst|||dS(s7Verify that conditions are met so that this command can run; namely that this command is called with appropriate arguments. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(R8(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]scCs*|jjdtj||j|S(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage sSearching Packages: (RRCRRRW(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR^s cCsdS(sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write sread-only:past((RTRRR'((s!/usr/share/yum-cli/yumcommands.pyRas( RbRcRdRYR[R\R]R^Ra(((s!/usr/share/yum-cli/yumcommands.pyRVs    tCheckUpdateCommandcBsGeZdZdZdZdZdZddZdZ RS(sZA class containing methods needed by the cli to execute the check-update command. cCsddddgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command s check-updates check-updatess check-upgradescheck-upgrades((RT((s!/usr/share/yum-cli/yumcommands.pyRY'scCsdS(sbReturn a usage string for this command. :return: a usage string for this command s [PACKAGE...]((RT((s!/usr/share/yum-cli/yumcommands.pyR[0scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s#Check for available package updates(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\7scCst|dS(s.Verify that conditions are met so that this command can run; namely that there is at least one enabled repository. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]>scsTtjdg|}jjddd}trJj|d|}jjsojj t j rj|d|}|j|_|j |_ nt |} t|jdkri} jjd} | r3xQt|jD]=} | jjdkr| jr| | | j| jfkr`|d}|d}nd}td |}|d krt}njjtj}|dks|r@yjjj Wq@t j j k r<|rnxLjj D]7} yjj| jWqt j j k r4qXqWq@Xnjjj} | jjj } jjd jjd } jjd } jjd}d}g}x| D]x} t|r|| | rqnd?\}}}d}d}d}d}t}|dks;| j|ks;| j|krXt}| | |}}}n| | krt}|dkrt}n|dkr| rqn|s|r|td|}ttd}|s|d7}|d7}qn|r|| }n|dks|r2|s,jjs,| jrDt| jj}nt| j}||}| jj}tg|D]\}}|| kru|^qu}|r||}|s|d|7}qn||7}q2nZt}|dkrt}n|dkr | r qn|td|}ttd}|s | j}| jdkrtj j!| j"rtj#| j"j$} | | jt%j%krd|}qqn|r| j&r| j'j(j)}!|!| j*j)krd|}qn|j+|| j||f|fq|r| j*}"nd@}"j-td| jj-td| jg}#|se|r|#j-td|g7}#n|"r|"j.d@k r|#j-td|"j.g7}#n|"r|"j/dr|"j/d}$|#j-tddj0t1|$g7}#n|"r|"j/drxgt1|"j/dD]O}%|"j/d|%}$|#j-tdd|%dj0t1|$fg7}#q9Wn|"r|#j-tdt%j2|"j)j-td |j-td!|g7}#nt3| d"r| j4}&n | j5}&|&rB|#j-td#dj0|&g7}#n|rR| j6n| j&r|#j-td$| j&g7}#|r| j'j(j)}'|#j-td%t%j2|'g7}#qn.| j7r|#j-td&| j7g7}#n|rf| j6rf|& rf| j6d}(t| j6dkrD|(d't| j6d7}(n|#j-td#|(g7}#ntj j!| j"std(} n$tj#| j"j$} t%j2| } | jd)krtd*| }nA| jstd+| }n%|| j}td,|| f}|#j-td-|j-td.| j8g7}#| jr |#j-td/dj0| jg7}#n| j9r |#j-td0dj0| j9g7}#n|r |#j-td1|g7}#n| j:r |#j-td2| j:g7}#njj;d3d4j0tt<j=|#qW| r |r ttd5})d}*d}+d},x|D]\}}-\}}}|)t|kr t|})n|*t|-kr t|-}*n|+|t|kr |t|}+n|,t|krp t|},qp qp W|dkr; jj>|)d}.nWttd6|+krz jj>|)ttd6d}.njj>|)|+d}.|.|*kr |.}*n*|.|*8}.|)|.d7})|*|.|.d7}*t?td5|)}/t?td7|*|*}0|dkr# jj;d8|/|0njj;d9|/|0td6x|D]\}}-\}}}|dkr jj;d8t?||)t?|-|*|*qI n|r t?||,d:t}njj;d;t?||)t?|-|*|*||qI Wndd<t=t@jAd=|tgfS(AsExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage cs:d}x$|jjD]}||j7}qWj|S(Ni(tsackR*t packagesizet format_number(R#RmR(R(s!/usr/share/yum-cli/yumcommands.pyt _repo_sizeLscs=x6|D].}|jj|dtdtkrtSqWtS(NR+R,(RR-R.RQ(R#Rtpat(R(s!/usr/share/yum-cli/yumcommands.pyt _repo_matchRs   cSsttjd|tS(Ns%d(RtlocaletformatR.(tnum((s!/usr/share/yum-cli/yumcommands.pyt _num2ui_numYsiiR@tdisabledtenabledcSs |jS(N(tlower(R\((s!/usr/share/yum-cli/yumcommands.pytasR}tgreenRtredtnormalRrs: is+%st!t*sRepo-id : sRepo-name : sRepo-status : sRepo-revision: tcontentsRepo-tags : s, tdistrosRepo-distro-tags: s[%s]: %ssRepo-updated : sRepo-pkgs : sRepo-size : t _orig_baseurlsRepo-baseurl : sRepo-metalink: s Updated : sRepo-mirrors : s (%d more)tUnknownisNever (last: %s)sInstant (last: %s)s%s second(s) (last: %s)sRepo-expire : s Filter : sRepo-exclude : sRepo-include : sRepo-excluded: sRepo-filename: s%s s srepo idtstatuss repo names%s %ss%s %s %stlefts %s %s %s%ss repolist: s%d(sallRsenabled(RrRrRrN(BR&tmapR.R4R_RR`RRJRLRIRt RepoErrorRR3tvaluesRFRtFG_COLORRRQRwRRRtexcludeR~R/t _excludesR1RGRDRERKtmetadata_cookietstattst_mtimettimetmetalinkt metalink_datatrepomdt timestampRKRRt fmtKeyValFilltrevisionttagsR0RtctimethasattrRtbaseurlturlst mirrorlisttmetadata_expire_filtert includepkgstrepofileR5RRRRRR(1RTRRR'RRRtargtverboseR#Rt enabled_repost on_ehibegt on_dhibegton_hiendttot_numtcolstehibegtdhibegthiendt ui_enabledt ui_endis_widtui_numtui_excludes_numt force_showRtui_sizeRtexcludesR6tpidRvtlasttmdtstmdtoutRRtbaseurlsttsturltid_lentnm_lentst_lentui_lentrnameRttxt_ridttxt_rnam((Rs!/usr/share/yum-cli/yumcommands.pyR^>s "        *       1       '      "        '              cCstS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise (RQ(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR_X s cCsdS(sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write sread-only:past((RTRRR'((s!/usr/share/yum-cli/yumcommands.pyRac s( RbRcRdRYR[R\R^R_Ra(((s!/usr/share/yum-cli/yumcommands.pyR{#s     t HelpCommandcBsSeZdZdZdZdZdZedZdZ dZ RS(sRA class containing methods needed by the cli to execute the help command. cCsdgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command R ((RT((s!/usr/share/yum-cli/yumcommands.pyRYt scCsdS(sbReturn a usage string for this command. :return: a usage string for this command tCOMMAND((RT((s!/usr/share/yum-cli/yumcommands.pyR[| scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command sDisplay a helpful usage message(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\ scCsgt|dkr(|jtjn;t|dksM|d|jkrc|jtjndS(s?Verify that conditions are met so that this command can run; namely that this command is called with appropriate arguments. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* iiN(R&RRRR (RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR] s   % cCsX|jd}y|j}Wnttfk r?d}nXy|j}Wnttfk rod}nXd}|dk r|d||f7}n|dk r|d|7}n|dkr|dkrtd|}n|j}t|dkrTt|dkr$|td7}n|td 7}|d j|jd7}n|S( NiRrs%s %ss %ssNo help available for %siis aliases: s alias: s, ( RYR[tAttributeErrorRZRR\RR&R0(tcommandtcanonical_nameRRt help_outputt command_names((s!/usr/share/yum-cli/yumcommands.pyR s.      cCsJ|d|jkr@|j|d}|jj|j|ndgfS(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage i(R R4R5R(RTRRR'R((s!/usr/share/yum-cli/yumcommands.pyR^ scCstS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise (RQ(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR_ s ( RbRcRdRYR[R\R]t staticmethodRR^R_(((s!/usr/share/yum-cli/yumcommands.pyRn s    $ tReInstallCommandcBsDeZdZdZdZdZdZdZdZRS(sWA class containing methods needed by the cli to execute the reinstall command. cCsdgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command t reinstall((RT((s!/usr/share/yum-cli/yumcommands.pyRY scCsdS(sbReturn a usage string for this command. :return: a usage string for this command s PACKAGE...((RT((s!/usr/share/yum-cli/yumcommands.pyR[ scCs5t|t|t|||t||dS(sVerify that conditions are met so that this command can run. These include that the program is being run by the root user, that there are enabled repositories with gpg keys, and that this command is called with appropriate arguments. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RR%R(RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR] s  cCs#|j|td|j|S(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage sSetting up Reinstall Process(RXRt reinstallPkgs(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR^ scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command sreinstall a package(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\ scCstS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise (RQ(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR_ s ( RbRcRdRYR[R]R^R\R_(((s!/usr/share/yum-cli/yumcommands.pyR s     tDowngradeCommandcBsDeZdZdZdZdZdZdZdZRS(sWA class containing methods needed by the cli to execute the downgrade command. cCsdgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command t downgrade((RT((s!/usr/share/yum-cli/yumcommands.pyRY( scCsdS(sbReturn a usage string for this command. :return: a usage string for this command s PACKAGE...((RT((s!/usr/share/yum-cli/yumcommands.pyR[0 scCs5t|t|t|||t||dS(sVerify that conditions are met so that this command can run. These include that the program is being run by the root user, that there are enabled repositories with gpg keys, and that this command is called with appropriate arguments. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RR%R(RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]7 s  cCs#|j|td|j|S(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage sSetting up Downgrade Process(RXRt downgradePkgs(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR^G scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command sdowngrade a package(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\X scCstS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise (RQ(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR__ s ( RbRcRdRYR[R]R^R\R_(((s!/usr/share/yum-cli/yumcommands.pyR# s     tVersionCommandcBsDeZdZdZdZdZdZdZdZRS(sUA class containing methods needed by the cli to execute the version command. cCsdgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command Ry((RT((s!/usr/share/yum-cli/yumcommands.pyRYp scCsdS(sbReturn a usage string for this command. :return: a usage string for this command s[all|installed|available]((RT((s!/usr/share/yum-cli/yumcommands.pyR[x scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s9Display a version for the machine and/or available repos.(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\ scCs!d}|r|d}n|d.kr2|d}nd}d}|jjtj}i}|d/krg}|dkrd}q|td}ntjj}xI|D]A} t|| j || <|| j r|| j |j qqW|dkr5t dGHxt|D]} dG| GHqWddgfS|dkrJx|D]} | |kr`qHnt dG| GHt dGH|sxt|| D]} dG| GHqWqHiid6id6} || } |j| } |j| | | | d| dg} |j| }|d |d f}|j| t| d|qHWddgfS|jd rt|rtx|D]}d|krd|krt|ds File doesn't exist: %scss|]}|jVqdS(N(tstrip(t.0tn((s!/usr/share/yum-cli/yumcommands.pys sidt releasevertbasearchRtwarns%s %s/%ss Installed:is%s %ssGroup-Installed:is Available:sGroup-Available:RuRy(s grouplists groupinfoRsnogroups-installedsnogroups-availables nogroups-alls installedsallsgroup-installeds group-alls availablesallsgroup-availables group-all(Rsnogroups-installedsnogroups-availables nogroups-all(s installedsallsgroup-installeds group-allN(sgroup-installeds group-all(s availablesallsgroup-availables group-all(sgroup-availables group-all(.R4R_RR`R&RItconfigtreadVersionGroupsConfigRtpkglisttrun_with_packagesRitrun_with_package_namesRRt_group_names2aipkgst_calcDataPkgColumnsRt_displayPkgsFromNamesR.RR!RDRERKRRtopent readlinestbasenametrangeRRtyumvarR?t simpleVersionthistoryRRtend_rpmdbversiont_rpmdb_warn_checksRRLR}t fmtColumnstzip(RTRRR'tvcmdRRRtgconfRtpkgnameR~Rtpkg_names2pkgsRtdgrpRtndgrptreltbaRtlastdbvRRvRuRRtline((s!/usr/share/yum-cli/yumcommands.pyR^ s                             "  %1 cCsNd}|r|d}n|jjtj}|dkrD|rDtS|dkS( sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise RiRRR@sgroup-availables group-all(s availablesallsgroup-availables group-all(R4R_RR`R.(RTRRR'RR((s!/usr/share/yum-cli/yumcommands.pyR_, s  cCsdS(sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write sread-only:present((RTRRR'((s!/usr/share/yum-cli/yumcommands.pyRa= s( RbRcRdRYR[R\R^R_Ra(((s!/usr/share/yum-cli/yumcommands.pyRk s    tHistoryCommandcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZRS(sUA class containing methods needed by the cli to execute the history command. cCsdgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command R((RT((s!/usr/share/yum-cli/yumcommands.pyRYM scCsdS(sbReturn a usage string for this command. :return: a usage string for this command sC[info|list|packages-list|summary|addon-info|redo|undo|rollback|new]((RT((s!/usr/share/yum-cli/yumcommands.pyR[U scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s(Display, or use, the transaction history(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\\ sc CsYitd6td6}idd6dd6dd6dd6}xt|dkrt}x\|djdd jd D];}||krqqnt}||d}|| || sisRollback to transaction %u(RQR&R.tpopRRRRRRRtaltered_lt_rpmdbtaltered_gt_rpmdbRItYumMergedHistoryTransactiontmergeRRRRR0RR( RTRR'R:RRtmobjRR$R((s!/usr/share/yum-cli/yumcommands.pyt_hcmd_rollback s@"     0       cCs|jjdS(N(Rt_create_db_file(RTRR'((s!/usr/share/yum-cli/yumcommands.pyt _hcmd_new scCsdG|jjGHtj|jjj}dGtjd|tGH|jj}|dkrmt dGdGHdS|jj }|jj dd}t dG|j GHt dGtj|jGHt dGtj|jGHt d GHt d Gtjd |d tGHt d Gtjd |dtGHt dGtjd |dtGHt dGtjd |dtGHt dGtjd |dtGHt dGtjd |dtGHdS(Ns File :s Size :s%ds Transactions:it1s Begin time :s End time :s Counts :s NEVRAC :s%6dtnevracs NEVRA :tnevras NA :Rts NEVR :tnevrs rpm DB :R?s yum DB :tyumdb(Rt_db_fileRDRtst_sizeRRR.RRRt _pkg_statsRRRRRt end_timestamp(RTRR'Rttrans_Ntcountsttrans_1((s!/usr/share/yum-cli/yumcommands.pyt _hcmd_stats s&  """""cCs|d}|sd}nxrt|jjd|D]U}|jj|dtdkr_q5ndG|GdG|jj|rdGHq5dGHq5WdS(NiRtcreatesSyncing rpm/yum DB data for:s...sDone.sFAILED.(RRR?R*Rtpkg2pidRQt sync_alldb(RTRR'tipkg((s!/usr/share/yum-cli/yumcommands.pyt _hcmd_sync s  " cCsd}|rJ|d|krJ|jjtddj|tjn|rw|dd krwt|t|nI|jj ot j |jj t j s|jjtdtjndS(!sZVerify that conditions are met so that this command can run. The exact conditions checked will vary depending on the subcommand that is being called. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* RR5Rtrepeattredotundotnewtrollbacktaddons addon-infotstatst statisticstsynctsynchronizepkgRspkg-lists pkgs-listtpackages package-listR;s packages-listspkg-infos pkgs-infos package-infos packages-infois%Invalid history sub-command, use: %s.s, s(You don't have access to the history DB.N(slistsinfossummarysrepeatR;R<snewR>R?s addon-infoR@RARBRCspkgsspkg-lists pkgs-listRDs package-listspackagess packages-listspkg-infos pkgs-infos package-infos packages-info(srepeatR;R<R>snew( RRRR0RRRR%RR-RDR R (RTRRR'R ((s!/usr/share/yum-cli/yumcommands.pyR] s"    'c Csd}|r|d}ntr"nz|dkr@|j|}n\|dkr^|j|}n>|dkr||j|}n |dkr|j|}n|dkr|j|}n|dkr|j||}n|dkr|j||}n|dkr|j||}n|dkr<|j ||}n`|d kr]|j ||}n?|d!kr~|j ||}n|d"kr|j |}n|d#krdd|fgfS|S($sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage RiR5RR?s addon-infoRRspkg-lists pkgs-listRDs package-listR;s packages-listR<R;R:R>R=R@RARBt synchronizespkg-infos pkgs-infos package-infos packages-infos history %s(saddons addon-info(spkgspkgsspkg-lists pkgs-listspackages package-listspackagess packages-list(sredosrepeat(sstatss statistics(ssyncRE(spkg-infos pkgs-infos package-infos packages-infoN(RQthistoryListCmdthistoryInfoCmdthistorySummaryCmdthistoryAddonInfoCmdthistoryPackageListCmdRRR%R'R4R9thistoryPackageInfoCmdR(RTRRR'RRm((s!/usr/share/yum-cli/yumcommands.pyR^ sB              cCs#d}|r|d}n|dkS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise RiR:R;R<R>(srepeatsredosundosrollback((RTRRR'R((s!/usr/share/yum-cli/yumcommands.pyR_' s  cCs-d}|r|d}n|d kr)dSdS( sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write RiR:R;R<R>R`sread-only:past(srepeatsredosundosrollback((RTRRR'R((s!/usr/share/yum-cli/yumcommands.pyRa5 s   (RbRcRdRYR[R\RRR%R'R4R9R]R^R_Ra(((s!/usr/share/yum-cli/yumcommands.pyR H s    (     1 tCheckRpmdbCommandcBsDeZdZdZdZdZdZdZdZRS(sYA class containing methods needed by the cli to execute the check-rpmdb command. cCs ddgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command tchecks check-rpmdb((RT((s!/usr/share/yum-cli/yumcommands.pyRYJ scCsdS(sbReturn a usage string for this command. :return: a usage string for this command s[dependencies|duplicates|all]((RT((s!/usr/share/yum-cli/yumcommands.pyR[R scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command sCheck for problems in the rpmdb(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\Y sc Cskd}|r|}nd}d}|jd|dtd|ddrTd }n|d ||fgfS( sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage R@cSst|jGHdS(N(Rt__str__(R\((s!/usr/share/yum-cli/yumcommands.pyt_outr siRRtchkcmdtheadercSsdS(N(R(R\((s!/usr/share/yum-cli/yumcommands.pyRw sis%s %s(RRQ(RTRRR'RPROtrc((s!/usr/share/yum-cli/yumcommands.pyR^` s    cCstS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise (RQ(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR_{ s cCsdS(sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write sread-only:past((RTRRR'((s!/usr/share/yum-cli/yumcommands.pyRa s( RbRcRdRYR[R\R^R_Ra(((s!/usr/share/yum-cli/yumcommands.pyRLE s     tLoadTransactionCommandcBsDeZdZdZdZdZdZdZdZRS(s^A class containing methods needed by the cli to execute the load-transaction command. cCs dddgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command sload-transactionsload-tssts-load((RT((s!/usr/share/yum-cli/yumcommands.pyRY scCsdS(sbReturn a usage string for this command. :return: a usage string for this command R((RT((s!/usr/share/yum-cli/yumcommands.pyR[ scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s&load a saved transaction from filename(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\ scsfd}d}|s0tjg}n|d}tjj|rI|jtd|ttjd|}d}t } x|D]} j | } | ddk rqn| d} | dj } |dkrt jjdtd}n| |kr td} nd } yDt| d j }d |}t| |j }|d7}Wn qnXidd 6dd 6}x+| |D]}|j}|||qWd }x7| |D]+}|j}||rqnd}PqWd|| f} | std}t|}|dkr<d}nt||}td}t|}|dkrxd}nt||}dG|GdG|GdGtdGHt} ntjd|d t}d||f}tjd|d t}d||f}d| ||tjj| fGHqWdtd|t|fgfS|jtd|j|d td|tjjfgfS(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage cs|jdstSy|jddjjd\}}t|j}t|jjd}|tjkrj|}n%|tj krj |}nt SWnt SXtS(Nsmbr:t:iRR( RR.RRtintttupleRIt TS_INSTALLtgetInstalledPackageObjectt TS_AVAILABLEtgetPackageObjectRQ(tltpkgtupt current_stateR(R(s!/usr/share/yum-cli/yumcommands.pyt _pkg_avail s(cSse|jdsdS|td}|d krB|dcd7 [-- install|cmd] ((RT((s!/usr/share/yum-cli/yumcommands.pyR[P scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command s3Simple way to swap packages, instead of using shell(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\W scCs5t|t|t|||t||dS(sVerify that conditions are met so that this command can run. These include that the program is being run by the root user, that there are enabled repositories with gpg keys, and that this command is called with appropriate arguments. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RR%R*RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR]^ s  c Csid|kr6|jd}|| }||d}n|d }|d}|oS|scddgfS|d|jkrdg|}n|d|jkrdg|}n|j}|j}xy||fD]k} dj| |_| |_|j|j} | ddkr| dd |dj| fgfSqW||_||_dd |dj|fgfS( sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage s--iRiRRfRis%s %s(tindexR R t cmdstringR0t parseCommandst doCommands( RTRRR'tofftrextcmdstiextcmdstocmdstolineR tcmdret((s!/usr/share/yum-cli/yumcommands.pyR^m s0           (  (RbRcRdRYR[R\R]R^(((s!/usr/share/yum-cli/yumcommands.pyRC s     tRepoPkgsCommandcBsMeZdZdZdZdZdZdZdZdZ RS(sRA class containing methods needed by the cli to execute the repo command. cCsddddgS(sReturn a list containing the names of this command. This command can be called from the command line by using any of these names. :return: a list containing the names of this command s repo-pkgss repo-packagessrepository-pkgssrepository-packages((RT((s!/usr/share/yum-cli/yumcommands.pyRY scCsdS(sbReturn a usage string for this command. :return: a usage string for this command sK [pkg(s)]((RT((s!/usr/share/yum-cli/yumcommands.pyR[ scCs tdS(shReturn a one line summary of this command. :return: a one line summary of this command sJTreat a repo. as a group of packages, so we can install/remove all of them(R(RT((s!/usr/share/yum-cli/yumcommands.pyR\ scCs5t|t|t|||t||dS(sVerify that conditions are met so that this command can run. These include that the program is being run by the root user, that there are enabled repositories with gpg keys, and that this command is called with appropriate arguments. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* N(RR%R7RO(RTRRR'((s!/usr/share/yum-cli/yumcommands.pyR] s  cCsd}|d}|d}|d}t}|sEt}dg}nd} i dd6dd 6d d 6d d 6d d 6d d6d d6dd6dd6dd6dd6dd6} | j||}trn|dkrtj|||d|S|dkrtj|||d|S|dkr8tj|||d|S|dkrxC|D];} |jd| d|} || || t| 7} qKW| rdt dd| fSn|dkr'xC|D];} |j d| d|} || || t| 7} qW| rt j |dt dd | fSns|dkrxI|D]A} |j d| d!td|} || || t| 7} q:W| rt j |dt dd | fSn|d6krL|r|j j} nxI|D]A} |jd| d|d$|} || || t| 7} qW|r-| |_ n| rdt d%d&| fSnN|d7kr|rp|j j} nxC|D];} |jd| d$|} || || t| 7} qwW|r| |_ n| rdt d*d+| fSn|d,kr#|r |j j} nxj|D]b} y"|jd| d|d$|} Wntjjk rVqnX|| || t| 7} qW|r| j|_ n| rdt d%d&| fSxC|D];} |jd| d$|} || || t| 7} qW|r| |_ n| rdt d*d+| fSnw|dkrxC|D];} |jd| d|} || || t| 7} q6W| rdt d-d.| fSn|dkrox|D]} |jd| d|} xg| D]^}|jj|j}x@t|D]2}|j|krqn| |jd/|7} PqWqW|| || t| 7} qW| rdt d0d1| fSn+|d krx|D]} |jd| d|} x| D]}|jj|jg}d8}x[t|D]M}|j|krqn|r|j|dr|j|q|g}qW|rx0|D](}|j|jkrUq7n|g}Pq7Wt|dkr|j|}qnx|D]}|j\}}}}}|j|j r| |jd/|7} q|j!|j r| |j d/|7} q|j"j|j| j|| |j#d/|7} qWqW|| || t| 7} qW| rdt d2d3| fSndt$d4|gfSdt$d5gfS(9sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage cSsx|D]}||_qWdS(N(trepopkg(ttxmbrsRttxmbr((s!/usr/share/yum-cli/yumcommands.pyt_add_repopkg2txmbrs s iiiRRRsremove-or-reinstallserase-or-reinstallsremove-or-syncs erase-or-syncserase-or-distro-syncsremove-or-distro-syncs%erase-or-distribution-synchronizations&remove-or-distribution-synchronizationRiRs update-tos upgrade-tos check-updates check-upgradescheck-upgradess check-updatesRRR5Rftpatterns%d package to installs%d packages to installs%d package to updates%d packages to updateRjs reinstall-oldsreinstall-installedtrepoid_installs%d package to reinstalls%d packages to reinstalls reinstall-newsreinstall-availablesmove-tos%d package to move tos%d packages to move toRs%d package to removes%d packages to removeRs%d package to remove/reinstalls%d packages to remove/reinstalls%d package to remove/syncs%d packages to remove/syncsNot a valid sub-command of %ss Nothing to do(s reinstall-oldsreinstall-installed(s reinstall-newsreinstall-availablesmove-toN(%RQR.RRR^RRZRfR&RRiRRlt _not_found_atcopyRRIRtReinstallRemoveErrorRRLtsearchPkgTupleR\RRRRwRtverEQRRxtbestPackagesFromListRRRqRR(RTRRR'RRRRWtnoargsRRRRt onot_found_aRRRtapkgsttoinstRtaRRR6((s!/usr/share/yum-cli/yumcommands.pyR^ sJ                                                                 cCsOd}t|dkr%|d}n|dkrKtj|||dStS(sGReturn whether a transaction set must be set up before this command can run. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: True if a transaction set is needed, False otherwise RfiR5Ri(sinfoslist(R&RR_R.(RTRRR'R((s!/usr/share/yum-cli/yumcommands.pyR_s   cCsud}t|dkr%|d}n|d krKtj|||dS|d krqtj|||dSd S( sAReturn the cache requirements for the remote repos. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: a list of arguments passed to *basecmd* :return: Type of requirement: read-only:past, read-only:present, read-only:future, write RfiR5Ris check-updates check-upgrades check-updatesscheck-upgradesR`(sinfoslist(s check-updates check-upgrades check-updatesscheck-upgrades(R&RRaRZ(RTRRR'R((s!/usr/share/yum-cli/yumcommands.pyRas   ( RbRcRdRYR[R\R]R^R_Ra(((s!/usr/share/yum-cli/yumcommands.pyR s    tUpdateinfoCommandcBs#eZidd6dd6dd6dd6dd6dd6dd 6Zd Zd Zd Zd ZdZdZdZ dZ i dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6dd6Z xe j D]Zee e\}}|sYqAn|Gdj|Gd|d | GHqAWnd}|s|d 7}ntd%Gdj|Gd|d | GH|r|d&GHtd'G|tdGHtd(G|tdGHtd)G|tdGHtd*G|tdGHtd+G|tdGHnfd,}|r!|dtd-|dtd.|dtd/|dtd0|dtd1|dtd2ni}|jdx*dD]}||d|qCWx*dD]}||d|qpWx*dD]}||d|qW||td-d&GH|rd n(ijd jd tt} | r?td3| GHnd }x}td4fd5d6tD]Z} |d7}| }td7tt| || j|fGH|| krgPqgqgWdS(8Ncss.x'|dkr)tjj|}|VqWdS(NR(RDRER(RE((s!/usr/share/yum-cli/yumcommands.pyt _dir_prefixesgscSstjdt|tS(s5 String of a number in the readable "locale" format. s%d(RRRUR.(R\((s!/usr/share/yum-cli/yumcommands.pytloc_numlst pkgs_sizet pkgs_not_sizetpkgs_ghost_sizetpkgs_miss_sizet pkgs_mod_sizet pres_sizet data_sizet data_not_sizeit pkgs_counttpkgs_not_counttpkgs_ghost_counttpkgs_miss_counttpkgs_mod_countt data_countcSs-||krd|||d kr)tj|d t }nd t d |gfS|dk rP|Sd|d |dgfS(sExecute this command. :param base: a :class:`yum.Yumbase` object :param basecmd: the name of the command :param extcmds: the command line arguments passed to *basecmd* :return: (exit_code, [ errors ]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string 2 = we've got work yet to do, onto the next stage iRR(trefiltersrefilter-cleanupR&RR'R#isfs snapsNot a valid sub-command of %sRs done(sfilterssfilterRsrefilter-cleanupsdusstatussdiffssnap(sfiltersfiltersN( RQRlRRRRRRR^RWRR(RTRRR'RRm((s!/usr/share/yum-cli/yumcommands.pyR^.s4            (RbRcRYR[R\R]RQRCRlRRRRRR^(((s!/usr/share/yum-cli/yumcommands.pyR$s    M Q   Y $(PRdRDRRRRIRRRRt yum.ErrorsRRRRtyum.i18nRRRRRjRrtdistutils.spawnRRmRt yum.configRt yum.packagesR tyum.fssnapshotsR R RRR%R(R*R7R8R9RBRGRORPReRhRnRRRRRRRR=RSRVRZRhRjRkRrRvRyR{RRRRR RLRSRRRRRRR$(((s!/usr/share/yum-cli/yumcommands.pyts         "          &     o=<<  kkNBlM<K<BCLnGHL^2]1