+
    
4iQ                     >   R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RI	H
t
HtHtHtHtHtHtHtHtHt  ^ RIHt ^ RIHtHtHt ^ RIHt ^ RItRtRt . ROt!R	t". ROt#R
t$Rt%Rt&Rt' ! R R](4      t) ! R R]PT                  4      t+ ! R R]4      t, ! R R4      t- ! R R]-4      t. ! R R]-4      t/ ! R R]4      t0]1R8X  dN   ]0! ]Pd                  ^,          R7      t3]3Ph                  Pk                  4       t5]6! ]5Po                  R
4      4       R# R#   ] d     Li ; i) zWRepresentation of Debian binary package (.deb) files


Debfile Classes
===============
N)Path)
AnyBinaryIODictIOIteratorListOptionalTextUnionoverload)Literal)ArFileArErrorArMember)	Changelogzdata.tarzcontrol.tarzdebian-binarycontrolzusr/share/doc/%s/changelog.gzz$usr/share/doc/%s/changelog.Debian.gzmd5sumsc                   6   a  ] tR t^Ft o RtV 3R lR ltRtV tR# )_NormedFilePatha^  File path class for squashing ./ at the start of files for TarFile

This class only replaces the __eq__ method of the file path comparison
so that "./" is always added to the start of the file path
meaning that "is this the right file to extract" will be true when
the code asks for "./control" but the control.tar member contains
the file "control"
c                &   < V ^8  d   QhRS[ RS[/# )   valuereturn)r   bool)format__classdict__s   "0/usr/lib/python3/dist-packages/debian/debfile.py__annotate___NormedFilePath.__annotate__P   s      C D     c                    \        V 4      p\        V4      pVR 8X  d   RpM VP                  R4      '       g
   RV,           pVR 8X  d   RpW#8H  # VP                  R4      '       g
   RV,           pW#8H  # )../)str
startswith)selfr   s1s2s   &&  r   __eq___NormedFilePath.__eq__P   sn    YZ9Bt$$B9B x t$$Bxr     N)__name__
__module____qualname____firstlineno____doc__r)   __static_attributes____classdictcell__r   s   @r   r   r   F   s      r    r   c                   j   a  ] tR t^^t o RtRtV 3R lR ltV 3R lR lt]! ]]4      t	V 3R lt
RtV tR# )	_NormedTarInfoa  TarInfo replacement that uses file path comparison that squashes ./

This class uses the above _NormedFilePath class for file paths when
iterating or inspecting the members of a TarFile. The _NormedFilePath
normalises the file path when inspecting or extracting from a .deb file.

The class replaces the 'name' member that is normally a str with
a property that addresses a _NormedFilePath.

The control tarball members of the .deb may contain an optional entry
for "." and prefix all entries in the tarball with "./".  Archives
generated by dpkg have this prefix but third party tools might not. The
published spec for the .deb file format, deb(5) from dpkg-dev, explicitly
permits this difference and thus it should be supported here.

See https://bugs.debian.org/1031674 for more detail.
Nc                0   < V ^8  d   QhRS[ S[,          /# r   r   r	   r$   )r   r   s   "r   r   _NormedTarInfo.__annotate__s   s      8C= r    c                    V P                   # N_namer&   s   &r   	_get_name_NormedTarInfo._get_names   s    zzr    c                $   < V ^8  d   QhRS[ RR/# )r   namer   Nr$   )r   r   s   "r   r   r9   v   s     + +c +d +r    c                &    \        V4      V n        R # r;   )r   r=   )r&   rB   s   &&r   	_set_name_NormedTarInfo._set_namev   s    $T*
r    c                6   < V ^8  d   Qh/ S[ S[,          ;R&   # )r   r=   r8   )r   r   s   "r   r   r9   ^   s     & C=' r    r<   )r,   r-   r.   r/   r0   r=   r?   rE   propertyrB   __annotate_func__r1   r2   r3   s   @r   r5   r5   ^   s:     $  E + + Iy)D7  r    r5   c                       ] tR t^|tRtR# )DebErrorr+   Nr,   r-   r.   r/   r1   r+   r    r   rK   rK   |   s    r    rK   c                      a  ] tR t^t o RtR tR t]R 4       tV 3R lR lt	RR lt
]RR	 l4       t]RR
 l4       tRR lt]RR l4       t]RR l4       tRR ltR tR tR tV 3R lR ltRtV tR# )DebPartal  'Part' of a .deb binary package.

A .deb package is considered as made of 2 parts: a 'data' part
(corresponding to the possibly compressed 'data.tar' archive embedded
in a .deb) and a 'control' part (the 'control.tar.gz' archive). Each of
them is represented by an instance of this class. Each archive should
be a compressed tar archive although an uncompressed data.tar is permitted;
supported compression formats are: .tar.gz, .tar.bz2, .tar.xz .

When referring to file members of the underlying .tar.gz archive, file
names can be specified in one of 3 formats "file", "./file", "/file". In
all cases the file is considered relative to the root of the archive. For
the control part the preferred mechanism is the first one (as in
deb.control.get_content('control') ); for the data part the preferred
mechanism is the third one (as in deb.data.get_file('/etc/vim/vimrc') ).
c                     Wn         R V n        R # r;   )_DebPart__member_DebPart__tgz)r&   members   &&r   __init__DebPart.__init__   s    
r    c                H  a  V 3R lpS P                   f   S P                  P                  p\        P                  P                  V4      ^,          R,          pV\        9   g   V\        8X  g   V\        8X  dN   VR8X  d   V! RR.4      pMS P                  p \        P                  ! VR\        R7      S n         S P                   # \        R
V,          4      hS P                   #   \        P                  \        P                  3 d   p\        R	T,          4      hRp?ii ; i)zReturn a TarFile object corresponding to this part of a .deb
package.

Despite the name, this method gives access to various kind of
compressed tar archives, not only gzipped ones.
c                   <a  ^ RI p^ RIoVP                  V VP                  VP                  RV3R lR7      pTP                  SP                  P                  4       4      ^ ,          pTP                  ^ 8w  d.   \        R	RP                  T 4      : R
TP                  : R24      h\        P                  ! T4      #   \        \
        3 d)   p\        RRP                  T 4      : RT: R24      hRp?ii ; i)    NFc                  P   < S P                  S P                  S P                  4      # r;   )signalSIGPIPESIG_DFL)rY   s   r   <lambda>9DebPart.tgz.<locals>._custom_decompress.<locals>.<lambda>   s    MM&..&..Ar    )stdinstdoutuniversal_newlines
preexec_fnzerror while running command ' z' as subprocess: ''z	command 'z' has failed with code ')
subprocessrY   PopenPIPEOSError
ValueErrorrK   joincommunicaterP   read
returncodeioBytesIO)command_listrd   procedatarY   r&   s   &    @r   _custom_decompress'DebPart.tgz.<locals>._custom_decompress   s    <! "'' $//*//', B	 (  ##DMM$6$6$89!<D!# # 6 I J J ::d## Z( < # 6 ; < <<s   6B> >C7#C22C7N   NNzstunzstdz--stdoutzr:*)fileobjmodetarinfoz#tarfile has returned an error: '%s'z"part '%s' has unexpected extension)rQ   rP   rB   ospathsplitext	PART_EXTS	DATA_PART	CTRL_PARTtarfileopenr5   	ReadErrorCompressionErrorrK   )r&   rs   rB   	extensionbufferrq   s   f     r   tgzDebPart.tgz   s    	$4 ::==%%D((.q1"5II%):di>O %/:0FGF!]]FN!(f5R`!aDJ
 zz CdJKKzz	  ))7+C+CD N"#H1#LMMNs   "C% %%D!
DD!c                    \        V 4      P                  RR4      p V P                  R4      '       d   V # V P                  R4      '       d
   RV ,           # V R8X  d   R# RV ,           # )zntry (not so hard) to obtain a member file name in a form that is
stored in the .tar.gz, i.e. starting with ./ \/r#   r"   )r$   replacer%   )fnames   &r   __normalize_memberDebPart.__normalize_member   s_     E
""4-D!!LC  ;C<e|r    c                6   < V ^8  d   QhRS[ RS[S[ ,          /# )r   r}   r   )r$   r	   )r   r   s   "r   r   DebPart.__annotate__   s#     #F #Fs #Fx} #Fr    c                    . pVP                  R4      R,           F  pVP                  V4       \        P                  P	                  RP                  V4      4      p\        P                  V4      pV P                  4       P                  V4      pVP                  4       '       g   K  VP                  P                  R4      '       d*   VP                  P                  R4      pVP                  pK  VP                  VR&   K  	  \        P                  \        P                  P	                  X4      4      #   \         d     R# i ; i)zwalk the path following symlinks

returns:
    resolved_path, info

if the path is not found even after following symlinks within the
archive, then None is returned.
r   ru   N)splitappendr|   r}   normpathri   rN   _DebPart__normalize_memberr   	getmemberissymlinknamer%   KeyError)r&   r}   resolved_path_partspathpartcurrpathtinfos   &&    r   __resolve_symlinksDebPart.__resolve_symlinks   s    	"$ JJsOB//#**8477++CHH5H,IJ"55h?
,,X6 ;;==~~0055.3nn.B.B3.G+#(>> 38..+B/% 00 ))"''*:*:8*DEE	  		s   B#D9 * D9 <D9 9EEc                    \         P                  V4      pV P                  4       P                  4       pW9   d   R# V'       d   V P	                  V4      pVRJ# W9   # )z]Check if this part contains a given file name.

Symlinks within the archive can be followed.
TN)rN   r   r   getnames_DebPart__resolve_symlinks)r&   r   follow_symlinksnames
fname_reals   &&&  r   has_fileDebPart.has_file  sV     **51
##%>007JT))~r    Nc                    R # r;   r+   r&   r   encodingerrorsr   s   &&&&&r   get_fileDebPart.get_file       	r    c                    R # r;   r+   r   s   &&&&&r   r   r     r   r    c                N   \         P                  V4      pV'       d#   V P                  V4      pVf   \        R4      hTp V P	                  4       P                  V4      pTf   \        R4      hTe   \        P                  ! YbTR7      # T#   \         d    \        R4      hi ; i)zReturn a file object corresponding to a given file name.

If encoding is given, then the file object will return Unicode data;
otherwise, it will return binary data.

If follow_symlinks is True, then symlinks within the archive will be
followed.
zFile not found inside packager   r   )	rN   r   r   rK   r   extractfiler   rm   TextIOWrapper)r&   r   r   r   r   r   fobjs   &&&&&  r   r   r   "  s     **51007J!>??E	<88:))%0D <:;;##DFKK  	<:;;	<s   B B$c                    R # r;   r+   r   s   &&&&&r   get_contentDebPart.get_contentB       	r    c                    R # r;   r+   r   s   &&&&&r   r   r   L  r   r    c                    V P                  \        V4      W#VR7      pRpV'       d!   VP                  4       pVP                  4        V# )a  Return the string content of a given file, or None (e.g. for
directories).

If encoding is given, then the content will be a Unicode object;
otherwise, it will contain binary data.

If follow_symlinks is True, then symlinks within the archive will be
followed.
)r   r   r   N)r   r$   rk   close)r&   r   r   r   r   fcontents   &&&&&  r   r   r   V  sG      MMJ+  

 ffhGGGIr    c                P    \        V P                  4       P                  4       4      # r;   )iterr   r   r>   s   &r   __iter__DebPart.__iter__s  s    DHHJ'')**r    c                $    V P                  V4      # r;   )r   r&   r   s   &&r   __contains__DebPart.__contains__w  s    }}U##r    c                $    V P                  V4      # r;   )r   r   s   &&r   __getitem__DebPart.__getitem__{  s    &&r    c                   < V ^8  d   QhRR/# r   r   Nr+   )r   r   s   "r   r   r     s      t r    c                :    V P                   P                  4        R # r;   )rP   r   r>   s   &r   r   DebPart.close  s    r    )__member__tgz)F)NNF)NF)r,   r-   r.   r/   r0   rS   r   staticmethodr   r   r   r   r   r   r   r   r   r   r1   r2   r3   s   @r   rN   rN      s     "
4l  &#F #FJ$    @    :+$' r    rN   c                       ] tR tRtRtR# )DebDatai  r+   NrL   r+   r    r   r   r     s    r    r   c                      a  ] tR tRt o V 3R lR ltV 3R lR lt]RR l4       t]RV 3R lR	 ll4       tRR
 ltRtV t	R# )
DebControli  c                6   < V ^8  d   QhRS[ S[S[3,          /# r7   r   r$   bytes)r   r   s   "r   r   DebControl.__annotate__  s      c5j) r    c                    / p\          F7  pV P                  V4      '       g   K  V P                  V4      pVf   K3  W1V&   K9  	  V# )zfReturn a dictionary of maintainer scripts (postinst, prerm, ...)
mapping script names to script text. )MAINT_SCRIPTSr   r   )r&   scriptsr   rr   s   &   r   r   DebControl.scripts  sF     %'"E}}U##''.#%)EN	 # r    c                H   < V ^8  d   QhRS[ P                  P                  /# r7   debiandeb822r   )r   r   s   "r   r   r     s!     H HFMM44 Hr    c                f    \         P                  P                  V P                  \        4      4      # )zReturn the debian/control as a deb822.DebControl (a Debian-specific dict-like
class) object.

For a string representation of debian/control try
.get_content('control') )r   r   r   r   CONTROL_FILEr>   s   &r   
debcontrolDebControl.debcontrol  s$     }}''(8(8(FGGr    Nc                    R # r;   r+   r&   r   r   s   &&&r   r   DebControl.md5sums  r   r    c                R   < V ^8  d   QhRS[ RS[S[ ,          RS[S[ S[ 3,          /# r   r   r   r   r$   r	   r   )r   r   s   "r   r   r     s/       Xc] d3PS8n r    c                    R # r;   r+   r   s   &&&r   r   r         r    c                   V P                  \        4      '       g   \        R\        ,          4      hV P                  \        WR7      p/ pRpVf   RpVP	                  4        FT  pVP                  V4      P                  R^4      w  rx\        V\        4      '       d   VP                  4       WH&   KP  WtV&   KV  	  VP                  4        V# )a  Return a dictionary mapping filenames (of the data part) to
md5sums. Fails if the control part does not contain a 'md5sum' file.

Keys of the returned dictionary are the left-hand side values of lines
in the md5sums member of control.tar.gz, usually file names relative to
the file system root (without heading '/' or './').

The returned keys are Unicode objects if an encoding is specified,
otherwise binary. The returned values are always Unicode.z('%s' file not found, can't list MD5 sumsr   z
Ns   
)r   MD5_FILErK   r   	readlinesrstripr   
isinstancer   decoder   )	r&   r   r   md5_filesumsnewlinelinemd5r   s	   &&&      r   r   r     s     }}X&&:XEG G ==H=L!%+G&&(DW-33D!<JC#u%%!jjl!U ) 	r    r+   NNr;   )
r,   r-   r.   r/   r   r   r   r   r1   r2   r3   s   @r   r   r     sR      H H      r    r   c                     a  ] tR tRt o RtRR ltV 3R lR lt]V 3R lR l4       t]R	 4       t	]R
 4       t
V 3R lR ltV 3R lR lt]RR l4       t]RV 3R lR ll4       tRR ltR tV 3R lR ltV 3R lR ltV 3R lR ltRtV tR# )DebFilei  a  Representation of a .deb file (a Debian binary package)

DebFile objects have the following (read-only) properties:
    - version       debian .deb file format version (not related with the
                    contained package version), 2.0 at the time of writing
                    for all .deb packages in the Debian archive
    - data          DebPart object corresponding to the data.tar.gz (or
                    other compressed or uncompressed tar) archive contained
                    in the .deb file
    - control       DebPart object corresponding to the control.tar.gz (or
                    other compressed tar) archive contained in the .deb
                    file
Nc                <  a \         P                  ! WW#4       \        V P                  4       4      oR  V3R llp\        S9  d   \        R\        ,          4      h/ V n        \        V P                  V! \        4      4      4      V P                  \        &   \        V P                  V! \        4      4      4      V P                  \        &   RV n        V P                  \        4      pVP                  4       P                  4       V n        VP!                  4        R# )c                0    V ^8  d   QhR\         R\         /# )r   basenamer   rC   )r   s   "r   r   &DebFile.__init__.<locals>.__annotate__  s     	" 	"3 	"3 	"r    c                 X  < \          Uu. uF  q: R V: 2NK  	  ppV \        \        39   d   VP                  V 4       SP	                  \        V4      4      pV'       g   \        RV,          4      h\        V4      ^8  d   \        RV,          4      h\        V4      ^ ,          # u upi )r"   z9missing required part in given .deb (expected one of: %s)z>too many parts in given .deb (was looking for only one of: %s))	r   r   r   r   intersectionsetrK   lenlist)r   ext
candidatespartsactual_namess   &   r   compressed_part_name.DebFile.__init__.<locals>.compressed_part_name  s    ?HIyXs3yJIIy11!!(+ --c*o>E-/9:; ; 5zA~9;EFG G ;q>! Js   B'z4missing required part in given .deb (expected: '%s')N)r   rS   r  r   	INFO_PARTrK   _DebFile__partsr   r   r   r   r   _DebFile__pkgnamerk   strip_DebFile__versionr   )r&   filenamerz   ry   r
  r   r	  s   &&&&  @r   rS   DebFile.__init__  s    64==?+	" 	"$ L($&/01 1 ",T^^ +.- #.Y")$.. ++- #.YNN9%)		r    c                   < V ^8  d   QhRR/# r   r+   )r   r   s   "r   r   DebFile.__annotate__  s     6 6 6r    c                >    V P                  4       R ,          V n        R# )packageN)r   r  r>   s   &r   __updatePkgNameDebFile.__updatePkgName  s    *95r    c                    < V ^8  d   QhRS[ /# r7   )r   )r   r   s   "r   r   r    s       r    c                    V P                   # r;   )r  r>   s   &r   versionDebFile.version  s    ~~r    c                0    V P                   \        ,          # r;   )r  r   r>   s   &r   rr   DebFile.data	       ||I&&r    c                0    V P                   \        ,          # r;   )r  r   r>   s   &r   r   DebFile.control  r  r    c                H   < V ^8  d   QhRS[ P                  P                  /# r7   r   )r   r   s   "r   r   r    s     ) )FMM44 )r    c                6    V P                   P                  4       # )zSee .control.debcontrol() )r   r   r>   s   &r   r   DebFile.debcontrol  s    ||&&((r    c                6   < V ^8  d   QhRS[ S[S[3,          /# r7   r   )r   r   s   "r   r   r    s     & &c5j) &r    c                6    V P                   P                  4       # )zSee .control.scripts() )r   r   r>   s   &r   r   DebFile.scripts  s    ||##%%r    c                    R # r;   r+   r   s   &&&r   r   DebFile.md5sums  r   r    c                R   < V ^8  d   QhRS[ RS[S[ ,          RS[S[ S[ 3,          /# r   r   )r   r   s   "r   r   r  #  s.       Xc] DcN r    c                    R # r;   r+   r   s   &&&r   r   r)  "  r   r    c                :    V P                   P                  WR7      # )zSee .control.md5sums() r   )r   r   r   s   &&&r   r   r)  &  s     ||##X#EEr    c                   V P                   f   V P                  4        \        V P                   ,          \        V P                   ,          3 Fd  p V P                  P                  VRR7      p\        P                  ! TR7      ;_uu_ 4       pTP                  4       pRRR4       \        X4      u # 	  R#   \         d     Kx  i ; i  + '       g   i     L3; i)z}Return a Changelog object for the changelog.Debian.gz of the
present .deb package. Return None if no changelog can be found. NT)r   )ry   )r  _DebFile__updatePkgNameCHANGELOG_DEBIANCHANGELOG_NATIVErr   r   rK   gzipGzipFilerk   r   )r&   r   fhgzraw_changelogs   &    r   	changelogDebFile.changelog+  s    
 >>!  "&7&79EYY''t'D r**b "	 +]++9    +*s   B7C	7CC	Cc                   < V ^8  d   QhRR/# r   r+   )r   r   s   "r   r   r  @  s      t r    c                n    V P                   P                  4        V P                  P                  4        R # r;   )r   r   rr   r>   s   &r   r   DebFile.close@  s     		r    c                   < V ^8  d   QhRR/# )r   r   r   r+   )r   r   s   "r   r   r  D  s      9 r    c                    V # r;   r+   r>   s   &r   	__enter__DebFile.__enter__D  s    r    c                0   < V ^8  d   QhRS[ RS[ RS[ RR/# )r   exc_typeexc_valexc_tbr   N)r   )r   r   s   "r   r   r  G  s)       s C D r    c                &    V P                  4        R # r;   )r   )r&   r@  rA  rB  s   &&&&r   __exit__DebFile.__exit__G  s    

r    )__parts	__pkgname	__version)NrNr   r;   )r,   r-   r.   r/   r0   rS   r.  rH   r  rr   r   r   r   r   r   r6  r   r=  rD  r1   r2   r3   s   @r   r   r     s     %N6 6   ' ' ' ') )& &     F
*   r    r   __main__)r  )r4  bz2xzlzmarw   )preinstpostinstprermpostrmconfig)8r0   r1  rm   r   sysos.pathr|   pathlibr   typingr   r   r   r   r   r   r	   r
   r   r   typing_extensionsr   ImportErrordebian.arfiler   r   r   debian.changelogr   debian.deb822r   r   r   r   r  r   r   r0  r/  r   r$   r   TarInfor5   rK   rN   r   r   r   r,   argvdebr   r   printr   r+   r    r   <module>r`     s,  0  	  
    	 4 3 &  		.		D2 9 
c 0*W__ *<	w 	@ @F	g 	
@ @F}f }@ z
388A;
'C
++//
C	#--	
"# w  		s   D DD