
Tc           @   s,  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l Z d  d l m Z d  d l m Z d   Z d e f d     YZ i d d	 6d
 d 6d d 6d d 6d d 6d d 6d d 6d d 6Z i d d d d d f d	 6d d d d f d 6Z i d d d d d  g d	 6d" d$ d& d  g d 6Z i d( d	 6d) d 6d* d+ 6Z d	 d d d d d d+ d d d, g
 Z d- d.  Z i d/ d0 6d1 d2 6d3 d4 6d5 d6 6d7 d8 6d9 d: 6d; d< 6d= d> 6d? d@ 6dA dB 6dC dD 6dE dF 6dG dH 6dI dJ 6dK dL 6dM dN 6dO dP 6dQ dR 6dS dT 6dU dV 6dW dX 6dY dZ 6d[ d\ 6d] d^ 6d_ d` 6da db 6dc dd 6de df 6dg dh 6di dj 6Z  i dk dl 6Z! e" d dm  Z$ e" d dn  Z% e j& do  Z' e" d dp  Z( dq   Z) dr   Z* ds   Z+ dt   Z, i i	 du dv 6dw dx 6dy dz 6e  d{ 6d| d} g d~ 6i e( dh 6e$ dB 6e% dV 6d 6d d 6d d 6e* d 6d 6i d dv 6d dx 6d d 6e+ d 6d 6i d dv 6d dx 6e- d 6d 6Z. i d d 6d d 6d d 6Z/ d d d g Z0 i d d 6Z1 i d d 6Z2 i d d 6d d 6d d 6d d 6d d 6d d 6d d 6Z3 d e  j4 d  Z5 d   Z6 e- e- d  Z7 e- e- e" d d  Z8 d e- e" d  Z9 d d  Z: d e- e- e" d  Z; d e- e- d  Z< d   Z= xe j d  D]Z> yee? e>  Z@ e	 jA jB e>  ZC e. jD eC i i  d{ 6e" d 6i  dL 6d d 6 e. eC <xe@ D] ZE y eE jF d d  \ ZG ZH eG jI   ZG eH jJ   ZH eG d k reH e. eC dv <n eG d k rLe= eH  \ ZK ZL eK e. eC d <eK d- k rd eL d e. eC dz <d eL e. eC dx <qLeK d k rLd e. eC dz <eL e. eC dx <qLn  WqeeM k
 r`qeXqeWe@ jN   WqeO k
 rqXqWd e jP f d     YZQ e- e" d  ZR e- d  ZS d d e- e- d d  ZT d d e- e- d  ZU d d  ZV d d d d e- e- d  ZW d d d e- e- d  ZX d S(   iN(   t   defaultdict(   t	   NoNetwork(   t   open_urlc         C   s0   y t  j |   SWn t  j j k
 r+ d SXd  S(   Nt    (   t   emailt   message_from_filet   Errorst   MessageParseError(   t   fp(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt
   msgfactory1   s    t   Errorc           B   s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyR
   9   s   s   makes unrelated software on the system (or the
    whole system) break, or causes serious data loss, or introduces a
    security hole on systems where you install the package.t   criticals   makes the package in question unusable by most or all users,
    or causes data loss, or introduces a security hole allowing access
    to the accounts of users who use the package.t   graves'  is a severe violation of Debian policy (that is,
    the problem is a violation of a 'must' or 'required' directive);
    may or may not affect the usability of the package.  Note that non-severe
    policy violations may be 'normal,' 'minor,' or 'wishlist' bugs.
    (Package maintainers may also designate other bugs as 'serious' and thus
    release-critical; however, end users should not do so.). For the canonical
    list of issues worthing a serious severity you can refer to this webpage:
    http://release.debian.org/testing/rc_policy.txt .t   seriouss{   a bug which has a major effect on the usability
    of a package, without rendering it completely unusable to
    everyone.t	   importants_   a bug that stops the package from being built
    from source.  (This is a 'virtual severity'.)s   does-not-builds   a bug that does not undermine the usability of the
    whole package; for example, a problem with a particular option or
    menu item.t   normals   things like spelling mistakes and other minor
    cosmetic errors that do not affect the core functionality of the
    package.t   minors*   suggestions and requests for new features.t   wishlists   breaks unrelated softwaresl   breaks unrelated software on the system
    (packages that have a dependency relationship are not unrelated)s   breaks the whole systemse   renders the entire system unusable (e.g.,
    unbootable, unable to reach a multiuser runlevel, etc.)s   causes serious data losss0   causes loss of important, irreplaceable
    datas   root security holes   introduces a security hole allowing access to
    root (or another privileged system account), or data normally
    accessible only by such accountst   unknowns   not sure, or none of the aboves   renders package unusables   renders the package unusable, or mostly
    so, on all or nearly all possible systems on which it could be installed
    (i.e., not a hardware-specific bug); or renders package uninstallable
    or unremovable without special efforts   causes non-serious data losssn   causes the loss of data on the system
    that is unimportant, or restorable without resorting to backup medias   user security holes_   introduces a security hole allowing access to
    user accounts or data not normally accessibles   The product, component or concept is completelynon-operational or some essential functionality is missing.  Noworkaround is known.s   The product, component or concept is not workingproperly or significant functionality is missing.  Problems thatwould otherwise be considered critical are rated serious whena workaround is known.s   The product, component or concept is workingin general, but lacks features, has irritating behavior, doessomething wrong, or doesnt match its documentation.s   non-criticalt   fixedt   debbugsc         C   sj   | d k r# i d d 6j  |  |   S| d k rb i d d 6d d 6d d 6d d	 6d d
 6j  |  |   S|  Sd S(   s!   Convert severity names if needed.R   R   s   non-criticalt   gnatsR   R   R   R   R   R   N(   t   get(   t   severityt   type(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   convert_severity   s    
s   General bugs in the base systemt   bases)   The bug tracking system, @bugs.debian.orgs   bugs.debian.orgs3   Problems and requests related to the Debian Builddss   buildd.debian.orgs2   Problems related to building packages for Emdebians   buildd.emdebian.orgs   CD Image issuess   cdimage.debian.orgs'   Problems with installation from CD-ROMst   cdroms3   Problems and requests related to Debian Maintainerss   debian-maintainerss3   Proposed changes in the Debian policy documentations   debian-policysB   Requests regarding Internationalization (i18n) of the distributions   debian-i18ns7   Problems with the FTP site and Package removal requestss   ftp.debian.orgs8   General problems (e.g., that many manpages are mode 755)t   generals   Problems with installing Debians   installation-reportss+   Problems with the WWW mailing list archivest   listarchivess-   The mailing lists, debian-*@lists.debian.org.s   lists.debian.orgs%   Problems with Debian archive mirrors.t   mirrorss0   New Maintainer process and nm.debian.org websites   nm.debian.orgs   Press release issuest   presss*   Problems related to project administrationt   projects/   Problems related to the quality assurance groups   qa.debian.orgs9   Requests regarding Debian releases and release team toolss   release.debian.orgs   Problems with the release notess   release-notess   The Debian Security Bug Trackers   security-trackers)   Problems with the security updates servers   security.debian.orgs+   Issues with the snapshot.debian.org services   snapshot.debian.orgs8   Spam (reassign spam to here so we can complain about it)t   spams0   Issues to be referred to the technical committees	   tech-cttes.   Reports of successful and unsucessful upgradess   upgrade-reportss   Problems with the Debian wikis   wiki.debian.orgs*   Work-Needing and Prospective Packages listt   wnppsN   Problems with the WWW site (including other *.debian.org sites, except alioth)s   www.debian.orgs   Any non-package-specific bugs   debian-generalc         C   s  d } } }	 }
 } d } g  } g  } t  } | j d i
 d d 6d d 6d d	 6d
 d 6d d 6d d 6d d 6d d 6d d 6d d 6d d t  } | s | j d  t  n  d } | d k r d  Sd } | j |  }  |  s | j d  d  S| j d  t j |   } | d } t } | sQt j	 |   } | rQt j | d  d   } qQn  | s| j
 d! d" i d# d$ 6d% d& 6 } | d& k rt j d  qn4 | d k r| d' p|  }  n  | d( | d) }
 } | d k r| j d* i7 d d+ 6d d, 6d d- 6d d. 6d d/ 6d d0 6d d1 6d d2 6d d3 6d d4 6d d5 6d d6 6d d7 6d d8 6d d9 6d d: 6d d; 6d d< 6d d= 6d d> 6d d? 6d d@ 6d dA 6d dB 6d dC 6d dD 6d dE 6d dF 6d dG 6d dH 6d dI 6d dJ 6d dK 6d dL 6d dM 6d dN 6d dO 6d dP 6d dQ 6d dR 6d dS 6d dT 6d dU 6d dV 6d dW 6d dX 6d dY 6d dZ 6d d[ 6d d\ 6d d] 6d d^ 6d d_ 6d d` 6d da 6db dc |
 d t  } | s|
 } n  | j dd i d de 6d df 6d dg 6d dh 6d di 6dj dc | d t  } | s| } n  | |
 k rD| | k rD| j
 dk dl i dm d$ 6dn d& 6 } | d& k rD| j do  t j d  qDn  | j dp i d dq 6d dr 6d ds 6dt dc dq d t  } | sdq } n  | dq k rdu |  | | | f } n dv |  | | f } dw } n| j dx i dy dz 6d{ d| 6d} d~ 6d d 6d d 6d d 6d d 6d d t  } | s%d } n  | d k rN| j d  | j d  n  d } | j |  } | smd  S| j
 d d" i d d$ 6d d& 6 } | d$ k rd } | j |  }	 |	 s| j d  t  qn  | d k r|	 r| j d  d } d d d } n  |	 rM| d k r4d |  | |	 | | f } qd |  |	 | | f } n8 | d k rrd |  | | | f } n d |  | | f } | d k r| j d  t j d  n  | | | | | | f S(   NR   t   unstables   What sort of request is this?  (If none of these things mean anything to you, or you are trying to report a bug in an existing package, please press Enter to exit reportbug.)s(   Package removal - Request Of Maintainer.t   ROMs+   Package removal - Requested by the QA team.t   RoQAs$   Package removal - Request of Porter.t   ROPs(   Package removal - Not Built [by] Source.t   NBSs1   Package removal - Never Part Of A Stable Release.t   NPOASRs,   Package removal - Newer Version In Unstable.t   NVIUs5   Package removal - Architecture Not Allowed In Source.t   ANAISs*   Package removal - Internal Compiler Error.t   ICEs   Change override request.t   overrides5   Not a package removal request, report other problems.t   others   Choose the request type: t   empty_oksO   To report a bug in a package, use the name of the package, not ftp.debian.org.
R   s&   Please enter the name of the package: s@   You seem to want to report a generic bug, not request a removal
s   Checking status database...
i   i    s/   This package doesn't appear to exist; continue?t   yNs!   Ignore this problem and continue.t   ys   Exit without filing a report.t   ni   i   i
   s   Select the new sectiont   admins   cli-monot   commt   databases   debian-installert   debugt   develt   doct   editorst	   educationt   electronicst   embeddedt   fontst   gamest   gnomes   gnu-rt   gnustept   graphicst   hamradiot   haskellt   httpdt   interpreterst   introspectiont   javat   kdet   kernelt   libdevelt   libst   lispt   localizationt   mailt   matht   metapackagest   misct   nett   newst   ocamlt   oldlibst	   otherosfst   perlt   phpt   pythont   rubyt   sciencet   shellst   soundt   text   textt   utilst   vcst   videot   webt   x11t   xfcet   zopes   Choose the section: t   defaults   Select the new priorityt   requiredR   t   standardt   optionalt   extras   Choose the priority: sn   You didn't change section nor priority: is this because it's ftp.debian.org override file that needs updating?t   Yns+   ftp.debian.org override file needs updatings   No, it's not the override files3   There's nothing we can do for you, then; exiting...s9   Is this request for an archive section other than "main"?t   maint   contribs   non-frees   Choose the archive section: s   override: %s:%s/%s %ss   override: %s:%s/%ss*   (Describe here the reason for this change)s^   Is the removal to be done in a suite other than "unstable"?  Please press Enter for "unstable"s   Old stable.t	   oldstables   Old stable proposed updates.s   oldstable-proposed-updatess   Stable.t   stables   Stable proposed updates.s   stable-proposed-updatess   Testing only (NOT unstable)t   testings   Testing proposed updatess   testing-proposed-updatess   Experimental.t   experimentals   Choose the suite: s-   X-Debbugs-CC: debian-release@lists.debian.orgs5   Your report will be carbon-copied to debian-release.
s%   Please enter the reason for removal: s3   Is this removal request for specific architectures?s3   This is a partial (specific architectures) removal.s&   This removal is for all architectures.s1   Please enter the arch list separated by a space: s<   Partial removal requests must have a list of architectures.
s_   Partial removal for testing; forcing suite to 'unstable', since it's the proper way to do that.s2   (please explain the reason for the removal here)

s=   Note: this was a request for a partial removal from testing, s   converted in one for unstables   RM: %s/%s [%s] -- %s; %ss   RM: %s [%s] -- %s; %ss   RM: %s/%s -- %s; %ss   RM: %s -- %s; %ssD   Please use release.debian.org pseudo-package and report a bug there.(   Rr   R%   Rs   (   t   Truet   menut   long_messaget
   SystemExitt
   get_stringt   log_messageRa   t   get_package_statust   Falset   get_source_packaget   select_optionst   syst   exitt   append(   t   packaget   btst   uit   fromaddrt   timeoutt   onlinet
   http_proxyt   bodyt   reasont   archst   sectiont   priorityt   suitet   headerst   pseudost   queryt   tagR   t   promptt   infot	   availablet   contt   new_sectiont   new_priorityt   arch_sectiont   subjectt   whyt   partial(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   handle_debian_ftp   s   		
##						 
c   !      C   s  d } g  } g  }	 t  }
 d  } d  } | j d i d d 6d d 6d d 6d	 d
 6d d 6d d 6d d 6d d 6d d t  } | s | j d  t  n  d } | d k r d  S| d k r | j d  } | s| j d  t j d  qn d } | j |  }  |  s| j d  d  S| j d  t	 j
 |   } | d } t }
 | szt	 j |   } | rzt	 j
 | d d  } qzn  | s| j d d i d  d! 6d" d# 6 } | d# k rt j d  qn | d$ p|  }  | dK k r| o| d } | r,| j d%  r,t j |  | | d&  f  j   d } n  | rq| j d' | d( i d) d! 6d* d# 6 } | d# k rqd  } qqn  | s| j d+  } | s| j d, |  d  Sqn  | dL k r5| j d- d i d. d! 6d/ d# 6 } | d! k r5| d k r| j d0  t  n  d1 } | j |  } | s2| j d2  q2q5n  |	 j d3  | j d%  rv|	 j d4  |	 j d5 | d&   n |	 j d6 |  | d k r| j d7  } d8 |  | f } d9 |  | | pd: | f } n| d k rd; |  } d< } d= } d= } d= } | j d>  d? } | j |  } | r?d@ } | j |  } n d  } | r| rdA   } g  | j   j   D] } | |  ^ qm} g  | j   j   D] } | |  ^ q} dB j }  dC |  | |  } dC |  |  } dC |  |  } n  | t j dD |  | | | f  7} n | d k r1| } d } n | d
 k rldE |  | f } t j dF |  |  | f  } nP | j d%  rdG | |  | f } dH } n% | d k rdI |  | f } dJ } n  | | | |	 | |
 f S(M   NR   s   What sort of request is this?  (If none of these things mean anything to you, or you are trying to report a bug in an existing package, please press Enter to exit reportbug.)s   binNMU requestst   binnmus   testing migration script bugst   britneys   transition trackingt
   transitions   unblock requestst   unblocks    wheezy proposed updates requestss	   wheezy-pus    jessie proposed updates requestss	   jessie-pus   Stable/Testing removal requestst   rms   None of the other optionsR/   s   Choose the request type: R0   sS   To report a bug in a package, use the name of the package, not release.debian.org.
R   s,   Please enter the subject of the bug report: s   No subject specified, exitingi   s&   Please enter the name of the package: s*   You seem to want to report a generic bug.
s   Checking status database...
i    s/   This package doesn't appear to exist; continue?R1   s!   Ignore this problem and continue.R2   s   Exit without filing a report.R3   i   s   -puis7   Latest version seems to be %s, is this the proper one ?Rm   s   This is the correct versions   Enter the proper versions)   Please enter the version of the package: s5   A version is required for action %s, not sending bug
s+   Is this request for specific architectures?s3   This is a partial (specific architectures) removal.s&   This removal is for all architectures.s  The proper way to request a partial removal from testing is to file a partial removal from unstable: this way the package for the specified architectures will be automatically removed from testing too. Please re-run reportbug against ftp.debian.org package.s1   Please enter the arch list separated by a space: s&   No architecture specified, skipping...s,   User: release.debian.org@packages.debian.orgs   Usertags: pus   Tags: %ss   Usertags: %ss   binNMU changelog entry: s
   nmu: %s_%ss   nmu %s_%s . %s . -m "%s"
t   ALLs   transition: %ss   (please explain about the transition: impacted packages, reason, ...
 for more info see: https://wiki.debian.org/Teams/ReleaseTeam/Transitions)
s
   <Fill out>sB  To assist the release team, please fill in the following information. You will be asked to provide package names of the library package(s) that are the source of the transition.  If more than one library is changing the name, please use a space separated list.  Alternatively you can use a regex by enclosing the regex in slashes ("/").  Please ensure that the "old" regex does not match the "new" packages.  Example: old="/libapt-pkg4.10|libapt-inst1.2/ libept1" new="/libapt-pkg4.12|libapt-inst1.5|libept1.4.12/". For futher reference, please refer to http://ben.debian.net/ .sM   Please enter old binary package name of the library (or a regex matching it):sM   Please enter new binary package name of the library (or a regex matching it):c         S   s   |  d d k r |  p d |  S(   Ni    t   /s   "%s"(    (   t   x(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   <lambda>  s    s    | .depends ~ s   .depends ~ u   
               Ben file:

               title = "%s";
               is_affected = %s;
               is_good = %s;
               is_bad = %s;

               s   unblock: %s/%su                   Please unblock package %s

                (explain the reason for the unblock here)

                (include/attach the debdiff against the package in testing)

                unblock %s/%s
                s   %s: package %s/%ss1   (please explain the reason for this update here)
s	   RM: %s/%ss*   (explain the reason for the removal here)
(   R   R   s	   jessie-pus	   wheezy-puR   (   R   R   (   Rt   t   NoneRu   Rv   Rw   Rx   R~   R   Ry   Ra   Rz   R{   R|   R}   t   endswitht   checkversionst   get_versions_availablet   valuesR   t   stript   splitt   joint   textwrapt   dedent(!   R   R   R   R   R   R   R   R   R   R   R   R   t   versionR   R   t   subject_britneyR   R   R   R   R   R   R   t   affectedt   goodt   badt   tfromt   ttot   quoteR   t   listbadt   listgoodt   j(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   handle_debian_release  s    		
)
	

	++						u`      * Package name    : %(package)s
      Version         : x.y.z
      Upstream Author : Name <somebody@example.org>
    * URL             : http://www.example.org/
    * License         : (GPL, LGPL, BSD, MIT/X, etc.)
      Programming Lang: (C, C++, C#, Perl, Python, etc.)
      Description     : %(short_desc)s

    (Include the long description here.)

    Please also include as much relevant information as possible.
    For example, consider answering the following questions:
     - why is this package useful/relevant? is it a dependency for
       another package? do you use it? if there are other packages
       providing similar functionality, how does it compare?
     - how do you plan to maintain it? inside a packaging team
       (check list at https://wiki.debian.org/Teams)? are you
       looking for co-maintainers? do you need a sponsor?
c         C   s  d } } g  }	 g  }
 t  } | j d i d d 6d d 6d d 6d	 d
 6d d 6d d t  } | sv | j d  t  n  d }  xY |  s | d9 k r d } n d } | j |  }  t j |   s | j d  d }  q q W| j d  t j |  d t  } | d } d } | d: k r| rp| s>t	 j
 |  d | d | rp| j d |  d d d d spt j d  qpn  d } d } x | s| j d  } qW| d
 k r|	 j d   |
 j d! | j d" d#   | j d$  n  t t   } nz| d; k rhd } t } | s>t j |   } | r>t j | d d  } q>n  | s| j d% d& i d' d( 6d d) 6 } | d) k rt j d  n  d } } n* | d* pd } | d+ p|  }  | d, } | d k r| r| d- d< k rd/ } n  | d k r|	 j d   | j d1  n  | rhd2 } | d k r/d3 } n | d k rDd4 } n  d5 | |  f } | | d6 } qhn  | rd7 | |  | f } n d8 | |  f } | | |	 |
 | | f S(=   NR   s   What sort of request is this?  (If none of these things mean anything to you, or you are trying to report a bug in an existing package, please press Enter to exit reportbug.)sO   The package has been `Orphaned'. It needs a new maintainer as soon as possible.t   Os+  This is a `Request for Adoption'. Due to lack of time, resources, interest or something similar, the current maintainer is asking for someone else to maintain this package. They will maintain it in the meantime, but perhaps not in the best possible way. In short: the package needs a new maintainer.t   RFAs   This is a `Request For Help'. The current maintainer wants to continue to maintain this package, but they needs some help to do this, because their time is limited or the package is quite big and needs several maintainers.t   RFHsr   This is an `Intent To Package'. Please submit a package description along with copyright and URL in such a report.t   ITPs   This is a `Request For Package'. You have found an interesting piece of software and would like someone else to maintain it for Debian. Please submit a package description along with copyright and URL in such a report.t   RFPs   Choose the request type: R0   sE   To report a bug in a package, use the name of the package, not wnpp.
s(   Please enter the proposed package name: s   Please enter the package name: s   Invalid package names   Checking status database...
t   availi   R   t   0R   sQ   A package called %s already appears to exist (at least on your system); continue?s   Ignore this problem and continue.  If you have already locally created a package with this name, this warning message may have been produced in error.s   Exit without filing a report.Rh   i    R   sp   Please briefly describe this package; this should be an appropriate short description for the eventual package: s+   X-Debbugs-CC: debian-devel@lists.debian.orgu	   Owner: %ss   utf-8t   replacesF   Your report will be carbon-copied to debian-devel, per Debian policy.
s/   This package doesn't appear to exist; continue?R1   s!   Ignore this problem and continue.R2   R3   i   i   i   i	   Ri   R   Rj   sG   Your request will be carbon-copied to debian-devel, per Debian policy.
s   intend to orphans   request an adopter fors#   request assistance with maintainings2   I %s the %s package.

The package description is:
s   
s   %s: %s -- %ss   %s: %s(   R   R   (   R   R   (   R   R   R   (   s   requireds	   importants   standard(   Rt   Ru   Rv   Rw   Rx   Ra   t   check_package_nameRy   Rz   R   t   check_availablet   yes_noR~   R   R   t   decodet   itp_templatet   varsR{   R|   R}   (   R   R   R   R   R   R   R   t
   short_descR   R   R   R   R   R   R   R   R   R   t	   long_desct   orphstrR   (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   handle_wnppO  s    
				
	
				c          C   s   t  j   }  t j   d } t  j   } |  rZ | |  k rG d |  } qd d |  | f } n
 d | } | r{ | d | 7} n  | d 7} | S(   Ni   u   Architecture: %s
u   Architecture: %s (%s)
u   Architecture: ? (%s)
u   Foreign Architectures: %s
s   
(   Ra   t   get_archt   ost   unamet   get_multiarch(   t   debarcht
   utsmachinet	   multiarcht   debinfo(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   dpkg_infofunc  s    

c           C   s   t  j   t   S(   N(   Ra   t   get_debian_release_infoR   (    (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   debian_infofunc  s    c           C   s   t  j   t   S(   N(   Ra   t   lsb_release_infoR   (    (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   ubuntu_infofunc  s    c          C   s"   t  j   d }  t j   d |  S(   Ni   u   Architecture: %s

(   R   R   Ra   R   (   R   (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   generic_infofunc  s    t   Debiant   names   %s@bugs.debian.orgR   s   http://www.debian.org/Bugs/t   btsroott	   otherpkgss   linux-images   kernel-imaget
   nonvirtualt   specialst   gccs   g++t   cppt   gcjt   gpct   gobjct   chillt   gijt   g77RZ   s   python-bases   x-window-system-cores   x-window-systemt   deppkgss   http://bugs.debian.org/cgi-bin/t   cgiroott   infofunct   debiant   Ubuntus   ubuntu-users@lists.ubuntu.comt   mailtoR   t   ubuntus   GUUG (German Unix User Group)s   %s@bugs.guug.des
   query-dpkgt   guugsU   The problem is a bug in the software or code.  Forexample, a crash would be a sw-bug.s   sw-bugs\   The problem is in the documentation.  For example,an error in a man page would be a doc-bug.s   doc-bugs   You are requesting a new feature or a changein the behavior of software, or are making a suggestion.  Forexample, if you wanted reportbug to be able to get your localweather forecast, as well as report bugs, that would be achange-request.s   change-requests3   This problem is a security vulnerability in Debian.t   securitys.   You are including a patch to fix this problem.t   patchs5   This bug applies to the upstream part of the package.t   upstreams<   This bug is relevant to the development of debian-installer.s   d-is9   This bug affects support for Internet Protocol version 6.t   ipv6s<   This bug affects support for large files (over 2 gigabytes).t   lfss;   This bug reports a localization/internationalization issue.t   l10nsT   This bug has a known solution but the maintainer requests someone else implement it.t   newcomerR   c         C   sK   t  j   } |  d k r( | j t  n  | t j k rG | j t  n  | S(   s   Returns the current tags list.

    If severity is release critical, than add additional tags not always present.
    If mode is higher than STANDARD, then add suite tags.R   R   R   (   s   graves   criticals   serious(   t   TAGSt   copyt   updatet   CRITICAL_TAGSRa   t   MODE_STANDARDt   EXPERT_TAGS(   R   t   modet   tags(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   get_tags  s    c         C   s(   |  r  t  |   d k r d Sd Sd Sd  S(   Nt   not   yes(   t   str(   t   setting(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   yn_bool-  s
    c         C   s7   t  |  j d  } | r3 d | | | t |  f Sd  S(   NR   s*   %sbugreport.cgi?bug=%d&archived=%s&mbox=%s(   t   SYSTEMSR   R  R   (   t   systemt   numbert   archivedt   mboxt   root(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   cgi_report_url5  s
    c   	      C   s   t  |  j d  } | s d  S| r9 i | j   d 6} n i | j   d 6} t |  | d <t |  | d <| r t |  | d <n  t j |  } d | | f S(   NR   t   srct   pkgt   repeatmergedR
  R   s   %spkgreport.cgi?%s(   R  R   R   t   lowerR  R  t   urllibt	   urlencode(	   R  R   R
  t   sourceR  R   R  R   t   qstr(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   cgi_package_url<  s     c         C   s0   t  |  |  } t j | j    } | d | S(   Ns   db/pa/l%s.html(   t   get_btsrootR  t
   quote_plusR  (   R  R   R    R  R  R   (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   package_urlR  s    c         C   sG   t  |  } t |  d k  r" d  St |  |  } | d | d  | f S(   Ni   s   db/%s/%s.html(   R  t   lenR   R  (   R  R	  R    R   (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt
   report_urlY  s
     c         C   s.   t  |  | | | |  p- t |  | | | |  S(   N(   R  R  (   R  R   R    R  R
  R  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   get_package_url_  s    c         C   s%   t  |  | | |  p$ t |  | |  S(   N(   R  R  (   R  R	  R    R
  R  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   get_report_urld  s    c         C   sz   |  j  d d  } t |  d k r( d  S| \ } } | j d  rP | d } n  x | j d  ro | d  } qS W| | f S(   Nt   :i   i   s   //R   i(   R   R  R   t
   startswithR   (   t   urlt   bitsR   t   loc(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   parse_bts_urlh  s       s   /etc/dpkg/origins/*s   : i   t   vendort   bugss   http://R   s   %s@t	   BTSParserc           B   s   e  Z d  e e d  Z d   Z d   Z e d  Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   t   summaryc         C   s   d d  l  } | j d t  t j j |   g  |  _ d  |  _ d  |  _	 d  |  _
 d  |  _ d |  _ | |  _ | |  _ | |  _ t |  _ |  _ d  |  _ | r g  |  _ n	 d |  _ t |  _ d  S(   Nis4   BTSParse is Deprecated, report a bug if you see thisi    R   (   t   warningst   warnt   DeprecationWarningt   sgmllibt
   SGMLParsert   __init__t	   hierarchyR   t   lidatat
   lidatalistt   savedatat   titlet   bugcountR   t   cgit	   followupsR{   t	   inbuglistt   intrailerinfot   bugtitlet   preblockt   endh2(   t   selfR   R4  R5  R(  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyR-    s&    												c         C   s%   |  j  d  k	 r! |  j  | 7_  n  d  S(   N(   R1  R   (   R;  t   data(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   handle_data  s    c         C   s   d |  _  d  S(   NR   (   R1  (   R;  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   save_bgn  s    c         C   s;   |  j  } | r. | r. d j | j    } n  d  |  _  | S(   Nt    (   R1  R   R   R   (   R;  R   R<  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   save_end  s
    		c         C   s#   |  j    |  j |  _ d |  _ d  S(   NR2  (   R>  R   t   oldmode(   R;  t   attrs(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   start_h1  s    
c         C   s   |  j    |  _ |  j |  _ d  S(   N(   R@  R2  RA  R   (   R;  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   end_h1  s    c         C   s$   |  j  r |  j   n  |  j   d  S(   N(   R/  t   check_liR>  (   R;  RB  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   start_h2  s    	 c         C   sP   |  j  d k rC |  j   } d | k rC |  j j | g  f  qC n  t |  _ d  S(   NR'  t   bug(   R   R@  R.  R   Rt   R:  (   R;  t	   hiertitle(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   end_h2  s
    c         C   sQ   |  j  d k rM x; | D]0 \ } } | d k r | d k r t |  _ q q Wn  d  S(   NR'  t   classR%  (   R   Rt   R6  (   R;  RB  t   kt   v(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   start_ul  s    c         C   s#   |  j  r |  j   n  t |  _  d  S(   N(   R6  RE  R{   (   R;  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   end_ul  s    	c         C   sf   |  j  d k r d |  _ nG |  j  d k rb |  j rb |  j rb |  j   |  _ t |  _ |  j   n  d  S(   NR2  R   R'  (   R   R1  R6  R7  R@  R8  Rt   R>  (   R;  RB  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   do_br  s    "	c         C   s"  |  j  d k r|  j s0 |  j   |  _ d } n |  j   } t j d |  } | r |  j } t j d | d  } t |  d k r d | d | j d  | d f } q | j	 d  r | d	  } n  d
 | | j d  f } n	 |  j } |  j
 j |  |  j d 7_ t |  _ |  _ n  d  S(   NR'  R   s$   fixed:\s+([\w.+~-]+(\s+[\w.+~:-]+)?)s   :\s+i   s   %s [FIXED %s]: %si    R  is   %s [FIXED %s](   R   R7  R@  R8  t   ret   searchR   R  t   groupR   R0  R   R3  R{   R/  (   R;  t	   trailinfot   matchR2  R!  t   buginfo(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyRE    s&    			$	c         C   sq   |  j  d k rm |  j rm |  j r. |  j   n  t |  _ |  j rW |  j d d |  _ n	 g  |  _ |  j   n  d  S(   NR'  ii   (   R   R6  R/  RE  Rt   R.  R0  R>  (   R;  RB  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   do_li  s    	 			c         C   s=   |  j  r |  j s/ d Sn |  j r/ |  j r/ d S|  j   d S(   s!   Save <pre> when we follow a </h2>N(   R5  R:  R4  R9  R>  (   R;  RB  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt	   start_pre  s    		  c         C   s   |  j  r` |  j s d  St |  _ |  j d  } |  j sM |  j j d |  q |  j j |  n' |  j oo |  j s |  j d  |  _ n  d  S(   Ni   i    (   R5  R:  R{   R@  R4  R9  t   insertR   (   R;  t   stuff(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   end_pre   s    		 		c   	      C   sN  |  j  s d  Sg  } g  } t j d  } t j d  } x |  j  D] \ } } d | k rr | j | | f  qA n  g  } x: | D]2 } | j |  r | j |  q | j |  q W| rA d j | j   d   } t |  d k r | d t |  7} n
 | d 7} | j | | f  qA qA W| rJd t |  | f g | |  _  n  d  S(	   Ns   \[FIXED ([^\]]+)\]t   ResolvedR?  ii   s
    (%d bugs)s    (1 bug)s+   Bugs fixed in subsequent releases (%d bugs)(   R.  RP  t   compileR   RQ  R   R   R  (	   R;  t   newhierarchyR   t   fixedfindert   resolvedfinderR2  t   buglistR%  RG  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt
   reorganize,  s.    	
(   R   R   R{   R-  R=  R>  R@  RC  RD  RF  RI  RM  RN  RO  RE  RV  RW  RZ  Ra  (    (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyR&    s    														c         C   sp  t  | | |  } | s d  St d | d |  } x | D] } | j |  q8 W| j   y d  | j j _ Wn n X| j   | j }	 d |  | j	 f }
 | s |	 g }	 n  g  } x |	 D] } | j
 d  } t j d | d t j t j B } d } | rd | j d	  } n  d j | d	  j   } | s:q n  | | t j } | j |  q W| sfd  S|
 | f S(
   NR4  R5  s   #%d: %ss   

s   ^Date: (.*)$i    R   s	   Date: %s
i   (   R   R   R&  t   feedt   closeR   t   _sockt   recvR9  R2  R   RP  RQ  t   Mt   IRR  R   t   rstripR   t   linesepR   (   R	  R   R   R   R5  R4  t   paget   parsert   linet   itemsR2  t   outputRY  t   partsRT  t   date_submittedt   item(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   parse_html_reportN  s>    

	#c         C   s  t  | | |  } | s d  St j | j    } y d  | j j _ Wn n X| j   t	 j
 | t  } d } g  }	 xK| D]C}
 |
 s n  |
 j d  } | s | } n  |
 j d  } |
 j d  } d } } xB |
 j   D]4 } | j   d k r | r | j d  t  } q q W| r7| d | t j f 7} n  | rc| | k rc| d | t j f 7} n  | r| d | t j f 7} n  | r| t j 7} n  | | j d	  t j 7} |	 j |  q} W|	 sd  Sd
 |  | f } | |	 f S(   NR   t   Subjectt   Datet   Froms
   text/plains
   From: %s%ss   Subject: %s%ss
   Date: %s%ss   
s   #%d: %s(   R   R   t	   cStringIOt   StringIOt   readR   Rd  Re  Rc  t   mailboxt   UnixMailboxR	   R   t   walkt   get_content_typet   get_payloadRt   R   Ri  Rh  R   (   R	  R   R   R   R5  Rj  t	   wholefileR  R2  Rn  t   messageR   t   datet   fromhdrR   t   entryt   part(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   parse_mbox_reporty  sL    
	
c         C   s)  y+ t  t | |  | | d | | |  } Wn t  n X| sE d St d t  } xT | D]L }	 y |	 j d  }	 Wn# t k
 r |	 j d d  }	 n X| j |	  q[ W| j	   y d  | j
 j _ Wn n X| j	   | j   y | j j d g  f  Wn n X| j | j | j f }
 ~ |
 S(   NR   i    R4  s   utf-8R   s   Select bugs(   i    NN(   R   R  R   R   R&  Rt   R   t   UnicodeDecodeErrorRb  Rc  R   Rd  Re  Ra  R.  t   removeR3  R2  (   R   R   R  R   R
  R  R   Rj  Rk  Rl  R<  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   get_cgi_reports  s8    



c         C   s=   t  |   }  t | |  d d d t } t |  | | | |  S(   NR
  R  R  (   t   intR  Rt   R  (   R	  R   R  R   R
  R5  R   (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   get_cgi_report  s    c         C   sX   | rD t  |  j d  } x( | D] } | j |  r  | | Sq  Wn  t  |  j d d  S(   NR    R   R   (   R  R   t   has_key(   R  R    t
   alternatest   mirror(    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyR    s    c      	   C   s  | d k r t  |  t  rE | r* d } n d } t j | |   }	 n t t |   }	 t j |	  }
 t t  } x" |
 D] } | | j	 j
 |  qv Wg  } x8 t D]0 } | | k r | j
 d | | | f  q q Wt |	  d |  | f St  |  t  rt | j d  rPy% t |  | | | | | d | } Wn t  n X| rP| Sn  t | |  | |  } y t | | |  } Wn t  n X| sd St   } x | D] } | j |  qW| j   y d  | j j _ Wn n X| j   | j | j | j f Sg  } g  |  D] } t |  ^ q}  |  j   xK |  D]C } t | | | | | |  } | r9| \ } } | j
 |  q9q9Wd	 } t |  } d
 | f g } | | | f S(   NR   R  R   s   Bugs with severity %ss   Bug reports for %sR   R   i    s   Multiple bug reportst   Reports(   i    NN(   t
   isinstancet
   basestringt	   debianbtst   get_bugst   mapR  t
   get_statusR    t   listR   R   t   SEVLISTR  R  R   R  R   R  R   R   R&  Rb  Rc  R   Rd  Re  R3  R2  R.  t   sortt
   get_report(   R   R   R  R    R   R   R
  R  t
   pkg_filterR%  t   statst   dt   st   hiert   sevt   resultR   Rj  Rk  Rl  t   this_hierarchyR   RG  R2  R   R3  R.  (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   get_reports  sl    	"
 
	


c         C   so  t  |   }  | d k r t j |   d } t j |   } g  }	 x | D] }
 t j j   } | j |
 d  | j   } g  } xD d d d g D]3 } | | k r | j	 | d | j
 |   q q W|	 j	 d j t |   d	 |
 d
  qG W| |	 f St | j
 d  r7t |  | | | | |  } | r7| Sn  t | |  |  } | sSd  St |  | | | | d t S(   NR   i    t   headerRt  Rs  Ru  s   : s   
s   

R   R   R4  (   R  R  R  t   get_bug_logR   Rk  t
   FeedParserRb  Rc  R   R   R   t   sortedR  R  R  R   Rr  R{   (   R	  R   R  R    R   R
  R5  t   statust   logt   bodiest   lt   ft   ht   hdrst   iR  R   (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyR  B  s0    %,
  (   s   breaks unrelated softwaresl   breaks unrelated software on the system
    (packages that have a dependency relationship are not unrelated)(   s   breaks the whole systemse   renders the entire system unusable (e.g.,
    unbootable, unable to reach a multiuser runlevel, etc.)(   s   causes serious data losss0   causes loss of important, irreplaceable
    data(   s   root security holes   introduces a security hole allowing access to
    root (or another privileged system account), or data normally
    accessible only by such accounts(   s   unknowns   not sure, or none of the above(   s   renders package unusables   renders the package unusable, or mostly
    so, on all or nearly all possible systems on which it could be installed
    (i.e., not a hardware-specific bug); or renders package uninstallable
    or unremovable without special effort(   s   causes non-serious data losssn   causes the loss of data on the system
    that is unimportant, or restorable without resorting to backup media(   s   user security holes_   introduces a security hole allowing access to
    user accounts or data not normally accessible(   s   unknowns   not sure, or none of the above(   R   s   g++R   R   R   R   R   R   R   s   pythons   python-bases   x-window-system-cores   x-window-system(Y   Ra   R~   Ry  R   t   email.parsert   email.ErrorsRv  R+  t   globR   RP  t   timeR  R   t   pprintR  t   collectionsR    R   t
   exceptionsR   t   urlutilsR   R	   t	   ExceptionR
   t
   SEVERITIESt   JUSTIFICATIONSt	   JUSTORDERt   SEVERITIES_gnatsR  R   t   debothert   progenyotherRt   R   R   R   R   R   R   R   R   R   R   R{   R  t   CLASSESt	   CLASSLISTR   R   R   t   MODE_NOVICER  R  R  R  R  R  R  R  R#  t   origint   fileR   t   patht   basenameR  R   Rl  R   R  t   contentR  R   R   R  t
   ValueErrorRc  t   IOErrorR,  R&  Rr  R  R  R  R  R  R  (    (    (    s5   /usr/lib/python2.7/dist-packages/reportbug/debbugs.pyt   <module>   s  	
    
   



	x				
  




		
+8+		T