+
    oFj
                         R 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HtHt ^ RIHt R R lt ! R R4      tRR	 R
 lltR R ltR# )z"Abstract crash database interface.N)Iterable)AnyLiteral)implc                F    V ^8  d   QhR\         \        ,          R\         /# )   stringreturn)strbytes)formats   "0/usr/lib/python3/dist-packages/apport/crashdb.py__annotate__r      s      sU{ s     c                V    \        V \        4      '       d   V P                  RR4      # V # )z.Convert str to an unicode if it isn't already.UTF-8ignore)
isinstancer   decode)r   s   &r   _ur      s%    &%  }}Wh//Mr   c                     a  ] tR t^!t o RtV 3R lR ltV 3R lR ltR tV 3R lR ltRKR
 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V 3R lR ltV 3R lR ltV 3R lR ltV 3R lR ltV 3R lR lt]P(                  RLV 3R lR ll4       t]P(                  V 3R lR l4       tRLV 3R  lR! lltV 3R" lR# ltV 3R$ lR% ltV 3R& lR' lt]V 3R( lR) l4       tRMR* ltR+ tR, tR- tRNR. ltROR/ lt V 3R0 lR1 lt!V 3R2 lR3 lt"V 3R4 lR5 lt#V 3R6 lR7 lt$V 3R8 lR9 lt%V 3R: lR; lt&V 3R< lR= lt'V 3R> lR? lt(V 3R@ lRA lt)RB t*V 3RC lRD lt+V 3RE lRF lt,RKV 3RG lRH llt-RI t.RJt/V t0R	# )PCrashDatabasezCrash database interface.c                N   < V ^8  d   QhRS[ R,          RS[S[ S[3,          RR/# )r   	auth_fileNoptionsr	   )r
   dictr   )r   __classdict__s   "r   r   CrashDatabase.__annotate__&   s.     / /#* /tCH~ /$ /r   c                n    Wn         W n        \        P                  '       d   ^ RIpRV n        RV n        R# )aJ  Initialize crash database connection.

You need to specify an implementation specific file with the
authentication credentials for retracing access for download() and
update(). For upload() and get_comment_url() you can use None.

options is a dictionary with additional settings from crashdb.conf; see
get_crashdb() for details.
N)r   r   typingTYPE_CHECKINGsqlite3duplicate_dbformat_version)selfr   r   r!   s   &&& r   __init__CrashDatabase.__init__&   s-     #9=*.r   c                .   < V ^8  d   QhRS[ R,          /# )r   r	   Nr
   )r   r   s   "r   r   r   8   s     3 3d
 3r   c                8    V P                   P                  R4      # )zReturn the base URL for bug patterns.

See apport.report.Report.search_bug_patterns() for details. If this
function returns None, bug patterns are disabled.
bug_pattern_urlr   getr$   s   &r   get_bugpattern_baseurl$CrashDatabase.get_bugpattern_baseurl8   s     || 122r   c                r    RV P                   9   d&   VP                  R4      V P                   R,          9   # R# )zCheck if this report can be uploaded to this database.

Crash databases might limit the types of reports they get with e. g.
the "problem_types" option.
problem_typesProblemTypeTr+   )r$   reports   &&r   acceptsCrashDatabase.accepts@   s0     dll*::m,_0MMMr   c                $   < V ^8  d   QhRS[ RR/# )r   pathr	   Nr(   )r   r   s   "r   r   r   P   s     <2 <2c <2d <2r   c                   ^ RI pVP                  R8X  g   Q R4       h^V n        \        P                  P                  V4      '       * ;'       g0    VR8H  ;'       g#    \        P                  P                  V4      ^ 8H  pVP                  VRR7      V n        V'       d   V P                  P                  4       pVP                  R4       VP                  RV P                  .4       VP                  R	4       VP                  R
4       V P                  P                  4        V P                  P                  4       pVP                  R4       VP                  4       pVR.8w  d   \        RV 24      h VP                  R4       VP                  4       pV^ ,          V P                  8  d   \        RV^ ,           24      hV^ ,          V P                  8  d=   \#        RV^ ,           RV P                   24       V P%                  V^ ,          4       R# R#   T P                  P                   d   pR\!        T4      9   d   ^ .p Rp?LRp?ii ; i)zpInitialize duplicate database.

path specifies an SQLite database. It will be created if it does not
exist yet.
Nqmarkz/this module assumes qmark dbapi parameter stylez:memory:i   )timeoutz.CREATE TABLE version (format INTEGER NOT NULL)zINSERT INTO version VALUES (?)a  CREATE TABLE crashes (
                signature VARCHAR(255) NOT NULL,
                crash_id INTEGER NOT NULL,
                fixed_version VARCHAR(50),
                last_change TIMESTAMP,
                CONSTRAINT crashes_pk PRIMARY KEY (crash_id))zCREATE TABLE address_signatures (
                signature VARCHAR(1000) NOT NULL,
                crash_id INTEGER NOT NULL,
                CONSTRAINT address_signatures_pk PRIMARY KEY (signature))zPRAGMA integrity_checkzCorrupt duplicate db:zSELECT format FROM versionzno such tablez duplicate DB has unknown format zduplicate db has format z, upgrading to )ok)r!   
paramstyler#   osr7   existsgetsizeconnectr"   cursorexecutecommitfetchallSystemErrorfetchoneOperationalErrorr
   print_duplicate_db_upgrade)r$   r7   r!   initcurresulterrors   &&     r   init_duplicate_dbCrashDatabase.init_duplicate_dbP   s    	 ')	=<	=)   t$$XX
(:XXbggood>SWX>X 	 $OOD$O?##**,CKKHIKK84;N;N:OPKK A B KK M N
 $$& &&(,-gY 5fX>??	KK45\\^F
 !9t*** @LMM!9t****6!9+ 6!!%!4!4 57 &&vay1 +   11 	#e*,	s   5!H I4IINc                   V P                   '       g   Q R4       hV'       g   V P                  V4      pV P                  W4       RV9   d   VR,          pMVP                  4       p. pV'       dG   V P	                  W14      pV'       d.   V F  w  rVV P                  V4       K  	  V P	                  W14      p VR,          P                  4       ^,          pRpRp	V F6  w  rZV
'       d&   V'       d   \        P                  ! Wz4      ^ 8  g   K2  TpT
p	 M)	  V'       d    V P                  WR,          ^ ,          4       VP                  4       pV'       dx   V P                  V4      pV'       d_   W8w  dY   Vf   TpMQW8  d%   V P                  W,V4       V P                  W4       M'V P                  W(V4       V P                  W4       TpRp	Ve5   W8w  d/   V'       d   V P!                  W4       V P                  W!V4       W3# V'       d   V P                   P#                  4       pVP%                  RV.4       VP'                  4       ^ ,          pV^ 8X  d9   VP%                  R\)        V4      VR34       V P                   P+                  4        V'       d   V P!                  W4       R#   \        \        3 d    Rp ELi ; i)a  Check whether a crash is already known.

If the crash is new, it will be added to the duplicate database and the
function returns None. If the crash is already known, the function
returns a pair (crash_id, fixed_version), where fixed_version might be
None if the crash is not fixed in the latest version yet. Depending on
whether the version in report is smaller than/equal to the fixed
version or larger, this calls close_duplicate() or mark_regression().

If the report does not have a valid crash signature, this function does
nothing and just returns None.

By default, the report gets download()ed, but for performance reasons
it can be explicitly passed to this function if it is already
available.
-init_duplicate_db() needs to be called beforeDuplicateSignaturePackageNz0SELECT count(*) FROM crashes WHERE crash_id == ?z7INSERT INTO crashes VALUES (?, ?, ?, CURRENT_TIMESTAMP))r"   download_mark_dup_checkedcrash_signature_duplicate_search_signature_duplicate_db_sync_statussplitKeyError
IndexError	packagingcompare_versionsmark_regressioncrash_signature_addresses#_duplicate_search_address_signatureclose_duplicate_duplicate_db_merge_id#_duplicate_db_add_address_signaturerA   rB   rF   r   rC   )r$   crash_idr3   sigexistingex_id_report_package_version	master_id
master_verex_veraddr_sig
addr_matchrK   count_ids   &&&            r   check_duplicateCrashDatabase.check_duplicate   sx   &    Q"QQ ]]8,Fx06)-.C((*C77FH (HE2259 !);;CJ	*%+I%6%<%<%>q%A" 	
%ME---.DMPQQ!	#
 & $$X|A?
 335AA(KJj5$ !+I
 +((YG//
F((JG//	F *I!%J Y%:88M  9=** ##**,CKKJXJW||~a(H1}MWh- !!((*44XHK *% 	*%)"	*s   6J( (J?>J?c                   V P                   P                  R4      '       g   R# R EFk  pVR8X  d#   RV9   d   VR,          pM!VP                  4       pMVP                  4       pV'       g   KG  V P	                  V4      pV'       g    R# \
        P                  P                  V P                   R,          V\        P                  P                  V4      4      p \        P                  P                  V4      ;_uu_ 4       pVP                  4       P                  R4      pRRR4       RX9   d   EK   TP!                  4        FJ  p TP#                  R^4      w  r\%        T	4      p	Y8X  g   K+  T P)                  Y4      pT'       g   RpTu u # 	  EKn  	  R#   + '       g   i     L; i  \         d     EK  i ; i  \&         d     K  i ; i)	a>  Check if the crash db already knows about the crash signature.

Check if the report has a DuplicateSignature, crash_signature(), or
StacktraceAddressSignature, and ask the database whether the problem is
already known. If so, return an URL where the user can check the status
or subscribe (if available), or just return True if the report is known
but there is no public URL. In that case the report will not be
uploaded (i. e. upload() will not be called).

Return None if the report does not have any signature or the crash
database does not support checking for duplicates on the client side.

The default implementation uses a text file format generated by
duplicate_db_publish() at an URL specified by the "dupdb_url" option.
Subclasses are free to override this with a custom implementation, such
as a real database lookup.
	dupdb_urlNrf   rR   r   z<title>404 Not Found1)rf   address)r   r,   rW   r`   duplicate_sig_hashr=   r7   joinurllibparse
quote_plusrequesturlopenreadr   OSError
splitlinesrZ   int
ValueError
get_id_url)r$   r3   kindrf   hurlrt   contentslinere   srL   s   &&          r   knownCrashDatabase.known   s   ( ||,,&Du}'61 !56C 002C668 '',A
 '',,[)41H1H1KC
^^++C00I(~~/66w?H 1)X5 6 !++-"&**T1"5KH"8}H 8!__V>F!!$!M .I 'b - 10   " s<   'F+  F F+F>F(#F++F;:F;>GGc                8   < V ^8  d   QhRS[ RS[R,          RR/# )r   re   versionNr	   r   r
   )r   r   s   "r   r   r   J  s&     # #3 #t # #r   c                    V P                   '       g   Q R4       hV P                   P                  4       pVP                  RW!34      pVP                  ^8X  g   Q hV P                   P	                  4        R# )zMark given crash ID as fixed in the duplicate database.

version specifies the package version the crash was fixed in (None for
'still unfixed').
rQ   zXUPDATE crashes SET fixed_version = ?, last_change = CURRENT_TIMESTAMP WHERE crash_id = ?N)r"   rA   rB   rowcountrC   )r$   re   r   rK   ns   &&&  r   duplicate_db_fixed CrashDatabase.duplicate_db_fixedJ  so        Q"QQ &&(KK! 	
 zzQ  "r   c                $   < V ^8  d   QhRS[ RR/# r   re   r	   Nr   )r   r   s   "r   r   r   \  s     
# 
#C 
#D 
#r   c                    V P                   '       g   Q R4       hV P                   P                  4       pVP                  RV.4       VP                  RV.4       V P                   P                  4        R# )zkRemove crash from the duplicate database.

This happens when a report got rejected or manually duplicated.
rQ   &DELETE FROM crashes WHERE crash_id = ?z1DELETE FROM address_signatures WHERE crash_id = ?Nr"   rA   rB   rC   )r$   re   rK   s   && r   duplicate_db_remove!CrashDatabase.duplicate_db_remove\  sd    
    Q"QQ &&(<xjIG(T  "r   c                *   < V ^8  d   QhRS[ RS[ RR/# )r   old_idnew_idr	   Nr   )r   r   s   "r   r   r   h  s"     # #C # # #r   c                    V P                   '       g   Q R4       hV P                   P                  4       pVP                  RW!.4       VP                  RW!.4       V P                   P                  4        R# )zChange a crash ID.rQ   zSUPDATE crashes SET crash_id = ?, last_change = CURRENT_TIMESTAMP WHERE crash_id = ?=UPDATE address_signatures SET crash_id = ? WHERE crash_id = ?Nr   )r$   r   r   rK   s   &&& r   duplicate_db_change_master_id+CrashDatabase.duplicate_db_change_master_idh  sr       Q"QQ &&(! 		
 	K	
 	  "r   c                P   < V ^8  d   QhRS[ RS[S[S[ S[3,          ,          RR/# )r   basedirsig_crash_tuplesr	   N)r
   r   tupler   )r   r   s   "r   r   r   y  s2      .6uS#X.G	r   c                   \         P                  ! V4       R pR pV F  w  rVV P                  V4      pVf   K  Ws8w  dF   TpV'       d   VP                  4        \	        \         P
                  P                  W4      RRR7      pVf   Q hVP                  V RV R24       K  	  V'       d   VP                  4        R # R # )Nwutf-8encoding 
)r=   mkdirrw   closeopenr7   rx   write)r$   r   r   cur_hashcur_filerf   re   r   s   &&&     r   _write_hash_filesCrashDatabase._write_hash_filesy  s     	-MC'',Ay}NN$W ?wW'''NNhZqR01 . NN r   c                $   < V ^8  d   QhRS[ RR/# )r   publish_dirr	   Nr(   )r   r   s   "r   r   r     s     %0 %0 %0 %0r   c                   V P                   '       g   Q R4       hV R2p\        P                  ! V4       V P                   P                  4       pVP	                  R4       V P                  \        P                  P                  VR4      VP                  4       4       VP	                  R4       V P                  \        P                  P                  VR4      VP                  4       4       \        P                  P                  V4      '       d   \        P                  ! W R24       \        P                  ! W!4       \        P                  P                  V R24      '       d   \        P                  ! V R24       R# R# )	ao  Create text files suitable for www publishing.

Create a number of text files in the given directory which Apport
clients can use to determine whether a problem is already reported to
the database, through the known() method. This directory is suitable
for publishing to the web.

The database is indexed by the first two fields of the duplicate or
crash signature, to avoid having to download the entire database every
time.

If the directory already exists, it will be updated. The new content is
built in a new directory which is the given one with ".new" appended,
then moved to the given name in an almost atomic way.
rQ   z.newz3SELECT * from address_signatures ORDER BY signaturerv   z:SELECT signature, crash_id from crashes ORDER BY signaturerf   z.oldN)r"   r=   r   rA   rB   r   r7   rx   rD   r>   renameshutilrmtree)r$   r   outrK   s   &&  r   duplicate_db_publish"CrashDatabase.duplicate_db_publish  s        Q"QQ  T"
 &&(IJrww||C;S\\^L 	PQrww||C7H 77>>+&&IIk]$#78
		##77>>[M.//MM[M./ 0r   c                $   < V ^8  d   QhRS[ RR/# )r   
cur_formatr	   Nr   )r   r   s   "r   r   r     s     1 1 1 1r   c                    V^8  d   \        R4      hV P                  f   Q hV P                  P                  4       pVP                  RV34       V P                  P	                  4        WP
                  8X  g   Q hR# )z#Upgrade database to current format.z2Cannot upgrade database from format earlier than 3NzUPDATE version SET format = ?)rE   r"   rA   rB   rC   r#   )r$   r   rK   s   && r   rI   #CrashDatabase._duplicate_db_upgrade  sr     >RSS  ,,,&&(3j]C  "00000r   c          	      b   < V ^8  d   QhRS[ S[,          RS[RS[S[S[S[ 3,          ,          /# )r   rf   re   r	   )r
   r   r   listr   )r   r   s   "r   r   r     s6     % %;%*-%	eCHo	%r   c                   V P                   f   Q hV P                   P                  4       pVP                  R\        V4      V.4       VP	                  4       pR pVP                  \        P                  ! V4      R7       V# )a  Look up signature in the duplicate db.

Return [(crash_id, fixed_version)] tuple list.

There might be several matches if a crash has been reintroduced in a
later version. The results are sorted so that the highest fixed version
comes first, and "unfixed" being the last result.

id is the bug we are looking to find a duplicate for. The result will
never contain id, to avoid marking a bug as a duplicate of itself if a
bug is reprocessed more than once.
zQSELECT crash_id, fixed_version FROM crashes WHERE signature = ? AND crash_id <> ?c                     V ^,          p V^,          pW8X  d   ^ # V '       g   Ve   ^# V'       g   R# \         P                  ! W4      # )   rT   )r]   r^   )xys   &&r   cmp6CrashDatabase._duplicate_search_signature.<locals>.cmp  s?    !A!Av	--a33r   )key)r"   rA   rB   r   rD   sort	functools
cmp_to_key)r$   rf   re   rK   rg   r   s   &&&   r   rX   )CrashDatabase._duplicate_search_signature  sy       ,,,&&(4Wh	

 <<>		4 	)..s34r   c                D   < V ^8  d   QhRS[ S[,          RS[R,          /# r   rf   r	   N)r
   r   r   )r   r   s   "r   r   r     s#      sU{ sTz r   c                   V'       g   R# V P                   f   Q hV P                   P                  4       pVP                  RV.4       VP                  4       p\	        V4      ^8:  g   Q hV'       d   V^ ,          ^ ,          # R# )zMReturn ID for crash address signature.

Return None if signature is unknown.
Nz<SELECT crash_id FROM address_signatures WHERE signature == ?)r"   rA   rB   rD   len)r$   rf   rK   existing_idss   &&  r   ra   1CrashDatabase._duplicate_search_address_signature  sx    
   ,,,&&(JSE	
 ||~< A%%%?1%%r   c          	      n   < V ^8  d   QhRS[ R,          RS[S[S[S[S[R,          3,          3,          /# )r   with_timestampsFr	   Nr   r   r   r   r
   )r   r   s   "r   r   r     s8     0 0&u~0	c5cDj))	*0r   c                    R # N r$   r   s   &&r   duplicate_db_dumpCrashDatabase.duplicate_db_dump  s     -0r   c          	      r   < V ^8  d   QhRS[ R,          RS[S[S[S[S[R,          S[3,          3,          /# )r   r   Tr	   Nr   )r   r   s   "r   r   r   	  s;     5 5&t}5	c5cDj#-..	/5r   c                    R # r   r   r   s   &&r   r   r     s     25r   c                <   < V ^8  d   QhRS[ RS[S[S[3,          /# )r   r   r	   )boolr   r   r   )r   r   s   "r   r   r     s$       $sEzBR r   c                    V P                   '       g   Q R4       h/ pV P                   P                  4       pVP                  R4       V F  w  rErgV'       d	   WVV3W$&   K  WV3W$&   K  	  V# )a)  Return the entire duplicate database as a dictionary.

The returned dictionary maps "signature" to (crash_id, fixed_version)
pairs.

If with_timestamps is True, then the map will contain triples
(crash_id, fixed_version, last_change) instead.

This is mainly useful for debugging and test suites.
rQ   zSELECT * FROM crashes)r"   rA   rB   )r$   r   dumprK   rf   re   verlast_changes   &&      r   r   r     sp        Q"QQ !#&&(+,/2+C3%K8	%O		 03
 r   c                $   < V ^8  d   QhRS[ RR/# r   r   )r   r   s   "r   r   r   $  s     ) )# )$ )r   c                &   V P                   '       g   Q R4       hV P                   P                  4       pVP                  RV.4       VP                  4       pV'       g   R# V^ ,          pV P	                  V4      pVR8X  d#   \        RV R24       V P                  V4       R# V'       g.   V'       d&   \        RV RV R24       V P                  W4       R# V'       d1   V'       g'   \        RV R	V R
24       V P                  VR4       R# R# R# )zUpdate the duplicate db to the reality of the report in the
crash db.

This uses get_fixed_version() to get the status of the given crash.
An invalid ID gets removed from the duplicate db, and a crash which got
fixed is marked as such in the database.
rQ   z4SELECT fixed_version FROM crashes WHERE crash_id = ?NinvalidzDEBUG: bug z( was invalidated, removing from databasez got fixed in version z, updating databasez& got reopened, dropping fixed version z from database)r"   rA   rB   rF   get_fixed_versionrH   r   r   )r$   re   rK   db_fixed_versionreal_fixed_versions   &&   r   rY   'CrashDatabase._duplicate_db_sync_status$  s!       Q"QQ &&(JXJW<<>+A.!33H= *Kz)QRS$$X.  $6hZ (122EG ##HA $6hZ (++;*<NL ##Hd3 %7r   c                *   < V ^8  d   QhRS[ RS[RR/# )r   rf   re   r	   N)r
   r   )r   r   s   "r   r   r   O  s"     ' 's 'c 'd 'r   c                2   V P                  V4      pV'       d   W28w  d   \        R V RV RV 24      hR# V P                  f   Q hV P                  P                  4       pVP	                  R\        V4      V34       V P                  P                  4        R# )zID z has signature z1, but database already has that signature for ID Nz,INSERT INTO address_signatures VALUES (?, ?))ra   rE   r"   rA   rB   r   rC   )r$   rf   re   rg   rK   s   &&&  r   rd   1CrashDatabase._duplicate_db_add_address_signatureO  s    ;;C@#!(?3% 8::BE  $ $$000##**,CKK>C(@S $$&r   c                *   < V ^8  d   QhRS[ RS[ RR/# )r   dupmasterr	   Nr   )r   r   s   "r   r   r   `  s"     # ## #s #t #r   c                    V P                   '       g   Q R4       hV P                   P                  4       pVP                  RV.4       VP                  RW!.4       V P                   P                  4        R# )zwMerge two crash IDs.

This is necessary when having to mark a bug as a duplicate if it
already is in the duplicate DB.
rQ   r   r   Nr   )r$   r   r   rK   s   &&& r   rc   $CrashDatabase._duplicate_db_merge_id`  si        Q"QQ &&(<seDKM	
 	  "r   c                4   < V ^8  d   QhRS[ RS[ R,          /# r   r(   )r   r   s   "r   r   r   q  s       d
 r   c                ,   RV 9   d   R# V P                  R^4      ^ ,          pRP                  VP                  R^4      R,          4      pVP                  RR4      p\        P                  P                  VP                  R4      4      pVR	,          pV# )
z6Create a www/URL proof hash for a duplicate signature.r   Nr   ri   ::Nr   N/r   :N   N)rZ   rx   replacery   rz   r{   encode)rf   is   & r   rw    CrashDatabase.duplicate_sig_hashp  s     3; IIc1a  HHQWWS!_R()IIc3LL##AHHW$56dGr   c                    \        R4      h)aD  Upload given problem report return a handle for it.

This should happen noninteractively.

If the implementation supports it, and a function progress_callback is
passed, that is called repeatedly with two arguments: the number of
bytes already sent, and the total number of bytes to send. This can be
used to provide a proper upload progress indication on frontends.

Implementations ought to "assert self.accepts(report)". The UI logic
already prevents uploading a report to a database which does not accept
it, but for third-party users of the API this should still be checked.
6this method must be implemented by a concrete subclassNotImplementedError)r$   r3   progress_callbackuser_message_callbacks   &&&&r   uploadCrashDatabase.upload  s     "D
 	
r   c                    \        R4      h)a  Return an URL that should be opened after report has been uploaded
and upload() returned handle.

Should return None if no URL should be opened (anonymous filing without
user comments); in that case this function should do whichever
interactive steps it wants to perform.
r  r  )r$   r3   handles   &&&r   get_comment_urlCrashDatabase.get_comment_url       "D
 	
r   c                    \        R4      h)zReturn URL for a given report ID.

The report is passed in case building the URL needs additional
information from it, such as the SourcePackage name.

Return None if URL is not available or cannot be determined.
r  r  )r$   r3   re   s   &&&r   r   CrashDatabase.get_id_url  r  r   c                    \        R4      h)z>Download the problem report from given ID and return a Report.r  r  r$   re   s   &&r   rU   CrashDatabase.download      !D
 	
r   c                    \        R4      h)a  Update the given report ID with all data from report.

This creates a text comment with the "short" data (see
ProblemReport.write_mime()), and creates attachments for all the
bulk/binary data.

If change_description is True, and the crash db implementation supports
it, the short data will be put into the description instead (like in a
new bug).

comment will be added to the "short" data. If attachment_comment is
given, it will be added to the attachment uploads.

If key_filter is a list or set, then only those keys will be added.
r  r  )r$   re   r3   commentchange_descriptionattachment_comment
key_filters   &&&&&&&r   updateCrashDatabase.update  s    0 "D
 	
r   c                4    V P                  VVV. ROR7       R# )zUpdate the given report ID for retracing results.

This updates Stacktrace, ThreadStacktrace, StacktraceTop,
and StacktraceSource. You can also supply an additional comment.
)r  N)
StacktraceThreadStacktraceStacktraceSourceStacktraceTop)r  )r$   re   r3   r  s   &&&&r   update_tracesCrashDatabase.update_traces  s#     		 	 
	
r   c                &   < V ^8  d   QhRS[ RS[/# r   re   r	   r   )r   r   s   "r   r   r     s     
 
3 
3 
r   c                    \        R4      h)z2Get 'DistroRelease: <release>' from the report ID.r  r  r  s   &&r   get_distro_release CrashDatabase.get_distro_release  r  r   c                0   < V ^8  d   QhRS[ S[,          /# r   r	   setr   )r   r   s   "r   r   r     s     
 
C 
r   c                    \        R4      h)zReturn set of crash IDs which have not been retraced yet.

This should only include crashes which match the current host
architecture.
r  r  r-   s   &r   get_unretracedCrashDatabase.get_unretraced  s     "D
 	
r   c                0   < V ^8  d   QhRS[ S[,          /# r'  r(  )r   r   s   "r   r   r     s     	
 	
3s8 	
r   c                    \        R4      h)zReturn set of crash IDs which need duplicate checking.

This is mainly useful for crashes of scripting languages such as
Python, since they do not need to be retraced. It should not return
bugs that are covered by get_unretraced().
r  r  r-   s   &r   get_dup_uncheckedCrashDatabase.get_dup_unchecked  s     "D
 	
r   c                0   < V ^8  d   QhRS[ S[,          /# r'  r(  )r   r   s   "r   r   r     s     
 
SX 
r   c                    \        R4      h)a0  Return an ID set of all crashes which are not yet fixed.

The list must not contain bugs which were rejected or duplicate.

This function should make sure that the returned list is correct. If
there are any errors with connecting to the crash database, it should
raise an exception (preferably OSError).
r  r  r-   s   &r   get_unfixedCrashDatabase.get_unfixed  s     "D
 	
r   c                4   < V ^8  d   QhRS[ RS[R,          /# r   r   )r   r   s   "r   r   r     s     
 
# 
#* 
r   c                    \        R4      h)a  Return the package version that fixes a given crash.

Return None if the crash is not yet fixed, or an empty string if the
crash is fixed, but it cannot be determined by which version. Return
'invalid' if the crash report got invalidated, such as closed a
duplicate or rejected.

This function should make sure that the returned result is correct. If
there are any errors with connecting to the crash database, it should
raise an exception (preferably OSError).
r  r  r  s   &&r   r   CrashDatabase.get_fixed_version  s     "D
 	
r   c                6   < V ^8  d   QhRS[ RS[S[,          /# r"  )r   r   r
   )r   r   s   "r   r   r     s     
 
c 
d3i 
r   c                    \        R4      h)z5Return list of affected source packages for given ID.r  r  r  s   &&r   get_affected_packages#CrashDatabase.get_affected_packages  r  r   c                &   < V ^8  d   QhRS[ RS[/# r"  r   r   )r   r   s   "r   r   r   $  s     
 
C 
D 
r   c                    \        R4      h)z3Check whether the user is the reporter of given ID.r  r  r  s   &&r   is_reporterCrashDatabase.is_reporter$  r  r   c                &   < V ^8  d   QhRS[ RS[/# r"  r=  )r   r   s   "r   r   r   *  s     

 

3 

4 

r   c                    \        R4      h)a  Check whether the user is eligible to update a report.

A user should add additional information to an existing ID if (s)he is
the reporter or subscribed, the bug is open, not a duplicate, etc. The
exact policy and checks should be done according to  the particular
implementation.
r  r  r  s   &&r   
can_updateCrashDatabase.can_update*  r  r   c                4   < V ^8  d   QhRS[ RS[ R,          /# r   r   )r   r   s   "r   r   r   6  s     
 
S 
S4Z 
r   c                    \        R4      h)zSReturn master ID for a duplicate bug.

If the bug is not a duplicate, return None.
r  r  r  s   &&r   duplicate_ofCrashDatabase.duplicate_of6      
 "D
 	
r   c                    \        R4      h)z\Mark a crash id as duplicate of given master ID.

If master is None, id gets un-duplicated.
r  r  )r$   r3   re   rk   s   &&&&r   rb   CrashDatabase.close_duplicate?  rI  r   c                *   < V ^8  d   QhRS[ RS[ RR/# )r   re   r   r	   Nr   )r   r   s   "r   r   r   H  s"     
 
 
S 
T 
r   c                    \        R4      h)ziMark a crash id as reintroducing an earlier crash which is
already marked as fixed (having ID 'master').
r  r  )r$   re   r   s   &&&r   r_   CrashDatabase.mark_regressionH  s     "D
 	
r   c                $   < V ^8  d   QhRS[ RR/# r   r   )r   r   s   "r   r   r   P  s     
 
c 
d 
r   c                    \        R4      h)zMark crash id as retraced.r  r  r  s   &&r   mark_retracedCrashDatabase.mark_retracedP  r  r   c                8   < V ^8  d   QhRS[ RS[R,          RR/# )r   re   invalid_msgNr	   r   )r   r   s   "r   r   r   V  s)     
 

*-*
	
r   c                    \        R4      h)zMark crash id as 'failed to retrace'.

If invalid_msg is given, the bug should be closed as invalid with given
message, otherwise just marked as a failed retrace.

This can be a no-op if you are not interested in this.
r  r  )r$   re   rT  s   &&&r   mark_retrace_failed!CrashDatabase.mark_retrace_failedV  s     "D
 	
r   c                    \        R4      h)ztMark crash id as checked for being a duplicate.

This is an internal method that should not be called from outside.
r  r  )r$   re   r3   s   &&&r   rV   CrashDatabase._mark_dup_checkedd  rI  r   )r   r"   r#   r   r   )FNN)FNN) )1__name__
__module____qualname____firstlineno____doc__r%   r.   r4   rN   rq   r   r   r   r   r   r   rI   rX   ra   r   overloadr   rY   rd   rc   staticmethodrw   r  r
  r   rU   r  r  r$  r+  r/  r3  r   r:  r?  rC  rG  rb   r_   rQ  rV  rV   __static_attributes____classdictcell__)r   s   @r   r   r   !   s    #/ /$3 3	 <2 <2|pdHT# #$
# 
## #" 2%0 %0N1 1% %N ( __0 0 0 __5 5 .) )V' '"# #   ,
$





8
$
 

 
	
 	

 

 
 
 

 


 


 


 

 

 

 
r   r   c                r    V ^8  d   QhR\         R,          R\         R,          R\         R,          R\        /# )r   r   Nnameconfr	   )r
   r   )r   s   "r   r   r   s  s>     /@ /@Tz/@!$t/@:=*/@/@r   c           
        Vf!   \         P                  P                  RR4      pV'       g   Q h/ p\        VRR7      ;_uu_ 4       p\	        \        VP                  4       VR4      V4       RRR4       V R2p\         P                  P                  V4      '       d   \         P                  ! V4       F  p\         P                  P                  WV4      p\         P                  P                  V4      '       g   KI  VP                  R4      '       g   Kb   \        VRR7      ;_uu_ 4       p\	        \        VP                  4       VR4      VR	,          4       RRR4       K  	  V'       g
   VR,          p\#        WR	,          V,          4      #   + '       g   i     EL,; i  + '       g   i     EK  ; i  \         d3   p\        P                  P!                  R
T RT R24        Rp?EK<  Rp?ii ; i)a  Return a CrashDatabase object for the given crash db name.

This reads the configuration file 'conf'.

If name is None, it defaults to the 'default' value in conf.

If conf is None, it defaults to the environment variable
APPORT_CRASHDB_CONF; if that does not exist, the hardcoded default is
/etc/apport/crashdb.conf. This Python syntax file needs to specify:

- A string variable 'default', giving a default value for 'name' if that is
  None.

- A dictionary 'databases' which maps names to crash db configuration
  dictionaries. These need to have at least the key 'impl' (Python module
  in apport.crashdb_impl which contains a concrete 'CrashDatabase' class
  implementation for that crash db type). Other generally known options are
  'bug_pattern_url', 'dupdb_url', and 'problem_types'.
NAPPORT_CRASHDB_CONFz/etc/apport/crashdb.confr   r   execz.dz.conf	databaseszInvalid file z: r   default)r=   environr,   r   rj  compiler~   r7   isdirlistdirrx   isfileendswith	Exceptionsysstderrr   load_crashdb)	r   rf  rg  settingsf	confd_dircfcfpathrM   s	   &&&      r   get_crashdbr|  s  sl   , |zz~~35OPK4!H	dW	%	%WQVVXtV,h7 
&
 &I	ww}}Y**Y'BWW\\)0Fww~~f%%"++g*>*>Jfw771WQVVXvv>@UV 87	 ( 	"	K#8#>??+ 
&	%	% 877 ! JJJ$$}VHBugR%HIIJsB   &FF8,-F#F8F 	#F5.F85F88G5&G00G5c                l    V ^8  d   QhR\         R,          R\        \         \        3,          R\        /# )r   r   Nspecr	   )r
   r   r   r   )r   s   "r   r   r     s-     , ,C$J ,d38n , ,r   c                v    \        RVR,           2\        4       \        4       R.4      pVP                  W4      # )zReturn a CrashDatabase object for a given DB specification.

spec is a crash db configuration dictionary as described in get_crashdb().
zapport.crashdb_impl.r   r   )
__import__globalslocalsr   )r   r~  ms   && r   rv  rv    s:    
 	
tF|n-wy&(_DU	A ??9++r   rZ  )r`  r   r=   r   rt  r   urllib.errorry   urllib.parseurllib.requestcollections.abcr   r   r   apport.packaging_implr   r]   r   r   r|  rv  r   r   r   <module>r     sI    (  	  
     $  3J
 J
d/@d,r   