+
    Ci#                        ^ RI t ^ RIt^ RIHtHt ^ RIt^ RIt^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt ^ RIHt ^ RIt ^ RIt^ RIHt ^ RIHt  ^ RIHt ^ RIHt ^ RIt^ RIt^ RIt^RIHt ^ R	IH t H!t!H"t" ^ R
I#H$t$ ^ RI%H&t& ^ RI'H(t(  ! R R])4      t*]+R8X  d1   ]*! 4       t,]-! ],P]                  4       4       ],P_                  ^ 4       R# R#   ] d    ]P                  t Li ; i  ] d    ^ RIt Li ; i  ] d
    ^ RIHt  Li ; i)    N)md5sha256)	maketrans)NamedTemporaryFile)escape)ConfigParser)gettext)AptAuth)SourcesListSourceEntryDeb822SourceEntry)InvalidShortcutException)shortcut_handler)Gioc                     a  ] tR t^Dt o RtRt]! ]! ^4      4      w  tt	t
]R]	R]
R/tR<R ltR tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R t#R t$R  t%R! t&R" t'R# t(R$ t)R% t*R& t+R' t,R( t-R) t.R* t/R+ t0R, t1R- t2R. t3R/ t4R0 t5R1 t6R2 t7R=R3 lt8R=R4 lt9R>R5 lt:R6 t;R7 t<R8 t=R9 t>]?R?R: l4       t@R;tAV tBR# )@SoftwarePropertiesz /usr/share/app-install/channels/z$/etc/update-manager/release-upgradesnormalltsneverNc                b   VR,           V n         W0n        VR8w  d!   \        P                  P	                  RV4       VR8X  d   RpW n        Wn        \        VR7      V n        \        P                  P                  4       V n
        . V n        RV n        V P                  4        V P                  4        V P!                  4        . V n        \$        P&                  ! 4       V n        \+        VR7      V n        \.        P0                  ! 4       V n        \4        P6                  ! V P8                  4       R# )	zProvides the core functionality to configure the used software
repositories, the corresponding authentication keys and
update automation z/etc/popularity-contest.conf/DirNz/usr/share/software-properties/)deb822F)rootdir)
popconfiler   apt_pkgconfigsetoptionsdatadirr   sourceslist
aptsourcesdistro
get_distroseen_servermodified_sourceslistreload_sourceslistbackup_sourceslistbackup_apt_confcustom_mirrorsqueueQueuemyqueuer
   apt_keyr   Cancellablecancellableatexitregisterwait_for_threads)selfr    r   r   r   s   &&&&&G/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py__init__SoftwareProperties.__init__W   s     <<DOL#~nn( $1gLL"&1D##..0DKD %D D ;;=DL 7+DL(D
OOD))*    c                    \         P                  ! 4        FC  pVP                  \         P                  ! 4       P                  8w  g   K3  VP	                  4        KE  	  R# )z8wait for all running threads (PPA key fetchers) to exit N)	threading	enumerateidentcurrent_threadjoin)r4   ts   & r5   r3   #SoftwareProperties.wait_for_threads   s9      "	
I,,.44	4	 #r8   c                    / V n         \        P                  P                  4        FE  p\        P
                  P                  \        P                  V,          4      pW P                   V&   KG  	  R# )z$Backup all apt configuration optionsN)apt_conf_backupsoftwarepropertiesCONF_MAPkeysr   r   find_i)r4   optionvalues   &  r5   r)   "SoftwareProperties.backup_apt_conf   sQ    D$--224%%&8&A&A&&IJ',V$ 5r8   c                   V P                   P                  4        FR  p\        P                  P	                  \
        P                  V,          \        V P                   V,          4      4       KT  	  V P                  4        R# )z$Restore the stored apt configurationN)	rB   rE   r   r   r   rC   rD   strwrite_config)r4   rG   s   & r5   restore_apt_conf#SoftwareProperties.restore_apt_conf   s\    &&++--66v>t33F;<	> . 	r8   c                f   \         P                  P                  \        P                  R,          4      ^ 8  Edu   \         P                  P                  \        P                  R,          4      ^8X  d6   \
        P                  P                  R4      '       d   \        P                  # \         P                  P                  \        P                  R,          4      ^8X  dJ   \         P                  P                  \        P                  R,          4      ^ 8X  d   \        P                  # \         P                  P                  \        P                  R,          4      ^ 8X  dJ   \         P                  P                  \        P                  R,          4      ^ 8X  d   \        P                  # R# \         P                  P                  \        P                  R,          4      ^ 8X  dJ   \         P                  P                  \        P                  R,          4      ^ 8X  d   \        P                  # R# )zParse the apt cron configuration. Try to fit a predefined use case
and return it. Special case: if the user made a custom
configurtation, that we cannot represent it will return None 
autoupdate
unattendedz/usr/bin/unattended-upgradeautodownloadN)r   r   rF   rC   rD   ospathexistsUPDATE_INST_SECUPDATE_DOWNLOADUPDATE_NOTIFYUPDATE_MANUALr4   s   &r5   get_update_automation_level.SoftwareProperties.get_update_automation_level   sj    ~~/88FG!K>>  !3!<!<\!JKqPww~~;<<%555^^""#5#>#>~#NOSTT^^""#5#>#>|#LMQRR%555^^""#5#>#>|#LMQRR^^""#5#>#>~#NOSTT%333			1::<H	IQ	N			1::>J	Kq	P!///r8   c                
   V\         P                  8X  d   \        P                  P	                  \         P
                  R,          \        ^4      4       \        P                  P	                  \         P
                  R,          \        ^4      4       EMV\         P                  8X  d   \        P                  P	                  \         P
                  R,          \        ^4      4       \        P                  P	                  \         P
                  R,          \        ^ 4      4       EMLV\         P                  8X  d~   \        P                  P	                  \         P
                  R,          \        ^ 4      4       \        P                  P	                  \         P
                  R,          \        ^ 4      4       M\        P                  P	                  \         P
                  R,          \        ^ 4      4       \        P                  P	                  \         P
                  R,          \        ^ 4      4       \        P                  P	                  \         P
                  R,          \        ^ 4      4       V P                  4        R# )zSet the apt periodic configurtation to the selected
update automation level. To synchronize the cache update and the
actual upgrading function, the upgrade function, e.g. unattended,
will run every day, if enabled. rQ   rR   rP   N)
rC   rV   r   r   r   rD   rK   rW   rX   set_modified_config)r4   states   &&r5   set_update_automation_level.SoftwareProperties.set_update_automation_level   s   
 "222-66|Dc!fM-66~FAO	$44	4-66~FAO-66|Dc!fM	$22	2-66~FAO-66|Dc!fM-66|Dc!fM-66|Dc!fM-66~FAOr8   c                   V\         P                  P                  \        P                  R,          4      8X  gQ   \         P                  P                  \        P                  R,          \        V4      4       V P                  4        R# R# )z8Set the interval in which we check for available updatesrP   N)r   r   rF   rC   rD   r   rK   r^   )r4   dayss   &&r5   set_update_interval&SoftwareProperties.set_update_interval   s]     W^^**+=+F+F|+TUU
..

/88FD	
R

"
"
$ Vr8   c                j    \         P                  P                  \        P                  R,          4      # )z2Returns the interval of the apt periodic cron job rP   )r   r   rF   rC   rD   rZ   s   &r5   get_update_interval&SoftwareProperties.get_update_interval   s#    >>  !3!<!<\!JKKr8   c                   \         P                  P                  V P                  4      '       g   V P                  # \        4       pVP                  V P                  4       VP                  RR4      '       dN   VP                  RR4      P                  4       pV P                  P                  4        F  w  r4WB8X  g   K  Vu # 	  V P                  # )zm
return the release upgrade policy:
 RELEASE_UPGRADES_NORMAL,
 RELEASE_UPGRADES_LTS,
 RELEASE_UPGRADES_NEVER
DEFAULTPrompt)rS   rT   rU   RELEASE_UPGRADES_CONFRELEASE_UPGRADES_NORMALr   read
has_optiongetlowerrelease_upgrades_policy_mapitems)r4   parsertypekvs   &    r5   get_release_upgrades_policy.SoftwareProperties.get_release_upgrades_policy   s     77>>$4455)))^F
KK**+8,,ZZ	(+113d2288:$!9( ; '''r8   c           
        \         P                  P                  V P                  4      '       gS   \	        V P                  R4      ;_uu_ 4       pVP                  RV P                  V,          ,          4       RRR4       R# \	        V P                  R4      ;_uu_ 4       p\        RR7      ;_uu_ 4       pV F{  pVP                  4       pVP                  4       P                  R4      '       d,   VP                  R	V P                  V,          ,          4       Kc  VP                  VR
,           4       K}  	  VP                  4        \        P                  ! V P                  VP                  4       \        P                  ! VP                  V P                  4       RRR4       RRR4       R#   + '       g   i     R# ; i  + '       g   i     L.; i  + '       g   i     R# ; i)zk
set the release upgrade policy:
 RELEASE_UPGRADES_NORMAL,
 RELEASE_UPGRADES_LTS,
 RELEASE_UPGRADES_NEVER
 wz[DEFAULT]
Prompt=%s
NTrzw+)modepromptz
Prompt=%s

)rS   rT   rU   rl   openwriterr   r   striprq   
startswithflushshutilcopymodenamecopy)r4   ifoutlines   &&   r5   set_release_upgrades_policy.SoftwareProperties.set_release_upgrades_policy   s:    77>>$4455**3//1	($*J*J1*MMN 0	d((	-	-4FD4Q4QUX$zz|::<""8,,
))MD$D$DQ$GG
H
))DI
  
iikood00#((;kk#((D667 5R	-  0/4Q4Q	-	- s1   *F/ G5C(G	G/G 	GGG'	c                   \         P                  P                  V P                  4      '       d   \	        V P                  4      ;_uu_ 4       pVP                  4       P                  R4      pRRR4       X FG  p VP                  R4      w  rEVR8X  d*   VP                  R4      P                  4       R8X  d    R# KG  KI  	  R#   + '       g   i     L_; i  \         d     Kn  i ; i)	zWill return True if the user wants to participate in the popularity
contest. Otherwise it will return False. Special case: if no
popcon is installed it will return False r   N=PARTICIPATE"yesTF)
rS   rT   rU   r   r   rn   splitr   rq   
ValueError)r4   r   linesr   keyrH   s   &     r5   get_popcon_participation+SoftwareProperties.get_popcon_participation   s     
ww~~doo&&$//""a&&(..&% #D"jjo-'EKK,<,B,B,D,M -N'   #"  s    C;>CC	C&%C&c           
     \   VR8X  d   RpMRp\         P                  P                  V P                  4      '       dW   \	        V P                  R4      ;_uu_ 4       pV Uu. uF"  p\
        P                  ! RRV,          V4      NK$  	  ppRRR4       M\        4       p\	        RR	4      ;_uu_ 4       pVP                  VP                  R
4      4       RRR4       VP                  4       p. pVP                  RV,          4       VP                  R\        V4      ,          4       VP                  R4       \	        V P                  R4      ;_uu_ 4       pVP                  X4       RRR4       R# u upi   + '       g   i     LO; i  + '       g   i     L; i  + '       g   i     R# ; i)z>Enable or disable the participation in the popularity contest Tr   nor|   z^(PARTICIPATE=)(".+?")z\1"%s"Nz/dev/urandomrbi   zMY_HOSTID="%s"
zPARTICIPATE="%s"
zUSE_HTTP="yes"
r{   )rS   rT   rU   r   r   resubr   updatern   	hexdigestappendrK   
writelines)	r4   
is_helpfulrH   r   r   r   mr   ids	   &&       r5   set_popcon_pariticipation,SoftwareProperties.set_popcon_pariticipation  s;   T	ww~~doo&& $//3'':!+-!+ VV5y57H$O!+  - ('
 E.$''1HHQVVD\" ([[])B./+c%j89)*	doos	#	#q	U 
$	#- (' (' 
$	#	#s6   E4(E/E40!FF/E44F	F	F+	c                d   \        V P                  P                  4      ^8  d   RV P                  n        R# RV P                  n        / p. pVP	                  V P                  P
                  4       VP	                  V P                  P                  4       V Fk  pVP                  V9   d7   VP                   F$  pWP                  ,          P                  V4       K&  	  KJ  \        VP                  4      WP                  &   Km  	  \        V P                  P                  4      ^ 8  d-   V P                  P                  WP                  P                  &   V P                  P                   F  pVP                  V9  g   VP                  V9   g   K'  \        \        WP                  ,          4      \        VP                  4      ,          4      ^ 8X  d   Kl  \        \        VP                  4      V P                  P                  ,          4      ^ 8X  d   K  RV P                  n         R# 	  R# )zReturn True if all distro componets are also available as
source code. Otherwise return Flase. Special case: If the
configuration cannot be represented return NoneFTN)lenr#   source_code_sourcesget_source_codeextendmain_sourceschild_sourcestemplatecompsaddr   cdrom_sourcescdrom_compssource_templateenabled_comps)r4   	templatessourcessourcecomps   &    r5   get_source_code_state(SoftwareProperties.get_source_code_state  s   
 4;;**+a/ ',# '+# 	t{{//0t{{001F)+"LLDoo.2248 ) .1->	//*  t{{(()A-59[[5L5LIkk112kk55Fi/9,S??34s6<<7HHIQNV\\*T[[-F-FFG1L.3+ 6 r8   c                   RVP                   3RVP                  3RVP                  '       * 3RVP                  '       * 33 F  w  r#\	        RV: RV: 24       K  	  VP
                  '       dM   RVP
                  P                  3RVP
                  P                  33 F  w  r#\	        RV: RV: 24       K  	  \	        R4       R	# )
z4Print the data of a source entry to the command linezURI:zComps:zEnabled:zValid: z	MatchURI:zBaseURI:r   N)urir   disabledinvalidprintr   	match_uribase_uri)r4   r   labelrH   s   &&  r5   print_source_entry%SoftwareProperties.print_source_entryE  s    "FJJ/$fll3&FOO(;<$&..&89; 	%'(	;
  +V__-F-FG *FOO,D,DEGNUeU+,G 
$Kr8   c                    \        R4       V P                   F  p\        VP                  4       4       K  	  \        R4       R# )zPrint the complete sources.listzSTART SOURCES.LIST:zEND SOURCES.LIST
N)r   r!   rK   r4   r   s   & r5   massive_debug_output'SoftwareProperties.massive_debug_outputR  s2    	
 ""fjjl #	
r8   c                |    WP                   n        V P                   P                  V4      pV P                  4        V# )z change the main download server )r#   default_serverchange_serverset_modified_sourceslist)r4   serverress   && r5   change_main_download_server.SoftwareProperties.change_main_download_serverY  s1    !'KK
++
#
#F
+C!!#Jr8   c                \    V P                   P                  V4       V P                  4        R# )z Enable a component of the distroN)r#   enable_componentr   r4   r   s   &&r5   r   #SoftwareProperties.enable_component`  s     KK  &!!#r8   c                \    V P                   P                  V4       V P                  4        R# )z!Disable a component of the distroN)r#   disable_componentr   r   s   &&r5   r   $SoftwareProperties.disable_componente  s     KK!!$'!!#r8   c                ~    V P                   P                  P                   F  pVP                  V8X  g   K  Vu # 	  R # N)r#   r   childrenr   )r4   r   r   s   && r5   _find_template_from_string-SoftwareProperties._find_template_from_stringj  s-    KK//88	$	 9r8   c                   \        V\        4      '       d   V P                  V4      pV P                  P                   F1  pVP
                  V8X  g   K  V P                  P                  V4       K3  	  V P                  P                   F1  pVP
                  V8X  g   K  V P                  P                  V4       K3  	  V P                  4        R# )7Enable a child repo of the distribution main repositoryN)

isinstancerK   r   r#   r   r   r!   remover   r   )r4   r   r   s   && r5   disable_child_source'SoftwareProperties.disable_child_sourceo  s    (C  00:h++++??h&##F+ , ++11??h&##F+ 2 	!!#r8   c                (   \        V\        4      '       d   V P                  V4      pVP                  R8X  d   V P                  P
                  pMVP                  pV P                  P                  W!P                  R7       V P                  4        R# )r   N)r   dist)	r   rK   r   r   r#   r   
add_sourcer   r   )r4   r   	child_uris   && r5   enable_child_source&SoftwareProperties.enable_child_source|  sn    (C  00:h D KK..	%%	KKy}}=!!#r8   c                .   . pVP                  V P                  P                  4       VP                  V P                  P                  4       V P                  P                   F  pV P
                  P                  V4       K   	  V P                  4        R# )z%Remove all distro source code sourcesN)r   r#   r   r   r   r!   r   r   r4   r   r   s   &  r5   disable_source_code_sources.SoftwareProperties.disable_source_code_sources  sg    GNN4;;++,NN4;;,,-++11' 2!!#r8   c                v   . pVP                  V P                  P                  4       VP                  V P                  P                  4       V P                  P                   F  pV P
                  P                  V4       K   	  V Fn  pV P
                  P                  RVP                  VP                  VP                  RV P
                  P                  V4      ^,           VP                  VR7       Kp  	  V P                  P                   F  pV P
                  P                  RV P                  P                  P                  V P                  P                  P                   VP                  RV P
                  P                  V4      ^,           VP                  VR7       K  	  V P#                  4        R# )z0Enable source code source for all distro sourcesdeb-srczAdded by software-properties)parentN)r   r#   r   r   r   r!   r   r   r   r   r   indexfiler   r   r   r   r   r   s   &  r5   enable_source_code_sources-SoftwareProperties.enable_source_code_sources  sQ   GNN4;;++,NN4;;,,- ++11' 2 Y#ZZ#[[#\\;!--33F;A=#[[$* 	 	,  ++++Y![[88AA![[88==#\\;!--33F;A=#[[$* 	 	, , 	!!#r8   c                   . V n         V P                  P                   F  p\        V\        4      '       d#   \	        VP
                  VP                  R7      pMF\        V\        4      '       d#   \        VP
                  VP                  R7      pM\        RV 24      hV P                   P                  V4       K  	  R# )z+Store a backup of the source.list in memoryr   r   sectionr   Unknown source: N)
sourceslist_backupr!   listr   r   r   r   r   	TypeErrorr   )r4   r   
source_bkps   &  r5   r(   %SoftwareProperties.backup_sourceslist  s     D""''fk**$&++6;;GJ 122*6;;V[[QJ.vh788&&z2 (r8   c                    V P                  4        V P                  P                   F  p\        V4      V8X  g   K  Vu # 	  R # r   )r'   r!   r   rK   )r4   r   r   s   && r5   _find_source_from_string+SoftwareProperties._find_source_from_string  s<     	""''	V	 ( r8   c                    \        V\        4      '       d   V P                  V4      pVP                  '       * Vn        V P	                  4        R# )z&Enable or disable the selected channelN)r   rK   r  r   r   r   s   &&r5   toggle_source_use$SoftwareProperties.toggle_source_use  s;     &#,,V4f //)FO!!#r8   c                   \        V P                  P                  4       F  w  r4\        V4      V8X  g   K  V P                  P                  V,          P                  p\        V\        4      '       d$   \        W%4      V P                  P                  V&   M"\        W%4      V P                  P                  V&   V P                  4         R # 	  R# TF)	r;   r!   r   rK   r   r   r   r   r   )r4   	old_entry	new_entryr   entryr   s   &&&   r5   replace_source_entry'SoftwareProperties.replace_source_entry  s    #D$4$4$9$9:	Uy	 $$U+00e.//+<Y+MD!!%(+6y+GD!!%(%%' ; r8   c                F    V P                  4        V P                  4        R# )zFRevert all settings to the state when software-properties
was launchedN)rM   revert_sourceslistrZ   s   &r5   revertSoftwareProperties.revert  s     	r8   c                   . V P                   n        V P                   F  p\        V\        4      '       d#   \	        VP
                  VP                  R7      pMF\        V\        4      '       d#   \        VP
                  VP                  R7      pM\        RV 24      hV P                   P                  P                  V4       K  	  V P                  4        V P                  4        R# )z6Restore the source list from the startup of the dialogr   r   r   N)r!   r   r   r   r   r   r   r   r   r   save_sourceslistr'   )r4   r   source_resets   &  r5   r  %SoftwareProperties.revert_sourceslist  s    D))fk**&FKKV[[IL 122,V[[v{{SL.vh788$$\2 * 	r8   c                    RV n         V P                  '       d-   V P                  P                  '       d   V P                  4        V P	                  4        V P                  4        R# )zCThe sources list was changed and now needs to be saved and reloadedTN)r&   r   massive_debugr   r  r'   rZ   s   &r5   r   +SoftwareProperties.set_modified_sourceslist  sF     $D|||222!!#r8   c                &    V P                  4        R# )z+Write the changed apt configuration to fileN)rL   rZ   s   &r5   r^   &SoftwareProperties.set_modified_config  s    r8   c                N   VP                   R8X  Edu   VP                  '       d   VP                  P                  RR4      P                  4       R,          \	        VP                  4      ^P8  d   RMR,           pR\        V4      : RVP                  : 2p\	        VP                  4      ^8  d$   VP                   F  pVR	V,          ,          pK  	  VP                  R9   d   VR	\        R
4      ,          ,          pVRVP                  ,          ,          pV# RVP                  : RVP                  : R2pVP                   F  pVR	V,          ,          pK  	  VP                  R9   d   VR	\        R
4      ,          ,          pV# RVP                   P                  ,          pVP                  R9   d   VR\        R4      ,          ,          pVP                  '       d   VR	VP                  ,          ,          pVP                   P                  R8X  d   VP                   F  pVP                   P                  V4      '       dM   VP                   P                   F0  pVP                  V8X  g   K  VRVP                  ,          ,          pK2  	  Kp  VRV,          ,          pK  	  V# )z5Render a nice output to show the source in a treeviewNr   r   :NP   Nu   […] z<b>z</b> z %sz(Source Code)z
%sz</b>z	<b>%s</b>z (%s)zSource CodeF)r   zrpm-src)r   commentreplacer   r   r   r   r   ru   _r   descriptionchildhas_component
componentsr   )r4   r   r  contentscr   s   &&    r5   render_source SoftwareProperties.render_source  s   $>>>&&tS1779#>!&..1B67B@  *0&++FH6<< 1$A	)H &{{44EAo$666++H '  *0V[[AH\\EAI% "{{44EAo$666 !<!<<;;00!M"222H>>>uv~~--H??  E)??0066 $__7766T>$(>>H 8 -H % r8   c                   ^p^p^p^p\        RR4      pVP                  '       dA   ^ pVP                  P                  pVP                  P                  V P                  8X  d   ^ pM?VP
                  : RVP                  : RVP                  : 2pVP                  '       d   ^ pVP                  P                  R4      '       d   ^ pW#WEVP                  V4      3# )z&extract attributes to sort the sources
0123456789
9876543210r   src)r   r   r   distributionr#   r   r   r   r  ru   find	translate)r4   r   cur_syshas_templatehas_comment	is_sourcerevert_numbersdescs   &&      r5   get_comparable!SoftwareProperties.get_comparable(  s    glki |<n	**??''4;;6G%zz6;;E$^^^k			%	 	 )[nn^,. .r8   c                   . pV P                   P                   F  pVP                  '       d   K  W P                  P                  9  g   K3  W P                  P
                  9  g   KO  W P                  P                  9  g   Kk  W P                  P                  9  g   K  W P                  P                  9  g   K  VP                  V4       K  	  V# )z>Return a list of sources that are not part of the distribution)
r!   r   r   r#   r   r   r   disabled_sourcesr   r   )r4   isv_sourcesr   s   &  r5   get_isv_sources"SoftwareProperties.get_isv_sources=  s    K""''~~~++222++333++333++666888v& ( r8   c                .    V P                   P                  # )z-Return the list of CDROM based distro sources)r#   r   rZ   s   &r5   get_cdrom_sources$SoftwareProperties.get_cdrom_sourcesJ  s    ;;$$$r8   c                L    VP                   V P                  P                  9   R3# )zReturn a tuple: the first value describes if a component is enabled
in the Internet repositories. The second value describes if the
first value is inconsistent.F)r   r#   download_compsr   s   &&r5   get_comp_download_state*SoftwareProperties.get_comp_download_stateN  s"    
 II333U;;r8   c                   . pV P                   P                   F1  pVP                  V8X  g   K  VP                  VP                  4       K3  	  \        V4      ^ 8  d7   \        V P                   P                  \        V4      ,          4      ^ 8X  d   R# \        V4      ^ 8  d7   \        V P                   P                  \        V4      ,          4      ^ 8w  d   R# R# )zReturn a tuple: the first value describes if a component is enabled
in one of the child source that matcth the given template.
The second value describes if the first value is inconsistent.r  )FT)FF)r#   r   r   r   r   r   r   r   )r4   r   r   r!  s   &&  r5   get_comp_child_state'SoftwareProperties.get_comp_child_stateU  s     E**>>X%LL% + 5zA~DKK%%E
23q8	UaDKK%%E
23q8  r8   c                    V P                   P                  4        . V n        V P                  P	                  V P                   4       V P                  4        R # r   )r!   refreshsourceslist_visibler#   get_sourcesr   rZ   s   &r5   r'   %SoftwareProperties.reload_sourceslistj  s@    DKKD,,- r8   c                .   V P                   R,           V P                   R,           V P                   R,           .pV F*  p\        P                  P                  V4      '       g   K*   M	  \	        R4       \        P                  P                  X4      p\        P                  P                  V4      '       g'   \        P                  ! V4      P                  RR7       \        V^ ,          R4      ;_uu_ 4       pVP                  R4       R	R	R	4       R
p\        P                  P                  V4      '       dr   \        P                  ! V4      \        P                  ,          pV\        P                  ,          '       g*   \	        RV,          4       \        P                  ! VR4       V EF'  p. p\        P                  P                  V4      '       g   K-  \        VR4      ;_uu_ 4       pVP!                  4       pR	R	R	4       \"        P$                  P'                  R4      p\        VR4      ;_uu_ 4       pV FK  p	VP)                  4        F#  p
V	P+                  RV
,          4      ^ 8  g   K"   K8  	  VP                  V	4       KM  	  VP)                  4        F,  pVP                  RV: RVP-                  V4      : R24       K.  	  R	R	R	4       EK*  	  R	#   + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     EKg  ; i)z+Write the current apt configuration to filez/etc/apt/apt.conf.d/10periodicz#/etc/apt/apt.conf.d/20auto-upgradesz+/etc/apt/apt.conf.d/15adept-periodic-updatezNo config found, creating oneT)parentsr{   r  Nz/etc/cron.daily/aptz file '%s' not executable, fixingi  r|   zAPT::PeriodiczAPT::Periodic::%szAPT::Periodic::z "z";
)r   rS   rT   isfiler   dirnamerU   pathlibPathmkdirr   r   statST_MODES_IXUSRchmod	readlinesr   r   subtreer   r-  rF   )r4   	conffilesr   rN  acpermperiodiccontentcnfr   r   r   s   &           r5   rL   SoftwareProperties.write_configp  s    >>CCKKMI
 			  +,"gWW^^G$$W##D#1	!c""a	 # 
B	ww~~bWWR[&dT\\!!0256
U g		!	!(C  AKKM' !nn$$_5 (C  Adxxz.#671< " ggdm  88:aGGQ

1FG  !   #""  ! 
 !  s+   9K.K/:3L2ALK,	/K?Lc                p    V P                   P                  R4       V P                   P                  4        R# )zJBackup the existing sources.list files and write the current
configurationz.saveN)r!   backupsaverZ   s   &r5   r  #SoftwareProperties.save_sourceslist  s*     	G$r8   c           	     X   \        V4      p\        P                  P                  V P                  4      '       d   \
        P
                  ! RV P                  ,          4       F  p\        V4      ;_uu_ 4       pV F  pVP                  4       P                  R4      '       d   K*  V\        V4      8X  g   K<  \        P                  P                  \        P                  P                  V4      4      ^ ,          u uuRRR4       u # 	  RRR4       K  	  R#   + '       g   i     K  ; i)zg
helper that checks if a given line is in the source list
return the channel name or None if not found
z	%s/*.list#N)r   rS   rT   rU   CHANNEL_PATHglobr   r   r   splitextbasename)r4   srclinesrcentryfilenamer   r   s   &&    r5   _get_channel_from_line)SoftwareProperties._get_channel_from_line  s    
 7#H	ww~~d''((iid.?.? ?@((^^qdzz|&&s++;t,,WW%%bgg&6&6x&@A!DD ^ ^ A  ^^s   8:D7ADDD)c                    VP                  4       P                  pV P                  V4      pV'       d(   V P                  : RV: R2pV P	                  V4       R# R# )zw
helper that adds the gpg key of the channel to the apt
keyring *if* the channel is in /usr/share/app-install/channels
r   z.keyTF)r   r   rl  re  add_key)r4   shortcutri  channelkeyps   &&   r5   &check_and_add_key_for_channel_shortcut9SoftwareProperties.check_and_add_key_for_channel_shortcut  sM    
 ""$))G))'2G --w7d
ll4r8   c                    R# )z(abstract interface to keep the UI alive N rZ   s   &r5   update_interface#SoftwareProperties.update_interface  s    r8   c                   VP                  R4      '       g   V# VP                  4       ^ ,          p VP                  R^4      ^,          pRV: RV P                  P                  : RV: 2pV#   \         d    Rp L3i ; i)z
short cut - this:
  apt-add-repository http://packages.medibuntu.org free non-free
same as
  apt-add-repository 'deb http://packages.medibuntu.org/ '$(lsb_release -cs)' free non-free'
httpr   mainzdeb )r   r   
IndexErrorr#   codename)r4   r   repoareass   &&  r5   expand_http_line#SoftwareProperties.expand_http_line  su     ??6""k::<?D

3q!!$ #DKK$8$8%ADK  s   A/ /A?>A?c                |     \        VP                  4       4      pT P                  Y24      #   \         d     R# i ; i)z"
Add a source for the given line.
F)r   r   r   add_source_from_shortcut)r4   r   enable_source_coderp  s   &&& r5   add_source_from_line'SoftwareProperties.add_source_from_line  s>    #DJJL1 ((FF $ s   , ;;c           
        VP                  4       P                  pVP                  pV P                  V4      pV'       d   RMRpWSR,          ,           p\        W44      p\        Wd4      pVP                  '       g   VP                  '       d   R# V P                  V4      '       g   VP                  4        V P                  P                  VP                  VP                  VP                  VP                  VP                  VP                  VP                  R7       V P                  P                  VVP                  VP                  VP                  VP                  VP                  VP                  R7       V P!                  4        V P"                  '       dM   V P"                  P$                  '       d1   ^ RIp	V	P)                  4       p
V
P%                  VP                  R7       R# )	z
Add a source with the given shortcut and add the signing key if the
site is a known channel or the shortcut implementer adds it.
r   z	# deb-src:   NNF)r  r   architecturesN)sources_listT)r   r   sourceparts_filer  r   rs  ro  r!   r   ru   r   r   r   r  r   r  r   r   r   aptCache)r4   rp  r  deb_liner   debsrc_entry_typedebsrc_linenew_deb_entrynew_debsrc_entryr  caches   &&&        r5   r  +SoftwareProperties.add_source_from_shortcut  s    ##%**H$$D$$X.H%7	[#rl2K/M";5 0 8 8 866x@@++&**&++&,,!.!6!6+00'4'B'B  D 	*)--)..)//!1!9!9.33'7'E'E  G 	!!#|||+++		"2"7"78r8   c                   V'       d   \        V\        4      '       d&   V P                  V4      pV P                  VR4       R# Veb   V P                  VR4       \        P                  ! V4      pRVn        RVn        V P                  VR4       RVn        V P                  VR4       R# \        V\        4      '       d   V P                  V4      pVf   R# VP                  \        P                  P                  R4      8w  d   VP                  P                  R4      '       d<   V P                  P                  P                  \        RVP                  R7      4       M:V P                  P                  P                  \!        RVP                  R7      4        V P                  P#                  V4       V P'                  4        R#   \$         d     Li ; i)	zRemove the given sourceTNFr   zDir::Etc::sourcelistz.sourcesr  )r   )r   rK   r  remove_sourcer   ru   r   r   r   r   	find_fileendswithr!   r   r   r   r   r   r   r   )r4   r   remove_source_codes   &&&r5   r   SoftwareProperties.remove_source	  sy   	FC	 	 ..v664(  65) 6"65)65) &#,,V4f~
 {{gnn../EFF			j	)	)$$%6r%LM$$[&++%FG
f% 	!!#  
 s   G
 
GGc                    \         P                  P                  V4      '       g   R#  V P                  P	                  V4      pV#     R# ; i)z7Add a gnupg key to the list of trusted software vendorsF)rS   rT   rU   r.   r   )r4   rT   r   s   && r5   ro  SoftwareProperties.add_key4  s@    77>>$llt$
s   A Ac           	        \         P                  ! 4       ;_uu_ 4       pVP                  4       P                  R4      '       d?   VR,           \	        VP                  R4      4      P                  4       ,           R,           pMn\        V^ ,          4      R
9   d?   VR,           \	        VP                  R4      4      P                  4       ,           R,           pM\        RV 24        RRR4       R# \        VR	4      ;_uu_ 4       pVP                  V4       VP                  4        RRR4       V P                  XP                  4      uuRRR4       #   + '       g   i     L5; i  + '       g   i     R# ; i)z<Add a gnupg key from a utf-8 data string (e.g. copy-n-paste)z$-----BEGIN PGP PUBLIC KEY BLOCK-----r   zutf-8z.ascz.gpgzNot an OpenPGP certificate: NFr{   )         )tempfileTemporaryDirectoryr   r   r   encoder   ordr   r   r   r   ro  r   )r4   keydatatmpdirtmpfiletmps   &&   r5   add_key_from_data$SoftwareProperties.add_key_from_data>  s   		$	$	&	&&==?%%&LMMslVGNN7,C%D%N%N%PPSYYG_ 22slVGNN7,C%D%N%N%PPSYYG0	:; 
'	& '33IIgIIK   ||CHH% 
'	&   
'	&	&s*   CE&0E&"E	&"E&E#E&&E7	c                N     V P                   P                  V4       R#     R# ; i)z<Remove a gnupg key from the list of trusted software vendorsTF)r.   rm)r4   keyids   &&r5   
remove_keySoftwareProperties.remove_keyM  s$    s    $c                N   \        V\        P                  4      '       g   Q hVP                  pV'       d   VP                  pVP
                  pM?\        P                  ! V4      pVP                  V4      pVP                  pVP
                  pVP                  : RV: RV: R2# )z!Return the PackageKit package id ;)	r   r   Packagecurrent_verver_strarchDepCacheget_candidate_verr   )r4   	apt_cachepkgcur_ververr  depcache	candidates   &&&     r5   get_package_id!SoftwareProperties.get_package_idU  s|    c7??++++ooGoo||##I...s3	~~((C..r8   c                F   \         P                  ! V 4      pVP                  V4      p. p VP                  P	                  R4       F>  pV F5  w  rxp	VP                  V4      R8w  g   K  VP                  W,          4       K7  	  K@  	  V#   \        \        3 d    . u # i ; i)zEGet the package dependencies, which can be filtered out by a pattern Depends)	r   r  r  depends_list_strrp   r-  r   KeyErrorr   )
r  packagepatternr  r  dependenciesdep_listdep_namedep_verdep_ops
   &&&       r5   get_dependencies#SoftwareProperties.get_dependenciesc  s     	*H**73IL!2266yAH-5)6==)R/ ''	(;< .6 B  i  	s   9B
 )B
 
B B )rB   r.   r0   r*   r    r#   r&   r-   r   r   r   r%   r!   r   rH  )NNr   F)F)Tr   )C__name__
__module____qualname____firstlineno__re  rl   r   rangerm   RELEASE_UPGRADES_LTSRELEASE_UPGRADES_NEVERrr   r6   r3   r)   rM   r[   r`   rd   rg   rx   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r  r  r  r  r  r   r^   r&  r5  r:  r=  rA  rD  r'   rL   r  rl  rs  rw  r  r  r  r  ro  r  r  r  staticmethodr  __static_attributes____classdictcell__)__classdict__s   @r5   r   r   D   se     2, A 58n	 heg!'+R-.(%L(&0 2%N $
$

$$$$<
3$(T.*%<*!/Hb 0"	G$L)$V&/  r8   r   __main__)0r   r   hashlibr   r   r   rS   rf  r   r:   r1   r  rO  stringr   ImportErrorrK   rR  r+   r,   r   xml.sax.saxutilsr   configparserr   r	   r  r"   aptsources.distrorC   r
   aptsources.sourceslistr   r   r   "softwareproperties.shortcuthandlerr   softwareproperties.shortcutsr   gi.repositoryr   objectr   r  spr   rx   r   rv  r8   r5   <module>r     s   4    	 	        ( #(' !     P P G 9 n nb z"&&()  # ]  mm)    ('(s4   C C% C6 C"!C"%C32C36DD