
                            S r SSKJr  SSKJr  SSKrSSKrSSKrSSKJr	  SSK
Jr  SSKJr  \R                  " SS	9r\R!                  S
SSS9  \R!                  SSSS9  \R!                  SSSS9  \R!                  SSSS9  \R!                  SSSS9  \R!                  SSSS9  \R!                  SSSS9  \R!                  SSSS9  S r\S:X  a  \" 5         gg)z;This package flattens image metadata into a single tarball.    )absolute_import)print_functionN)docker_image)logging_setup)zipzFlatten container images.)descriptionz	--tarballstorez&An optional legacy base image tarball.)actionhelpz--configz.The path to the file storing the image config.z--digestappendz,The list of layer digest filenames in order.z--layerz0The list of compressed layer filenames in order.z--uncompressed_layerz2The list of uncompressed layer filenames in order.z	--diff_idzThe list of diff_ids in order.z--filesystemz2The name of where to write the filesystem tarball.z
--metadataz:The name of where to write the container startup metadata.c                  P   [         R                  " [        5        [        R                  5       n [         R                  " U S9  U R
                  (       aQ  [        R                  " SU R
                  5        [        U R
                  S5       nUR                  5       nS S S 5        OxU R                  (       a[  [        R                  " SU R                  5        [        R                  " U R                  5       nUR                  5       nS S S 5        OU R
                  n[        [        U R                   =(       d    / U R"                  =(       d    / 5      5      n[        [        U R$                  =(       d    / U R&                  =(       d    / 5      5      n[        R                  " S5        [        R(                  " WUUU R                  S9 n[*        R                  " U R,                  SSS	9 n[        R.                  " Xg5        S S S 5        [        U R0                  S
5       nUR3                  UR                  5       5        S S S 5        S S S 5        g ! , (       d  f       GNC= f! , (       d  f       GNU= f! , (       d  f       Ny= f! , (       d  f       NL= f! , (       d  f       g = f)N)argszReading config from %rrzReading config from tarball %rz Loading v2.2 image From Disk ...)config_filelayersuncompressed_layerslegacy_basezw:zutf-8)encodingw)r   DefineCommandLineArgsparser
parse_argsInitconfiglogginginfoopenreadtarball
v2_2_imageFromTarballr   listr   digestlayerdiff_iduncompressed_layerFromDisktarfile
filesystemextractmetadatawrite)	r   readerr   baser   r   v2_2_imgtarfs	            8lib/third_party/containerregistry/tools/fast_flatten_.pymainr3   E   s   %%f-				$$ 
[[LL)4;;7	dkk3	6{{}f 
 	||LL14<<@				-!f 
.	- [[FDKK%2tzz'7R89&	$,,
"d55;<>	,,12-,,	  $,	dootg	>#' 
? 
dmmS	!Qggh""$% 
"    
 	 
.	- 
?	> 
"	!   sT   I7I#
!J+I5J  J J
I #
I25
J	?J
J	J
J%__main__)__doc__
__future__r   r   argparser   r(   containerregistry.client.v2_2r   r    containerregistry.toolsr   	six.movesr   ArgumentParserr   add_argumentr3   __name__     r2   <module>r@      s@   B & %    D 1 		 	 -H	I   &N  P   	9  ;
   	7  9
   	;  =
   	=  ?
   'G  I   	=  ?
      &D z& r?   