§
    Â&=dÖ!  ã                   ó„   — d dl Z d dlZddlmZ ddlmZ d dlmZ d dl	m
Z
 d dlmZ dZd	Zd
„ Zd„ Zdd„Zdd„Z	 	 	 dd„ZdS )é    Né   )Úutils)Úopen_url)Ú	NoNetwork)ÚDeb822)Údebian_supportz4https://qa.debian.org/madison.php?package=%s&text=onz$http://ftp-master.debian.org/new.822c                 ó8   — | r|sdS t          j        || ¦  «        S )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+   € ð( ð ˜(ð ØˆqÝÔ)¨(°GÑ<Ô<Ð<ó    c                 ó2   — t          | |¦  «        dk    r|S | S )ad  
    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#   € õ& ˜˜1ÑÔ Ò!Ð!ØˆØ€Hr   Úi386c                 ó„  — t          j        ¦   «         }t          | z  }|r|dd                     |¦  «        z   z  }|d|z   z  }	 t	          |||¦  «        }nL# t
          $ r i cY S t          j        j        $ r(}t          d|t          j        ¬¦  «         i cY d}~S d}~ww xY w|si S |                     dd¦  «                             ¦   «         }i }	|                     d	¦  «        D ]Z}
	 |
                     d
¦  «        \  }}}}n# t          $ r Y Œ*w xY w|dk    rŒ5t           j                             ||¦  «        }||	|<   Œ[|	S )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ðÝ˜˜Z¨Ñ1Ô1ˆˆøÝð ð ð Øˆ	ˆ	ˆ	ÝŒ<Ô!ð ð ð Ýˆj˜!¥#¤*Ð-Ñ-Ô-Ð-Øˆ	ˆ	ˆ	ˆ	ˆ	ˆ	øøøøðøøøð ð Øˆ	ð �lŠl˜3 Ñ#Ô#×)Ò)Ñ+Ô+€Gà€HØ—’˜dÑ#Ô#ð ð ˆð	ØŸš C™œ‰JˆAˆq�!�Q�Qøåð 	ð 	ð 	ØˆHð	øøøð �Š=ˆ=Øõ Ô#×'Ò'¨¨1Ñ-Ô-ˆàˆ�‰ˆà€Os6   ÁA ÁBÁ$BÁ7BÂBÂBÃ(DÄ
DÄDc                 óª  — |€d}	 t          t          ||¦  «        }nL# t          $ r i cY S t          j        j        $ r(}t          d|t          j        ¬¦  «         i cY d}~S d}~ww xY w|si S i }t          j
        |¦  «        D ]O}|d         | k    rA|d         dz   |d         z   d	z   }	t          |d
                              ¦   «         ¦  «        ||	<   ŒP|S )aj  
    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/   r0   r1   r2   r4   r5   r7   ÚparaÚks
             r   Úget_newqueue_availablerI   ­   s  € ð4 €}Ø)ˆðÝ� j°'Ñ:Ô:ˆˆøÝð ð ð Øˆ	ˆ	ˆ	ÝŒ<Ô!ð ð ð Ýˆj˜!¥#¤*Ð-Ñ-Ô-Ð-Øˆ	ˆ	ˆ	ˆ	ˆ	ˆ	øøøøðøøøð ð Øˆ	à€Hõ Ô& tÑ,Ô,ð 7ð 7ˆØ�Œ>˜WÒ$Ð$Ø�^Ô$ tÑ+¨d°7¬mÑ;¸cÑAˆAå˜d 9œo×3Ò3Ñ5Ô5Ñ6Ô6ˆH�Q‰Køà€Os   † �A&«A&¾A!ÁA&Á!A&Tc                 ó„  — i }t          | ||||¦  «        }	|                     |	¦  «         |r@t          j        | ¦  «        }
|
€| }
t	          |
||||¦  «        }	|                     |	¦  «         i }d}|D ]5}t          |||         ¦  «        }|dk    r||         ||<   Œ*|dk     r|dz  }Œ6|o|t          |¦  «        k    }||fS )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.
    Nr   r   )r=   Úupdater   Úget_source_namerI   r   Úlen)r.   Úversionr/   r0   Úcheck_incomingÚcheck_newqueuer1   r2   ÚavailÚstuffÚ
srcpackageÚnewÚnewerr<   Ú
comparisonÚtoo_news                   r   Úcheck_availablerX   ß   sõ   € ðP €Eå" 7¨G°U¸JÈÑMÔM€EØ	‡L‚L�ÑÔÐØð ÝÔ*¨7Ñ3Ô3ˆ
ØÐØ ˆJÝ& z°7¸EÀ:ÈtÑTÔTˆØ�Š�UÑÔÐð €Cð €Eàð ð ˆÝ% g¨u°T¬{Ñ;Ô;ˆ
Ø˜Š>ˆ>à˜dœˆC�‰IˆIØ˜!Š^ˆ^à�Q‰JˆEøØÐ,˜¥# e¡*¤*Ò,€GØ�ˆ<Ðr   )NNr   )NTTNr   )r&   Úurllib.errorr"   r   r   Úurlutilsr   Úreportbug.exceptionsr   Údebian.deb822r   Údebianr   r    rD   r   r   r=   rI   rX   © r   r   ú<module>r_      s	  ðð0 €
€
€
Ø Ð Ð Ð à Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð ðð ð ð ð ð ð
 !Ð  Ð  Ð  Ð  Ð  Ø !Ð !Ð !Ð !Ð !Ð !àE€Ø5€ð=ð =ð =ð2ð ð ð0Pð Pð Pð Pðf/ð /ð /ð /ðd 6:Ø8<Ø*0ðCð Cð Cð Cð Cð Cr   