Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 ©ft`W.ã@sZdZddlmZmZddlmZddlmZmZmZddl Tddl Z ddl Z ddlZ ddlZ ddlZ ddlZddlZddlZddlZddlZddlZddlZddlZddlZdgZdadd „Zdad d „Zd d „ZGdd„de ƒZ!dd„Z"dd„Z#d,dd„Z$dd„Z%dd„Z&dd„Z'd-dd„Z(d d!„Z)da*d"d#„Z+d.d$d%„Z,d&d'„Z-d(d)„Z.d/d*d+„Z/dS)0z% Assorted utility functions for yum. é)Úprint_functionÚabsolute_import)Úunicode_literals)Úbase64_decodebytesÚ basestringÚunicode)Ú*NZsha256cCstdkrtjdƒjat|ƒS)z( Tests if a string is a shell wildcard. Nz [*?]|\[.+\])Ú_re_compiled_glob_matchÚreÚcompileÚsearch)Ús©rú/usr/lib/python3.6/misc.pyÚre_glob.s rcCsFtdkr(tjdƒj}tjdƒj}||faxtD]}||ƒr.dSq.WdS)zC Tests if a string needs a full nevra match, instead of just name. Nz.*([-.*?]|\[.+\]).z[0-9]+:TF)Ú_re_compiled_full_matchr r Úmatch)r ZoneZtwoZrecrrrÚre_full_search_needed6s   rcCstdS)Nr)Ú_default_checksumsrrrrÚget_default_chksum_typeDsrc@s:eZdZdZd dd„Zdd„Zdd„Zd d „Zd d „ZdS)Ú GenericHolderzèGeneric Holder class used to hold other objects of known types It exists purely to be able to do object.somestuff, object.someotherstuff or object[key] and pass object to another function that will understand itNcCs ||_dS)N)Ú_GenericHolder__iter)ÚselfÚiterrrrÚ__init__MszGenericHolder.__init__cCs|jdk rt||jƒSdS)N)rr)rrrrÚ__iter__Ps zGenericHolder.__iter__cCs t||ƒrt||ƒSt|ƒ‚dS)N)ÚhasattrÚgetattrÚKeyError)rÚitemrrrÚ __getitem__Ts  zGenericHolder.__getitem__cCsdd„t|ƒjƒDƒS)z!Return a dictionary of all lists.cSs"i|]\}}t|ƒtkr||“qSr)ÚtypeÚlist)Ú.0ÚkeyZlist_rrrú \sz+GenericHolder.all_lists..)ÚvarsÚitems)rrrrÚ all_listsZszGenericHolder.all_listscCs4x.|jƒjƒD]\}}t|ƒj|gƒj|ƒqW|S)z7 Concatenate the list attributes from 'other' to ours. )r(r'r&Ú setdefaultÚextend)rÚotherr$ÚvalrrrÚ merge_lists_szGenericHolder.merge_lists)N) Ú__name__Ú __module__Ú __qualname__Ú__doc__rrr r(r-rrrrrGs  rcCsštjdd|ƒ}tjƒ}d}d}xn|jdƒD]`}|jdƒr>d}q*|rT|jƒdkrTd}q*|rf|jdƒrfPq*|rx|jdƒrxPq*|r*|j|dƒq*Wt|j ƒƒS) z,Convert ASCII-armored GPG key to binary s ?ó rs$-----BEGIN PGP PUBLIC KEY BLOCK-----éós"-----END PGP PUBLIC KEY BLOCK-----ó=) r ÚsubÚioÚBytesIOÚsplitÚ startswithÚstripÚwriterÚgetvalue)ÚrawkeyÚblockZinblockZ pastheadersÚlinerrrÚ procgpgkeyes  rAcCsPxJ|jddƒD]:}|d|krt|ddƒ}||kr8dS||krDdSdSqWd S) ab Return if the GPG key described by the given keyid and timestamp are installed in the rpmdb. The keyid and timestamp should both be passed as integers. The ts is an rpm transaction set object Return values: - -1 key is not installed - 0 key with matching ID and timestamp is installed - 1 key with matching ID is installed but has an older timestamp - 2 key with matching ID is installed but has a newer timestamp No effort is made to handle duplicates. The first matching keyid is used to calculate the return result. Únamez gpg-pubkeyÚversionÚreleaseérr3ééÿÿÿÿ)ZdbMatchÚint)ZtsÚkeyidZ timestampZhdrZ installedtsrrrÚ keyInstalled‚s rJTc Cstjj|ƒstj|ƒtjj|ƒ�òtjjƒ�Ü}ttjj |dƒdƒ�}|j dƒWdQRX|j |ƒ|�r|d}tjj|ƒ�stj|dd�xFt j |dƒD]4}tjj |ƒ}|d|} tj|| ƒtj| dƒqžWd } ttjj |dƒd dƒ�}|j | ƒWdQRXd SQRXWdQRXdS) Nzgpg.confÚwbr4z-roií)Úmodez/*ú/z‘lock-never no-auto-check-trustdb trust-model direct no-expensive-trust-checks no-permission-warning preserve-permissions ÚwT)ÚosÚpathÚexistsÚmakedirsÚdnfZcryptoZ pubring_dirZContextÚopenÚjoinr<Z op_importÚglobÚbasenameÚshutilÚcopyÚchmod) r>rIZgpgdirZ make_ro_copyZctxÚfpZrodirÚfrWZro_fZoptsrrrÚimport_key_to_pubring¡s&      r]c CsÔtjƒ}y.tj|ƒ}tjj|dƒ}dtjj|f}Wn$t k rZdtjj|f}YnXdtjj |f}t t j |ƒƒ}xB|D]:}tj |ƒ}t|dƒr€t|dƒdkr€|d|kr€|Sq€Wtj|tjj d�}|S)zqreturn a path to a valid and safe cachedir - only used when not running as root or when --tempcache is setrz%s-%s-z%s/%s*iÀé)ÚprefixÚdir)rOÚgeteuidÚpwdÚgetpwuidrSZi18nZucdÚconstZPREFIXrZTMPDIRÚsortedrVÚlstatÚS_ISDIRÚS_IMODEÚtempfileZmkdtemp) ZuidZusertupZusernamer_ÚdirpathZ cachedirsZthisdirZstatsZcachedirrrrÚ getCacheDirÄs   (rkcCsfg}t|ƒ}t|ƒ}d}x6||krN||}|j|||…ƒ||7}||8}qW|j||d…ƒ|S)zE Given a seq, split into a list of lists of length max_entries each. rN)Úlenr"Úappend)ÚseqZ max_entriesÚretZnumZbegÚendrrrÚ seq_max_splitÜs  rqcCsDytj|ƒWn0tk r>}z|jtjkr.‚WYdd}~XnXdS)z| Call os.unlink, but don't die if the file isn't there. This is the main difference between "rm -f" and plain "rm". N)rOÚunlinkÚOSErrorÚerrnoÚENOENT)ÚfilenameÚerrrÚunlink_fês  rxFcCs^y tj|ƒStk rX}z2|jtjtjfkr2dS|rF|jtjkrFdS‚WYdd}~XnXdS)zF Call os.stat(), but don't die if the file isn't there. Returns None. N)rOÚstatrsrtruÚENOTDIRZEACCES)rvZ ignore_EACCESrwrrrÚstat_fós r{cCsFy$tdƒ�}|jƒ}t|ƒSQRXWnttfk r@tjƒSXdS)z� Get the audit-uid/login-uid, if available. os.getuid() is returned instead if there was a problem. Note that no caching is done here. z/proc/self/loginuidN)rTÚreadrHÚIOErrorÚ ValueErrorrOÚgetuid)ÚfoÚdatarrrÚ _getloginuidþs  r‚cCstdkrtƒatS)z§ Get the audit-uid/login-uid, if available. os.getuid() is returned instead if there was a problem. The value is cached, so you don't have to save it. N)Ú_cached_getloginuidr‚rrrrÚ getloginuid sr„c Csè|r |}nJd}|jdƒ}|dkr@||d…}|d kr@|d|…}|dkrTtjjd ƒ‚|r€t|ƒ}t|ƒ}|r€|r€|j|jkr€|Sytjj||d ƒWn2t k rÆ}ztjjt |ƒƒ‚WYdd}~XnX|rä|rät j ||j|jfƒ|S) zÎtake a filename and decompress it into the same relative location. When the compression type is not recognized (or file is not compressed), the content of the file is copied to the destinationNÚ.rú.zckú.xzú.bz2ú.gzú.lzmaú.zstz(Could not determine destination filenamei¤)r†r‡rˆr‰rŠr‹) ÚrfindrSÚ exceptionsZ MiscErrorr{Úst_mtimeÚlibdnfZutilsÚ decompressÚ RuntimeErrorÚstrrOÚutime) rvÚdestÚcheck_timestampsÚoutZdot_posZextZfir€rwrrrr�s,    "r�cCs:tjj|ƒ}|d7}tjj|ƒs.tj|dd�|d|S)Nz/genií)rLrM)rOrPÚdirnamerQrR)rvÚgenerated_namer”rrrÚcalculate_repo_gen_dest8s   r™cCst||ƒ}t||dd�S)zÇ This is a wrapper around decompress, where we work out a cached generated name, and use check_timestamps. filename _must_ be from a repo. and generated_name is the type of the file. T)r”r•)r™r�)rvr˜r”rrrÚrepo_gen_decompress@s ršc Cs˜g}xŽtj|ƒD]€}t|ƒ�n}xf|D]^}tjd|ƒr6q$|jƒ}|jƒ}|sLq$|rx|jddƒ}|jddƒ}|j|jƒƒq$|j |ƒq$WWdQRXqW|S)a( Takes a glob of a dir (like /etc/foo.d/\*.foo) returns a list of all the lines in all the files matching that glob, ignores comments and blank lines, optional paramater 'line_as_list tells whether to treat each line as a space or comma-separated list, defaults to True. z\s*(#|$)Ú ú ú,N) rVrTr rÚrstripÚlstripÚreplacer*r9rm)ZthisglobZ line_as_listÚresultsZfnamer\r@rrrÚread_in_items_from_dot_dirHs"     r¢)NT)F)NF)T)0r1Z __future__rrrZ dnf.pycomprrrryZ libdnf.utilsr�Z dnf.constrSZ dnf.cryptoZdnf.exceptionsZdnf.i18nrtrVr7rOZos.pathrbr rXrirr rrrrÚobjectrrArJr]rkrqrxr{r‚rƒr„r�r™ršr¢rrrrÚsN  #   #