MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /usr/share/createrepo/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/share/createrepo/dumpMetadata.pyc
m
4	Dc@s6dkZdkZdkZdkZdkZdkZdkZdkZdkZdk	Z	dk
lZdk	l
Z
lZddgZde	ifdYZdddZd	Zd
Zddd
ZdZdZdeifdYZdfdYZdZdZdZdZdS(N(serror(swrite32usFNAMEtGzipFiletopencBstZdZRS(NcCs|iid|iid|id }d}|o
t}n|iit|t|it	d|iid|iid|o|ii|dndS(Nssiisst(
tselftfileobjtwritetfilenametfnametflagstFNAMEtchrtwrite32utlong(RRR((t%/usr/share/createrepo/dumpMetadata.pyt_write_gzip_header's

(t__name__t
__module__R(((R
R&strbi	cCst|||S(N(RRtmodet
compresslevel(RRR((R
t	_gzipOpen6scCs<yti|ti}Wntj
otdnX|S(NsError opening file(tosRRtO_RDONLYtfdnotOSErrortMDError(RR((R
treturnFD;s
cCsd}y?t|tijod}ti|ti}n|}Wnt	j
ot
dnX|it
it
iBt
iBy|i|}Wnt
ij
ot
dnXt|t
ijo
t
dn|id|oti|~n|S(s>hand back the rpm header or raise an Error if the pkg is fubariisError opening filesError opening packageN(topened_herettypetpackagettypest
StringTypeRRRRRRttst
setVSFlagstrpmt_RPMVSF_NOSIGNATUREStRPMVSF_NOMD5tRPMVSF_NEEDPAYLOADthdrFromFdnothdrterrortclose(R RR'RR((R
t	returnHdrBs*



iicCsd}yt|tij	o
|}nd}t|d|}|djot	i
}n+|djoti
}nt
d||i}x(|o |i|}|i|qW|o|i~n|iSWnt
d|nXdS(	stakes filename, hand back Checksum of it
       sumtype = md5 or sha
       filename = /path/to/file
       CHUNK=65536 by defaultiiRtmd5tshas/Error Checksumming file, wrong checksum type %ss#Error opening file for checksum: %sN(RRtfileRRtfoRtCHUNKtsumtypeR+tnewtsumR,RtreadtchunktupdateR)t	hexdigest(R0R-R/RR4R2R.((R
tgetChecksum\s.



	
cCs|d	jodSnt|to|Snyt|d}|SWntj
ozddddg}xc|D]V}yt||}Wntj
oqnX|i||jo|idSqnqnWnXd}x9|D]1}t|djo|d}q||}qW|S(
shands back a unicoded stringttasciisutf-8s
iso-8859-1siso-8859-15s
iso-8859-2it?N(tstringtNonet
isinstancetunicodetxtUnicodeErrort	encodingstenctencodet	newstringtchartord(R;RBRERAR?RD((R
t
utf8Strings2
cCsd}t|tij	o
|}nd}t|d}|id|id}t
id|\}|id}t
id|\}|d}||}
|
d}|djod|}nd	|
|}|i||idd|id}t
id|\}
|id}t
id|\}	|
d}|	|d}||}|o|i~n||fS(sQtakes an rpm file or fileobject and returns byteranges for location of the headeriitrihis>IiiipN(RRR-RRR.RtseekR3tbinindextstructtunpacktsigindextbindatatsigdatatsigindexsizetsigsizetdisttoboundarythdrstartthdrindexthdrdatathdrindexsizethdrsizethdrendR)(R-RPRXRSRRVRWRORMRURQRNRRRTRJR.((R
t
byterangess<









RcBstZddZRS(NcCstii|||_dS(N(t
exceptionst	Exceptiont__init__Rtargs(RR]((R
R\s(RRR<R\(((R
RstRpmMetaDatacBstZdZhZdZdZdZdZdZdZ	dZ
dZd	Zd
Z
dZdZd
ZdZdZdZdZdZdZdZRS(seach rpm is one object, you pass it an rpm file
       it opens the file, and pulls the information out in bite-sized chunks :)
    cCsy?titii||}|d|_|d|_	~Wn(t
j
o}
td||fnX||_
|d|_||_ttii||}	t||	|_ti|	ddti|	d}|i||_|idt|\|_|_|i~~	|d}|d}g|_!g|_"x'|D]}|i"i$t%i&|qOWx'|D]}|i!i$t%i&|qyWg|_'g|_(g|_)|i*dS(	NiisError Stat'ing file %s %stbaseurliRsfile-pattern-matchsdir-pattern-match(+RtstattpathtjointbasedirRtstatsRtsizetmtimeRteRtoptionstlocalurltrelativepathRtfdR*R R'tlseektfdopenR.tdoChecksumCachetpkgidRIRYt
rangestarttrangeendR)t	fileglobstdirglobstdirrctfilerctglobtappendtretcompilet	filenamestdirnamest
ghostnamestgenFileLists(RR RcRRhRsRdRrRvRkRgR.((R
R\sD

	
	



					cCs/|iddjodSn|idSdS(Nt
sourcepackageitsrctarch(Rt	tagByName(R((R
RscCsg}|djo|Snt|tij	o|d@}|i|n@x<|D]4}|}|dj	o|d@}n|i|qSW|S(Ni(	treturnflagsRR<RRtListTypetnewflagRwtflag(RRRRR((R
t
_correctFlagss


cCsg}|djo|Snt|tij	o
|g}nxZ|D]R}|}|dj	o9|d@}|djo|idq|idqEqEW|S(Ni@ii(	treqsRR<RRRRRRw(RRRRR((R
t_checkPreReqs




cCsg}d}|djo|i||Snt|tij	o7|dj	o|i	|}nd}|i|nExA|D]9}|dj	o|i	|}nd}|i|qW|S(N(NNN(NNN(NNN(t
returnversR<tvertupletversRwRRRRt_stringToVersiontver(RRRRR((R
t_correctVersion*s"



cCs|id}|djo|| }nd}|id}|djoE||d|!djo
d}n||d|!}||d}n4||ddjo
d}n||d}d}|||fS(Nt:it0t-iR8(tstrngtfindtitepochtjR<tversiontrelease(RRRRRRR((R
RAs



c	CsUt|}|djogSnh}yx|D]}d||<q1WWntj
o
~nX|iSyt|}|i	Wntj
o
~nX|djpt
|d}d}}xM||jo?|||jo ||||<}|d7}n|d7}qW|| Sg}x,|D]$}||jo|i|q)q)W|S(sTReturn a list of the elements in s, but without duplicates.
    
        For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3],
        unique("abcabc") some permutation of ["a", "b", "c"], and
        unique(([1, 2], [2, 3], [1, 2])) some permutation of
        [[2, 3], [1, 2]].
    
        For best speed, all sequence elements should be hashable.  Then
        unique() will usually work in linear time.
    
        If not possible, the sequence elements should enjoy a total
        ordering, and if list(s).sort() doesn't raise TypeError it's
        assumed that they do enjoy a total ordering.  Then unique() will
        usually work in O(N*log2(N)) time.
    
        If that's not possible either, the sequence elements must support
        equality-testing.  Then unique() will usually work in quadratic
        time.
        iiN(tlentstntuR?t	TypeErrortkeystlisttttsorttAssertionErrortlasttlastiRRw(	RRRRRRRRR?((R
t_uniq[sB

	



cCsR|i|}t|tijo't|djo|dSqNdSn|SdS(NiR8(RR'ttagtdataRRRR(RRR((R
Rs
cCs`g}|i|}|djo|Snt|tijo|i	|n|i
||S(s8take a tag that should be a list and make sure it is oneN(tlstRR'RRR<RRRtextendRw(RRRR((R
t
listTagByNames


cCs-|iddjodSn|idSdS(NRi(RR'R<R(R((R
RscCs0|id}|id}|id}t|||}x|D]\}}}|djp
|djo|ii|qFnt
ii|pti|t
i|<nt
i|o|ii|qF|djo|ii|qF|d@o|ii|qFn|ii|qFWdS(s=produces lists of dirs and files for this header in two listsRzt	fileflagst	filemodesR8i@N(RRtfilesRRtzipt	filetupleR-RRR<RzRwR^t
mode_cachethas_keyR`tS_ISDIRR{R|(RRRRRRRR-((R
R}s(
cCsdh}xW|iD]L}|djoqnx/|iD]$}|i|od||<q4q4WqW|S(ssearch for good filesiN(treturnsRRztitemR<RuRvtmatch(RRRRv((R
tusefulFiless


cCsdh}xW|iD]L}|djoqnx/|iD]$}|i|od||<q4q4WqW|S(s"search for useful ghost file namesiN(RRR|RR<RuRvR(RRRRv((R
tusefulGhostss


cCsjh}xW|iD]L}|djoqnx/|iD]$}|i|od||<q4q4WqW|iS(ssearch for good dirsiN(	RRR{RR<RtRvRR(RRRRv((R
t
usefulDirss


cCsg}|iti}|iti}|i|}|i
|}|i|iti
}|dj	ot||||}n|i|S(s(returns a list of tuples of dependenciesN(RRR'R"tRPMTAG_REQUIRENAMEtnamestRPMTAG_REQUIREFLAGSttmpflagsRRRtprereqRtRPMTAG_REQUIREVERSIONRR<RR(RRRRRRR((R
tdepsLists
cCs~g}|iti}|iti}|i|}|i
|iti}|dj	ot|||}n|i|S(N(RRR'R"tRPMTAG_OBSOLETENAMERtRPMTAG_OBSOLETEFLAGSRRRRtRPMTAG_OBSOLETEVERSIONRR<RR(RRRRRR((R
t
obsoletesLists
cCs~g}|iti}|iti}|i|}|i
|iti}|dj	ot|||}n|i|S(N(RRR'R"tRPMTAG_CONFLICTNAMERtRPMTAG_CONFLICTFLAGSRRRRtRPMTAG_CONFLICTVERSIONRR<RR(RRRRRR((R
t
conflictsLists
cCs~g}|iti}|iti}|i|}|i
|iti}|dj	ot|||}n|i|S(N(RRR'R"tRPMTAG_PROVIDENAMERtRPMTAG_PROVIDEFLAGSRRRRtRPMTAG_PROVIDEVERSIONRR<RR(RRRRRR((R
tprovidesLists
cCs`g}|id}|id}|id}t|djot|||}n|S(Nt
changelognamet
changelogtimet
changelogtexti(RRRRttimesttextsRR(RRRRR((R
tchangelogLists%scCs|idpt|id|Snd|id|itif}d|id|f}t	i
i|oF|it	i
|djo)t|d}|i}|in=t|id|}t|d	}|i||i|S(sXreturn a checksum for a package:
           - check if the checksum cache is enabled
              if not - return the checksum
              if so - check to see if it has a cache file
                if so, open it and return the first line's contents
                if not, grab the checksum and write it to a file for this pkg
            tcacheR0s%s-%stnames%s/%stcachediriRHtwN(RRhR7R.R'R"tRPMTAG_SHA1HEADERtcsumtagtcsumfileRRatexistsRfR`RtcsumotreadlinetchecksumR)R(RR.RRRR((R
Rn.s!0

(RRt__doc__RR\RRRRRRRRRR}RRRRRRRRRn(((R
R^s,	(						D	
							
	
	
	
		cCs|i}|id=dd=}|idd|id=d|id|id=d|i|id=dd=}|idt
|i|idt
|id|id	t
|id
|id=d|i}|id||idd
xlddddgD]X}|i|}t|}tidd|}|id=|d=}|i|q W|id=dd=}|idt
|i|idt
|id|id=dd=}|idt
|i|idt
|id|idt
|id|id=dd=}|id=j	o|id|in|id|i|i|dd=}xod d!d"d#d$gD]X}|i|}t|}tidd|}|i||d=}|i|qW|i|d%d=}|id&t
|i|id't
|i x|i!d(f|i"d)f|i#d*fgD]w\}}t&|d+joX|i||d=}x@|D]4\}}\}}}|i|d,d=}|id||d+jo|d-jo
d.}
n|d/jo
d0}
n|d1jo
d2}
n|d3jo
d4}
n|d5jo
d6}
n|id7|
|o|idt
|n|o|idt
|n|o|id	t
|qqqWqqW|i.}
t&|
d+jo|i|d8d=}xj|
D]^\}}\}}}}|i|d,d=}|id||d+jo|d-jo
d.}
n|d/jo
d0}
n|d1jo
d2}
n|d3jo
d4}
n|d5jo
d6}
n|id7|
|o|idt
|n|o|idt
|n|o|id	t
|qsn|d9jo|id:t
|q<q<WnxB|i0D]4}	|id=dd=}t|	}	|i|	qWxR|i3D]D}|id=dd=}t|}|i||idd;qWxR|i5D]D}|id=dd=}t|}|i||idd<qIW|S(>sstakes an xml doc object and a package metadata entry node, populates a 
       package node with the md informationRRR"RRRRRtrelRRRotYEStsummarytdescriptiontpackagerturls
$R8ttimeR-tbuildt	buildtimeRet	installedtarchivetarchivesizetlocationsxml:basethreftformattlicensetvendortgroupt	buildhostt	sourcerpmsheader-rangetstarttendtprovidest	conflictst	obsoletesitentryitLTitGTitEQi
tLEitGERtrequiresitpretdirtghostN(6tnodetnstnewChildR<tpkgNodetnewProptrpmObjRRRtstrRRotcsumR0RtvalueRGRxtsubRt
addContentRRfReRRiRjRtformatnsthrRpRqRRRRtnodenameRtrpconodeRRRgtvRHtargRRRR-RRt	directoryR(tdocRRRR0RRRRR-RRReRRRRRRRR
RRgRRR	RHRRRR((R
tgenerateXMLJs4










*











"




c	Cs|iddd}|id|i|id|id|id|i|iddd}|idt
|i|idt
|id|idt
|id	x?|iD]4}|idd
d}t|}|i|qWxO|iD]D}|idd
d}t|}|i||iddqWxO|iD]D}|idd
d}t|}|i||idd
qdW|S(NRRoRRRRRRRR-RRR(RRR<tpkgRRRoRRRRRRzR-RRGRR{RR|R(	RRRRR-RRRR((R
tfileListXMLs4




c
CsD|iddd}|id|i|id|id|id|i|iddd}|idt
|i|idt
|id|idt
|id	|i}xk|D]c\}}	}|idd
d}|it||idt||idt
|	qW|S(
NRRoRRRRRRRt	changelogtauthortdate(RRR<RRRRoRRRRRRtclogsRRttexttclogRRG(
RRRRRRRRRR((R
totherXMLs cCsW|d}|ddf|ddf|ddfg}x|D]\}}ttii|d|d	|}t
||}|it
|tii|d|d	|}titii|d|d	|d
}|iddd}|id||idd
d}|ddj	o|id|dn|idtii|d||idd|}
|
id||iddt|}|idd|}
|
id|q>W|ddj	ot|d}ti|d
}tii|}	t|d}ttii|d|d	|	d}|i|i |i|i!dt
||}|i|iddd}|idd|idd
d}|ddj	o|id|dn|idtii|d|	|idd|}
|
id||iddt|}ndS(sDgenerate the repomd.xml file that stores the info on the other filesR0t	otherfiletothert
filelistsfilet	fileliststprimaryfiletprimaryt	outputdirttempdiriRRRR_sxml:baseRtfinaldirRt	timestamps
open-checksumt	groupfileRHRiRN("tcmdsR0t	workfilesR-tftypeRRRaRbtzfoR7tuncsumR)RR`R'RRR<RRRRRt
unchecksumtgrpfiletbasenametsfileRR.toutputRR3RI(RR)R-RR+RR0R'R/R1R.RR.RR*R,R2R-((R
trepoXMLsR
-&
)-#
)


#(RR"RZR+R,RRKRxR`tgziptzlibR(t	zlibErrorRR	t__all__RRRR*R7RGRYR[RR^RRRR3(R7RYR*R^R"RRKR7RRxRR`RRGR4RR	R6RR+R3RRR,RZRR((R
R:s4										
		#		1x	k		

Anon7 - 2021