%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�!f<�����dZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZ	ddlmZddlmZmZddlmZddlmZddlZddlZddlZddlm Z!dZ"ejFjId	�Z%d
�Z&d�Z'Gd�d
ejPjR�Z)da*Gd�dejVjX�Z-Gd�dej\j^�Z0dd�Z1y#e$rdZY��wxYw)z,Crash database implementation for Launchpad.�N)�FailedToDecompressContent)�	HTTPError�RestfulError)�	Launchpad)�lookup_web_root)�impl�
productionz%~/.cache/apport/launchpad.credentialsc#�K�|D]P}	|jj�}|j}|jd�s|jd�s�M|���Ry#ttf$r"tj
j
d�Y��wxYw�w)Nz"Broken attachment on bug, ignoring�.txt�.gz)	�data�openrr�apport�logging�error�filename�endswith)�attachments�
attachment�f�names    �?/usr/lib/python3/dist-packages/apport/crashdb_impl/launchpad.py�filter_filenamer1s����!��
�	����$�$�&�A��z�z���=�=�� �D�M�M�%�$8��G����4�5�	��N�N� � �!E�F��	�s-�B
�A�.B
�B
�.B
�B
�	B
�
B
c�&�td�|D��S)Nc3�K�|]6}t|jjd�j�����8y�w)�/N)�int�	self_link�split�pop)�.0�is  r�	<genexpr>zid_set.<locals>.<genexpr>?s-����@�Q�s�1�;�;�$�$�S�)�-�-�/�0�@�s�<>)�set)�taskss r�id_setr&=s���@�%�@�@�@�c�,�eZdZdZd�Zed��Zd�Zed��Zd$d�Z	de
fd	�Zd
�Zde
jjdede
fd
�Zd�Z			d%d�Zd&d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d'd�Z"d�Z#d �Z$d!�Z%d"�Z&e'd#��Z(y)(�
CrashDatabasez5Launchpad implementation of crash database interface.c�h�tjd�rtjd�|d<|sD|jd�}|r+djt|jdd�df�}nt}tjjj|||�|jd�|_
|jrd|vsJd	��d|vsJd
��d|vrd|d�d
�|_ndtj��d
�|_||_||_|jsJ�d|_d|_tjd|jd��|_|j$sLt'j(d��|_t+j,t.j0|j$d��yy)aOInitialize Launchpad crash database.

        You need to specify a launchpadlib-style credentials file to
        access launchpad. If you supply None, it will use
        default_credentials_path (~/.cache/apport/launchpad.credentials).

        Recognized options are:
        - distro: Name of the distribution in Launchpad
        - project: Name of the project in Launchpad
          (Note that exactly one of "distro" or "project" must be given.)
        - launchpad_instance: If set, this uses the given launchpad instance
          instead of production (optional). This can be overridden or set by
          $APPORT_LAUNCHPAD_INSTANCE environment. For example: "qastaging" or
          "staging".
        - cache_dir: Path to a permanent cache directory; by default it uses a
          temporary one. (optional). This can be overridden or set by
          $APPORT_LAUNCHPAD_CACHE environment.
        - escalation_subscription: This subscribes the given person or team to
          a bug once it gets the 10th duplicate.
        - escalation_tag: This adds the given tag to a bug once it gets more
          than 10 duplicates.
        - initial_subscriber: The Launchpad user which gets subscribed to newly
          filed bugs (default: "apport"). It should be a bot user which the
          crash-digger instance runs as, as this will get to see all bug
          details immediately.
        - triaging_team: The Launchpad user/team which gets subscribed after
          updating a crash report bug by the retracer (default:
          "ubuntu-crashes-universe")
        - architecture: If set, this sets and watches out for needs-*-retrace
          tags of this architecture. This is useful when being used with
          apport-retrace and crash-digger to process crash reports of foreign
          architectures. Defaults to system architecture.
        �APPORT_LAUNCHPAD_INSTANCE�launchpad_instance�.z://�����distro�projectz/Must not set both "project" and "distro" optionz0Need to have either "project" or "distro" option�architecturezneed-�-retraceN�APPORT_LAUNCHPAD_CACHE�	cache_dirzlaunchpadlib.cache.)�prefixT)�
ignore_errors)�os�getenv�get�join�default_credentials_pathrr�crashdbr)�__init__r0�arch_tag�	packaging�get_system_architecture�options�auth�_CrashDatabase__launchpad�_CrashDatabase__lp_distro�_CrashDatabase__lpcache�tempfile�mkdtemp�atexit�register�shutil�rmtree)�selfrCrB�lp_instances    rr>zCrashDatabase.__init__Es���D�9�9�0�1�,.�I�I�6Q�,R�G�(�)��!�+�+�&:�;�K���x�x�-�{�/@�/@���/J�2�/N�O���0�����$�$�-�-�d�D�'�B��k�k�(�+����;�;���(�
A�@�
A�(��W�$�
B�A�
B�$��W�$�#�G�N�$;�#<�H�E�D�M�#�I�$E�$E�$G�#H��Q�D�M������	��y�y��y����������#;�W�[�[��=U�V����~�~�%�-�-�5J�K�D�N��O�O�F�M�M�4�>�>��N�r'c��|jr|jSt�Itjj	dtj
d�d��tjd�|jjd�r|jjd�}nt}tjj|j�}|r4tjj|�stj|�	tj d||j"dg|jd	�
�|_|jS#t$t&t(f$ri}t*j,j/dt1|dt3|��|j�tjd
�Yd}~|jSd}~wwxYw)zReturn Launchpad instance.NzERROR: The launchpadlib Python rzK module is not installed. Please install the python3-launchpadlib package!
r.r,zapport-collect�
WRITE_PRIVATEz1.0)�launchpadlib_dir�allow_access_levels�credentials_file�versionzZconnecting to Launchpad failed: %s
You can reset the credentials by removing the file "%s"�content�c)rDr�sys�stderr�writerT�exitrBr:�DEFAULT_LAUNCHPAD_INSTANCEr8�path�dirnamerC�isdir�makedirs�
login_withrFr�OSError�
ValueErrorrrr�getattr�str)rMr,�auth_dirrs    r�	launchpadzCrashDatabase.launchpad�sd������#�#�#����J�J���1�#�+�+�a�.�1A�BF�G�
�

�H�H�Q�K��<�<���0�1�!%���!1�!1�2F�!G��!;���7�7�?�?�4�9�9�-���B�G�G�M�M�(�3��K�K��!�	�(�3�3� �"�!%���%4�$5�!%����
 �D��"������g�z�2�	��N�N� � �J���y�#�e�*�5��	�	�	
�
�H�H�R�L�L������	�s�5E�G�AF>�>Gc#�K�|jsy|D]j}|jj�|jk(s=tjd|j�d�|jj��s�g|���ly�w)Nz^.+\(z.*\)$)r0�bug_target_name�lower�re�match)rMr%�ts   r�_get_distro_taskszCrashDatabase._get_distro_tasks�sm�����{�{���	�A�� � �&�&�(�D�K�K�7�2�8�8�����
�U�+�Q�->�->�-D�-D�-F�<���		�s�A6B�9Bc�R�|j��|jr4|jj|j|_|jSd|jvr7|jj
|jd|_|jSt
d��|jS)z,Return Launchpad distribution (e.g. ubuntu).r1z:distro or project needs to be specified in crashdb options)rEr0rf�
distributionsrB�projects�SystemError)rMs r�	lp_distrozCrashDatabase.lp_distro�s������#��{�{�#'�>�>�#?�#?����#L�� ������d�l�l�*�#'�>�>�#:�#:�4�<�<�	�;R�#S�� �����	"�P������r'Nc��|j|�sJ�|j|�}t|||j���}|j	�|sJ�|S)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.
        )�hostname)�accepts�_generate_upload_blob�upload_blob�get_hostname�close)rM�report�progress_callback�user_message_callback�	blob_file�tickets      r�uploadzCrashDatabase.upload�sT���|�|�F�#�#�#��.�.�v�6�	��Y�(9�D�DU�DU�DW�X�������
�v��
r'�returnc��|jjdt�}tjjt
|��}|jS)z/Return the hostname for the Launchpad instance.r,)rBr:r[�urllib�parse�urlparser�netloc)rMr,�urls   rrxzCrashDatabase.get_hostname�sC��!�\�\�-�-� �"<�
���l�l�#�#�O�4F�$G�H���z�z�r'c��i}|jd|j��}|r||d<|j�}d|vr|d}n|jjd�}|r+d|�d|�d|�dtj
j
|���Sd	|vr;d|�d|j�d
|d	�d|�dtj
j
|���
Sd|�d|j�d|�dtj
j
|���S)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.
        �Titlezfield.title�
SnapSourcer1�
https://bugs.rz
/+filebug/�?�
SourcePackagez	/+source/)r:�standard_titlerxrBr�r��	urlencoder0)rMrz�handle�args�titlertr1s       r�get_comment_urlzCrashDatabase.get_comment_url�s&�����
�
�7�F�$9�$9�$;�<���"'�D����$�$�&���6�!��\�*�G��l�l�&�&�y�1�G����z��7�)�:�f�X��F�L�L�*�*�4�0�1�3�
�
�f�$���z��4�;�;�-�8��?�+�,�J�v�h��F�L�L�*�*�4�0�1�3�
��H�:�Q�t�{�{�m�:�f�X�����&�&�t�,�-�
/�	
r'rz�crash_idc�.�d|j��d|��S)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�z/bugs/)rx)rMrzr�s   r�
get_id_urlzCrashDatabase.get_id_urls!���t�0�0�2�3�6�(��D�Dr'c�Z�tjj�}|jj|}tjd|jt
j�}|s@tjd|jt
jt
jz�}|sJd��|jd�jd�jdd�jdd	�}d
|vrZd|vrA|jdd�\}}|jd
d	�dz|jd
d�dz}n|jd
d�d}|jtj |��d
|vr	|j"j%�|d
<d|vrqd|j(vrd|d<n]d|j(vrd|d<nId|j(vrd|d<n5d|j(vrd|d<n!t+dt-|j(�����|j/|j(�d|vr|d|d<|j0|d<t3|j4�D]�}t6j8j;|j<�\}	}
	d||	<|
dk(r,|jC�||	<	||	jEd�||	<�f|
dk(r4	tIjJ|��5}|jC�||	<ddd���tQd |j<����|S#t&$r|j"|d
<Y���wxYw#t>t@t*f$rY��wxYw#tF$rY��wxYw#1swY�mxYw#tL$r=}dt-|�vr�|jOd�|jC�||	<Yd}~��Od}~wwxYw)!z>Download the problem report from given ID and return a Report.z(ProblemType:.*)$z^--- \r?$[\r\n]*(.*)z8bug description must contain standard apport format datar.�UTF-8s � s
�
s

sUname:r�Date�ProblemTypez
apport-bug�Bug�apport-crash�Crashzapport-kernelcrash�KernelCrashzapport-package�Packagez(cannot determine ProblemType from tags: r��
OriginalTitle�rr)�fileobjNz
Not a gzipzUnknown attachment type: ))rrz�Reportrf�bugsrj�search�description�S�M�group�encode�replacer�load�io�BytesIO�date_created�ctime�AttributeError�tagsrbrd�add_tagsr�rrr8r\�splitextr�AssertionError�	TypeError�read�decode�UnicodeDecodeError�gzip�GzipFilera�seek�NotImplementedError)
rMr�rz�b�mr��part1�part2r�key�ext�gzrs
             r�downloadzCrashDatabase.downloads~�����%�%�'���N�N����)��
�I�I�*�A�M�M�2�4�4�@����	�	�1�1�=�=�"�$�$����+�N�A��L�L�L�q�
�G�G�A�J�
�V�G�_�
�W�[�$�
'�
�W�W�e�
$�		��k�!��K�'�"-�!2�!2�9�a�!@�����M�M�'�5�1�� ��k�k�'�1�-�a�0�1��*�/�/���;�A�>�����B�J�J�{�+�,����

0�!"���!5�!5�!7��v����&��q�v�v�%�(-��}�%��1�6�6�)�(/��}�%�%����/�(5��}�%�!�Q�V�V�+�(1��}�%� �>�s�1�6�6�{�m�L���	��������f��&,�W�o�F�?�#��'�'��w��)�!�-�-�8�	�J��w�w�'�'�
�(;�(;�<�H�C��
� ��s���f�}�(�o�o�/��s���"(��+�"4�"4�W�"=�F�3�K����	4����z�:�0�b�&(�g�g�i��s��0��*�/�
�0C�0C�/D�E���3	�8�
��i"�
0�!"����v��
0��:#�I�z�:�
��
��*�����0�0���4�$�3�u�:�5���O�O�A�&�",�/�/�"3�F�3�K��
4�sf�9L�L/�$M	�M$�M�,M$�L,�+L,�/M�M�		M�M�M!	�M$�$	N*�-2N%�%N*c
��|jj|}|r&t|j��t|�z
}nd}t	j
�5}	|j
|	|��|	j�|	jd�tj|	�}
|
j�}t|�}|j�sJ�t|�}|j�rJ�|j�dk(sJ�|sy|jdd}
|
j!d�d|vr%|
|j#|d�j%�z
}
|
|_|j'�|jj|}|j)d��j+d	d
�}|rJ|r'|j,�d|��|_|j'�n!|s|j.}|j1||��|D]I}|j3|xsd
|j5�d|j)d��|j5�d���K	ddd�y#1swYyxYw)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.
        N)�	skip_keysrz
text/plainzapport-collected�TagsT)r�r�r�z
--- 
�rU�subjectr�F)�commentr��content_typer
r�is_patch)rfr�r$�keysrG�
TemporaryFile�
write_mime�flushr��email�message_from_binary_file�walk�next�is_multipart�get_content_typer��append�_filter_tag_namesr�lp_save�get_payloadr�r�r��
newMessage�
addAttachment�get_filename)rMr�rzr��change_description�attachment_comment�
key_filter�bugr��mime�msg�msg_iter�part�x�texts               r�updatezCrashDatabase.update~s ��0�n�n�!�!�(�+����F�K�K�M�*�S��_�<�I��I�
�
#�
#�
%�3	�����d�i��8��J�J�L��I�I�a�L��0�0��6�C��x�x�z�H���>�D��$�$�&�&�&���>�D��(�(�*�*�*��(�(�*�l�:�:�:���H�H�Q�K�����+�,��V�#���/�/��v��?�E�E�G�G�A�������
��n�n�)�)�(�3���#�#�4�#�0�7�7���K�D��%�),���(9��$��&H�C�O��K�K�M�"�"%�)�)���N�N�4��N�A�!�
���!�!�.�4�"� $� 1� 1� 3�!%��)�)��)�6�!�.�.�0�"�
"��
�W3	�3	�3	�s
�G I�Ic�z�tjjj||||�|jj
|}d|vr�|jD]v}|jjjd�s�)|jj|d��|_|j�|jj
|}n|j��r|jD]#}|jdk(s�	|j!��%	|j%|j�}t'|�}|j(dk(rd|_|j�|j-�}|r�t/j0d|j�}|ri|j3d�|k7rU|j3d	�|z|j3d
�z|_	|j�|jj
|}|j5||�y#t"$rY��/wxYw#t*$rY��wxYw#t"$rY�VwxYw)z�Update the given report ID for retracing results.

        This updates Stacktrace, ThreadStacktrace, StacktraceTop,
        and StacktraceSource. You can also supply an additional comment.
        r��
#distribution�r�CoreDump.gz�	Undecided�Mediumz,^(.*crashed with SIG.* in )([^( ]+)(\(\).*$)�r.�N)rr=r)�
update_tracesrfr��	bug_tasks�target�resource_type_linkrrr�getSourcePackager��has_useful_stacktracerr��
removeFromBugrrmr��
importance�
StopIteration�stacktrace_top_functionrjrkr��_subscribe_triaging_team)	rMr�rzr�r��task�a�fnr�s	         rr�zCrashDatabase.update_traces�s���	���$�$�2�2�4��6�7�S��n�n�!�!�(�+���f�$��
�
�
���;�;�1�1�:�:�?�K�"&�.�.�"A�"A�#�O�4�#B�#�D�K��L�L�N��.�.�-�-�h�7�C��
��'�'�)��_�_�
���7�7�m�+�����)�
�
��-�-�c�m�m�<���D�z���?�?�k�1�&.�D�O��L�L�N�
�/�/�1�B���H�H�L�c�i�i�X��������r�)� !����
�R��!�'�'�!�*� <�C�I�����
��.�.�-�-�h�7�C��%�%�c�6�2��/%�����!�
��
��%����s7�H�AH�H.�	H�H�	H+�*H+�.	H:�9H:c��|jj|}tjd|j�}|r|jd�St
d��)zNGet 'DistroRelease: <release>' from the given report ID and return
        it.z"DistroRelease: ([-a-zA-Z0-9.+/ ]+)r.z)URL does not contain DistroRelease: field)rfr�rjr�r�r�rb)rMr�r�r�s    r�get_distro_releasez CrashDatabase.get_distro_release	sJ���n�n�!�!�(�+���I�I�:�C�O�O�L����7�7�1�:���D�E�Er'c�R�tjd|j�d��}|jj|}g}|j
D]Y}|j
|jj�}|s�+|jdvr�:|j|jd���[|S)z5Return list of affected source packages for given ID.rz2/(?:(?P<suite>[^/]+)/)?\+source/(?P<source>[^/]+)$>�Invalid�	Won't Fix�Fix Released�source)rj�compiler0rfr�r�r�r�r�statusr�r�)rMr��
bug_target_rer��resultr�rks       r�get_affected_packagesz#CrashDatabase.get_affected_packagess����
�
�����
�T�U�
�
��n�n�!�!�(�+�����M�M�	1�D�!�(�(����)>�)>�?�E����{�{�F�F���M�M�%�+�+�h�/�0�
	1��
r'c��|jj|}|jj|jjjk(S)z3Check whether the user is the reporter of given ID.)rfr��ownerr�me)rMr�r�s   r�is_reporterzCrashDatabase.is_reporter$s9���n�n�!�!�(�+���y�y�~�~����!2�!2�!7�!7�7�7r'c�J�|jj|}|jry|jj|jj
jk(ry|jj
j}|jjD]}|d|k(s�yy)aACheck 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.
        FT�person_link)	rfr��duplicate_ofrrrr�
subscriptions�entries)rMr�r�r�subs     r�
can_updatezCrashDatabase.can_update)s����n�n�!�!�(�+�������9�9�>�>�T�^�^�.�.�3�3�3���^�^�
�
�
(�
(���$�$�,�,�	�C��=�!�R�'��	�r'c��	|jj|jd��}t|�S#t$rH}t
jjdt|��tjd�Yd}~yd}~wwxYw)z}Return an ID set of all crashes which have not been retraced yet and
        which happened on the current host architecture.�
2011-08-01�r��
created_since�"connecting to Launchpad failed: %srVN)rr�searchTasksr?r&rrrrrdrWrZ�rMr�rs   r�get_unretracedzCrashDatabase.get_unretraced@sk��	��>�>�-�-��]�]�,�.��D��$�<����	��N�N� � �!E�s�5�z�R��H�H�R�L�L��	�s�14�	B�>B�Bc��	|jjdd��}t|�S#t$rH}tj
j
dt|��tjd�Yd}~yd}~wwxYw)a,Return an ID set of all crashes which have not been checked for
        being a duplicate.

        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().
        �need-duplicate-checkrrrrVN)
rrrr&rrrrrdrWrZrs   r�get_dup_uncheckedzCrashDatabase.get_dup_uncheckedLsg��	��>�>�-�-�+�<�.��D��$�<����	��N�N� � �!E�s�5�z�R��H�H�R�L�L��	�s�'*�	A;�>A6�6A;c�P�|jjd��}t|�S)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�)rrrr&)rMr�s  r�get_unfixedzCrashDatabase.get_unfixed]s%���~�~�)�)�~�)�>���d�|�r'c��|jjjd||jj��}|djS)z�Return the version of given source package in the latest release of
        given distribution.

        If 'distro' is None, we will look for a launchpad project .
        T)�exact_match�source_name�
distro_seriesr)rr�main_archive�getPublishedSources�current_series�source_package_version)rM�package�sourcess   r�_get_source_versionz!CrashDatabase._get_source_versionisI���.�.�-�-�A�A����.�.�7�7�B�
���q�z�0�0�0r'c�:��	�	�jj|}|jryt	|j
�}�j�rd�jj��d��	t	t�	fd�|��}|st	t�fd�|��}|ryt|�dkDr,tjjd�j|�y|r=|j�}	�j|jj!�d	�St	t�	fd
�|��}|rt	t�	fd�|��}|syyt	td�|��}|ryt	td
�|��ryy#t$rYywxYw#t"$rYywxYw)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).
        �invalid�(�)c�^��|jdk(xr�|jj�vS�Nr�r	�bug_target_display_nameri�r��distro_identifiers �r�<lambda>z1CrashDatabase.get_fixed_version.<locals>.<lambda>�s0�������!>�"R�)�T�-I�-I�-O�-O�-Q�Q�r'c���|jdk(xr5|jj��jj�k(Sr5)r	rhrir0)r�rMs �rr:z1CrashDatabase.get_fixed_version.<locals>.<lambda>�s=���T�[�[�N�%B�&P� �0�0�6�6�8�D�K�K�<M�<M�<O�O�r'r�r.zVThere is more than one task fixed in %s %s, using first one to determine fixed versionrc�\��|jdvxr�|jj�vS)N>�Expiredrrr6r8s �rr:z1CrashDatabase.get_fixed_version.<locals>.<lambda>�s1���T�[�[�4W�%W�&V�-��1M�1M�1S�1S�1U�U�r'c�\��|jdvxr�|jj�vS)N)rrr=r6r8s �rr:z1CrashDatabase.get_fixed_version.<locals>.<lambda>�s8������#F�*G�*D� 1�#�;�;�A�A�C�!D�r'c� �|jdk(Sr5�r	�r�s rr:z1CrashDatabase.get_fixed_version.<locals>.<lambda>�s��D�K�K�>�$A�r'c� �|jdk(S)Nrr@rAs rr:z1CrashDatabase.get_fixed_version.<locals>.<lambda>�s�����y�(@�r'N)rfr��KeyErrorr�listr�r0ri�filter�lenrr�warningr r/r7r�
IndexError)
rMr�r�r%�fixed_tasks�fixed_distror��
invalid_tasks�non_invalid_tasksr9s
`        @r�get_fixed_versionzCrashDatabase.get_fixed_versionws����$	����#�#�H�-�A�
�>�>���Q�[�[�!���;�;�"#�D�K�K�$5�$5�$7�#8�� :����R����K��#��P��� �� ���;��!�#����&�&�B��K�K��	���"���(��%��3�3��4�4�:�:�<�Q�?���!%��V���!�
�!�(,��D�"��)�%�-�(����A�5�I��K����F�@�%�H�I� ���a�	��	��Z"�%�$�%�s#�E?�,+F�?	F�
F�	F�Fc�f�|jj|j}|r|jSy)zcReturn master ID for a duplicate bug.

        If the bug is not a duplicate, return None.
        N)rfr�r�id)rMr�r�s   rrzCrashDatabase.duplicate_of�s-��

�N�N����)�6�6����4�4�K�r'c���|jj|}|�rY||k7sJdt|��d���|jj|}|jrI|j}|j}|j|k(r"t
jjd||�y|jD]"}|jdvs�	|j��$|jj|}|jd|�d�d�	�|jj|}|jrd
|_
|js||_|j}t|j �dk(r�d|j"vrW|j"d|vrF|j"j%d
d�|vr(||j"dgz|_|j'�d|j"vrV|j"j%d
d�|vr8|jj(|j"d}|j+|��|j-�r�d|vsd|vr~|j/||d|��gd���|jj|}|jdd}		|	j1d�	|	j1d�|	|_	|j'�dg}
|j4j6D],}|j8dvr�|
j;|j<��.t?|j�}|j}|jA|�}
|
D]}||
vs�|j;|��||_|j'�n|jrd|_|jBr|j'�yy#t$rY��wxYw#t2$rY��&wxYw#t2$rY��$wxYw#t$rY��wxYw)zlMark a crash id as duplicate of given master ID.

        If master is None, id gets un-duplicated.
        zcannot mark bug z as a duplicate of itselfzNBug %i was manually marked as a dupe of newer bug %i, not closing as duplicateN>�ProcMaps.txt�
Registers.txt�ProcStatus.txt�Stacktrace.txt�Disassembly.txt�ThreadStacktrace.txtr�z�Thank you for taking the time to report this crash and helping to make this software better.  This particular crash has already been reported and is a duplicate of bug #aE, so is being marked as such.  Please look at the other bug report to see if there is any missing information that you can provide, or to see if there is a workaround for the bug.  Additionally, any further discussion regarding the bug should occur in the other report.  Please continue to report any other bugs you may find.zThis bug is a duplicater�F�
�escalation_tag�
escalated_tagz	 invalid �escalation_subscription��personzapport-request-retrace�apport-failed-retracez'Updated stack trace from duplicate bug )�
Stacktrace�ThreadStacktracer��Dependencies�ProcMaps�ProcCmdline)r�zbugpattern-needed)zActive DevelopmentzCurrent Stable Release�	SupportedzPre-release Freeze)"rfr�rdrrOrrrGrr�r�rr��privater�rF�
duplicatesrBr:r��people�	subscriber�r��removerbrr�seriesr	r�rr$�
difference�_dirty_attributes)rMrzr��	master_idr��masterr��master_tags�pr��tags_to_copyri�	dupe_tags�missing_tags�tags               r�close_duplicatezCrashDatabase.close_duplicate�s����n�n�!�!�(�+����I�%�
K�!�#�h�-��0I�J�
K�%��^�^�(�(��3�F��"�"��,�,��"�I�I�	��9�9��(��N�N�*�*�4� �!�	���_�_�

���7�7�������)�

� �.�.�%�%�h�/�C��N�N���K� �	�2�
�
��.�.�%�%�h�/�C��{�{�#����#�#�#)�� �!�+�+�K��6�$�$�%��+�$����4����%5�6�k�I����(�(��+�F�&�'�#.����%5�6�1�#�F�K��N�N�$�.����=����(�(��+�F�&�'����-�-�d�l�l�;T�.U�V�A��$�$�A�$�.��+�+�-�(�K�7�*�k�9������=�h�Z�H� �	�����,�,�Y�7���K�K��N����H�H�4�5���H�H�5�6� �����N�N�$�
0�0�L��.�.�/�/�
1���=�=�)����#�#�F�K�K�0�
1��C�H�H�
�I� �+�+�K�$�/�/��<�L�#�
,���,�&��&�&�s�+�
,�&�F�K��N�N��
�
�
�#�C��� � ��K�K�M�!��g%�����V"�����"�����
!����sH�N'�N7�O�7O�'	N4�3N4�7	O�O�	O�O�	O$�#O$c���|jj|}|jd|�d�d��|jj|}|jdgz|_|j	�y)zyMark a crash id as reintroducing an earlier crash which is
        already marked as fixed (having ID 'master').
        z<This crash has the same stack trace characteristics as bug #z�. However, the latter was already fixed in an earlier package version than the one in this report. This might be a regression or because the problem is in a dependent package.zPossible regression detectedr�zregression-retracerN)rfr�r�r�r�)rMr�rmr�s    r�mark_regressionzCrashDatabase.mark_regression�su���n�n�!�!�(�+�������H���
3�
	�	
��n�n�!�!�(�+���8�8�4�5�5������
r'c�
�|jj|}|j|jvrC|jdd}|j	|j�||_	|j�yy#t$rYywxYw)zMark crash id as retraced.N)rfr�r?r�rhr�r)rMr�r�r�s    r�
mark_retracedzCrashDatabase.mark_retraced�sq���n�n�!�!�(�+���=�=�C�H�H�$������A�
�H�H�T�]�]�#��C�H�
����
�%���
��
�s�$A6�6	B�Bc��|jj|}|r�	|j|j�}t	|�}d|_|j�|j|d��|jD]#}|jdk(s�	|j��%yd|jvr&|jdgz|_
|j�yy#t
$r|jd}Y��wxYw#t$rY��wxYw)z%Mark crash id as 'failed to retrace'.rrz Crash report cannot be processedr�r�r]N)rfr�rmr�r�r�r	r�r�rr�r�rr�)rMr��invalid_msgr�r�r�s      r�mark_retrace_failedz!CrashDatabase.mark_retrace_failed�s����n�n�!�!�(�+���
(��-�-�c�m�m�<���D�z��$�D�K��L�L�N��N�N�#�-O�
�
��_�_�
���7�7�m�+�����)�
�%�C�H�H�
4��x�x�#:�";�;�C�H��K�K�M�5��!�
(��}�}�Q�'��
(��%����s#�&C�
C3�C0�/C0�3	C?�>C?c��|jj|}d|vr�|jD]w}|jjjd�s�)|jj|d��|_	|j�|jj|}nd|jvr�|jdd}|jd�||_
|j�d|vrQ|jD]B}d|jjvs�|jdk(s�,d|_|j��D|j||�y#t$rY��wxYw)	z/Mark crash id as checked for being a duplicate.r�r�r�r!N�	Tracebackr�r�)rfr�r�r�r�rrrr�r�rr�rhr�r�)rMr�rzr�r�r�s      r�_mark_dup_checkedzCrashDatabase._mark_dup_checked�s?���n�n�!�!�(�+���f�$��
�
�
���;�;�1�1�:�:�?�K�"&�.�.�"A�"A�#�O�4�#B�#�D�K������"�n�n�1�1�(�;��
�
�"�S�X�X�-������A�
�H�H�+�,��C�H��K�K�M��f�$��M�M�+�D�&�$�+�+�*H�*H�H��?�?�k�9�.6�D�O� �L�L�N�	+�
	
�%�%�c�6�2��#%����s�8)E�	E�Ec���tjjj||�}|s|S||d<	tj
j
|�d��5}|j�}|jd�s
	ddd�y|D]9}|jd�rd|vsd|vr
ddd�yn|j�r�9nddd�|S#1swY|SxYw#t$r|cYSwxYw)	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.
        �DuplicateOfz/+textsbug:NTstags:sapport-failed-retracesapport-request-retrace)rr=r)�knownr��request�urlopen�readline�
startswith�stripra)rMrzr�r�lines     rr�zCrashDatabase.known�s���*�n�n�*�*�0�0��v�>����J�!$��}��	����'�'�3�%�v��7�
�1��z�z�|�����w�/� �
�
���D����x�0�4��<�8�D�@�#'�
�
�� �:�:�<���
�2�
�3
�2�
���	��J�	�sM�"C�#C�:C�C�"C�+C�>C�C�C�C�C�C&�%C&c���d|vr|dj�ddk7ry|jjdd�}|jj�d|��}|jt
|jj�d�jd�|jD�cgc]!}t
|�jd	d
��d��#c}vr|j|�
�yycc}w)z-Subscribe the right triaging team to the bug.�
DistroReleaser�UbuntuN�
triaging_teamzubuntu-crashes-universe�~r�rr.)�maxsplitr/r[)
rrBr:rf�	_root_urir�rdr�rrg)rMr�rz�teamr\rs      rr�z&CrashDatabase._subscribe_triaging_teams���
�f�$���)@�)F�)F�)H��)K�x�)W���|�|����1J�K���N�N�,�,�-�Q�t�f�5���~�~�c�$�.�.�":�":�;�R�@�F�F�s�K�;>�;L�;L�P
�47�C��H�N�N�3��N�+�B�/�P
�
�
�M�M��M�(�
��P
s�!&Cc���dd|dj���i}|jd�}|r|dk(r|jd�}|r|dxxd|��z
cc<d|vr"|dxxd|j|d���z
cc<d|vro|rRd	|vsd
|vsd|vrFd|d
<|jd|jjdd��|d<|dxxd|�d�z
cc<nd|vrd|d
<d|d<|dxxdz
cc<d|vrd|dvr
|dxxdz
cc<d|vr|d|d<gd�}t	j
�}|j
||gd�|��|j�|jd�|S)z�Generate a multipart/MIME temporary file for uploading.

        You have to close the returned file object after you are done with it.
        r�zapport-r��PackageArchitecture�all�Architecture� r��VmCore�CoreDump�LaunchpadPrivate�yes�Private�LaunchpadSubscribe�initial_subscriberr�Subscribersz need-r3r}z need-duplicate-check�DuplicateSignaturer!�CheckboxSubmissionzHWDB-Submission)	r�r�r��
Regression�Reproducible�TestedUpstream�ProcVersionSignature�Uname�NonfreeKernelModules)r�r�r�)�
extra_headersr��priority_fieldsr)	rir:r�rBrGr�r�r�r�)rMrz�hdrr��orderr�s      rrvz#CrashDatabase._generate_upload_blob*s������
�!6�!<�!<�!>� ?�@�A���J�J�,�-���A��J��
�
�>�*�A����K�Q�q�c�7�"�K��V����K�Q�t�5�5�f�V�n�E�F�G�G�K��f�$���F�"���'�%��/�!&��I��%+�Z�Z�(��L�L�$�$�%9�8�D�&��M�"��F����s�(�3�3����&�!&��I��%-��M�"��F��6�6���6�)�.D�C�PV�K�.W���K�2�2�K� �6�)�%+�,@�%A�C�!�"�

���%�%�'�������H�!�		�	
�	
�
�
���	�	�!���r'c��d}|j�jdd��D],}|dvst|�dkDr|dvr|t|�z
}�(|dz
}�.|S)	zJReplace characters from tags which are not palatable to
        Launchpad.r��ASCII�ignore)�errorss%abcdefghijklmnopqrstuvwxyz0123456789 rs+-.r-)rir�rF�chr)r��res�chs   rr�zCrashDatabase._filter_tag_namesnse�����*�*�,�%�%�g�h�%�?�	�B��=�=��C��1���v���s�2�w����s�
��
	��
r')NN)FNN)r��N))�__name__�
__module__�__qualname__�__doc__r>�propertyrfrmrrrrdrxr�rrzr�rr�r�r�r�rrrrrr"r$r/rMrrtrvrxr{r~r�r�rv�staticmethodr��r'rr)r)Bs��?�FO�P�( ��( �T�� �� ��$�c��$
�LE����!5�!5�E��E��E�a�P!���V�p13�fF��$8�
�.
��"
�1�d�L�]�~�$
��63�B7�r)�"B�H���r'r)c��eZdZdZd�Zy)�HTTPSProgressConnectionzWImplement a HTTPSConnection with an optional callback function for
    upload progress.c��ts+tjjj	||�yd}t|�}d}||kr�t||�t
j�}tjjj	|||||z�||z
}t
j�}|dkDr||z
dkr|dz}n
||z
dkDr|dz}||kr��yy)Nrig�?r.r�)�_https_upload_callback�http�client�HTTPSConnection�sendrF�time)rMr
�sent�total�	chunksize�t1�t2s       rr�zHTTPSProgressConnection.send�s���%��K�K�'�'�,�,�T�4�8�����D�	���	��U�l�"�4��/�����B��K�K�'�'�,�,�T�4���y�@P�3R�S��I��D�����B��4����7�S�=��!�O�I��"�W�q�[��!�O�I��U�lr'N)r�r�r�r�r�r�r'rr�r��s���$r'r�c��eZdZdZd�Zy)�HTTPSProgressHandlerzTImplement a HTTPSHandler with an optional callback function for
    upload progress.c�.�|jt|�Sr�)�do_openr�)rM�reqs  r�
https_openzHTTPSProgressHandler.https_open�s���|�|�3�S�9�9r'N)r�r�r�r�r�r�r'rr�r��s���:r'r�c���d}d|�d�}|atjjj	�}tjj
j
d�}|jdd�|j|�tjjjdd�}|jdd	�|j|j�jd
��|j|�tj�}tj j#|d��}	|	j%|�t&j(j+||j-��}
|
jd
d|j/����t&j(j1t2�}|j5|
�}|j7�j9d�}|sJ�|S)a)Upload blob (file-like object) to Launchpad.

    progress_callback can be set to a function(sent, total) which is regularly
    called with the number of bytes already sent and total number of bytes to
    send. It is called every 0.5 to 2 seconds (dynamically adapted to upload
    bandwidth).

    Return None on error, or the ticket number on success.

    By default this uses the production Launchpad hostname. Set
    hostname to 'launchpad.dev', 'qastaging.launchpad.net', or
    'staging.launchpad.net' to use another instance for testing.
    Nzhttps://z/+storeblob�1zContent-Dispositionzform-data; name="FORM_SUBMIT"�applicationzoctet-streamz*form-data; name="field.blob"; filename="x"�asciiF)�mangle_from_zContent-Typezmultipart/form-data; boundary=zX-Launchpad-Blob-Token)r�r�r��	multipart�
MIMEMultipartr��MIMEText�
add_header�attach�base�MIMEBase�set_payloadr�r�r�r��	generator�BytesGenerator�flattenr�r��Request�getvalue�get_boundary�build_openerr�r�infor:)
�blobr{rtr~r�r
�submit�	form_blob�	data_flat�genr��openerrs
             rrwrw�s����F��X�J�k�
*�C�/���:�:���-�-�/�D�
�Z�Z�_�_�
%�
%�c�
*�F�
���+�-L�M��K�K����
�
���(�(���G�I�
����K�����$�)�)�+�,�,�W�5�6��K�K�	���
�
��I�
�/�/�
(�
(���
(�
G�C��K�K����.�.�
 �
 ��i�&8�&8�&:�
;�C��N�N��8��9J�9J�9L�8M�N���^�^�
(�
(�)=�
>�F�
�[�[��
�F�
�[�[�]�
�
�7�
8�F��M�6��Mr')Nz
launchpad.net)2r�rIr�r��http.clientr�r��os.pathr8rjrKrWrGr��urllib.parser��urllib.request�httplib2r�launchpadlib.errorsrr�launchpadlib.launchpadr�launchpadlib.urisr�ImportError�apport.crashdbr�apport.logging�
apport.report�apport.packaging_implrr@r[r\�
expanduserr<rr&r=r)r�r�r�r�r��HTTPSHandlerr�rwr�r'r�<module>r�s���2� ����	��	�
�
������2�;�0�1�
���3�)���7�7�-�-�.U�V��	�A�
y�F�N�N�0�0�y�@"��$�d�k�k�9�9�$�::�6�>�>�6�6�:�1��U$���I��s�C+�+C5�4C5

Zerion Mini Shell 1.0