v_c@sdZddlZddlZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z ddl ZddlmZddlmZddlmZmZmZddlZddlmZmZdd lTdd lmZmZmZdd lm Z dd l!m"Z"ddl#Zddl$Zdd lm%Z%m&Z&m'Z'ddl(Z(ye)dddkst*WndZ+dZ)nXdZ,de fdYZ-de fdYZ.dfdYZ/dfdYZ0dfdYZ1dfdYZ2e3dZ4d e fd!YZ5e3d"Z6e7d#kre8ej9d$koej9d$d%krGd&GHd'GHd&GHe0Z:xd(d)d*d$d+d,d-d.d/d0d1d2d3d4dd5d6d7d8d-d9d-d:d-d;fD]8Z;e:j<e;Z=d<e;e=d=d>e8e=e=fGHqWne8ej9d$kolej9d$d?krId&GHd@GHd&GHx4e>d(dAD]#Z;e6e;d0dBej?d*qWd&GHdCGHd&GHx<e>d(dAD]+Z;e6e;d0dDdEdFej?d*qWd&GHdGGHd&GHx1e>d(dAD] Z;e6e;d0ej?d*q"Wne8ej9d$kotej9d$d?dHfkrVe5Z@eAe@_BdBe@jCdId(dAD]/Z;e@jDdMdIe;d0e;d0ej?d*qWd&GHdNGHd&GHxLe>d(dAD];Z;e@jDdOdPdQdRdKe;d0e;d0ej?d*qWne8ej9d$koej9d$d?dSdHdTfkrejEjFne8ej9d$koej9d$d?dSfkrud&GHdUGHd&GHx:e>d(dAD])Z;e6e;d0edVej?d*qWd&GHd&GHdWGHd&GHxBe>d(dAD]1Z;e6e;d0edVdFdRej?d*q8Wd&GHne8ej9d$koej9d$d?dSdHdTfkre5Z@eAe@_BedVe@jCdId(dAD]/Z;e@jDdMdIe;d0e;d0ej?d*q Wd&GHdYGHd&GHxLe>d(dAD];Z;e@jDdOdPdQdRdKe;d0e;d0ej?d*q[Wd&GHnndS(Zs"Handle actual output from the cli.iN(tproxy(t TextMetertTextMultiFileMeter(t URLGrabError(tprco_tuple_to_string(tto_strtto_utf8t to_unicode(t checkSignalst formatRequire(t*(t logginglevelst_tP_(tRPMBaseCallback(tpackagesNewestByNameArch(t utf8_widthtutf8_width_filltutf8_text_filliicGs*x#|D]}||kr|}qqW|S(N((txtargsty((s/usr/share/yum-cli/output.pytmin8s  cGs*x#|D]}||kr|}qqW|S(N((RRR((s/usr/share/yum-cli/output.pytmax<s  cCsIttjdsdStjj}|dkr5dS|dkrEdS|S(s= Simple terminal width, limit to 20 chars. and make 0 == 80. tterminal_width_cachediPii(thasattrt urlgrabbertprogressR(tret((s/usr/share/yum-cli/output.pyt _term_widthAs  t YumTextMetercBseZdZddZRS(s,A class to display text progress bar output.cCsttj|||dS(s Update the status of the text progress bar :param amount_read: the amount of data, in bytes, that has been read :param now: the current time in seconds since the epoch. If *now* is not given, the output of :func:`time.time()` will be used. N(RRtupdate(tselft amount_readtnow((s/usr/share/yum-cli/output.pyRPsN(t__name__t __module__t__doc__tNoneR(((s/usr/share/yum-cli/output.pyRMstYumTextMultiFileMetercBseZdZRS(cCsttj|||dS(N(RRt update_meter(R tmeterR"((s/usr/share/yum-cli/output.pyR(\s(R#R$R((((s/usr/share/yum-cli/output.pyR'[stYumTermcBseZdZeZeejdr6edZ nidd6dd6dd6Z id d 6d d 6d d6dd6dd6dd6dd6dd6Z id d 6d d6d d6dd6dd 6dd6dd6dd6Z idd6dd6dd6dd6d d6d!d6Z id"d 6d#d6d$d6d%d6d&d 6d'd6d(d6d)d6Zid*d 6d+d6d,d6d-d6d.d 6d/d6d0d6d1d6Zd2Zd=d3d4Zd=d3d5Zd6Zd=ed7Zd8Zd9Zd:Zd;Zd<ZRS(>s>A class to provide some terminal "UI" helpers based on curses.RcCstS(N(R(R ((s/usr/share/yum-cli/output.pytmstsmult underlinetrevtreversetsgr0tnormalitblackitblueitgreenitcyanitreditmagentaityellowitwhitestboldstblinkttdimsss(BsssssssssssssssscCs(|j|_|j|_|j|_dS(N(t_YumTerm__ansi_forced_MODEtMODEt_YumTerm__ansi_forced_FG_COLORtFG_COLORt_YumTerm__ansi_forced_BG_COLORtBG_COLOR(R ((s/usr/share/yum-cli/output.pyt __forced_inits  tautoc Cst|_ttjds'd|_nd|_|dkrJ|jdSidd6dd6dd 6dd 6dd 6dd 6|_idd 6dd6dd6dd6dd6dd6dd6dd6|_ idd 6dd6dd6dd6dd6dd6dd6dd6|_ |dkrt |_dS|dks*t yddl }Wnt |_dSX|s`tj}n|jsyt |_dSy|jd|jWnt |_dSX|j|_ttjds|jd|_n|jd|_xR|jD]G}|}||jkr!|j|}n|j|p3d|j|[/*]?(R\tretsub(R Rftcap((s/usr/share/yum-cli/output.pyR_sc s|js |S|stj}nfd}xM|D]E}||} |rhtj| tj} ntj| ||}q8W|S(s)Search the string *haystack* for all occurrences of any string in the list *needles*. Prefix each occurrence with *beg*, and postfix each occurrence with *end*, then return the modified string. For example:: >>> yt = YumTerm() >>> yt.sub('spam and eggs', 'x', 'z', ['and']) 'spam xandz eggs' This is particularly useful for emphasizing certain words in output: for example, calling :func:`sub` with *beg* = MODE['bold'] and *end* = MODE['normal'] will return a string that when printed to the terminal will appear to be *haystack* with each occurrence of the strings in *needles* in bold face. Note, however, that the :func:`sub_mode`, :func:`sub_bold`, :func:`sub_fg`, and :func:`sub_bg` methods provide convenient ways to access this same emphasizing functionality. :param haystack: the string to be modified :param beg: the string to be prefixed onto matches :param end: the string to be postfixed onto matches :param needles: a list of strings to add the prefixes and postfixes to :param escape: a function that accepts a string and returns the same string with problematic characters escaped. By default, :func:`re.escape` is used. :param ignore_case: whether case should be ignored when searching for matches :return: *haystack* with *beg* prefixing, and *end* postfixing, occurrences of the strings in *needles* cs|jS(N(tgroup(tmatch(tbegtend(s/usr/share/yum-cli/output.pyR+Js(RPRotescapettemplatetIRp( R thaystackRtRutneedlesRvt ignore_casetrendertneedletpat((RtRus/usr/share/yum-cli/output.pyRp$s    cKs |j|||jd||S(sOSearch the string *haystack* for all occurrences of any string in the list *needles*. Prefix each occurrence with *beg*, and postfix each occurrence with self.MODE['normal'], then return the modified string. If *beg* is an ANSI escape code, such as given by self.MODE['bold'], this method will return *haystack* with the formatting given by the code only applied to the strings in *needles*. :param haystack: the string to be modified :param beg: the string to be prefixed onto matches :param end: the string to be postfixed onto matches :param needles: a list of strings to add the prefixes and postfixes to :return: *haystack* with *beg* prefixing, and self.MODE['normal'] postfixing, occurrences of the strings in *needles* R1(RpR?(R RyRtRztkwds((s/usr/share/yum-cli/output.pytsub_normQscKs|j||j|||S(sTSearch the string *haystack* for all occurrences of any string in the list *needles*. Prefix each occurrence with self.MODE[*mode*], and postfix each occurrence with self.MODE['normal'], then return the modified string. This will return a string that when printed to the terminal will appear to be *haystack* with each occurrence of the strings in *needles* in the given *mode*. :param haystack: the string to be modified :param mode: the mode to set the matches to be in. Valid values are given by self.MODE.keys(). :param needles: a list of strings to add the prefixes and postfixes to :return: *haystack* with self.MODE[*mode*] prefixing, and self.MODE['normal'] postfixing, occurrences of the strings in *needles* (RR?(R RyRgRzR((s/usr/share/yum-cli/output.pytsub_modedscKs|j|d||S(sSearch the string *haystack* for all occurrences of any string in the list *needles*. Prefix each occurrence with self.MODE['bold'], and postfix each occurrence with self.MODE['normal'], then return the modified string. This will return a string that when printed to the terminal will appear to be *haystack* with each occurrence of the strings in *needles* in bold face. :param haystack: the string to be modified :param needles: a list of strings to add the prefixes and postfixes to :return: *haystack* with self.MODE['bold'] prefixing, and self.MODE['normal'] postfixing, occurrences of the strings in *needles* R:(R(R RyRzR((s/usr/share/yum-cli/output.pytsub_boldxscKs|j||j|||S(scSearch the string *haystack* for all occurrences of any string in the list *needles*. Prefix each occurrence with self.FG_COLOR[*color*], and postfix each occurrence with self.MODE['normal'], then return the modified string. This will return a string that when printed to the terminal will appear to be *haystack* with each occurrence of the strings in *needles* in the given color. :param haystack: the string to be modified :param color: the color to set the matches to be in. Valid values are given by self.FG_COLOR.keys(). :param needles: a list of strings to add the prefixes and postfixes to :return: *haystack* with self.FG_COLOR[*color*] prefixing, and self.MODE['normal'] postfixing, occurrences of the strings in *needles* (RRA(R RyReRzR((s/usr/share/yum-cli/output.pytsub_fgscKs|j||j|||S(sSearch the string *haystack* for all occurrences of any string in the list *needles*. Prefix each occurrence with self.BG_COLOR[*color*], and postfix each occurrence with self.MODE['normal'], then return the modified string. This will return a string that when printed to the terminal will appear to be *haystack* with each occurrence of the strings in *needles* highlighted in the given background color. :param haystack: the string to be modified :param color: the background color to set the matches to be in. Valid values are given by self.BG_COLOR.keys(). :param needles: a list of strings to add the prefixes and postfixes to :return: *haystack* with self.BG_COLOR[*color*] prefixing, and self.MODE['normal'] postfixing, occurrences of the strings in *needles* (RRC(R RyReRzR((s/usr/share/yum-cli/output.pytsub_bgsN(R#R$R%RORPRRRtpropertyRQR^R`RcR>R@RBRRR&RmRnR_RSRpRRRRR(((s/usr/share/yum-cli/output.pyR*`sz        o -    t YumOutputcBsLeZdZdZdZdZdZdMdZdZ dZ e dZ dMd dMd d Z e d Zd ZddedZed edMdZed edMdZdZddZdZedZdMdMdZidMidZedidZdZdZddMdZddMdMdZ d Z!d!Z"d"Z#d d#d$Z$e d d%Z%dMdMdMd&Z&dMd'Z'ed(Z(d)Z)d*Z*d+Z+d,Z,d-Z-d.Z.d/Z/d0Z0d1Z1dMd2Z2e d3Z3d4Z4d5Z5d6Z6d7Z7d8Z8d9Z9d:Z:gd;Z;i ed<d=6ed<d<6ed>d>6ed?d?6ed@d@6edAdA6edBdB6edCdC6edDdD6edEdE6edFdF6Z<gdGZ=dHZ>dIZ?dJZ@dKZAe dLZBRS(Ns+Main output class for the yum command line.cCstjd|_tjd|_ttdrQtjdjd|_n dg|_t |_ d|_ dt jD|_dS(Nsyum.clisyum.verbose.clit expandMacros %_i18ndomainst:s redhat-distcSsi|]\}}t|qS((RS(t.0tktv((s/usr/share/yum-cli/output.pys s (tloggingt getLoggertloggertverbose_loggerRtrpmRtsplitt i18ndomainsR*ttermR&t_last_interrupttERRORS_TO_KBASE_ARTICLESt iteritemstreported_error_msgs(R ((s/usr/share/yum-cli/output.pyRns   c Cstdtdtdtdtdtdtdtdtd td td td g }tjtj}|ttjd |dtjd|}|S(sReturn a string representing the current time in the form:: Mon dd hh:mm:ss :return: a string representing the current time tJantFebtMartAprtMaytJuntJultAugtSeptOcttNovtDecs%mis %d %T (R ttimet localtimetinttstrftime(R tmonthsR"R((s/usr/share/yum-cli/output.pyt printtimes 6<cCs|jjd|j|jt|dr`|jr`|jjdkr`|jjtddS|jjtd|j||jdS(sPerform failure output for failovers from urlgrabber :param errobj: :class:`urlgrabber.grabber.CallbackObject` containing information about the error :raises: *errobj*.exception s%s: %stretry_no_cacheis'Trying again, now avoiding proxy cache.NsTrying other mirror.( Rterrorturlt exceptionRRterrnoR tsuggestKBaseArticle(R terrobj((s/usr/share/yum-cli/output.pyt failureReports cCsd}t|jdr9|jjtkr9|jj}n3t|jdrl|jjtkrl|jj}n|svdS|j|s|jjt|t |j|' - highlighting used when the package has a higher version number :return: (exit_code, [errors]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string tlisttinfoiis%stkernsbold,underlinesnot inR1Rt>R:t|jjdkr^|jjr^|jr^tjj|g|j\}}}|sW|r^dSn|jjrwd|} nd|j |j f} |j | |j |j } |r|dkr|jj}n|j| ||dt} n| GH|dkr|jjtj}n|sdStd|jGHt} xtjj|D]} t| } t|j | ksHt|j | krqHn| stdGHt} nt} trn1t|j| krtd} |j | } nt|j| krtd } t} nt|j| kr:td } t} n| jd rmtd } |j | } t} nwg}x1|j D]&}|d | kr}|j!|q}q}W|rtd} tjj"t#|d } n td} |r|j| ||dt} n| r(|j | t$| GHqH| | GHqHWdGHdS(sOutput search/provides type callback matches. :param po: the package object that matched the search :param values: the information associated with *po* that matched the search :param matchfor: a list of strings to be highlighted in the output :param verbose: whether to output extra verbose information :param highlight: highlighting options for the highlighted matches RNs%s : s%s.%s : R{sRepo : %ss Matched from:sDescription : sURL : %ssLicense : %st/sFilename : %sisProvides : sOther : s (%RR&R$tquery_install_excludestcmdline_excludesR9R|t parsePackagestshowdupesfromreposRRRRRR&tcolor_search_matchRRORRR RR RRSR:tuniqueRR!RR RtprovidesRRRR(R RtvaluestmatchforRqRtetmtuRtdoneRit can_overflowRtprovstprov((s/usr/share/yum-cli/output.pyt matchcallback@st $      *             cCs|j|||dtS(sqOutput search/provides type callback matches. This will output more information than :func:`matchcallback`. :param po: the package object that matched the search :param values: the information associated with *po* that matched the search :param matchfor: a list of strings to be highlighted in the output Rq(RRO(R RRR((s/usr/share/yum-cli/output.pytmatchcallback_verboses c s\d}d}d}t}fd}x|D]}ywt|j} || 7}y|jrl|| 7}nWnnX|sw.nyt|j} WnnX|| 7}Wq.t}jjtdPq.Xq.W|sX|r|tdj |n||kr0|tdj ||n|rX|tdj |qXndS(sReport the total download size for a set of packages :param packages: a list of package objects :param installonly: whether the transaction consists only of installations icsgjjtjjr1jjtj|n2jjsJjj rcj j tj|ndS(N( RRR9R tINFO_1tlogR$tassumenot assumeyesRtwarn(R(R (s/usr/share/yum-cli/output.pyt _call_logss2There was an error calculating total download sizesTotal size: %ssTotal download size: %ssInstalled size: %sN( RSRRR't installedsizeRORRR R( R R|t installonlyttotsizetlocsizetinsizeRRRR((R s/usr/share/yum-cli/output.pytreportDownloadSizesB      cCsd}t}xR|D]J}yt|j}||7}Wqt}|jjtdPqXqW|s|jjt j j r|jj t j td|j |q|jjs|jj r|jjt j td|j |qndS(smReport the total size of packages being removed. :param packages: a list of package objects is-There was an error calculating installed sizesInstalled size: %sN(RSRRRORRR RRR9R RRRR$RRR(R R|RRRR((s/usr/share/yum-cli/output.pytreportRemoveSizes&    c/ sjjttg}iid6id6id6}d}gfd}jj}i}jjdkr9|r9g}xjjD]}t|drd|jf}||krg||gSdg|}d}x|D]w}t|||krt|||}||krgS||8}t|||tt|D]*}||c||7<||cd9 %    "cCs1|jjdks"tjj r7d}d}d}n-tdtj}tdtj}t}|j dif}|}|j }t |dr||j _ ||j _||j _||j _||j _ n?|jj||||j_|jj||jj|tt|}||_dS(s`Set up the progress callbacks and various output bars based on debug level. itfot prerepoconfN((R$t debuglevelRVRWRXR&RR'tCacheProgressCallbackRtinterrupt_callbackRR'Rtmulti_progressbartcallbacktfailure_callbacktrepostsetProgressBartsetFailureCallbacktsetInterruptCallbacktDepSolveProgressCallBacktweakreft dsCallback(R RR+R,tfreportR-R*tdscb((s/usr/share/yum-cli/output.pytsetupProgressCallbackss,"        cCs|jdS(s;This function is for API purposes only to protect the typo.N(R7(R ((s/usr/share/yum-cli/output.pytsetupProgessCallbacksscCsy|j}|j}|j}t|drQ||j_||j_||j_n$||j_||j_||j_dS(s7Set up callbacks to import and confirm gpg public keys.R'N( RYt getKeyForRepotgetCAKeyForRepoRR't confirm_functgpg_import_functgpgca_import_funcR.(R R;R<R=((s/usr/share/yum-cli/output.pytsetupKeyImportCallbacks s       cCsd}td}tj}|js|jjd}|jjd}td|||||f}|jjtj|n||j|krt n||_t dtddS( s Handle CTRL-C's during downloads. If a CTRL-C occurs a URLGrabError will be raised to push the download onto the next mirror. If two CTRL-C's occur in quick succession then yum will exit. :param cbobj: :class:`urlgrabber.grabber.CallbackObject` g@ttwoR:R1sZ Current download cancelled, %sinterrupt (ctrl-c) again%s within %s%s%s seconds to exit. isuser interruptN( R RRRR?RRR tINFO_2tKeyboardInterruptR(R tcbobjtdelta_exit_chktdelta_exit_strR"RRR((s/usr/share/yum-cli/output.pyR*/s     c CsGt|dkrdSttjds,dStjjd}|jjtjd|j t j |}|dkrd}n|j d|j |}|j d |j ||jd k}|j d}|j d |j ||} dttd|j |j | |||f} |jjtj| dS(slOutputs summary information about the download process. :param remote_pkgs: a list of package objects that were downloaded :param remote_size: the total amount of information that was downloaded, in bytes :param download_start_timestamp: the time when the download process started, in seconds since the epoch iNt TerminalLineiRmig{Gz?s | %5sBs %siPRis %5sB/ss %s%s%s%s%stTotals (RRRRRERRR R@trestRRzRRt_llenRR ( R t remote_pkgst remote_sizetdownload_start_timestampttltdl_timetui_sizetui_timetui_endtui_bsR((s/usr/share/yum-cli/output.pytdownload_callback_total_cbPs    ( $cCsUt}d}x||D]t}|j}|dkr:d}n|dkrOd}n|dkrdd}n|dkr|j||d 7}qqWt|d kstt|d kr<itd d6tdd6tdd6tdd 6tdd 6tdd6}|djgt|D]}||^q"fS|djt|fS(Nis True-InstallRs Dep-Installt Obsoletedt ObsoletingtUpdatetEraseRRiiRxtORtRtDtUs, R<(sInstallRURVs Reinstalls DowngradeRT( RKtstateRzRRTR RRR4(R thpkgstactionsRthpkgtstt large2smallR((s/usr/share/yum-cli/output.pyt_history_uiactionsls0               0c Csst|tgkr;g|D]}|j||^qS|dksS|d krtd}tdd|}|dk rt||kr|}nt|Sd}ytj|}||jdd}d ||j f}|dk rCt||krCd |||j f}t||krCd |j }qCnt|SWnt k rntt |SXdS( NIistSystemRcWs!|j|}|sdS|dS(sf Split gives us a [0] for everything _but_ '', this function returns '' in that case. R<i(R(ttextRR((s/usr/share/yum-cli/output.pyt _safe_split_0st;is%s <%s>s %s ... <%s>s<%s>(Ii( RRR&R RRtpwdtgetpwuidtpw_gecostpw_nametKeyErrorR( R R"tlimitRtloginidRRdtusertfullname((s/usr/share/yum-cli/output.pyRs(#     csfd}d|krdS|jdd\}}||}|jkrVdS|dkrfdS||}|jkrdS|dks|dkrdS||kr||}}n||fS(s3 Convert a user "TID" string of 2..4 into: (2, 4). csy|dks|jdrvj}|jdrrt|td}|dkretdn||8}n|St|SWntk rdSXdS(Ntlastslast-itz(RttidRRRR&(RRqtoff(told(s/usr/share/yum-cli/output.pytstr2ints     s..iiN(R&RRq(RsRqRttbtidtetid((Rss/usr/share/yum-cli/output.pyt_historyRangeRTIDss"     cCst}d}xt|D]}|d|kr`|jjtd|d|dfqn|d}x0t|d|ddD]}|j|qWqW|S(su Convert a list of ranged tid typles into all the tids needed, Eg. [(2,4), (6,8)] == [2, 3, 4, 6, 7, 8]. iis4Skipping merged transaction %d to %d, as it overlapsi(RKRRRR RRz(R trtidsttidstlast_endtmtidR((s/usr/share/yum-cli/output.pyt_historyRangeTIDss ( "c CsZ|jj}|dkr5|jjtddSt}g}|d}t}|rt}|ddkr|j dqnx|D]y}yt ||j |Wqt k r|j ||}|r|j|j|gqn|j|qXqW|r)|j|jj|n| rP|rP|jjtddS||fS(NsNo transactionsiitalls)Bad transaction IDs, or package(s), given(NN(NN(thistoryRoR&RtcriticalR RKRSRORRRzRRwRR|Rtsearch( R textcmdsRsRytpatstusertidstprintallRqtrtid((s/usr/share/yum-cli/output.pyt_history_list_transactionss8       c Cs|j|\}}|d(krA|s4ddgfSddgfSd}|rVd(}n|jj|d|}d}|jjdkrddg}n|jjd krdg}n|jjd kstt}d}x[|D]S} | r||krPn|d7}| jd(kr$|d7}n|j | j qWt |dkrj||dkrj|j d nd } t |dkrt d } n t d} | t t dddt | ddt t dddt t dddt t dddfGHddGHd} d}x|D]} | rB||krBPn|d7}t |dkrp| jpjd} n|j| j d} tjdtj| j} |j| j\} }t | dd} t |dd}d}}| jd(krd}}nX| jrd}}nB| jr1d }}n,| jrGd!}}n| jr]d"}}n| jrod#}n| jrd$}n| | j| | || fGd%||fGHq%W|jj}|d(kr|jd&tn5|jj d't!d}|j"|kr|jnd(S()s)Output a list of information about the history of yum transactions. :param extcmds: list of extra command line arguments :return: (exit_code, [errors]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string isNo accessible history to listisFailed history listiRktusersitcommandsssingle-user-commandstblahs%s | %s | %s | %s | %ss Command lines Login usertIDiis Date and timeis Action(s)itAlterediRmiOs%6u | %s | %-16.16s | %s | %4uR<s%Y-%m-%d %H:%MRR t#RRRR8R7s%s%sRt main_onlyN(#RR&R~RsR$thistory_list_viewRTRKtcmdlineRztloginuidRR RRRRRt beg_timestampRat trans_datat return_codetoutputtrpmdb_problemst trans_skiptaltered_lt_rpmdbtaltered_gt_rpmdbRqRot_rpmdb_warn_checksRSRZt simpleVersionROtend_rpmdbversion(R RRyRRktold_tidsRtuidstblanksRstfmtRttmRtuiactstrmarktlmarktlastdbvtrpmdbv((s/usr/share/yum-cli/output.pythistoryListCmds          "                   - c Cst|dkr,|jjtddSg}d}x8|dD],}y|dksg|jdr|dkrt}|jjd|}|dkrt dqn|j }|jdrt |td}|dkrt dn||8}n|j t |wCnt |dkr6t dn|j |WqCt k rn|jjtd dSXqCW|jj|}|s|jjtd dS|S( NisNo transaction ID giveniRoslast-tcomplete_transactions_onlyRpisBad transaction ID givensNot found given transaction ID(RRRR R&RRSR~RoRRqRRRRs( R RRyRotextcmdtctoRqRrRs((s/usr/share/yum-cli/output.pyt_history_get_transactions_s@         cCsR|j|}|dkrdSt|dkrJ|jjtdn|dS(Nis#Found more than one transaction ID!i(RR&RRRR (R RRs((s/usr/share/yum-cli/output.pyt_history_get_transactions  cCsd}t}t}g}|jj}|d kr_|jjtdddgfSx{|dD]o}|j||r|j|j||qjn+||d k r|j||qjn|j |qjW|r|j |jj |n|j }|r6t |}|j |j|n| rt|dkr|jjdt}|d k r|j|j|j|jqn|s|jjtdddgfS|jj} | d k r| j} | j} nt} d\} } d }|r%|jd \} } nx|jj|D]o}| d k r|j| kr|jjd td }| |krt|_qnd } |j| kr|j| kr|d krtjj|}qm|j|n|d k rm| rd d GHnt} |j|d }|rm|jd \} } |j| krj|j| krjtjj|}qjqmn|j|kr8| rd d GHnt} |j||q8q8W|d k r| rd d GHn|j|nd S(sOutput information about a transaction in history :param extcmds: list of extra command line arguments :return: (exit_code, [errors]) exit_code is:: 0 = we're done, exit 1 = we've errored, exit with error string cSs'yt|SWntk r"dSXdS(N(RRR&(R((s/usr/share/yum-cli/output.pyRts sNo transactionsisFailed history infoiRs$No transaction ID, or package, giveniiRRmiON(ii(RKR~RoR&RRR RwRzRRRtcopyRR|RRSRqRRRsRZRRORR9tYumMergedHistoryTransactiontmerget_historyInfoCmd(R RRtRytmtidsRRsRqtutidsRtlasttidRtbmtidtemtidtmobjR((s/usr/share/yum-cli/output.pythistoryInfoCmds                     cCspd|jkr|jS|jj|j}|se|jj|j}|sPdSdt|djS|djS(sn Given a pkg, find the ipkg.ui_from_repo ... if none, then get an apkg. ... and put a ? in there. R t?s@?i(RRRZtsearchPkgTupleR=R\RR(R R^RaRb((s/usr/share/yum-cli/output.pyt_hpkg2from_reposc sj|j}itdd6tdd6tdd6tdd6itdd6td d6td d6td d6tgjjD]}t|^q}|d <|d  siRiRIs-Impossible, installed not newer and not olderR:R1RR<s%s%s%s%s %-*s %s( RZR[RtsortR=RSRTRRR( Rt prefix_lent was_installedRt pkg_max_lent show_repoRt _pkg_statesR[RaRRtui_repo(t_pkg_states_availablet_pkg_states_installedR^R (s/usr/share/yum-cli/output.pyt _simple_pkg s2       sTransaction ID :s%u..%uisBegin time :sBegin rpmdb :s**iRii<s (%u seconds)s (%u minutes)is (%u hours)s (%u days)sEnd time :sEnd rpmdb :sUser :sReturn-Code :tAborteds Failures:s, sFailure:tSuccesssCommand Line :s config-mains config-repostsaved_txs-Additional non-default information stored: %dsTransaction performed with:css!|]}tt|VqdS(N(RR(RR^((s/usr/share/yum-cli/output.pys v siRRsPackages Altered:sPackages Skipped:css!|]}tt|VqdS(N(RR(RR^((s/usr/share/yum-cli/output.pys ~ sRsRpmdb Problems:s%s%s: css!|]}tt|VqdS(N(RR(RR^((s/usr/share/yum-cli/output.pys siRsScriptlet output:s%4dsErrors:i,i,iPFi,iPFiiiiQs ((RRR RRRRSRORRqRRRtbeg_rpmdbversionR&Rt end_timestampRRRRRRRRR~treturn_addon_dataRKt differencet trans_withthistoryInfoCmdPkgsAlteredRRtproblemRRcR|tmainRterrors(R RsRRRRRtbegtmtendtmtendtmstbegtmstsofarRRtcodesRt addon_infotdefault_addonst non_defaultRtprobRRtline((RRR^R s/usr/share/yum-cli/output.pyRs&  *          (               Rs True-Installs Dep-InstallRSRTRVRRRRURcCsed }|j}d}d}xw|jD]l}|j|j|j}|t|krdt|}n|tt|kr%tt|}q%q%Wx|jD]}d} |jsd} nd} |rtj j |g|\} } } | s| rd} qn|j | \}}|j }|j|j|j}t ||}trPn|d k r|jdkr|j|jkr|jdkrt|jd }d|||}n|d k r|jd kr|j|jkr|jd krt|jd }d|||}nd }|jdkr6|}nd | ||||||j|fGHqWd S(s/Print information about how packages are altered in a transaction. :param old: the :class:`history.YumHistoryTransaction` to print information about :param pats: a list of patterns. Packages that match a patten in *pats* will be highlighted in the output iRis ** R1R:RRUiRRs%s%s%s%s %-*s %sNs (sUpdateds Downgrade(R&t_history_state2uistateRR>R[RRRR9R|RRtui_nevraRRSRR(R RsRRot all_uistatesRRR^tuistateRRRRRRRtcntln((s/usr/share/yum-cli/output.pyR sR   !    ! ! c Cs8|j|\}}|d$kr.ddgfSd}|ttdddttdddttdd d ttd d d fGHd d GHd}iid6id6id6id6id6id6id6}x|jj|D]}|j|jd}d}tj} t r n|j | d&kr<d}n|j | d)krXd}np|j | d,krtd}nT|j | d0krd}n8|j | d4krd}n|j | d7krd}n||j |gj |qWitdd6tdd6tdd6tdd6td d6td!d6td"d6} d#} xd8D]}||smqWnxt ||D]}| r| dkrPn| d7} g} x&|||D]}| j|jqW|j| \} }| |}|t|ddt|ddt|d d | fGHq~WqWWd$S(9srPrint a summary of transactions in history. :param extcmds: list of extra command line arguments isFailed history infos%s | %s | %s | %ss Login useritTimeis Action(s)iRiRmiOs%s | %s | %s | %8utdaytweekt fortnighttquarterthalftyearR}ii<iii imsLast days Last weeks Last 2 weekss Last 3 monthss Last 6 monthss Last yearsOver a year agoiNiiQiiQi: iiQiuiiQi: iwiiQi: iiiQi3(RRRRRRsall(RR&RR R~RsRRRRSRR_RRRRRa(R RRyRRRRsRtperiodR"t _period2userRR\RRtuperiod((s/usr/share/yum-cli/output.pythistorySummaryCmd sp          !         cCsEd}t|dkr:|d}|dkr:d}q:n|dk ryt|Wqtk r|jjtdddgfSXn|dk r|jjd|g}nK|jj dt g}|ddkr|jjtdddgfS|s*|jjtd |ddgfS|d}|jj |j }t|d krtd G|j GHtd GHx&|jj |j D]}d |GHqWdGHddgfSx|d D]}||kr|j jtjd||jj |j |G|j jtjdntd|GH|j jtjdqWdS(s|Print addon information about transaction in history. :param extcmds: list of extra command line arguments iRosBad transaction ID givensFailed history addon-infoRyRis$No transaction ID, or package, givensNo Transaction %s foundisTransaction ID:s)Available additional history information:s %sR<shistory addon-infos%s:s)%s: No additional data found by this nameN(R&RRRRRR R~RsRoRSRRqRRR R@(R RRqRst hist_dataRtitemnameRi((s/usr/share/yum-cli/output.pythistoryAddonInfoCmd$ sH             cCs|jj|}d }|rH| rH|jjtdddgfS|sWd}n|j}d}|ttdddttdd d ttd d d fGHd d GHd}d}x|jj|d|D]}|d k r|r|t |j |krPnd }d} } |j d kr=d} } nX|j rSd} } nB|j rid} } n,|j rd} } n|jrd} } n|jrd} n|jrd} nx|j D]} |d kr tjj| g|\} } }| r | r qq n|j| j| j}t|d }| j}trFn|d k r|jdkr|j| jkr| jdkrt | jd}d|||}n|d k r|jdkr|j| jkr| jdkrt | jd}d|||}nd }| jd!kr,| }n|d7}||j||fGd| | fGHqWqW|jj}|d kr|jdtn5|jjdtd}|j|kr|jnd S("sPrint a list of information about transactions from history that involve the given package or packages. :param extcmds: list of extra command line arguments s)Bad transaction IDs, or package(s), givenisFailed history packages-listis %s | %s | %sRis Action(s)iRi5RmiOs%6u | %s | %-50siRkRR RRRRR8R7RRURRs%s%sRRN(sUpdateds Downgrade( R~RR&RRR RRRsRRRRRRRRR9R|RR>R[RRSRRqRoRRZRROR(R RRyRkRRRRsRoRRR^RRRRRRRR((s/usr/share/yum-cli/output.pythistoryPackageListCmdU s     +               !   ! !  + c Cs|jj|}d}|rH| rH|jjtdddgfS|sWd}n|j}d}x|jj|d|D]}|dk r|r|t|j |krPnx|j D]}|dkrt j j |g|\}} } | r| rqqn|j |j|j} |r.dGHntdG|jGHtj|j} td G| GHtd G|jGHtd G| GH|jdk rt|j}td Gtjd |tGHn|jdk rtdG|jGHn|jdk rtjt|j} tdG| GHn|jdk rBtdG|jGHn|jdk rftdG|jGHn|jdk rtdG|jGHn|jdk rtdG|jGHn|jdk rtdG|jGHn|j dk r tjt|j } tdG| GHn|j!dk r/tdG|j!GHn|j"j#dk rYtdG|j"j#GHn|j"j$dk rtdG|j"j$GHn|j"j%dk rtdG|j"j%GHn|j"j&dk rt|j"j&} |j'| }tdG|GHn|j"j(dk r7t|j"j(} |j'| }tdG|GHn|d7}qWqW|jj)}|dkrw|j*dt+n5|j,j-dtd}|j.|kr|j*ndS(sPrint information about packages in history transactions. :param extcmds: list of extra command line arguments s)Bad transaction IDs, or package(s), givenisFailed history packages-infoiiRkR<sTransaction ID :sBegin time :sPackage :sState :sSize :s%dsBuild host :sBuild time :sPackager :sVendor :sLicense :sURL :sSource RPM :sCommit Time :sCommitter :sReason :sCommand Line :sFrom repo :sInstalled by :sChanged by :RRN(/R~RR&RRR RRsRRR9R|RR>R[RqRRRRRRtlocaleRROt buildhostRtpackagertvendorR Rt sourcerpmRRRtreasont command_lineR R RR RoRRSRZRR(R RRyRkRRRsR^RRRRRR"RRR((s/usr/share/yum-cli/output.pythistoryPackageInfoCmd s    + ! ! ccsPxI|D]A}td}dt|d}||jdd|fVqWdS(Ns Error: %sRis (R RR(trestringRRt prefix2nd((s/usr/share/yum-cli/output.pytpretty_output_restring s  N(CR#R$R%RnRRRR&RRRt staticmethodRRRRRRRSRRRRRR#R3RGR RWRYRfRjRsRRRRRRRRRRR%R7R8R>R*RRRaRRwR|RRRRRRRRRRRRRR(((s/usr/share/yum-cli/output.pyRs       m 1     .&G)  2 I 9 0 P 4  F (   !   !%  a $  d            < @ 1 [ UR2cBseZdZddZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZRS(sQA class to provide text output callback functions for Dependency Solver callback.cCs(tjd|_d|_||_dS(s8requires yum-cli log and errorlog functions as argumentssyum.verbose.cliiN(RRRtloopstayum(R R((s/usr/share/yum-cli/output.pyRn s c Csitdd6tdd6tdd6tdd6td d 6td d 6td d6tdd6}|\}}}}}||} |jjtjtd|||||| dS(sPrint information about a package being added to the transaction set. :param pkgtup: tuple containing the package name, arch, version, and repository :param mode: a short string indicating why the package is being added to the transaction set. Valid current values for *mode* are:: i = the package will be installed u = the package will be an update e = the package will be erased r = the package will be reinstalled d = the package will be a downgrade o = the package will be obsoleting another package ud = the package will be updated od = the package will be obsoleted RRs an updateRterasedRRRs a downgradeRt obsoletingRRtudR"tods&---> Package %s.%s %s:%s-%s will be %sN(R RRR R@( R R=RgtmodedictRIRRRRtmodeterm((s/usr/share/yum-cli/output.pytpkgAdded s       cCs|jd7_dS(sRPerform setup at the beginning of the dependency solving process. iN(R(R ((s/usr/share/yum-cli/output.pytstart8 scCs |jjtjtddS(s?Output a message stating that a transaction check is beginning.s--> Running transaction checkN(RRR R@R (R ((s/usr/share/yum-cli/output.pyttscheck> scCsE|jd7_|jjtjtd|jjd|jdS(sBOutput a message stating that dependency resolution is restarting.is6--> Restarting Dependency Resolution with new changes.s---> Loop Number: %dN(RRRR R@R tdebug(R ((s/usr/share/yum-cli/output.pyt restartLoopB s cCs |jjtjtddS(sAOutput a message stating that dependency resolution has finished.s"--> Finished Dependency ResolutionN(RRR R@R (R ((s/usr/share/yum-cli/output.pyRuI scCs&|jjtjtd||dS(scOutput a message stating that the package *formatted_req* is being processed as a dependency for the package *name*. :param name: the name of the package that *formatted_req* is a dependency of :param formatted_req: a string representing the package that is being processed as a dependency of *name* s---> Processing Dependency: %s for package: %sN(RRR R@R (R Rt formatted_req((s/usr/share/yum-cli/output.pytprocReqO s  cCs&|jjtjtd||dS(sXOutput a message stating that the package *formatted_req* is being processed as a dependency for the package *po*. :param po: the package object that *formatted_req* is a dependency of :param formatted_req: a string representing the package that is being processed as a dependency of *po* s---> Processing Dependency: %s for package: %sN(RRR R@R (R RR((s/usr/share/yum-cli/output.pyt procReqPo\ s  cCs&|jjtjtd||dS(stOutput a message stating that the given package will not be removed. This method is used during leaf-only group remove, leaf-only repo-pkg remove and normal remove commands to indicate that the package will be kept. :param po: the :class:`yum.packages.PackageObject` that will not be removed :param hits: unused s"---> Keeping package: %s due to %sN(RRR R@R (R Rtdeppothits((s/usr/share/yum-cli/output.pyt removeReqi s cCs#|jjtjtd|dS(sOutput a message stating that there is an unresolved dependency. :param msg: string giving information about the unresolved dependency s--> Unresolved Dependency: %sN(RRR R@R (R R((s/usr/share/yum-cli/output.pyt unresolvedv sc s|\}}|jd||jf}td|f}t||}|td|f7}sq|Sdfd}fd} dtx/tjjD]} || |}qWt} xQtj jD]7} | | |\} }| r| j | j qqWdx/tjj | D]} || |}qmWdx8tj j | D]} | | |\} }qW|S(s>Return an error message stating that a package required to fulfill a dependency is missing. :param reqPo: the package object that has a dependency that cannot be fulfilled :param reqTup: the name, flags, and version of the package needed to fulfil the dependency s%s (%s)s Package: %ss Requires: %sc Ss&td|||jf}|dd f}t}x@|jd|D],}t}|tdtjj|7}qDW|s |j dd}||kr xk|j D]]}|d}|j dd}||krt}tjj|}|td|7}qqWq n|s"|td7}n|S( s? Add a package to the message, including any provides matches. s %s: %s (%s)Rs %st 0123456789is ~%ss Not foundN(NNN( R RR&RSt matchingPrcosROR9R:Rt translateR( RRtneednameRtneedtupRR=t nneednameR((s/usr/share/yum-cli/output.pyt_msg_pkg s&$   !c s^|j|j|j|jf}|ksK|jrO|jjkrO|Sj|td}jj |j t }|rtd}n|||7}itdd6tdd6tdd6}x|D]w}xn|j D]c\}}||kr qn|j|j|j|jf}j|||||7}qWqW|S( NRRs Updated Byt updatedbys Downgraded Byt downgradedbys Obsoleted Byt obsoletedby( RR RRR?RRzR RtgetMembersWithStateR=tTS_REMOVE_STATESt relatedto( RRtnevrRtrmedtrelmapRtrpkgtrtype(RRoRt seen_pkgstyb(s/usr/share/yum-cli/output.pyt _run_inst_pkg s(-      "cs|j|j|j|jf}|ksK|jrX|jjkrXt|fSj|td}j j |j t rtd}n|||7}t ||fS(Nt AvailableR(RR RRR?RRSRzR RR R=tTS_INSTALL_STATESRO(RRR#R(RRoRR(R)(s/usr/share/yum-cli/output.pyt_run_avail_pkg s-   N( RRR R R&RKRRZt getProvidesR\RzRR[( R treqPotreqTupt needflagst needversiontprob_pkgRtui_reqR*R-Rtavailable_namesttst((RRoRR(R)s/usr/share/yum-cli/output.pytformat_missing_requires s6      cCs&|jjtjtd||dS(s Print a message stating that two packages in the transaction conflict. :param name: the name of the first package involved in the conflict :param confname: the name of the second package involved in the conflict s(--> Processing Conflict: %s conflicts %sN(RRR R@R (R Rtconfname((s/usr/share/yum-cli/output.pyt procConflict s  cCs&|jjtjtd||dS(sPrint a message stating that two packages in the transaction conflict. :param name: the first package object involved in the conflict :param confname: the second package object involved in the conflict s(--> Processing Conflict: %s conflicts %sN(RRR R@R (R RR8((s/usr/share/yum-cli/output.pytprocConflictPo s  cCs |jjtjtddS(sEOutput a message stating that the transaction set is being populated.sC--> Populating transaction set with selected packages. Please wait.N(RRR R@R (R ((s/usr/share/yum-cli/output.pyttransactionPopulation scCs#|jjtjtd|dS(sOutput a message stating that the header for the given package is being downloaded. :param name: the name of the package s<---> Downloading header for %s to pack into transaction set.N(RRR R@R (R R((s/usr/share/yum-cli/output.pytdownloadHeader sN(R#R$R%R&RnR R R RRuRRRRR7R9R:R;R<(((s/usr/share/yum-cli/output.pyR2 s   "     h R)cBs>eZdZdZdZdZdZddZRS(sFA class to handle text output callbacks during metadata cache updates.cCs:tjd|_tjd|_tjd|_dS(Nsyum.clisyum.verbose.clisyum.filelogging.cli(RRRRt file_logger(R ((s/usr/share/yum-cli/output.pyRn scCs|jj||dS(s{Output a log message. :param level: the logging level for the message :param message: the message N(RR(R tleveltmessage((s/usr/share/yum-cli/output.pyR scCs|jj||dS(sOutput an errorlog message. :param level: the logging level for the message :param message: the message N(RR(R R>R?((s/usr/share/yum-cli/output.pyterrorlog" scCs|jj||dS(sOutput a file log message. :param level: the logging level for the message :param message: the message N(R=R(R R>R?((s/usr/share/yum-cli/output.pytfilelog* scCsd}t}||}|dkr+t}n=|dkr@t}n(||krUt}n||sht}n|rt|||ndS(sGOutput the current status to the terminal using a progress status bar. :param current: a number representing the amount of work already done :param total: a number representing the total amount of work to be done :param name: a name to label the progress bar with iiN(RSROR(R RRRt num_outputsRtopc((s/usr/share/yum-cli/output.pyR2 s         N( R#R$R%RnRR@RAR&R(((s/usr/share/yum-cli/output.pyR) s     c se|dkr|S|dkr%d}ngfd}x?|jjd |D](}|j|krkqPn||jqPWs|Sjd }st|St}t}xAD]9}|j|st }n|j |j krt }qqW|rG|j d kr$d |j |j |jfSd |j |j |j |jfSn|rad|j |j fS|S(s Get more information on a simple pkgname, if we can. We need to search packages that we are dealing with atm. and installed packages (if the transaction isn't complete). RRRRRRRcsDr3dj|jkr3dj|r3dSj|dS(Ni(RR?R(R(tmatches(s/usr/share/yum-cli/output.pyt _cond_add[ s/RiRs%s-%s-%ss %s:%s-%s-%ss%s.%sN(RRRRRsodsud(R&Rt matchNaevrtts_stateRRRROR?RSRR RRR( Rtpkgnamet ts_statesRERtfmatchtshow_vert show_archRs((RDs/usr/share/yum-cli/output.pyt _pkgname_uiN s<       tYumCliRPMCallBackcBsteZdZedZddZddZdZdZ d Z d Z e dd d Z d ZRS(s1A Yum specific callback class for RPM operations.cCstS(N(R(R((s/usr/share/yum-cli/output.pyR+ scCsbtj|td|_d|_tjdjt j |_ d|_ d|_ ||_dS(NR<syum.verbose.cliRi(RRnRtlastmsgR&t lastpackageRRRR R@RtmarktmarksR(R R((s/usr/share/yum-cli/output.pyRn s    RRRcCst|j||S(sReturn more information on a simple pkgname, if possible. :param pkgname: the name of the package to find information about :param ts_states: a tuple containing the states where the package might be found (RMR(R RHRI((s/usr/share/yum-cli/output.pyt pkgname_ui sc Cs|j|}|j}t|tjkr=t|} n|j|} ||_|dkrjd} n|d|} |j||||| || |dS(sOutput information about an rpm operation. This may include a text progress bar. :param package: the package involved in the event :param action: the type of action that is taking place. Valid values are given by :func:`rpmtrans.RPMBaseCallback.action.keys()` :param te_current: a number representing the amount of work already done in the current transaction :param te_total: a number representing the total amount of work to be done in the current transaction :param ts_current: the number of the current transaction in transaction set :param ts_total: the total number of transactions in the transaction set ildN( Rt_max_action_widthRttypest StringTypesRRSRPt _out_event( R tpackageRt te_currenttte_totalt ts_currenttts_totaltprocesstwid1RHtpercent((s/usr/share/yum-cli/output.pytevent s     cCsit|ds\d}x8|jjD]'}t|}||kr%|}q%q%W||_n|j}|S(Nt_max_action_wid_cachei(RRRRRa(R R^Ritwid_val((s/usr/share/yum-cli/output.pyRT s     c Cs|jrtjjs$||kr|j|||dtjjd|d|\} }} | t|||t|| | f} | |jkrtjjt| tjj | |_n||krdGHqndS(NRRHR^R( RRVRWRXt_makefmtRROtwriteRtflush( R RYRZR[R\R_R]RHR^Rtwid2R((s/usr/share/yum-cli/output.pyRW s$   cCs0|r,tjjt|tjjndS(sPrint messages originating from a package script. :param package: unused :param msgs: the messages coming from the script N(RVRWRdRRe(R RXR((s/usr/share/yum-cli/output.pyt scriptout sicCstt|}d||f}d|d|d} | ||f} |dkr]d} n t|} d|d} | d|d7} | d7} | d7} | d7} |j} | | kr| } n| | 8} | | dkr| d} n|j| | }d||f} d| d }| |d}|rN|d krNd | }|}n|r||jt||d f}d |d| }| }nK|d krd| }|}n,||j|f}d|d| }| }|||fS(Ns%s.%st%ss/%Riiis[%-ss]ids %s: %s gY@s %s: %s Rs %s: %s s %s: %s (RRR&RRRQR(R R_R[R\RRHR^tlRtfmt_doneRtpnltoverheadRRRtfmt_bartfull_pnlRRftbar((s/usr/share/yum-cli/output.pyRc sH             "    c Csw|}t|j}d}td}t|j}tt||j} |jdd|||||| dS(sC Callback for post transaction when we are in verifyTransaction(). idt VerifyingN( RRR RRRRRTRW( R tbaseRRRYRZR_R]RHR^((s/usr/share/yum-cli/output.pyt verify_txmbr s N(RsodsudN(R#R$R%RRR&RnRSR`RTRWRgRORcRr(((s/usr/share/yum-cli/output.pyRN s "  /c Csd}tjjsdS|dkr.d}n%|dkrMt||}nd}t}|dkr}||kr}d}nd||f}|t|d8}|dkrd}n|dkr |d8}|dkrd}n|t||}d|||f}n||kr6d t||||f}n|d 8}|dkrUd}n|d} | t |krt |} n|| 8}|t||}d t|| | |||f}||krtjj |n||krtjj d ntjj dS( sIOutput the current status to the terminal using a simple text progress bar consisting of 50 # marks. :param current: a number representing the amount of work already done :param total: a number representing the total amount of work to be done :param name: a name to label the progress bar with RNiRms %d/%diis [%-*s]%ss %s%sis %s: [%-*s]%ss ( RVRWRXRRR&RRRRRdRe( RRRRQR_RRuthashbarRtnwid((s/usr/share/yum-cli/output.pyR sL                     t__main__iRR<s5 Doing format_number tests, right column should alignigg?g?g?i i g333333&@idgfffff[@iiWii'ig+ii?Biii#s%36s <%s> %s <%5s>RiRs Doing progress, small nameietabcds Doing progress, big names_%s_s 123456789 is Doing progress, no names rpm-progresstfoos_12345678_.endRos! Doing CB, small proc / small pkgtspkgs Doing CB, big proc / big pkgtlpkgs-=is.ends i18n-progresssi18n-rpm-progresss! Doing progress, i18n: small names 正在安装s Doing progress, i18n: big names' Doing CB, i18n: small proc / small pkgs# Doing CB, i18n: big proc / big pkg(GR%RVRRRURRfRRoR3Rturlgrabber.progressRRRturlgrabber.grabberRtyum.miscRtyum.i18nRRRR9trpmUtils.miscutilsRR t yum.constantsR R R t yum.rpmtransRtyum.packageSackRt yum.packagest yum.historyRRRRRRTRRRR'R*RR2R)R&RMRNRR#RtargvRRRRRtsleeptcbRORRR`R:t setup_locale(((s/usr/share/yum-cli/output.pyts                 Ub< 1 > ( $*( .    (% .%   (