Ë
    §!f  ã                   óf   — d Z ddlZddlZddlZddlZ G d„ dej                  j                  «      Zy)z Debian crash database interface.é    Nc                   ó*   — e Zd ZdZd„ Zd„ Zdd„Zd„ Zy)ÚCrashDatabaseziDebian crash database.

    This is a Apport CrashDB implementation for interacting with Debian BTS.
    c                 ó  — t         j                  j                  j                  | ||«       || _        | j                  j                  d«      sd| j                  d<   | j                  j                  d«      sd| j                  d<   yy)z°Initialize crash database connection.

        Debian implementation is pretty basic as most of its bug management
        processes revolve around the email interface
        Úsmtphostzreportbug.debian.orgÚ	recipientzsubmit@bugs.debian.orgN)ÚapportÚcrashdbr   Ú__init__ÚoptionsÚget)ÚselfÚ	auth_filer   s      ú</usr/lib/python3/dist-packages/apport/crashdb_impl/debian.pyr
   zCrashDatabase.__init__   sl   € ô 	�‰×$Ñ$×-Ñ-¨d°I¸wÔGØˆŒà�|‰|×Ñ 
Ô+Ø'=ˆD�L‰L˜Ñ$à�|‰|×Ñ Ô,Ø(@ˆD�L‰L˜Ò%ð -ó    c                 óÐ   — | j                   j                  d«      s	d|vrd|d<   d|v r|j                  «       sd|d<   t        j                  j
                  j                  | |«      S )zqCheck if this report can be uploaded to this database.
        Checks for the proper settings of apport.
        ÚsenderÚUnreportableReasonz<Please configure sender settings in /etc/apport/crashdb.confÚ
Stacktracez>Incomplete backtrace. Please install the debug symbol packages)r   r   Úhas_useful_stacktracer   r	   r   Úaccepts)r   Úreports     r   r   zCrashDatabase.accepts+   sn   € ð �|‰|×Ñ Ô)Ð.BÈ&Ñ.PàNð Ð'Ñ(ð
 ˜6Ñ!¨&×*FÑ*FÔ*HàPð Ð'Ñ(ô �~‰~×+Ñ+×3Ñ3°D¸&ÓAÐAr   Nc                 óÞ  — | j                  |«      sJ ‚	 |d   j                  d«      \  }}t	        j
                  «       5 }|j                  j                  d|› d�j                  d«      «       |j                  j                  d|› d�j                  d«      «       |j                  j                  d	j                  d«      «       	 |d
= |j                  |«       |j                  j                  d«       t        j                  j                  j                  |j                  j                  «       j                  d«      «      }ddd«       |d   d<   | j                   d   |d<   | j                   d   |d<   |j#                  d| j                   d   «       |j#                  dd|d   j%                  «       › �«       t'        j(                  | j                   d   «      }|j+                  | j                   d   | j                   d   |j-                  «       j                  d«      «       |j/                  «        y# t        t        f$ r Y yw xY w# t        $ r Y �Œ“w xY w# 1 sw Y   �ŒxY w)zÏUpload given problem report return a handle for it.

        In Debian, we use BTS, which is heavily email oriented. This method
        crafts the bug into an email report understood by Debian BTS.
        ÚPackageú Fz	Package: ú
zUTF-8z	Version: z


z=============================

ÚCoreDumpr   NÚTitleÚSubjectr   ÚFromr   ÚTozX-Debbugs-CCÚUsertagzapport-ÚProblemTyper   T)r   ÚsplitÚKeyErrorÚ
ValueErrorÚtempfileÚNamedTemporaryFileÚfileÚwriteÚencodeÚseekÚemailÚmimeÚtextÚMIMETextÚreadÚdecoder   Ú
add_headerÚlowerÚsmtplibÚSMTPÚsendmailÚ	as_stringÚquit)	r   r   Úprogress_callbackÚuser_message_callbackÚbuggy_packageÚbuggy_versionÚtempÚmsgÚsmtps	            r   ÚuploadzCrashDatabase.upload<   s  € ð �|‰|˜FÔ#Ð#Ð#ð	Ø-3°IÑ->×-DÑ-DÀSÓ-IÑ*ˆ]˜Mô ×(Ñ(Ó*ð 	M¨dØ�I‰I�O‰O˜i¨ °bÐ9×@Ñ@ÀÓIÔJØ�I‰I�O‰O˜i¨ °fÐ=×DÑDÀWÓMÔNØ�I‰I�O‰OÐ@×HÑHÈÓQÔRðØ˜:Ð&ð
 �L‰L˜Ôà�I‰I�N‰N˜1Ôä—*‘*—/‘/×*Ñ*¨4¯9©9¯>©>Ó+;×+BÑ+BÀ7Ó+KÓLˆC÷+	Mð.   ™ˆˆI‰Ø—l‘l 8Ñ,ˆˆF‰Ø—L‘L Ñ-ˆˆD‰	ð 	�‰�~ t§|¡|°HÑ'=Ô>Ø�‰�y G¨F°=Ñ,A×,GÑ,GÓ,IÐ+JÐ"KÔLä�|‰|˜DŸL™L¨Ñ4Ó5ˆØ�‰Ø�L‰L˜Ñ"Ø�L‰L˜Ñ%Ø�M‰M‹O×"Ñ" 7Ó+ô	
ð
 	�	‰	ŒØøôS œ*Ð%ò 	Ùð	ûô  ò Úðú÷	Mñ 	MúsC   •H= Á BI"ÃIÃA<I"È=IÉIÉ	IÉI"ÉIÉI"É"I,c                  ó   — y)a8  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.
        N© )r   r   Úhandles      r   Úget_comment_urlzCrashDatabase.get_comment_urlt   s   € ð r   )NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r
   r   r@   rD   rB   r   r   r   r      s   „ ñòAòBó"6ópr   r   )	rH   Úemail.mime.textr,   r4   r&   Úapport.crashdbr   r	   r   rB   r   r   ú<module>rK      s.   ðÙ &ó Û Û ã ôi�F—N‘N×0Ñ0õ ir   