
    eeUj                         d Z ddlZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ej                  j                  Z G d	 d
ej                        Z G d dej"                        Zy)a  
Copyright (c) 2022, Ian Santopietro
All rights reserved.

This file is part of RepoLib.

RepoLib is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

RepoLib is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with RepoLib.  If not, see <https://www.gnu.org/licenses/>.
    N)Pathdeb822   )ParseDeb)	SourceKey)utilc                   (     e Zd ZdZdd fd
Z xZS )SourceErrorz  Exception from a source object.r   )codec                2    t        |   |i | || _        y)zException with a source object

        Arguments:
            code (:obj:`int`, optional, default=1): Exception error code.
    N)super__init__r   )selfr   argskwargs	__class__s       0/usr/lib/python3/dist-packages/repolib/source.pyr   zSourceError.__init__%   s     	$)&)	    )__name__
__module____qualname____doc__r   __classcell__r   s   @r   r   r   "   s    *#$  r   r   c                   f    e Zd ZdZeZededefd       Z	dddZ fdZ
d Zdefd	Zdefd
Zd[dedefdZdZdZdeddf fdZedefd       Zej*                  dZd       Zd\defdZdefdZd]deddfdZdZdZdefdZdefdZdefdZdededdfdZdZdZedefd       Zedefd       Z e j*                  d eddfd!       Z edefd"       Z!e!j*                  d#eddfd$       Z!ede"jF                  fd%       Z$e$j*                  dZd&       Z$edefd'       Z%e%j*                  d(eddfd)       Z%edefd*       Z&e&j*                  d+eddfd,       Z&edefd-       Z'e'j*                  d.eddfd/       Z'edefd0       Z(e(j*                  d1eddfd2       Z(edefd3       Z)e)j*                  d4eddfd5       Z)ed6        Z*e*j*                  d7        Z*edefd8       Z+e+j*                  dZd9       Z+edefd:       Z,e,j*                  dZd;       Z,edefd<       Z-e-j*                  dZd=       Z-edefd>       Z.e.j*                  dZd?       Z.edefd@       Z/e/j*                  dZdA       Z/edefdB       Z0e0j*                  dZdC       Z0edefdD       Z1e1j*                  dZdE       Z1edefdF       Z2e2j*                  dZdG       Z2edefdH       Z3e3j*                  dZdI       Z3edefdJ       Z4e4j*                  dZdK       Z4edefdL       Z5e5j*                  dZdM       Z5edefdN       Z6e6j*                  dZdO       Z6edefdP       Z7e7j*                  dZdQ       Z7edefdR       Z8e8j*                  dZdS       Z8edefdT       Z9edefdU       Z:edefdV       Z;d^defdWZ<defdXZ=dZdYZ> xZ?S )_Sourcea  A DEB822 object representing a single software source.
    
    Attributes:
        ident(str): The unique id for this source
        name(str): The user-readable name for this source
        enabled(bool): Whether or not the source is enabled
        types([SourceType]): A list of repository types for this source
        uris([str]): A list of possible URIs for this source
        suites([str]): A list of enabled suites for this source
        components([str]): A list of enabled components for this source
        comments(str): Comments for this source 
        signed_by(Path): The path to this source's key file
        file(SourceFile): The file this source belongs to
        key(SourceKey): The key which signs this source
    shortcutreturnc                     | j                         }| j                  d      syt        |      dkD  syt        j                  syt        |      dk(  rd|d   vryy)zDetermine whether a deb line is valid.
        
        Arguments:
            shortcut(str): The shortcut to validate
        
        Returns: bool
            `True` if the PPA is valid, otherwise False
        debF   /T)split
startswithlenr	   validate_debline)r   shortcut_lists     r   	validatorzSource.validatorA   s\     &^^-""5)=!A%$$}"s-2C'Cr   N)filec                    t        j                  t              | _        t	        |   |i | | j                          || _        d| _        d| _	        y)zInitialize this source objectFN)
logging	getLoggerr   logr   r   reset_valuesr+   twin_sourcetwin_enabled)r   r+   r   r   r   s       r   r   zSource.__init__[   sJ    $$X.$)&)	 !r   c           
         | j                   r+d| d<   | dxx   dj                  | j                         z  cc<   ddj                  | j                         D cg c]  \  }}|d| c}}      z  }d}| D ]!  }|t        j                   d| d	| |    d
z  }# |dd }|t        j                  j                  dd       z  }|dz  }| j                   r| j                  d       |S c c}}w )ztype: () -> str# Comments # z{%s}z, z: {'z': 'z', N  })commentsjoinitemsr	   PRETTY_PRINTreplacepop)r   kvrepkeys        r   __repr__zSource.__repr__d   s    
 ==#D

4== 99499DJJL%QDAq!Q&7%QRR 	BCd''(#d49+SAAC	B #2h$##++C456s
==HHZ 
 &Rs   C'c                     t        | j                        dkD  }t        | j                        dkD  }t        | j                        dkD  }|r|r|ryy)Nr   TF)r'   urissuites
components)r   has_uri	has_suitehas_components       r   __bool__zSource.__bool__|   sG    499~)T[[)A-	 1A5y]r   c                     | j                   S )z~Get a UI-compatible description for a source. 
        
        Returns: (str)
            The formatted description.
        )namer   s    r   get_descriptionzSource.get_description   s     yyr   halt_errorsc                    | j                   r{| j                   j                  j                         }t        |      dkD  rDd| j                   dt        |       d}|rt        |      | j                  j                  |       |d   S i S )ae   Get a dictionary containing information for the signing key for
        this source.

        Arguments:
            halt_errors (bool): if there are errors or other unexpected data, 
                raise a SourceError exception. Otherwise, simply log a warning.
        
        Returns: dict
            The dictionary from gnupg with key info.
        r   zThe keyring for z
 contains z; keys. Check the keyring object for details about the keys.r   )rF   gpg	list_keysr'   identr   r/   warning)r   rT   keys	error_msgs       r   get_key_infozSource.get_key_info   s     88..0D4y1}*4::,jT LQ Q  %i00  +7N	r   c                    | j                   j                  d       d| _        d| _        d| _        t
        j                  j                  g| _        g | _	        g | _
        g | _        g | _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        d| _        | j7                          d| _        d| _        y)z+Reset the default values for all attributeszResetting source infor;   TN)r/   inforX   rQ   enabledr	   
SourceTypeBINARYtypesrI   rJ   rK   r=   	signed_byarchitectures	languagestargetspdiffsby_hashallow_insecure
allow_weakallow_downgrade_to_insecuretrustedcheck_valid_untilvalid_until_minvalid_until_maxprefs_update_legacy_optionsr+   rF   rR   s    r   r0   zSource.reset_values   s    -.
	oo,,-
	 +-(!#!!
##%	r   datac                 >   | j                   j                  d       | j                          t        j                  |d         r,t        |      dkD  rt        dt        |       d      t               }|j                  |d         }|d   | _	        |d   | _
        |d   | _        |d	   g| _        |d
   g| _        |d   g| _        |d   | _        |d   D ]  }|d   |   | |<    | j!                          |d   D ]  }| j"                  j%                  |        | j"                  dgk(  rg | _        | j                  s| j'                         | _
        | j(                  r| j+                          yt,        | ]  |       | j(                  r| j+                          y)a  Loads source information from the provided data

        Should correctly load either a lecagy Deb line (optionally with 
        preceeding comment) or a DEB822 source.
        
        Arguments:
            data(list): the data to load into the source.
        zLoading source from datar   r   z+The source is a legacy source but contains z( entries. It may only contain one entry.rX   rQ   r_   	repo_typeurisuiterK   optionsr=   r;   N)sequence)r/   r^   r0   r	   r(   r'   r   r   
parse_linerX   rQ   r_   rb   rI   rJ   rK   rq   r=   appendgenerate_default_namerc   load_keyr   r   )r   rr   
deb_parserparsed_deblinerF   commentr   s         r   load_from_datazSource.load_from_data   s    	01  a)4y1}!A#d) M5 5  "J'2247;N'0DJ&v.DI))4DL(56DJ'./DI)'23DK,\:DO%i0 ;*95c:S	;''))*5 .$$W-.}}$ "99 668	~~ 	$'>>MMOr   c                 R    t         j                  j                  | j                  v ryy)zB`True` if this source also provides source code, otherwise `False`TF)r	   r`   
SOURCECODErb   rR   s    r   sourcecode_enabledzSource.sourcecode_enabled   s      ??%%3r   c                     t         j                  j                  g}|t         j                  v r)|j	                  t         j                  j
                         || _        y)z Accept a variety of input valuesN)r	   r`   ra   true_valuesrz   r   rb   )r   r_   rb   s      r   r   zSource.sourcecode_enabled   sA     ''(d&&&LL334
r   c                 |   d}t        | j                        dkD  r^| j                  d   j                  dd      }|j                         }dj	                  |dd       }t        j                  |      }| | }|d| j                  d   j                          z  }	 | d   s|| d<   |S # t        $ r	 || d<   Y |S w xY w)	zkGenerates a suitable ID for the source
        
        Returns: str
            A sane default-id
        r;   r   r#   r:   -r   NX-Repolib-ID)
r'   rI   rA   r%   r>   r	   scrub_filenamerb   rX   KeyError)r   prefixrX   ru   uri_listuri_strbranch_names          r   generate_default_identzSource.generate_default_ident  s     tyy>Aiil**34CIIKH((8AB<0G"11':Kh{m,E1TZZ]((*+,,	)'',^$   	)#(D 	)s   
B) )B;:B;c                     | j                   }	 | d   }|s| j                   | d<   | d   S # t        $ r | j                   | d<   | d   cY S w xY w)zwGenerate a default name based on the ident
        
        Returns: str
            A name based on the ident
        X-Repolib-Name)rX   r   r   rQ   s     r   r{   zSource.generate_default_name  si     ::	*()D
 %)ZZD!"$%%  	*%)ZZD!"())	*s   ) A	A	ignore_errorsc                    | j                   j                  d| j                         | j                  s4|r'| j                   j	                  d| j                         nt        d      | j                  t        j                  vrTt               }|j                  | j                         || _
        |t        j                  t        |j                        <   yt        j                  | j                     | _
        y)zFinds and loads the signing key from the system
        
        Arguments:
            ignore_errors(bool): If `False`, throw a SourceError exception if
                the key can't be found/doesn't exist (Default: `True`)
        zFinding key for source %szNo key configured for source %sz)No key configured for source {self.ident})pathN)r/   r^   rX   rc   rY   r   r	   rZ   r   
reset_pathrF   strr   )r   r   new_keys      r   r|   zSource.load_key,  s     	14::>~~  !BDJJO!"MNN>>*kGDNN3DH+2DIIc',,'(yy0DHr   c                 X    | j                   dk(  s| j                   j                          yy)zProxy method to save the sourceN)r+   saverR   s    r   r   zSource.saveB  s!    yyD IINN !r   c                     | j                   S )a8  Outputs a legacy representation of this source
        
        Note: this is expected to fail if there is more than one type, URI, or
        Suite; the one-line format does not support having multiple of these
        properties.

        Returns: str
            The source output formatted as Legacy
        )legacyrR   s    r   output_legacyzSource.output_legacyG  s     {{r   c                     | j                   S )zOutputs a DEB822 representation of this source
        
        Returns: str
            The source output formatted as Deb822
        r   rR   s    r   
output_822zSource.output_822S  s     {{r   c                     | j                   S )zOutputs a string representation of this source for use in UIs
        
        Returns: str
            The source output string
        )uirR   s    r   	output_uizSource.output_ui[  s     wwr   propitemc                 .    |}|j                  |       |}y)a  Appends an item to a list property of this source.
        NOTE: List properties are `types`, `uris`, `suites`, and `components`.

        Arguments:
            prop(list): The property on which to append the item.
            item(str): The item to append to the propery
        N)rz   )r   r   r   _lists       r   prop_appendzSource.prop_appendc  s     Tr   c                      y)z+Extra tasks to perform when saving a sourceN )r   r   r   s      r   
tasks_savezSource.tasks_saveo  s    r   c                 N    g d}|D ]  }t        t        | |            dk  s y y)z>(RO) True if all required attributes are set, otherwise false.)rI   rJ   rX   r   FT)r'   getattr)r   required_partsattrs      r   has_required_partszSource.has_required_partst  s4     5" 	D74&'!+	 r   c                 ,    	 | d   S # t         $ r Y yw xY w)z)The ident for this source within the filer   r;   r   rR   s    r   rX   zSource.ident  s$    	'' 		    	rX   c                 8    t        j                  |      }|| d<   y )Nr   )r	   r   )r   rX   s     r   rX   zSource.ident  s    ##E*$^r   c                 ^    	 | d   }|s| j                          | d   S # t         $ r d}Y $w xY w)z'The human-friendly name for this sourcer   r;   )r   r{   )r   _names     r   rQ   zSource.name  sE    	)*E &&($%%  	E	    ,,rQ   c                     || d<   y )Nr   r   r   s     r   rQ   zSource.name  s    !%r   c                    	 | d   t         j                  v }|r&| j
                  rt         j                  j                  S t         j                  j                  S # t        $ r t         j                  j                  cY S w xY w)z+Whether or not the source is enabled/activeEnabled)r	   r   r   AptSourceEnabledFALSEr   TRUEr   r_   s     r   r_   zSource.enabled  so    	/9o)9)99G t..((---$$***  	/((...	/s   A #A?>A?c                 >    d| d<   |t         j                  v rd| d<   yy)z<For convenience, accept a wide varietry of input value typesnor   yesN)r	   r   r   s     r   r_   zSource.enabled  s)     Yd&&&#DO 'r   c                     g }	 | d   j                         D ]&  }|j                  t        j                  |             ( 	 |S # t        $ r Y |S w xY w)z(The list of source types for this sourcerb   )r%   rz   r	   r`   r   )r   _types
sourcetypes      r   rb   zSource.types  s_     	"7m113 ;
dooj9:;   		s   <A 	AArb   c                     d| d<   g }|D ]  }||vs|j                  |        |D ]  }| dxx   |j                   dz  cc<    | d   j                         | d<   y)z2Turn this list into a string of values for storager;   Typesr:   N)rz   valuestrip)r   rb   r   r   s       r   rb   zSource.types  sx     W 	*J'j)	* ! 	4JM
 0 0133M	4W++-Wr   c                 L    	 | d   j                         S # t        $ r g cY S w xY w) The list of URIs for this sourceURIsr%   r   rR   s    r   rI   zSource.uris  s.    	<%%'' 	I	    ##rI   c                 H    dj                  |      j                         | d<   y )Nr:   r   r>   r   )r   rI   s     r   rI   zSource.uris  s    xx~++-Vr   c                 L    	 | d   j                         S # t        $ r g cY S w xY w)r   Suitesr   rR   s    r   rJ   zSource.suites  s.    	>'')) 	I	r   rJ   c                 H    dj                  |      j                         | d<   y )Nr:   r   r   )r   rJ   s     r   rJ   zSource.suites  s    &)//1Xr   c                 L    	 | d   j                         S # t        $ r g cY S w xY w)r   
Componentsr   rR   s    r   rK   zSource.components  s/    	%++-- 	I	r   rK   c                 H    dj                  |      j                         | d<   y )Nr:   r   r   )r   rK   s     r   rK   zSource.components  s     XXj1779\r   c                     | j                   S )zThe options for this source)_optionsrR   s    r   rw   zSource.options  s     }}r   rw   c                 h    d|v r'|d   | _         | j                   r|j                  d       || _        y N	Signed-By)rc   rB   r   )r   rw   s     r   rw   zSource.options  s0    '!$[1DN~~K(r   c                 ^    	 | d   }|rt        |      S t               S # t         $ r d}Y $w xY w)z6The path to any apt preferences files for this source.X-Repolib-Prefsr;   )r   r   )r   rp   s     r   rp   zSource.prefs   s>    	*+E ;v  	E	r   c                 P    	 | d= |rt        |      }|| d<   yy# t         $ r Y w xY w)z"Accept a str or a Path-like objectr   N)r   r   )r   rp   	prefs_strs      r   rp   zSource.prefs  sB    	&' E
I&/D"#   		s    	%%c                 ,    	 | d   S # t         $ r Y yw xY w)zarchitectures optionArchitecturesr;   r   rR   s    r   rd   zSource.architectures  s$    	(( 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   rB   r   rq   r   rr   s     r   rd   zSource.architectures#  sB    	HH_% $(D!##%  		   + 	77c                 ,    	 | d   S # t         $ r Y yw xY w)zlanguages option	Languagesr;   r   rR   s    r   re   zSource.languages/  $    	$$ 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   r   r   s     r   re   zSource.languages7  B    	HH[!  $D##%  		r   c                 ,    	 | d   S # t         $ r Y yw xY w)ztargets optionTargetsr;   r   rR   s    r   rf   zSource.targetsC  #    		?" 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   r   r   s     r   rf   zSource.targetsK  A    	HHY "DO##%  		r   c                 ,    	 | d   S # t         $ r Y yw xY w)zpdiffs optionPdiffsr;   r   rR   s    r   rg   zSource.pdiffsW  s#    	>! 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   r   r   s     r   rg   zSource.pdiffs_  sA    	HHX !DN##%  		r   c                 ,    	 | d   S # t         $ r Y yw xY w)zby_hash optionBy-Hashr;   r   rR   s    r   rh   zSource.by_hashk  r   r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   r   r   s     r   rh   zSource.by_hashs  r   r   c                 ,    	 | d   S # t         $ r Y yw xY w)zallow_insecure optionAllow-Insecurer;   r   rR   s    r   ri   zSource.allow_insecure  s%    	()) 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   r   r   s     r   ri   zSource.allow_insecure  sD    	HH%& %)D!"##%  		r   c                 ,    	 | d   S # t         $ r Y yw xY w)zallow_weak option
Allow-Weakr;   r   rR   s    r   rj   zSource.allow_weak  s$    	%% 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   r   r   s     r   rj   zSource.allow_weak  sB    	HH\" !%D##%  		r   c                 ,    	 | d   S # t         $ r Y yw xY w)z"allow_downgrade_to_insecure optionAllow-Downgrade-To-Insecurer;   r   rR   s    r   rk   z"Source.allow_downgrade_to_insecure  s%    	566 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   r   r   s     r   rk   z"Source.allow_downgrade_to_insecure  sD    	HH23 26D./##%  		r   c                 ,    	 | d   S # t         $ r Y yw xY w)ztrusted optionTrustedr;   r   rR   s    r   rl   zSource.trusted  r   r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr   r   r   s     r   rl   zSource.trusted  r   r   c                 ,    	 | d   S # t         $ r Y yw xY w)zsigned_by optionr   r;   r   rR   s    r   rc   zSource.signed_by  r   r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY wr   r   r   s     r   rc   zSource.signed_by  r   r   c                 ,    	 | d   S # t         $ r Y yw xY w)zcheck_valid_until optionCheck-Valid-Untilr;   r   rR   s    r   rm   zSource.check_valid_until  s%    	+,, 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr  r   r   s     r   rm   zSource.check_valid_until  sD    	HH() (,D$%##%  		r   c                 ,    	 | d   S # t         $ r Y yw xY w)zvalid_until_min optionValid-Until-Minr;   r   rR   s    r   rn   zSource.valid_until_min  %    	)** 		r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr  r   r   s     r   rn   zSource.valid_until_min  D    	HH&' &*D"###%  		r   c                 ,    	 | d   S # t         $ r Y yw xY w)zvalid_until_max optionValid-Until-Maxr;   r   rR   s    r   ro   zSource.valid_until_max  r  r   c                 t    	 | j                  d       |r|| d<   | j                          y # t        $ r Y #w xY w)Nr  r   r   s     r   ro   zSource.valid_until_max  r	  r   c                 ,    	 | d   S # t         $ r Y yw xY w)z%The default mirror/URI for the sourceX-Repolib-Default-Mirrorr;   r   rR   s    r   default_mirrorzSource.default_mirror  s%    	233 		r   c                     |r|| d<   y d| d<   y )Nr  r;   r   )r   mirrors     r   r  zSource.default_mirror&  s    /5D+,/1D+,r   c                     | j                          | j                  r+d| d<   | dxx   dj                  | j                        z  cc<   | j                         }| j                  r| j	                  d       |r|S y)z(The DEB822 representation of this sourcer4   zX-Repolib-Commentsr6   r;   )rq   r=   r>   dumprB   )r   _deb822s     r   r   zSource.deb822/  sl     	##% ==)-D%&%&%**T]]*CC&))+==HH)*Nr   c                 \   | j                          | j                  j                  d      }| j                   d}|D ]4  }|j                  d      d   }|t        j
                  vs*|s-|| dz  }6 t        j                  D ]%  }|j                  |t        j                  |         }' |S )z-The UI-friendly representation of this source
z:
:r   )rq   r   r%   rX   r	   output_skip_keyskeys_maprA   )r   _ui_list	ui_outputlinerF   s        r   r   z	Source.ui?  s     	##%))$/ JJ<s+	 	-D**S/!$C$///D6,I		-
 == 	CC!))#t}}S/ABI	Cr   c                 ~   | j                          t        | j                        dk7  rt        d      | j                  }t        | j                        dkD  r)d| _        t        j                  j                  g| _        d}d}|| j                         z  }| j                  r|dz  }|| j                  d|      z  }|S )z8The legacy/one-line format representation of this source.zBApt Preferences files can only be used with DEB822-format sources.r   Tr;   r  )
sourcecoder_   )rq   r   rp   r   r   r'   rb   r1   r	   r`   ra   _generate_legacy_output)r   r  r   s      r   r   zSource.legacyN  s     	##%tzz?c!T  ,,
tzz?Q#D//001DJJ$..00dNFd22dJ2WWFr   c                    d}t        | j                        dkD  r'd| _        t        j                  j
                  g| _        dD ]7  }t        t        | |            dkD  sd| d}|d|dd	  d
z  }t        |       | j                  j                         s|s|dz  }|r|s|dz  }|r|dz  }n!|| j                  d   j                  z  }|dz  }| j                         }|r|dz  }||z  }|j                         }|dz  }|| j                  d    dz  }|| j                  d    dz  }|dj                  | j                         z  }|S )z8Generate a string of the current source in legacy formatr;   r   T)rb   rI   rJ   zThe source has too many r  z"Legacy-format sources support one Nr$   z only.r4   zdeb-src r   r:   [z] )r'   rb   r1   r	   r`   ra   r   r   r_   get_boolr   _legacy_optionsr   rI   rJ   r>   rK   )r   r  r_   r   r   msgoptions_strings          r   r   zSource._generate_legacy_outputg  sm   tzz?Q#D//001DJ/ 	'D74&'!+0a8;D"I;fMM!#&&		' ||$$&zdNFgdNFj Fdjjm)))FcMF--/cMFn$F\\^FdNFTYYq\N!$$T[[^$A&& 	#((4??++ r   c                     d}| j                   D ]=  }| j                   |   dk7  s|| d| j                   |   j                  dd       dz  }? |S )zTurn the current options into a oneline-style string
        
        Returns: str
            The one-line-format options string
        r;   =r:   ,)rw   rA   )r   options_strrF   s      r   r$  zSource._legacy_options  se     << 	OC||C B&#aS(9(A(A#s(K'LANN	O r   c                 2   | j                   | j                  | j                  | j                  | j                  | j
                  | j                  | j                  | j                  | j                  | j                  | j                  | j                  d| _        y)z)Updates the current set of legacy options)archlangtargetrg   zby-hashzallow-insecurez
allow-weakzallow-downgrade-to-insecurerl   z	signed-byzcheck-valid-untilzvalid-until-minzvalid-until-maxN)rd   re   rf   rg   rh   ri   rj   rk   rl   rc   rm   rn   ro   rw   rR   s    r   rq   zSource._update_legacy_options  st     &&NNllkk||"11//+/+K+K||!%!7!7#33#33
r   )r   N)F)r;   )T)FT)@r   r   r   r   DEFAULT_FORMATdefault_formatstaticmethodr   boolr*   r   rG   rO   rS   dictr\   r0   listr   propertyr   setterr   r{   r|   r   r   r   r   r   r   r   rX   rQ   r	   r   r_   rb   rI   rJ   rK   rw   rp   rd   re   rf   rg   rh   ri   rj   rk   rl   rc   rm   rn   ro   r  r   r   r   r   r$  rq   r   r   s   @r   r   r   .   s     $N3 4  2 $( "0$    2<.$ .4 .` D    3 *&s &$1T 1T 1,

s 
C 3 
t 
# 
$ 

 D   s   \\%3 %4 % %
 	&c 	& 	& 
[[& & & & 	+.. 	+ 	+ ^^$ $ t   \\	.4 	.D 	. 	. d   
[[. .$ . .    ]]2T 2d 2 2 D   :T :d : :    ^^ d  t     	 	 \\	0 	0    & & C   & & #   ^^& &    ]]& & #   ^^& &    & & S   & & c   !''& (& #   ^^& & C   & & C   & & #   & & #   & &    2 2    C     0, ,\
 

r   r   )r   r-   pathlibr   debianr   parsedebr   rF   r   r;   r	   SourceFormatLEGACYr/  	RepoErrorr   Deb822r   r   r   r   <module>r>     sQ   (      ""))
$.. 
C
V]] C
r   