a
    K56aòÓ  ã                (   @   s  d dl m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 mZ d dlmZmZ d dlmZ dd	„ ZG d
d„ deƒZdddddddddœZdddœZg d¢g d¢dœZddddœZg d¢Zd®d d!„Z d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIœ'Z!dJdKiZ"d¯dMdN„Z#d°dOdP„Z$e %dQ¡Z&d±dRdS„Z'd²dTdU„Z(d³dVdW„Z)dXdY„ Z*dZd[„ Z+d\d]„ Z,d^d_„ Z-d`dadbe!dcddge'e#e$e(e)deœdfdge+dhœ	didjdke,dlœdmdndodpœdqœZ.drdsdtduœZ/g du¢Z0dvdwiZ1dvdwiZ2dxdydzd{d|d}d~dd€dœ	Z3d‚ej4fdƒd„„Z5d…d†„ Z6d´d‡dˆ„Z7dµd‰dŠ„Z8d¶d‹dŒ„Z9d·ddŽ„Z:d¸dd„Z;d¹d‘d’„Z<d“d”„ Z=e d•¡D ]0Z>ze?e>d–d—Z@ejA Be>¡ZCe. DeCi dLi dd˜œ¡e.eC< e@D ]ÎZEz²eE Fd™d ¡\ZGZHeG I¡ ZGeH J¡ ZHeGdškr*eHe.eC d›< nveGdœkr e=eHƒ\ZKZLeKe.eC d< eKdkr|džeL dŸ e.eC d < d¡eL e.eC d¢< n$eKdkkr de.eC d < eLe.eC d¢< n W n eMy¶   Y n0 qìe@ N¡  W n eOyÚ   Y n0 q¬dºd£d¤„ZPd»d¥d¦„ZQd¼d§d¨„ZRd½dªd«„ZSd¾d¬d­„ZTdS )¿é   )Úutilsé    N)Údefaultdict)Úcheckversions)Ú	NoNetworkÚQuertBTSError)Úopen_urlc                 C   s*   zt  | ¡W S  t jjy$   Y dS 0 d S )NÚ )ÚemailZmessage_from_fileÚerrorsZMessageParseError)Úfp© r   ú3/usr/lib/python3/dist-packages/reportbug/debbugs.pyÚ
msgfactory/   s    r   c                   @   s   e Zd ZdS )ÚErrorN)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   8   s   r   z°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.zµ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.a(  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 deserving a serious severity you can refer to this webpage:
    http://release.debian.org/testing/rc_policy.txt .z{a bug which has a major effect on the usability
    of a package, without rendering it completely unusable to
    everyone.z_a bug that stops the package from being built
    from source.  (This is a 'virtual severity'.)z‡a bug that does not undermine the usability of the
    whole package; for example, a problem with a particular option or
    menu item.zthings like spelling mistakes and other minor
    cosmetic errors that do not affect the core functionality of the
    package.z*suggestions and requests for new features.)ÚcriticalÚgraveÚseriousÚ	importantúdoes-not-buildÚnormalÚminorÚwishlist))úbreaks unrelated softwarezlbreaks unrelated software on the system
    (packages that have a dependency relationship are not unrelated))úbreaks the whole systemzerenders the entire system unusable (e.g.,
    unbootable, unable to reach a multiuser runlevel, etc.))úcauses serious data lossz0causes loss of important, irreplaceable
    data)úroot security holez”introduces a security hole allowing access to
    root (or another privileged system account), or data normally
    accessible only by such accounts©Úunknownznot sure, or none of the above))úrenders package unusablezè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)úcauses non-serious data losszncauses the loss of data on the system
    that is unimportant, or restorable without resorting to backup media)úuser security holez_introduces a security hole allowing access to
    user accounts or data not normally accessibler    )r   r   )r   r   r   r   r!   )r"   r#   r$   r!   z‚The product, component or concept is completelynon-operational or some essential functionality is missing.  Noworkaround is known.zÃ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.zœThe product, component or concept is workingin general, but lacks features, has irritating behavior, doessomething wrong, or doesnt match its documentation.)r   r   únon-critical)
r   r   r   r   r   r   r%   r   r   ZfixedÚdebbugsc                 C   s@   |dkrddi  | | ¡S |dkr8ddddddœ  | | ¡S | S dS )	z!Convert severity names if needed.r&   r%   r   Zgnatsr   r   )r   r   r   r   r   N)Úget)ÚseverityÚtyper   r   r   Úconvert_severity•   s    üür*   z)The bug tracking system, @bugs.debian.orgz3Problems and requests related to the Debian Builddsz2Problems related to building packages for EmdebianzCD Image issueszInstallation systemz8Issues involving Debian images for public/private cloudszKIssues with the Debian Contributors Website and coordination of maintenancezNIssues regarding the d-i.debian.org service and general Debian Installer taskszBRequests regarding Internationalization (i18n) of the distributionz)General problems with Debian Live systemsz7Problems with the FTP site and Package removal requestsz4General problems (e.g. "many manpages are mode 755")z6Reports of installation problems with stable & testingz*Issues with the jenkins.debian.org servicez,The mailing lists, debian-*@lists.debian.orgzGIssues with the Debian Manpages Website and coordination of maintenancez"Problems with the official mirrorsz-New Member process and nm.debian.org webpagesz"The Debian Package Entropy Trackerz+Issues with the piuparts.debian.org servicezPress release issuesz*Problems related to project administrationzThe Quality Assurance groupz9Requests regarding Debian releases and release team toolszProblems with the Release NoteszVIssues in the operation of the Debian RTC services which are not package-specific bugszThe Debian Security Bug TrackerzThe Debian Security Teamz,Issues with the snapshot.debian.org service z8Spam (reassign spam to here so we can complain about it)z+Requests for package review and sponsorshipzAProblems and requests related to the Debian Single Sign On systemz<Problems and requests related to the DebConf Summit instancez5The Debian Technical Committee (see the Constitution)zJIssues with the Debian Package Tracker and coordination of its maintenancez0Reports of upgrade problems for stable & testingzProblems with the Debian wikiz*Work-Needing and Prospective Packages listzProblems with the WWW site)'zbugs.debian.orgzbuildd.debian.orgzbuildd.emdebian.orgzcdimage.debian.orgZcdromzcloud.debian.orgzcontributors.debian.orgzd-i.debian.orgzdebian-i18nzdebian-liveúftp.debian.orgZgeneralúinstallation-reportszjenkins.debian.orgzlists.debian.orgzmanpages.debian.orgÚmirrorsznm.debian.orgzpet.debian.netzpiuparts.debian.orgZpressZprojectzqa.debian.orgúrelease.debian.orgzrelease-noteszrtc.debian.orgzsecurity-trackerzsecurity.debian.orgzsnapshot.debian.orgZspamzsponsorship-requestszsso.debian.orgzsummit.debconf.orgz	tech-ctteztracker.debian.orgúupgrade-reportszwiki.debian.orgÚwnppzwww.debian.orgzdebian-generalzAny non-package-specific bugTc              =   C   s  d } } }	 }
}d}g }g }d}|j dddddd	d
dddddœ
ddd}|s^| d¡ t‚d}|dkrnd S d}| |¡} | sŽ| d¡ d S | d¡ t | ¡}|d }d}|sÒt | ¡}|rÒt |d d ¡}|s| dddddœ¡}|d krt	 
d¡ n|d! |d"  }
}|d#kr¬| d$¡ | d%¡ |j d&ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'œ:d(|
dd)}|sÆ|
}|j d*dddddd+œd,|dd)}|sð|}||
kr6||kr6| d-d.d/d0dœ¡}|d kr6| d1¡ t	 
d¡ ||krT| d2¡ | d3¡ |j d4dddd5œd6d7dd)}|szd7}|d7kr–d8| |||f }nd9| ||f }d:}nF|j d;d<d=d>d?d@dAdBdCdDœdEddd)}|sÜd}|dFvrú| dG¡ | dH¡ dI}| |¡}|sd S | dJddKdLdœ¡}|dMkrRdN}| |¡}	|	sR| dO¡ t‚|dPkrt|	rt| dQ¡ d}dR}|	rª|dkr˜dS| ||	||f }ndT| |	||f }n*|dkrÆdU| |||f }ndV| ||f }|dPkrò| dW¡ t	 
d¡ ||||||fS )XNr	   ÚunstableTú®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.)z(Package removal - Request Of Maintainer.z+Package removal - Requested by the QA team.z$Package removal - Request of Porter.z(Package removal - Not Built [by] Source.z1Package removal - Never Part Of A Stable Release.z,Package removal - Newer Version In Unstable.z5Package removal - Architecture Not Allowed In Source.z*Package removal - Internal Compiler Error.zChange override request.z5Not a package removal request, report other problems.)
ZROMZRoQAZROPZNBSZNPOASRZNVIUZANAISZICEÚoverrideÚotherúChoose the request type: ©Úempty_okzOTo report a bug in a package, use the name of the package, not ftp.debian.org.
r   r4   zHPlease enter the name of the package (either source of binary package): z@You seem to want to report a generic bug, not request a removal
úChecking status database...
r   Fr   ú/This package doesn't appear to exist; continue?ÚyNú!Ignore this problem and continue.úExit without filing a report.©ÚyÚnr?   é   é
   r3   z(User: ftp.debian.org@packages.debian.orgzUsertags: overridezSelect the new section):Zadminzcli-monoZcommZdatabasezdebian-installerÚdebugZdevelÚdocZeditorsZ	educationZelectronicsZembeddedZfontsZgamesZgnomezgnu-rZgnustepZgolangZgraphicsZhamradioZhaskellZhttpdZinterpretersZintrospectionÚjavaZ
javascriptZkdeZkernelZlibdevelZlibsZlispZlocalizationZmailZmathZmetapackagesZmiscZnetZnewsZocamlZoldlibsZ	otherosfsZperlZphpÚpythonZrubyZrustZscienceZshellsZsoundZtexÚtextr   ZvcsZvideoZwebZx11ZxfceÚzopezChoose the section: ©Údefaultr7   zSelect the new priority)Úrequiredr   ÚstandardZoptionalZextrazChoose the priority: znYou didn't change section nor priority: is this because it's ftp.debian.org override file that needs updating?ÚYnz+ftp.debian.org override file needs updatingzNo, it's not the override filez3There's nothing we can do for you, then; exiting...z*X-Debbugs-Cc: debian-boot@lists.debian.orgz2Your report will be carbon-copied to debian-boot.
z9Is this request for an archive section other than "main"?)ÚmainZcontribznon-freezChoose the archive section: rM   zoverride: %s:%s/%s %szoverride: %s:%s/%sz*(Describe here the reason for this change)z;Is the removal to be done in a suite other than "unstable"?zOld stable.zOld stable proposed updates.zStable.zStable proposed updates.zTesting only (NOT unstable)zTesting proposed updatesZUnstablezExperimental.)Ú	oldstablezoldstable-proposed-updatesÚstablezstable-proposed-updatesÚtestingztesting-proposed-updatesr1   ÚexperimentalúChoose the suite: )rP   r1   rQ   z-X-Debbugs-Cc: debian-release@lists.debian.orgz5Your report will be carbon-copied to debian-release.
z%Please enter the reason for removal: z3Is this removal request for specific architectures?z3This is a partial (specific architectures) removal.z&This removal is for all architectures.r>   ú1Please enter the arch list separated by a space: z<Partial removal requests must have a list of architectures.
rP   z_Partial removal for testing; forcing suite to 'unstable', since it's the proper way to do that.zŒ(please explain the reason for the removal here)

Note: this was a request for a partial removal from testing, converted in one for unstablezRM: %s/%s [%s] -- %s; %szRM: %s [%s] -- %s; %szRM: %s/%s -- %s; %szRM: %s -- %s; %szDPlease use release.debian.org pseudo-package and report a bug there.)ÚmenuÚlong_messageÚ
SystemExitÚ
get_stringÚlog_messager   Úget_package_statusÚget_source_packageÚselect_optionsÚsysÚexitÚappend)ÚpackageÚbtsÚuiÚfromaddrÚtimeoutÚonlineÚ
http_proxyÚbodyÚreasonÚarchsZsectionZpriorityÚsuiteÚheadersÚpseudosÚqueryÚtagr(   ÚpromptÚinfoÚ	availableÚcontZnew_sectionZnew_priorityZarch_sectionÚsubjectZwhyÚpartialr   r   r   Úhandle_debian_ftpÓ   s>   öò





ÿþ




ïîûúÿý





ýü
ø	ö



ÿþ








rt   c           )         sþ  d}g }g }	d}
d }d }t jd }|d }|d }|d }t jd }|d }|d }|d }t jd }|jd	d
ddddddd|d| |d| ddddiddd}|s²| d¡ t‚d}|dkrÂd S |dkrî| d¡}|sì| d¡ t d¡ n¨d}| |¡} | s| d¡ d S | d ¡ t  	| ¡}|d }d!}
|sXt  
| ¡}|rXt  	|d" d" ¡}|sˆ| d#d$d%d&d'œ¡}|d(kr–t d¡ n|d) p”| } |d
d||dfv r\|o¶|d" }|r| d¡rz(tt | ||d d*… f¡ ¡ ƒd" }W n ty   Y n0 |r4| d+| d,d-d.d'œ¡}|d(kr4d }|s\| d/¡}|s\| d0| ¡ d S |d1v rº| d2d$d3d4d'œ¡}|d5krº|dkrœ| d6¡ t‚d7}| |¡}|sº| d8¡ |d
kr|jd9|d|d|d|d|d|d|dd:dd;di	d<d:dd=}|sd:}|	 d>¡ | d¡r>|	 d?¡ |	 d@|d d*…  ¡ n|	 dA| ¡ |d
krˆ| dB¡}dC| |f } dD| ||pzdE||f }nf|dkrndF|  } dG}dH}!dH}"dH}#| dI¡ dJ}| |¡}$|$rØdK}| |¡}%nd }%|$rR|%rRdLdM„ ‰ ‡ fdNdO„|$ ¡  ¡ D ƒ}&‡ fdPdO„|% ¡  ¡ D ƒ}'dQj}(dR|(|&|' ƒ }!dR|(|'ƒ }"dR|(|&ƒ }#|t dS| |!|"|#f ¡7 }n€|dkr‚|} d}nl|dkr®dT| |f } t dU| | |f ¡}n@| d¡rÔdV|| |f } t dW¡}n|dkrîdX| |f } dY}| |||	||
fS )ZNr	   TrN   z-puz
-backportsz	-securityrO   rP   r2   ÚbinnmuzbinNMU requestsZbritneyztesting migration script bugsZ
transitionztransition trackingZunblockzunblock requestsz%s proposed updates requestsÚrmzStable/Testing removal requestsr4   zNone of the other optionsr5   r6   zSTo report a bug in a package, use the name of the package, not release.debian.org.
r   z,Please enter the subject of the bug report: zNo subject specified, exitingr   z&Please enter the name of the package: z*You seem to want to report a generic bug.
r8   Fr   r9   r:   r;   r<   r=   r?   é   éýÿÿÿz7Latest version seems to be %s, is this the proper one ?rL   zThis is the correct versionzEnter the proper versionz)Please enter the version of the package: z5A version is required for action %s, not sending bug
)ru   rv   z+Is this request for specific architectures?z3This is a partial (specific architectures) request.z&This request is for all architectures.r>   a  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.rS   z&No architecture specified, skipping...z/For which suite are you requesting this binNMU?r1   rQ   rR   rH   z,User: release.debian.org@packages.debian.orgzUsertags: puzTags: %szUsertags: %szbinNMU changelog entry: z
nmu: %s_%sznmu %s_%s . %s . %s . -m "%s"
ÚANYztransition: %sz(please explain about the transition: impacted packages, reason, ...
 for more info see: https://wiki.debian.org/Teams/ReleaseTeam/Transitions)
z
<Fill out>aC  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 further reference, please refer to http://ben.debian.net/ .zMPlease enter old binary package name of the library (or a regex matching it):zMPlease enter new binary package name of the library (or a regex matching it):c                 S   s   | d dkr| pd|  S )Nr   ú/z"%s"r   )Úxr   r   r   Ú<lambda>1  ó    z'handle_debian_release.<locals>.<lambda>c                    s   g | ]}ˆ |ƒ‘qS r   r   ©Ú.0r{   ©Zquoter   r   Ú
<listcomp>3  r}   z)handle_debian_release.<locals>.<listcomp>c                    s   g | ]}ˆ |ƒ‘qS r   r   r~   r€   r   r   r   4  r}   z | .depends ~ z.depends ~ z¢
               Ben file:

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

               zunblock: %s/%saP                  Please unblock package %s

                (Please provide enough (but not too much) information to help
                the release team to judge the request efficiently. E.g. by
                filling in the sections below.)

                [ Reason ]
                (Explain what the reason for the unblock request is.)

                [ Impact ]
                (What is the impact for the user if the unblock isn't granted?)

                [ Tests ]
                (What automated or manual tests cover the affected code?)

                [ Risks ]
                (Discussion of the risks involved. E.g. code is trivial or
                complex, key package vs leaf package, alternatives available.)

                [ Checklist ]
                  [ ] all changes are documented in the d/changelog
                  [ ] I reviewed all changes and I approve them
                  [ ] attach debdiff against the package in testing

                [ Other info ]
                (Anything else the release team should know.)

                unblock %s/%s
                z%s: package %s/%saø                  (Please provide enough information to help the release team
                to judge the request efficiently. E.g. by filling in the
                sections below.)

                [ Reason ]
                (Explain what the reason for the (old-)stable update is. I.e.
                what is the bug, when was it introduced, is this a regression
                with respect to the previous (old-)stable.)

                [ Impact ]
                (What is the impact for the user if the update isn't approved?)

                [ Tests ]
                (What automated or manual tests cover the affected code?)

                [ Risks ]
                (Discussion of the risks involved. E.g. code is trivial or
                complex, alternatives available.)

                [ Checklist ]
                  [ ] *all* changes are documented in the d/changelog
                  [ ] I reviewed all changes and I approve them
                  [ ] attach debdiff against the package in (old)stable
                  [ ] the issue is verified as fixed in unstable

                [ Changes ]
                (Explain *all* the changes)

                [ Other info ]
                (Anything else the release team should know.)
                z	RM: %s/%sz*(explain the reason for the removal here)
)r   ZSUITE2CODENAMErT   rU   rV   rW   r\   r]   rX   rY   rZ   r[   ÚendswithÚlistr   Zget_versions_availableÚvaluesÚ
IndexErrorr^   ÚstripÚsplitÚjoinÚtextwrapÚdedent))r_   r`   ra   rb   rc   rd   re   rf   rj   rk   rl   rh   ÚversionrN   Zoldstable_puZoldstable_backportsZoldstable_securityrO   Z	stable_puZstable_backportsZstable_securityrP   rm   r(   Zsubject_britneyrn   ro   rp   rq   rs   ri   rg   rr   ZaffectedZgoodZbadZtfromZttoZlistbadZlistgoodÚjr   r€   r   Úhandle_debian_release‹  sB   


ø	ô







ÿþ
(ÿþ


ÿþ





÷
ö







	
÷


ã 
r   a`      * 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 }
d}|j ddddddd	œd
dd}|sD| d¡ t‚d} | s‚|dv rZd}nd}| |¡} t | ¡sH| d¡ d} qH| d¡ tj| dd}|d }d}|dv rP|rê|rÊtj	| d||drê|j
d|  ddddsêt d¡ d}d}|s| d¡}qò|dkrB|
 d ¡ |
 d! tj tj |¡¡¡¡ | d"¡ ttƒ  }n&|d#v rvd}d$}|sŠt | ¡}|rŠt |d d ¡}|sÂ| d%d&d'dd(œ¡}|d)kr¸t d¡ d }}n$|d* pÎd}|d+ pÜ| } |d, }|d-kr|r|d. d/v rd0}|d1kr&|
 d ¡ | d2¡ |rfd3}|d4kr@d5}n|d1krNd6}d7|| f }|| d8 }|
 d9| › ¡ |rŒd:|| |f }nd;|| f }|||	|
||fS )<Nr	   Tr2   zOThe package has been `Orphaned'. It needs a new maintainer as soon as possible.a+  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.zÜThis is a `Request For Help'. The current maintainer wants to continue to maintain this package, but they need some help to do this because their time is limited or the package is quite big and needs several maintainers.zrThis is an `Intent To Package'. Please submit a package description along with copyright and URL in such a report.zÚ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.)ÚOÚRFAÚRFHÚITPÚRFPr5   r6   zETo report a bug in a package, use the name of the package, not wnpp.
)r’   r‘   z(Please enter the proposed package name: zPlease enter the package name: zInvalid package namer8   )Zavailr   r   )r‘   r’   Ú0)re   zQA package called %s already appears to exist (at least on your system); continue?z–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.r<   r   )rI   r   zpPlease briefly describe this package; this should be an appropriate short description for the eventual package: r‘   z+X-Debbugs-Cc: debian-devel@lists.debian.orgz	Owner: {}zFYour report will be carbon-copied to debian-devel, per Debian policy.
)rŽ   r   r   Fr9   r:   r;   r=   r?   é   rw   é   rŽ   é	   )rJ   r   rK   r   r   zGYour request will be carbon-copied to debian-devel, per Debian policy.
zintend to orphanr   zrequest an adopter forz#request assistance with maintainingz2I %s the %s package.

The package description is:
Ú
zControl: affects -1 src:z%s: %s -- %sz%s: %s)rT   rU   rV   rW   r   Zcheck_package_namerX   rY   r   Zcheck_availableZyes_nor\   r]   r^   Úformatr
   ÚheaderZmake_headerZdecode_headerÚitp_templateÚvarsrZ   r[   )r_   r`   ra   rb   rc   rd   re   Ú
short_descrf   rj   rk   rl   rm   rn   ro   rp   r(   rq   Z	long_descZorphstrrr   r   r   r   Úhandle_wnpp¨  sÀ    û÷






ÿÿú
ÿ

ÿ


ÿþ


ÿ




ÿr   c              	   C   st   d }}g }	g }
d}d}d}|  d¡p(d}|  d¡p6d}|  d¡pDd}t d	|› d
|› d|› d¡}|||	|
||fS )Nr	   Tz9How did you boot the installer (CD/DVD/USB/network/...)? z/<boot method (CD/DVD, USB stick, network, etc.>zMWhat image did you use to install? (If you can, give its URL and build date) z*<Full URL to image you downloaded is best>z/Describe your machine (manufacturer and type): z-<Description of machine (manufacturer, type)>z»        (Please provide enough information to help the Debian
        maintainers evaluate the report efficiently - e.g., by filling
        in the sections below.)

        Boot method: z
        Image version: z@
        Date: <Date and time of the install>

        Machine: añ  
        Partitions: <df -Tl will do; the raw partition table is preferred>


        Base System Installation Checklist:
        [O] = OK, [E] = Error (please elaborate below), [ ] = didn't try it

        Initial boot:           [ ]
        Detect network card:    [ ]
        Configure network:      [ ]
        Detect media:           [ ]
        Load installer modules: [ ]
        Clock/timezone setup:   [ ]
        User/password setup:    [ ]
        Detect hard drives:     [ ]
        Partition hard drives:  [ ]
        Install base system:    [ ]
        Install tasks:          [ ]
        Install boot loader:    [ ]
        Overall install:        [ ]

        Comments/Problems:

        <Description of the install, in prose, and any thoughts, comments
              and ideas you had during the initial install.>


        Please make sure that any installation logs that you think would
        be useful are attached to this report. Please compress large
        files using gzip.
        )rW   r‰   rŠ   )r_   r`   ra   rb   rc   rd   re   rœ   rf   rj   rk   rl   r(   rr   Z
bootmethodZimageÚmachiner   r   r   Úhandle_installation_report  s.    
ÿ
ÿ
ÿûú	÷
)rŸ   c                 C   s6   d }}g }	g }
d}d}d}t  d¡}|||	|
||fS )Nr	   Ta‚          (Please provide enough information to help the Debian
        maintainers evaluate the report efficiently - e.g., by filling
        in the sections below.)

        My previous release is: <codename or version from which you are upgrading>
        I am upgrading to: <codename or version of the release you are upgrading to>
        Archive date: <Timestamp, available as project/trace/ftp-master.debian.org
             on your mirror or .disk/info on your CD/DVD set>
        Upgrade date: <Date and time of the upgrade>
        uname -a before upgrade: <The result of running uname -a on a shell prompt>
        uname -a after upgrade: <The result of running uname -a on a shell prompt>
        Method: <How did you upgrade?  Which program did you use?>

        Contents of /etc/apt/sources.list:


        - Were there any non-Debian packages installed before the upgrade?  If
          so, what were they?

        - Was the system pre-update a pure sarge system? If not, which packages
          were not from sarge?

        - Did any packages fail to upgrade?

        - Were there any problems with the system after upgrading?


        Further Comments/Problems:


        Please attach the output of "COLUMNS=200 dpkg -l" (or "env COLUMNS ...",
        depending on your shell) from before and after the upgrade so that we
        know what packages were installed on your system.
        )r‰   rŠ   )r_   r`   ra   rb   rc   rd   re   rœ   rf   rj   rk   rl   r(   rr   r   r   r   Úhandle_upgrade_report\  s    
$r    c                  C   sd   t  ¡ } t ¡ d }t  ¡ }| r@|| kr2d|  }qHd| |f }nd| }|rX|d| 7 }|d7 }|S )Né   zArchitecture: %s
zArchitecture: %s (%s)
zArchitecture: ? (%s)
zForeign Architectures: %s
r—   )r   Zget_archÚosÚunameZget_multiarch)ZdebarchÚ
utsmachineZ	multiarchZdebinfor   r   r   Údpkg_infofunc‹  s    
r¥   c                   C   s   t  ¡ tƒ  S ©N)r   Zget_debian_release_infor¥   r   r   r   r   Údebian_infofuncœ  s    r§   c                   C   s   t  ¡ tƒ  S r¦   )r   Úlsb_release_infor¥   r   r   r   r   Úubuntu_infofunc   s    r©   c                  C   s   t  ¡ d } t ¡ d|   S )Nr¡   zArchitecture: %s

)r¢   r£   r   r¨   )r¤   r   r   r   Úgeneric_infofunc¤  s    rª   ZDebianz%s@bugs.debian.orgzhttp://www.debian.org/Bugs/zlinux-imagezkernel-image)r0   r+   r.   r,   r/   )Zgcczg++ZcppZgcjZgpcZgobjcZchillZgijZg77rE   zpython-basezx-window-system-corezx-window-systemz https://bugs.debian.org/cgi-bin/)	Únamer
   ÚbtsrootÚ	otherpkgsZ
nonvirtualZspecialsZdeppkgsÚcgirootÚinfofuncZUbuntuzubuntu-users@lists.ubuntu.comZmailto)r«   r
   r)   r¯   zGUUG (German Unix User Group)z%s@bugs.guug.deF)r«   r
   ú
query-dpkg)ÚdebianZubuntuZguugzUThe problem is a bug in the software or code.  Forexample, a crash would be a sw-bug.z\The problem is in the documentation.  For example,an error in a man page would be a doc-bug.zî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.)zsw-bugzdoc-bugzchange-requestZsecurityz3This problem is a security vulnerability in Debian.z.You are including a patch to fix this problem.z5This bug applies to the upstream part of the package.z<This bug is relevant to the development of debian-installer.z9This bug affects support for Internet Protocol version 6.z<This bug affects support for large files (over 2 gigabytes).z;This bug reports a localization/internationalization issue.z9This bug is relevant to the accessibility of the package.zTThis bug has a known solution but the maintainer requests someone else implement it.z'The package fails to build from source.)	ZpatchZupstreamzd-iZipv6ZlfsZl10nZa11yÚnewcomerZftbfsr	   c                 C   sL   t  ¡ }| dv r| t¡ |tjkr0| t¡ n|tjk rHd|v rH|d= |S )z«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   r²   )ÚTAGSÚcopyÚupdateÚCRITICAL_TAGSr   ZMODE_STANDARDÚEXPERT_TAGS)r(   ÚmodeZtagsr   r   r   Úget_tagsë  s    

r¹   c                 C   s    | rt | ƒdkrdS dS dS d S )NZnoZyes)Ústr)Zsettingr   r   r   Úyn_boolÿ  s
    r»   c                 C   s0   t |   d¡}|r,d|||t|ƒt|ƒf S d S )Nr®   z7%sbugreport.cgi?bug=%d&archived=%s&mbox=%s&mboxmaint=%s)ÚSYSTEMSr'   r»   )ÚsystemÚnumberÚarchivedÚmboxÚ	mboxmaintÚrootr   r   r   Úcgi_report_url  s    ÿrÃ   c           	      C   st   t |   d¡}|sd S |r(d| ¡ i}nd| ¡ i}t|ƒ|d< t|ƒ|d< |r\t|ƒ|d< tj |¡}d||f S )Nr®   ÚsrcÚpkgÚrepeatmergedr¿   r‹   z%spkgreport.cgi?%s)r¼   r'   Úlowerr»   rº   ÚurllibÚparseZ	urlencode)	r½   r_   r¿   ÚsourcerÆ   r‹   rÂ   rl   Zqstrr   r   r   Úcgi_package_url  s    rË   c                 C   s&   t | |ƒ}tj | ¡ ¡}|d|  S )Nzdb/pa/l%s.html)Úget_btsrootrÈ   rÉ   Z
quote_plusrÇ   )r½   r_   r-   rÊ   rÆ   r¬   r   r   r   Úpackage_url(  s    
rÍ   c                 C   s:   t |ƒ}t|ƒdk rd S t| |ƒ}|d|d d… |f  S )Né   zdb/%s/%s.html)rº   ÚlenrÌ   )r½   r¾   r-   r¬   r   r   r   Ú
report_url0  s
    
rÐ   c                 C   s    t | ||||ƒpt| ||||ƒS r¦   )rË   rÍ   )r½   r_   r-   rÊ   r¿   rÆ   r   r   r   Úget_package_url9  s    ÿrÑ   c                 C   s   t | |||ƒpt| ||ƒS r¦   )rÃ   rÐ   )r½   r¾   r-   r¿   rÀ   rÁ   r   r   r   Úget_report_url?  s    
ÿrÒ   c                 C   sZ   |   dd¡}t|ƒdkrd S |\}}| d¡r:|dd … }| d¡rR|d d… }q:||fS )Nú:r   rÎ   z//rz   éÿÿÿÿ)r‡   rÏ   Ú
startswithr‚   )ÚurlÚbitsr)   Zlocr   r   r   Úparse_bts_urlD  s    

rØ   z/etc/dpkg/origins/*Úbackslashreplace)r   )r­   r°   r-   r®   ú: Zvendorr«   Úbugsr)   zhttp://rz   r¬   z%s@r
   c                 C   sî   t |||ƒ}|sd S t||d}| ¡ D ]}| |d ¡ q(| ¡  |j}	d| |jf }
|sb|	g}	g }|	D ]r}| d¡}t 	d|d tj
tjB ¡}d}|r¨d| d	¡ }d |d	d … ¡ ¡ }|sÄqj|| tj }| |¡ qj|sæd S |
|fS )
N)ÚcgiÚ	followupsr—   ú#%d: %sú

z^Date: (.*)$r   r	   z	Date: %s
r   )r   Ú	BTSParserÚ
splitlinesÚfeedÚcloseZpreblockÚtitler‡   ÚreÚsearchÚMÚIÚgrouprˆ   Úrstripr¢   Úlinesepr^   )r¾   rÖ   re   rc   rÝ   rÜ   ÚpageÚparserÚlineÚitemsrä   ÚoutputZstuffÚpartsÚmatchZdate_submittedÚitemr   r   r   Úparse_html_reportu  s4    
rô   c                 C   s,  t |||ƒ}|sd S t |¡}t |t¡}d}g }	|D ]Ö}
|
s>|
 d¡}|sP|}|
 d¡}|
 d¡}d }}|
 ¡ D ] }| ¡ dkrt|st| 	d d¡}qt|r¬|d|t
jf 7 }|rÊ||krÊ|d|t
jf 7 }|rà|d	|t
jf 7 }|rî|t
j7 }|| d
¡t
j 7 }|	 |¡ q6|	sd S d| |f }||	fS )Nr	   ÚSubjectÚDateÚFromz
text/plainTz
From: %s%szSubject: %s%sz
Date: %s%sr—   rÞ   )r   ÚioÚStringIOÚmailboxZUnixMailboxr   r'   ÚwalkZget_content_typeZget_payloadr¢   rë   rê   r^   )r¾   rÖ   re   rc   rÝ   rì   Z	wholefilerÀ   rä   rð   Úmessagerr   ÚdateZfromhdrrf   ÚentryÚpartr   r   r   Úparse_mbox_report›  s@    




r   c                 C   s@   |r0t |   d¡}|D ]}||v r||   S qt |   dd¡S )Nr-   r¬   r	   )r¼   r'   )r½   r-   Z
alternatesZmirrorr   r   r   rÌ   Î  s    rÌ   r±   c              	   C   sÀ  |dkrˆt | tƒrX|r:tj| d}|tjd|  d7 }ntj| d}|tj| d7 }n´g }| D ]ª}	z|t|	ƒg7 }W q` ty   |	 d¡rº|tj|	dd … d7 }|tj|	d7 }nJ|rä|tj|	d7 }|tjd|	 d7 }n |tj|	d7 }|tj|	d7 }Y q`0 q`tt|ƒƒ}t 	|¡}
t
tƒ}|
D ]}||j  |¡ q.g }tD ]&}||v rN| d| || f¡ qNt|ƒd|  |fS t | tƒrPt|  d	¡rÚzt| ||||||d
}W n   t‚Y n0 |rÚ|S t|| ||ƒ}zt|||ƒ}W n   t‚Y n0 |sdS tƒ }| ¡ D ]}| |d ¡ q"| ¡  |j|j|jfS g }dd„ | D ƒ} |  ¡  | D ]0}t||||||ƒ}|rn|\}}| |¡ qnd}t|ƒ}d|fg}|||fS )Nr±   )rÄ   zsrc:)Zaffects)r_   r¡   zBugs with severity %szBug reports for %sr®   )r‹   )r   NNr—   c                 S   s   g | ]}t |ƒ‘qS r   )Úintr~   r   r   r   r   '  r}   zget_reports.<locals>.<listcomp>zMultiple bug reportsZReports)Ú
isinstancerº   Ú	debianbtsZget_bugsr  Ú
ValueErrorrÕ   rƒ   ÚsetÚ
get_statusr   r(   r^   ÚSEVLISTrÏ   r¼   r'   Zget_cgi_reportsr   rÍ   r   rà   rá   râ   rã   Úbugcounträ   Ú	hierarchyÚsortÚ
get_report)r_   rc   r½   r-   r‹   re   r¿   rÊ   rÛ   rÅ   ZstatsÚdÚsZhierZsevÚresultrÖ   rì   rí   rî   Zthis_hierarchyZbugrä   rf   r  r	  r   r   r   Úget_reports×  s€    




ÿ



r  c                 C   sæ   t | ƒ} |dkr–t | g¡d }t | ¡}g }	|D ]Z}
|
d }g }dD ]$}||v rF| |d | |¡ ¡ qF|	 d t|ƒ¡d |
d  ¡ q2||	fS t|  d	¡r¾t	| |||||ƒ}|r¾|S t
|| |ƒ}|sÒd S t| ||||d
dS )Nr±   r   rü   )rö   rõ   r÷   rÚ   r—   rß   rf   r®   F)rÜ   )r  r  r  Zget_bug_logr^   r'   rˆ   Úsortedr¼   Zget_cgi_reportrÐ   rô   )r¾   rc   r½   r-   re   r¿   rÝ   ZstatusÚlogZbodiesÚlÚhZhdrsÚir  rÖ   r   r   r   r  7  s.    
"
ÿr  )r&   )TN)TN)TN)TN)TN)FFF)FFTN)NFT)N)NFFT)NFFT)FT)F)N)r±   NNr	   FF)r±   Nr	   FF)Ur	   r   r\   rú   r
   Zemail.errorsrø   Zglobr¢   rå   Zurllib.requestrÈ   Zurllib.parseZurllib.errorr‰   r  Úcollectionsr   r   Ú
exceptionsr   r   Zurlutilsr   r   Ú	Exceptionr   Z
SEVERITIESZJUSTIFICATIONSZ	JUSTORDERZSEVERITIES_gnatsr  r*   ZdebotherZprogenyotherrt   r   rŠ   rš   r   rŸ   r    r¥   r§   r©   rª   r¼   ZCLASSESZ	CLASSLISTr¶   r·   r³   ZMODE_NOVICEr¹   r»   rÃ   rË   rÍ   rÐ   rÑ   rÒ   rØ   ÚoriginÚopenr   ÚpathÚbasenamer½   r'   rî   r‡   r™   ZcontentrÇ   r†   r)   rÂ   r  rã   ÚIOErrorrô   r   rÌ   r  r  r   r   r   r   Ú<module>   sz  	æóúø
Ù+ÿ
 9
  	

w
=
/üðþÿçûÿÿ÷	
  ÿ
  ÿ

	  ÿ

ý






&
3
	  ÿ
`  ÿ