ó
¨M‘Nc           @   sI   d  Z  d d l Z d d l Z d d l Z d „  Z d „  Z d „  Z d S(   s°   Apport package hook for the ubiquity live CD installer.

Copyright (C) 2009 Canonical Ltd.
Authors: Colin Watson <cjwatson@ubuntu.com>,
         Brian Murray <brian@ubuntu.com>iÿÿÿÿNc         C   s²   t  j j d | ƒ r# d | } n' t  j j d | ƒ rF d | } n d  St  j | t  j ƒ r{ t | d ƒ j ƒ  |  | <n3 t  j j | ƒ r® t j j	 |  i d | | 6ƒ n  d  S(   Ns   /var/log/installer/%ss   /var/log/%st   rs   cat '%s'(
   t   ost   patht   existst   accesst   R_OKt   opent   readt   apportt	   hookutilst   attach_root_command_outputs(   t   reportt   identt   namet   f(    (    s2   /usr/share/apport/package-hooks/source_ubiquity.pyt   add_installation_log   s    c         C   s­  d } x |  j  d ƒ D]} | r¥ d | k r` | d k r` d j | j  d ƒ d ƒ d } q q¥ d | k r¥ | d k r¥ | d j | j  d ƒ d ƒ d 7} q q¥ n  | r¼ | d k r¼ | Sd | k rø | rø | d j | j  d ƒ d ƒ d 7} q n  d | k r1| r1d j | j  d ƒ d ƒ d } q n  t | j  d ƒ d ƒ d k rod	 | k ro| d k ro| Sn  d	 | k rq n  | d j | j  d ƒ d ƒ d 7} q Wd  S(
   Nt    s   
s   grub-installer:t    i   s"   Traceback (most recent call last):i   i   t	   Traceback(   t   splitt   joint   len(   t   syslogt   collect_grubt   collect_tracet   collectt   line(    (    s2   /usr/share/apport/package-hooks/source_ubiquity.pyt   prepare_duplicate_signature   s2     $	$ +c   
   	   C   so  t  |  d d ƒ |  d } d | k r‹ t j d | ƒ rl t j d | ƒ j d ƒ } t j d | | ƒ } n  | r‹ | j d ƒ t ‚ q‹ n  d | k r­ | j d ƒ t ‚ n  |  d	 d
 k rUd |  k rUt } t } d | k rö d | k rö t } n  d | k rt } n  | s| r?t | | | ƒ } | r?| |  d <q?n  | rUd |  d <qUn  t j d |  d ƒ } | rƒ| j d ƒ } n  |  j	 d d ƒ | rº|  d c d | j
 ƒ  d 7<n  t  |  d d ƒ t j j d ƒ r| j d ƒ }	 |	 d  k r t ‚ n  |	 rt  |  d d ƒ qn  t  |  d d ƒ t  |  d d ƒ t  |  d  d! ƒ d  |  k rk|  d c d" 7<n  d  S(#   Nt   UbiquitySyslogR   s   Buffer I/O error on devices   Attached .* CD-ROM (\w+)i   s   Buffer I/O error on device %ss¹  The system log from your installation contains an error.  The specific error commonly occurs when there is an issue with the media from which you were installing.  This can happen when your media is dirty or damaged or when you've burned the media at a high speed.  Please try cleaning the media and or burning new media at a lower speed.  In the event that you continue to encounter these errors it may be an issue with your CD / DVD drive.s   SQUASHFS error: Unable to readt   ProblemTypet   BugR   s8   grub-installer: Installation finished. No error reporteds   grub-installer:t   DuplicateSignatures   grub-installert   SourcePackages   ubiquity.*Ubiquity (.*)
t   TagsR   s    ubiquity-%si    t   UbiquityPartmant   partmans   /var/log/installer/debugs­   The debug log file from your installation would help us a lot but includes the password you used for your user when installing Ubuntu.  Do you want to include this log file?t   UbiquityDebugt   debugt
   UbiquityDmt   dmt   Caspers
   casper.logt   OemConfigLogs   oem-config.logs    oem-config(   R   t   ret   searcht   groupt   informationt   StopIterationt   Falset   TrueR   t
   setdefaultR   R   R   R   t   yesnot   None(
   R   t   uiR   t   cd_drivet   cd_errorR   R   t   duplicate_signaturet   matcht   response(    (    s2   /usr/share/apport/package-hooks/source_ubiquity.pyt   add_info6   sZ    
			!	(	   t   __doc__t   apport.hookutilsR   t   os.pathR   R*   R   R   R:   (    (    (    s2   /usr/share/apport/package-hooks/source_ubiquity.pyt   <module>   s   		