%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/apport/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/apport/__pycache__/crashdb.cpython-312.pyc

�

�!f���	��dZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZ
d�ZGd�d�Z	ddedzd	edzd
edzdefd�Zd
�Zy)z"Abstract crash database interface.�N)�Any)�implc�J�t|t�r|jdd�S|S)z.Convert str to an unicode if it isn't already.�UTF-8�ignore)�
isinstance�bytes�decode)�strings �0/usr/lib/python3/dist-packages/apport/crashdb.py�_ur
s"���&�%� ��}�}�W�h�/�/��M�c��eZdZdZd�Zd�Zd�Zd�Zd)d�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd*d�Zd�Zd�Zd�Zed��Zd+d�Zd�Zd�Zd�Z			d,d�Zd-d�Zd�Zd�Zd�Zd�Z d�Z!d �Z"d!�Z#d"�Z$d#�Z%d$�Z&d%�Z'd&�Z(d)d'�Z)d(�Z*y).�
CrashDatabasezCrash database interface.c�<�||_||_d|_d|_y)azInitialize 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)�	auth_file�options�duplicate_db�format_version)�selfrrs   r�__init__zCrashDatabase.__init__'s"��#������ ���"��rc�8�|jjd�S)z�Return 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�rs r�get_bugpattern_baseurlz$CrashDatabase.get_bugpattern_baseurl6s���|�|��� 1�2�2rc�`�d|jvr |jd�|jdvSy)z�Check 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�acceptszCrashDatabase.accepts>s0���d�l�l�*��:�:�m�,����_�0M�M�M�rc�6�ddl}|jdk(sJd��d|_tjj|�xs)|dk(xs"tjj
|�dk(}|j|d��|_|r�|jj�}|jd	�|jd
|jg�|jd�|jd�|jj�|jj�}|jd
�|j�}|dgk7rtd|����	|jd�|j�}|d|jkDrtd|d����|d|jkr3t#d|d�d|j���|j%|d�yy#|jj$r}dt!|�vrdg}Yd}~��d}~wwxYw)z�Initialize duplicate database.

        path specifies an SQLite database. It will be created if it does not
        exist yet.
        rN�qmarkz/this module assumes qmark dbapi parameter style�z:memory:i )�timeoutz.CREATE TABLE version (format INTEGER NOT NULL)zINSERT INTO version VALUES (?)aCREATE 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))z�CREATE TABLE address_signatures (
                signature VARCHAR(1000) NOT NULL,
                crash_id INTEGER NOT NULL,
                CONSTRAINT address_signatures_pk PRIMARY KEY (signature))zPRAGMA integrity_check)�okzCorrupt duplicate db:zSELECT format FROM versionz
no such tablez duplicate DB has unknown format zduplicate db has format z, upgrading to )�sqlite3�
paramstyler�os�path�exists�getsize�connectr�cursor�execute�commit�fetchall�SystemError�fetchone�OperationalError�str�print�_duplicate_db_upgrade)rr+�dbapi2�init�cur�result�errors       r�init_duplicate_dbzCrashDatabase.init_duplicate_dbNs��	!�
����(�	=�<�	=�(� ��������t�$�$�X��
�(:�X�b�g�g�o�o�d�>S�WX�>X�	
�#�N�N�4��N�>�����#�#�*�*�,�C��K�K�H�I��K�K�8�4�;N�;N�:O�P��K�K�A�
�
�K�K�M�
�
���$�$�&����&�&�(�����,�-�������g�Y��� 5�f�X�>�?�?�	��K�K�4�5��\�\�^�F�
�!�9�t�*�*�*�� @�����L�M�M��!�9�t�*�*�*��*�6�!�9�+�6!�!%�!4�!4� 5�7�
�
�&�&�v�a�y�1�+��
� � �1�1�	��#�e�*�,������	�s�!G%�%H�>H�HNc��|jsJd��|s|j|�}|j||�d|vr|d}n|j�}g}|rA|j	||�}|r-|D]\}}|j|��|j	||�}	|dj
�d}d}d}	|D](\}}
|
r|rtj||
�dks�$|}|
}	n|r|j||dd�|j�}|rq|j|�}|r^||k7rY|�|}nT||kr&|j|||�|j||�n)|j|||�|j||�|}d}	|�0||k7r+|r|j!||�|j|||�||	fS|r}|jj#�}
|
j%d|g�|
j'�d}|dk(r8|
j%d	t)|�|df�|jj+�|r|j!||�y#ttf$rd}Y���wxYw)
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�Package�Nr���z0SELECT 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_signaturer/r0r4r
r1)r�crash_idr!�sig�existing�ex_id�_�report_package_version�	master_id�
master_ver�ex_ver�addr_sig�
addr_matchr;�count_ids               r�check_duplicatezCrashDatabase.check_duplicate�s���&� � �Q�"Q�Q� ���]�]�8�,�F����x��0��6�)��-�.�C��(�(�*�C�����7�7��X�F�H�� (�:�H�E�1��2�2�5�9�:��;�;�C��J��	*�%+�I�%6�%<�%<�%>�q�%A�"��	��
�%�	@�M�E�6��-��-�-�.D�f�M�PQ�Q�!�	�#�
��	@���$�$�X�x��|�A��?�
�3�3�5����A�A�(�K�J��j�I�5��$�!+�I�
��+��(�(���Y�G��/�/�
�I�F��(�(���J�G��/�/�	�:�F� *�I�!%�J�� �Y�(�%:���8�8��9�M�� � ���9�=��z�*�*���#�#�*�*�,�C��K�K�J�X�J�W��|�|�~�a�(�H��1�}����M���W�h��-���!�!�(�(�*���4�4�X�x�H���K�*�%�	*�%)�"�	*�s�I�I�Ic�H�|jjd�sydD�];}|dk(rd|vr|d}n!|j�}n|j�}|s�7|j	|�}|syt
jj|jd|tjj|��}	tjj|�5}|j�jd�}ddd�dvr��	|j%�D]D}	|j'dd�\}	}
t)|	�}	|
|k(s�*|j-||	�}|sd	}|ccS��>y#1swY�jxYw#ttj j"f$rY��rwxYw#t*$rY��wxYw)
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_urlN)rV�addressrVrArz<title>404 Not FoundrC�1)rrrGrP�duplicate_sig_hashr*r+�join�urllib�parse�
quote_plus�request�urlopen�readr
�OSErrorr=�URLError�
splitlinesrJ�int�
ValueError�
get_id_url)rr!�kindrV�h�urlrc�contents�linerU�sr<s            r�knownzCrashDatabase.knowns���(�|�|����,��&�/	"�D��u�}�'�6�1� �!5�6�C� �0�0�2�C��6�6�8�����'�'��,�A���
�'�'�,�,����[�)�4����1H�1H��1K��C�

��^�^�+�+�C�0�@�I�(�~�~�/�6�6�w�?�H�@�)�X�5��6�!�+�+�-�
"���"&�*�*�T�1�"5�K�H�a�"�8�}�H���8�!�_�_�V�X�>�F�!�!$��!�M�
"�I/	"�b�-@�@���V�\�\�2�2�3�
��
��"����s<�7E+� E�6E+� F�E(	�$E+�+#F�F�	F!� F!c���|jsJd��|jj�}|jd||f�}|jdk(sJ�|jj	�y)z�Mark given crash ID as fixed in the duplicate database.

        version specifies the package version the crash was fixed in (None for
        'still unfixed').
        r@zXUPDATE crashes SET fixed_version = ?, last_change = CURRENT_TIMESTAMP WHERE crash_id = ?rCN)rr/r0�rowcountr1)rrU�versionr;�ns     r�duplicate_db_fixedz CrashDatabase.duplicate_db_fixedKsn��� � �Q�"Q�Q� ����&�&�(���K�K�
!��h��	
���z�z�Q������� � �"rc���|jsJd��|jj�}|jd|g�|jd|g�|jj�y)z{Remove crash from the duplicate database.

        This happens when a report got rejected or manually duplicated.
        r@�&DELETE FROM crashes WHERE crash_id = ?z1DELETE FROM address_signatures WHERE crash_id = ?N�rr/r0r1)rrUr;s   r�duplicate_db_removez!CrashDatabase.duplicate_db_remove]sa��
� � �Q�"Q�Q� ����&�&�(�����<�x�j�I����G�(��T���� � �"rc���|jsJd��|jj�}|jd||g�|jd||g�|jj�y)zChange a crash ID.r@zSUPDATE crashes SET crash_id = ?, last_change = CURRENT_TIMESTAMP WHERE crash_id = ?�=UPDATE address_signatures SET crash_id = ? WHERE crash_id = ?Nr�)r�old_id�new_idr;s    r�duplicate_db_change_master_idz+CrashDatabase.duplicate_db_change_master_idiss��� � �Q�"Q�Q� ����&�&�(�����
!��V��		
�	���K�
�V��	
�	
��� � �"rc�N�|jsJd��|�d�}tj|�tjj	|d�}tj|�d}d}|jj�}|j
d�|j�D]u\}}|j|�}	|	��|	|k7r@|	}|r|j�ttjj	||�dd��}|j|�d	|�d
���w|r|j�tjj	|d�}
tj|
�d}d}|j
d�|j�D]�\}}|j|�}	|	��|	|k7r>|	}|r|j�ttjj	|
|�d
�}|j|�d	|�d
�jd����|r|j�tjj|�rtj||�d��tj||�tjj|�d��rtj |�d��yy)a�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.
        r@z.newrdNz3SELECT * from address_signatures ORDER BY signature�w�utf-8��encoding� �
rVz:SELECT signature, crash_id from crashes ORDER BY signature�wbrz.old)rr*�mkdirr+rgr/r0r2rf�close�open�write�encoder,�rename�shutil�rmtree)r�publish_dir�out�	addr_base�cur_hash�cur_filer;rVrUru�sig_bases           r�duplicate_db_publishz"CrashDatabase.duplicate_db_publishzsJ��"� � �Q�"Q�Q� ��
�T�"��
����
��G�G�L�L��i�0�	�
������������&�&�(�����I�J� �\�\�^�
	2�M�C���'�'��,�A��y���H�}�����N�N�$���G�G�L�L��H�5�s�W���
�N�N�h�Z�q���R�0�1�
	2���N�N���7�7�<�<��U�+��
������������P�Q� �\�\�^�	B�M�C���'�'��,�A��y���H�}�����N�N�$�������X�x� @�$�G���N�N�h�Z�q���R�0�7�7��@�A�	B���N�N���7�7�>�>�+�&��I�I�k�k�]�$�#7�8�
�	�	�#�{�#�
�7�7�>�>�[�M��.�/��M�M�[�M��.�/�0rc���|dkrtd��|jj�}|jd|f�|jj	�||j
k(sJ�y)z#Upgrade database to current format.r%z2Cannot upgrade database from format earlier than 3zUPDATE version SET format = ?N)r3rr/r0r1r)r�
cur_formatr;s   rr8z#CrashDatabase._duplicate_db_upgrade�sb����>��R�S�S����&�&�(�����3�j�]�C���� � �"��T�0�0�0�0�0rc���|jj�}|jdt|�|g�|j	�}d�}|jt
j|���|S)aLook 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�^�|d}|d}||k(ry|s|�y|sytj||�S)NrCrrD)rMrN)�x�ys  r�cmpz6CrashDatabase._duplicate_search_signature.<locals>.cmp�sA���!��A��!��A��A�v���������-�-�a��3�3r)�key)rr/r0r
r2�sort�	functools�
cmp_to_key)rrVrUr;rWr�s      rrHz)CrashDatabase._duplicate_search_signature�sg�����&�&�(�����
4�
��W�h��	
�
�<�<�>��		4�	�
�
�)�.�.�s�3�
�4��rc��|sy|jj�}|jd|g�|j�}t	|�dksJ�|r|ddSy)z]Return ID for crash address signature.

        Return None if signature is unknown.
        Nz<SELECT crash_id FROM address_signatures WHERE signature == ?rCr)rr/r0r2�len)rrVr;�existing_idss    rrQz1CrashDatabase._duplicate_search_address_signature�sf��
�����&�&�(�����J�S�E�	
��|�|�~���<� �A�%�%�%����?�1�%�%�rc���|jsJd��i}|jj�}|jd�|D]\}}}}|r	|||f||<�||f||<�|S)aYReturn 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.
        r@zSELECT * FROM crashes)rr/r0)r�with_timestamps�dumpr;rVrU�ver�last_changes        r�duplicate_db_dumpzCrashDatabase.duplicate_db_dumps~��� � �Q�"Q�Q� ������&�&�(�����+�,�/2�	,�+�C��3���%�s�K�8��S�	�%�s�O��S�	�		,�
�rc���|jsJd��|jj�}|jd|g�|j�}|sy|d}|j	|�}|dk(r!td|�d��|j
|�y|s'|r%td|�d|�d	��|j||�y|r(|s%td|�d
|�d��|j||�yyy)a$Update 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.
        r@z4SELECT fixed_version FROM crashes WHERE crash_id = ?Nr�invalidzDEBUG: bug z( was invalidated, removing from databasez got fixed in version z, updating databasez& got reopened, dropping fixed version z from database)rr/r0r4�get_fixed_versionr7r�r)rrUr;�db_fixed_version�real_fixed_versions     rrIz'CrashDatabase._duplicate_db_sync_status's"��� � �Q�"Q�Q� ����&�&�(�����J�X�J�W��<�<�>����+�A�.��!�3�3�H�=����*��K��z�)Q�R�S��$�$�X�.�� �$6���h�Z�(�1�2�2E�G�
�
�#�#�H�.@�A���$6���h�Z�(+�+;�*<�N�L�
�
�#�#�H�.@�A��
%7�rc��|j|�}|r||k7rtd|�d|�d|����y|jj�}|j	dt|�|f�|jj
�y)NzID z has signature z1, but database already has that signature for ID z,INSERT INTO address_signatures VALUES (?, ?))rQr3rr/r0r
r1)rrVrUrWr;s     rrTz1CrashDatabase._duplicate_db_add_address_signatureRs����;�;�C�@����8�#�!��(��?�3�%�8:�:B��E���$��#�#�*�*�,�C��K�K�>��C��(�@S�
�
���$�$�&rc���|jsJd��|jj�}|jd|g�|jd||g�|jj�y)z�Merge two crash IDs.

        This is necessary when having to mark a bug as a duplicate if it
        already is in the duplicate DB.
        r@r�r�Nr�)r�dup�masterr;s    rrSz$CrashDatabase._duplicate_db_merge_idbsh��� � �Q�"Q�Q� ����&�&�(�����<�s�e�D����K�
�S�M�	
�	
��� � �"rc��d|vry|jdd�d}dj|jdd�dd�}|jd	d�}tjj|j
d
��}|dd}|S)z6Create a www/URL proof hash for a duplicate signature.r�Nr�rCrrY�:��/r��)rJrg�replacerhrirjr�)rV�is  rrfz CrashDatabase.duplicate_sig_hashrs����3�;��
�I�I�c�1��a� ��
�H�H�Q�W�W�S�!�_�R�a�(�)��
�I�I�c�3����L�L�#�#�A�H�H�W�$5�6��
�d�s�G���rc��td��)a�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)rr!�progress_callback�user_message_callbacks    r�uploadzCrashDatabase.upload�s��"�D�
�	
rc��td��)a8Return 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�)rr!�handles   r�get_comment_urlzCrashDatabase.get_comment_url����"�D�
�	
rc��td��)z�Return 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�)rr!rUs   rrszCrashDatabase.get_id_url�r�rc��td��)z>Download the problem report from given ID and return a Report.r�r��rrUs  rrEzCrashDatabase.download����!�D�
�	
rc��td��)ahUpdate 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�)rrUr!�comment�change_description�attachment_comment�
key_filters       r�updatezCrashDatabase.update�s��0"�D�
�	
rc�2�|j|||gd���y)z�Update the given report ID for retracing results.

        This updates Stacktrace, ThreadStacktrace, StacktraceTop,
        and StacktraceSource. You can also supply an additional comment.
        )�
Stacktrace�ThreadStacktrace�StacktraceSource�
StacktraceTop)r�N)r�)rrUr!r�s    r�
update_traceszCrashDatabase.update_traces�s#��	
�������		�
	
rc��td��)z2Get 'DistroRelease: <release>' from the report ID.r�r�r�s  r�get_distro_releasez CrashDatabase.get_distro_release�r�rc��td��)z�Return set of crash IDs which have not been retraced yet.

        This should only include crashes which match the current host
        architecture.
        r�r�rs r�get_unretracedzCrashDatabase.get_unretraced�s��"�D�
�	
rc��td��)aReturn 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�rs r�get_dup_uncheckedzCrashDatabase.get_dup_unchecked�s��"�D�
�	
rc��td��)aXReturn 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�rs r�get_unfixedzCrashDatabase.get_unfixeds��"�D�
�	
rc��td��)aReturn 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�zCrashDatabase.get_fixed_versions��"�D�
�	
rc��td��)z5Return list of affected source packages for given ID.r�r�r�s  r�get_affected_packagesz#CrashDatabase.get_affected_packagesr�rc��td��)z3Check whether the user is the reporter of given ID.r�r�r�s  r�is_reporterzCrashDatabase.is_reporter%r�rc��td��)aBCheck 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_updatezCrashDatabase.can_update+r�rc��td��)zcReturn master ID for a duplicate bug.

        If the bug is not a duplicate, return None.
        r�r�r�s  r�duplicate_ofzCrashDatabase.duplicate_of7���
"�D�
�	
rc��td��)zlMark a crash id as duplicate of given master ID.

        If master is None, id gets un-duplicated.
        r�r�)rr!rUr[s    rrRzCrashDatabase.close_duplicate@r�rc��td��)zyMark a crash id as reintroducing an earlier crash which is
        already marked as fixed (having ID 'master').
        r�r�)rrUr�s   rrOzCrashDatabase.mark_regressionIs��"�D�
�	
rc��td��)zMark crash id as retraced.r�r�r�s  r�
mark_retracedzCrashDatabase.mark_retracedQr�rc��td��)z�Mark 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�)rrU�invalid_msgs   r�mark_retrace_failedz!CrashDatabase.mark_retrace_failedWr�rc��td��)z�Mark crash id as checked for being a duplicate.

        This is an internal method that should not be called from outside.
        r�r�)rrUr!s   rrFzCrashDatabase._mark_dup_checkedcr�r)N)F�NN)FNN)�)+�__name__�
__module__�__qualname__�__doc__rrr"r>rarzrr�r�r�r8rHrQr�rIrTrS�staticmethodrfr�r�rsrEr�r�r�r�r�r�r�r�r�r�r�rRrOr�r�rF�rrrr"s���#�
#�3�	� ?2�Bp�dH�T#�$
#�#�"O0�b1�"�H�&�.)�V'� #� ����,
�$

�

�
�!���
�8
�$
�
�	
�
�
� 
�
�

�
�
�
�
�

�
rrr�name�conf�returnc	�@�|� tjjdd�}|sJ�i}t|d��5}t	t|j
�|d�|�ddd�|�d�}tjj|�r�tj|�D]�}tjj||�}tjj|�s�C|jd�s�U	t|d��5}t	t|j
�|d�|d	�ddd���|s|d
}t#||d	|�S#1swY��xYw#1swY�0xYw#t$r0}tjj!d
|�d|�d��Yd}~��d}~wwxYw)aNReturn 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*�environrr�r�compilermr+�isdir�listdirrg�isfile�endswith�	Exception�sys�stderrr��load_crashdb)	rrr�settings�f�confdDir�cf�cfpathr=s	         r�get_crashdbrrsr��,�|��z�z�~�~�3�5O�P���K�4�!�H�	
�d�W�	%�8���W�Q�V�V�X�t�V�
,�h�7�8�
��r�{�H�	�w�w�}�}�X���*�*�X�&�		J�B��W�W�\�\�(�B�/�F��w�w�~�~�f�%�"�+�+�g�*>�J��f�w�7�W�1��W�Q�V�V�X�v�v�>���@U�V�W��			J���	�"���	�8�K�#8��#>�?�?�+8�8��W�W��!�J��J�J�$�$�}�V�H�B�u�g�R�%H�I�I��J�s;�&E�3
E$�)E�)E$�E�E!	�E$�$	F�-&F�Fc�p�td|d��t�t�dg�}|j||�S)z�Return a CrashDatabase object for a given DB specification.

    spec is a crash db configuration dictionary as described in get_crashdb().
    zapport.crashdb_impl.rr)�
__import__�globals�localsr)r�spec�ms   rrr�s<��
	�
�t�F�|�n�-�w�y�&�(�_�DU�	�A�
�?�?�9�d�+�+rr�)r�r�r*r�r�urllib.errorrh�urllib.parse�urllib.request�typingr�apport.packaging_implrrMr
rr6rrrrr�<module>r$sz��(��	�
�
�����3��H

�H

�bHL�/@��T�z�/@�!$�t��/@�:=��*�/@��/@�d,r

Zerion Mini Shell 1.0