ó
    z#¶g×!  ã                   óˆ   • S SK r S SKrSSKJr  SSKJr  S SKJr  S SK	J
r
  S SKJr  SrS	rS
 rS rSS jrSS jr   SS jrg)é    Né   )Úutils)Úopen_url)Ú	NoNetwork)ÚDeb822)Údebian_supportz4https://qa.debian.org/madison.php?package=%s&text=onz%https://ftp-master.debian.org/new.822c                 óL   • U (       a  U(       d  g[         R                  " X5      $ )a˜  
Compare package version strings

This is a wrapper around `debian_support.version_compare()` that
returns 0 if one if the versions is empty.

Parameters
----------
current : str
    version assumed to be currently installed
upstream : str
    version assumed to be available upstream

Returns
-------
int
    1 if upstream is newer than current, -1 if current is
    newer than upstream, and 0 if the same.
r   )r   Úversion_compare)ÚcurrentÚupstreams     Ú9/usr/lib/python3/dist-packages/reportbug/checkversions.pyÚcompare_versionsr   )   s   € ö( ž(ØÜ×)Ò)¨(Ó<Ð<ó    c                 ó(   • [        X5      S:”  a  U$ U $ )a,  
Pick the later version of two version strings

This is a helper function originally used in
:func:`get_incoming_version()`, but currently not used.

Parameters
----------
a : str
    first package version
b : str
    second package version

Returns
-------
str
    the later (higher) version string
r   )r   )ÚaÚbs     r   Úlater_versionr   B   s   € ô& ˜Ó Ó!ØˆØ€Hr   c                 óv  • [         R                  " 5       n[        U -  nU(       a  USSR                  U5      -   -  nUSU-   -  n [	        XSU5      nU(       d  0 $ UR                  SS5      R                  5       n0 n	UR                  S	5       HC  n
 U
R                  S
5      u  p¼pÞUS:X  a  M   [         R                   R#                  XÝ5      nXÉU'   ME     U	$ ! [
         a    0 s $ [        R                  R                   a%  n[        SU[        R                  S9  0 s SnA$ SnAff = f! [         a     M©  f = f)aÒ  
Get package versions available.

If `dists` is not given, get versions from all dists known to the
version lookup service at https://qa.debian.org/madison.php

Parameters
----------
package : str
    package name
timeout : int
    connection timeout in seconds
dists : (str, ...), optional
    tuple of dist names ('stable', 'testing' etc.) to check
http_proxy : str, optional
    http proxy url
arch : str, optional
    architecture name

Returns
-------
{str: str, ...}
    dictionary with found dists as keys and versions as values,
    e.g.,:

        {
            "oldstable": "46.1",
            "stable": "1:26.1+1-3.2+deb10u1",
            "testing": "1:26.1+1-4",
            "unstable": "1:26.3+1-1"
        }
z&s=Ú,z&a=source,all,úWarning:©ÚfileNÚ Ú Ú
Ú|Úsource)r   Úget_archÚRMADISON_URLÚjoinr   r   ÚurllibÚerrorÚ	HTTPErrorÚprintÚsysÚstderrÚreplaceÚstripÚsplitÚ
ValueErrorÚCODENAME2SUITEÚget)ÚpackageÚtimeoutÚdistsÚ
http_proxyÚarchÚurlÚpageÚxÚcontentÚversionsÚlineÚpÚvÚdr   Údists                   r   Úget_versions_availabler<   Z   s/  € ôB �>Š>Ó€Dä
˜Ñ
 €CÞØˆu�s—x‘x “Ñ&Ñ&ˆð Ð˜dÑ"Ñ"€CðÜ˜¨Ó1ˆö Øˆ	ð �l‰l˜3 Ó#×)Ñ)Ó+€Gà€HØ—‘˜dÖ#ˆð	ØŸ™ C›‰JˆA�!ð
 �‹=Ùô ×#Ñ#×'Ñ'¨Ó-ˆà�‹ñ $ð  €OøôK ó ØŠ	Ü�<‰<×!Ñ!ó Üˆj˜!¤#§*¡*Ò-Ø�	ûðûô. ó 	Úð	ús6   ÁC ÂD*ÃD'Ã%D'ÄD"ÄD'Ä"D'Ä*
D8Ä7D8c                 óœ  • Uc  Sn [        [        X15      nU(       d  0 $ 0 n[        R                  " U5       H=  nUS   U :X  d  M  US   S-   US   -   S	-   n	[        US
   R                  5       5      Xy'   M?     U$ ! [         a    0 s $ [        R                  R
                   a%  n[        SU[        R                  S9  0 s SnA$ SnAff = f)a  
Get package versions available in the NEW queue

If `dists` is not given, get versions from unstable (NEW queue).

This is a helper function for :func:`check_available()`.

Parameters
----------
package : str
    package name
timeout : int
    connection timeout in seconds
dists : (str, ...), optional
    tuple of dist names ('stable', 'testing' etc.) to check
http_proxy : str, optional
    http proxy url
arch : str, optional
    unused

Returns
-------
{str: str, ...}
    dictionary with found dists as keys and versions as values
N)zunstable (new queue)r   r   ÚSourceÚDistributionz (ÚQueueÚ)ÚVersion)r   ÚNEWQUEUE_URLr   r!   r"   r#   r$   r%   r&   r   Úiter_paragraphsÚmaxr)   )
r-   r.   r/   r0   r1   r3   r4   r6   ÚparaÚks
             r   Úget_newqueue_availablerH   ­   sÌ   € ð4 �}Ø)ˆðÜœ jÓ:ˆö Øˆ	à€Hô ×&Ò& tÖ,ˆØ�‰>˜WÕ$Ø�^Ñ$ tÑ+¨d°7©mÑ;¸cÑAˆAä˜d 9™o×3Ñ3Ó5Ó6ˆH‹Kñ	 -ð €Oøô# ó ØŠ	Ü�<‰<×!Ñ!ó Üˆj˜!¤#§*¡*Ò-Ø�	ûðús#   ‡A; Á;CÂ	CÂ&CÃ CÃCc                 ób  • 0 n[        XX6U5      n	UR                  U	5        U(       a9  [        R                  " U 5      n
U
c  U n
[	        X¢X6U5      n	UR                  U	5        0 nSnU H,  n[        XU   5      nUS:”  a  X�   X½'   M  US:  d  M'  US-  nM.     U=(       a    U[        U5      :H  nX¿4$ )a  
Check a package version against other available versions

The package archive contains many different versions of most
packages. This function determines whether a given package version
is newer than all versions available in the archive, and (if not)
which available versions are newer.

Parameters
----------
package : str
    package name
version : str
    package version
timeout : int
    connection timeout in seconds
dists : (str, ...), optional
    tuple of dist names ('stable', 'testing' etc.) to check
check_incoming : bool
    unused/ignored
check_newqueue : bool
    True if the NEW queue should be checked for new versions
http_proxy : str, optional
    http proxy url
arch : str, optional
    architecture name

Returns
-------
(dict, bool)
    Tuple with a dictionary and a bool. The dictionary contains the
    versions found to be newer than the given version. E.g.,
            {"unstable": "42.1", "testing": "42.0"}

    The bool indicates whether the checked (installed)
    version is strictly newer than all available versions.
r   r   )r<   Úupdater   Úget_source_namerH   r   Úlen)r-   Úversionr.   r/   Úcheck_incomingÚcheck_newqueuer0   r1   ÚavailÚstuffÚ
srcpackageÚnewÚnewerr;   Ú
comparisonÚtoo_news                   r   Úcheck_availablerW   ß   s¿   € ðP €Eä" 7°UÈÓM€EØ	‡L�L�ÔÞÜ×*Ò*¨7Ó3ˆ
ØÑØ ˆJÜ& z¸EÈtÓTˆØ�‰�UÔð €Cð €EãˆÜ% g°T©{Ó;ˆ
Ø˜‹>à™ˆC‹IØ˜!�^à�Q‰JŠEñ ð ×,˜¤# e£*Ñ,€GØˆ<Ðr   )NNÚi386)NTTNrX   )r%   Úurllib.errorr!   r   r   Úurlutilsr   Úreportbug.exceptionsr   Údebian.deb822r   Údebianr   r   rC   r   r   r<   rH   rW   © r   r   Ú<module>r_      sR   ðó0 Û å Ý õõ
 !Ý !àE€Ø6€ò=ò2ô0Pôf/ðd 6:Ø8<Ø*0õCr   