HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/apport/crashdb_impl/__pycache__/debian.cpython-310.pyc
o

Z�8d��@sHdZddlZddlZddlmZddlZddlZGdd�dejj�ZdS)z Debian crash database interface.�N)�MIMETextc@s2eZdZdZdd�Zdd�Zddd�Zd	d
�ZdS)�
CrashDatabasezk
    Debian crash database
    This is a Apport CrashDB implementation for interacting with Debian BTS
    cCsLtjj�|||�||_|j�d�sd|jd<|j�d�s$d|jd<dSdS)z�
        Initialize crash database connection.

        Debian implementation is pretty basic as most of its bug management
        processes revolve around the email interface
        �smtphostzreportbug.debian.org�	recipientzsubmit@bugs.debian.orgN)�apport�crashdbr�__init__�options�get)�self�	auth_filer	�r
�</usr/lib/python3/dist-packages/apport/crashdb_impl/debian.pyrs
�zCrashDatabase.__init__cCsD|j�d�sd|vrd|d<d|vr|��sd|d<tjj�||�S)zz
        Check 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_stacktracerrr�accepts)r�reportr
r
rr(s
zCrashDatabase.acceptsNc	Csf|�|�sJ�z|d�d�\}}WnttfyYdSwt��}|j�d|d�d��|j�d|d�d��|j�d	�d��z|d
=Wn	tyTYnw|�|�|j�	d�t
|j���d��}|d|d
<|j
d|d<|j
d|d<|�d|j
d�|�dd|d���t�|j
d�}|�|j
d|j
d|���d��|��dS)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: �
zUTF-8z	Version: z


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

�CoreDumpr�Title�Subjectr�Fromr�TozX-Debbugs-CC�Usertagz	apport-%s�ProblemTyperN)r�split�KeyError�
ValueError�tempfile�NamedTemporaryFile�file�write�encode�seekr�read�decoder	�
add_header�lower�smtplib�SMTP�sendmail�	as_string�quit)rr�progress_callback�buggyPackage�buggyVersion�temp�msg�sr
r
r�upload6s4�
�
$zCrashDatabase.uploadcCsdS)aA
        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.
        Nr
)rr�handler
r
r�get_comment_urlhs	zCrashDatabase.get_comment_url)N)�__name__�
__module__�__qualname__�__doc__rrr7r9r
r
r
rrs
2r)	r=r,r"�email.mime.textrr�apport.crashdbrrr
r
r
r�<module>s