%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/pkgng.pyc

�
���^c@@sdZddlmZmZmZddlZddlZddlZddlZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
ddlZ
ddlmZmZddlmZeje�ZdZd�Zdddd�Zdddd	�Zd
�Zddddd�Zd
d�Z d�Z!e
j"j#j$e!d�Z%ddde&d�Z'e
j"j#j$e'd�Z(d�Z)e
j"j#j$e)d�Z*e&ddde&d�Z+d�Z,e&e&dddd�Z-dddd�Z.dddd�Z/dddd�Z0ddddddde&e&e&e&e&e&e&e&e&e&d�Z1ddddde&e&e&e&e&e&e&d�Z2e
j"j#j$e2d�Z3e
j"j#j$e2d�Z4d�Z5ddde&e&d �Z6ddde&d!�Z7ddde&e&e&d"�Z8ddde&e&d#�Z9ddde&e&e&e&e&e&e&e&e&e&e&e&d$�Z:ddde&e&de;e&e&e&e&d%�Z<dddddd&�Z=ddd'�Z>ddd(�Z?d)�Z@d*�ZAd+�ZBd,�ZCdd-�ZDe;d.�ZEd/�ZFe&d0�ZGdS(1us
Support for ``pkgng``, the new package manager for FreeBSD

.. important::
    If you feel that Salt should be using this module to manage packages on a
    minion, and it is using a different module (or gives an error similar to
    *'pkg.install' is not available*), see :ref:`here
    <module-provider-override>`.

.. warning::

    This module has been completely rewritten. Up to and including version
    0.17.x, it was available as the ``pkgng`` module, (``pkgng.install``,
    ``pkgng.delete``, etc.), but moving forward this module will no longer be
    available as ``pkgng``, as it will behave like a normal Salt ``pkg``
    provider. The documentation below should not be considered to apply to this
    module in versions <= 0.17.x. If your minion is running a 0.17.x release or
    older, then the documentation for this module can be viewed using the
    :mod:`sys.doc <salt.modules.sys.doc>` function:

    .. code-block:: bash

        salt bsdminion sys.doc pkgng


This module provides an interface to ``pkg(8)``. It acts as the default
package provider for FreeBSD 10 and newer. For FreeBSD hosts which have
been upgraded to use pkgng, you will need to override the ``pkg`` provider
by setting the :conf_minion:`providers` parameter in your Minion config
file, in order to use this module to manage packages, like so:

.. code-block:: yaml

    providers:
      pkg: pkgng

i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionErrortMinionError(tsixupkgcC@s�tddkrtStddkr>ttd�dkr>tStddkr�ttd�dkr�i}d	tkr�td	}ntjd
|�|r�d|kr�|ddkr�tjd
�tSntdfS(u�
    Load as 'pkg' on FreeBSD 10 and greater.
    Load as 'pkg' on DragonFly BSD.
    Load as 'pkg' on FreeBSD 9 when config option
    ``providers:pkg`` is set to 'pkgng'.
    ukernelu	DragonFlyuosuFreeBSDu	osreleasei
uosmajorreleasei	u	providersu__opts__.providers: %supkgupkgngu_Configuration option 'providers:pkg' is set to 'pkgng', using 'pkgng' in favor of 'freebsdpkg'.uwThe pkgng execution module cannot be loaded: only available on FreeBSD 10 or FreeBSD 9 with providers.pkg set to pkgng.(t
__grains__t__virtualname__tfloattintt__opts__tlogtdebugtFalse(t	providers((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt__virtual__@s&&
"
cC@sadg}|r%|jd|g�n8|rA|jd|g�n|r]|jd|g�n|S(ur
    Returns the prefix for a pkg command, using -j if a jail is specified, or
    -c if chroot is specified.
    upkgu-ju-cu-r(textend(tjailtchroottroottret((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt_pkgYs	cC@s-t|||�dg}td|�j�S(u%
    return the version of 'pkg'
    u	--versionucmd.run(Rt__salt__tstrip(RRRtcmd((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt_get_pkgng_versionhscC@svxotjjj|d�D]U}|s+qny|jdd�\}}Wntk
r]qnX||kr|SqWdS(u�
    ``pkg search`` will return all packages for which the pattern is a match.
    Narrow this down and return the package version, or None if no exact match.
    u
u-iN(tsalttutilst	itertoolstsplittrsplitt
ValueErrortNone(tnametresultstlinetpkgnametpkgver((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt_get_versionps
u
pkg.list_pkgscC@sd|r tj|�dj|�S|r@tj|�dj|�S|r`tj|�dj|�S|S(u�
    As this module is designed to manipulate packages in jails and chroots, use
    the passed jail/chroot to ensure that a key in the __context__ dict that is
    unique to that jail/chroot is used.
    u	.jail_{0}u.chroot_{0}u	.root_{0}(Rt	text_typetformat(RRRtprefix((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt_contextkey�su/usr/local/etc/pkg.confc	C@s�i}tjj|�s%dj|�Stjjj|��m}xc|D][}tjjj	|�}|j
d�s�|j
d�r�qD|jd�\}}|||<qDWWdQX||d<|S(u�
    Return dict of uncommented global variables.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.parse_config

    ``NOTE:`` not working properly right now
    u!Unable to find {0} on file systemu#u
u	Nuconfig_file(tostpathtisfileR(RRtfilestfopentstringutilst
to_unicodet
startswithR(t	file_nameRtifileR#tkeytvalue((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytparse_config�s


cO@s�|jdt�}td||�}tjjj|�s>|St|�dkrdi||d6}ntj	di�}t
gtj|�D]2\}}|i|j	|d�d6|d6f^q��S(	u#
    Returns a string representing the package version or an empty string if not
    installed. If more than one package name is specified, a dict of
    name/version pairs is returned.

    .. note::

        This function can accessed using ``pkg.info`` in addition to
        ``pkg.version``, to more closely match the CLI usage of ``pkg(8)``.

    jail
        Get package version information for the specified jail

    chroot
        Get package version information for the specified chroot (ignored if
        ``jail`` is specified)

    root
        Get package version information for the specified root (ignored if
        ``jail`` is specified)

    with_origin : False
        Return a nested dictionary containing both the origin name and version
        for each specified package.

        .. versionadded:: 2014.1.0


    CLI Example:

    .. code-block:: bash

        salt '*' pkg.version <package name>
        salt '*' pkg.version <package name> jail=<jail name or id>
        salt '*' pkg.version <package1> <package2> <package3> ...
    uwith_originupkg_resource.versioniiu
pkg.originuuoriginuversion(
tpopR
RRRtdatatis_truetlent__context__tgettdictRt	iteritems(tnamestkwargstwith_originRtoriginstxty((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytversion�s%uinfocC@sbtjjjt�t|||�}|jd�|rH|jd�ntd|dt�dkS(uF
    Refresh PACKAGESITE contents

    .. note::

        This function can accessed using ``pkg.update`` in addition to
        ``pkg.refresh_db``, to more closely match the CLI usage of ``pkg(8)``.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.refresh_db

    jail
        Refresh the pkg database within the specified jail

    chroot
        Refresh the pkg database within the specified chroot (ignored if
        ``jail`` is specified)

    root
        Refresh the pkg database within the specified root (ignored if
        ``jail`` is specified)

    force
        Force a full download of the repository catalog without regard to the
        respective ages of the local and remote copies of the catalog.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.refresh_db force=True
    uupdateu-fucmd.retcodetpython_shelli(	RRtpkgt
clear_rtagR
RtappendRR
(RRRtforceR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt
refresh_db�s%
uupdatec
@s2t|�dkrdSi}x|D]}d||<q#W|jd�}|jd�}|jd�}|jd�}tdtd|d	|d
|�}tjjjt|||�dd�r�t}	nt	}	xC|D];}d
|kr�t
|||�dg}
n(t
|||�ddddddg}
|	r=|
jd�ntjjj
|�sb|
jd�n|
j|�t|ttd|
dt	dd�j�dt�jd����dk	r�|j|g�}|s��||<qt�fd�|D��s�||<qq�q�Wt|�dkr.||dS|S(u,
    Return the latest version of the named package available for upgrade or
    installation. If more than one package name is specified, a dict of
    name/version pairs is returned.

    If the latest version of a given package is already installed, an empty
    string will be returned for that package.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.latest_version <package name>
        salt '*' pkg.latest_version <package name> jail=<jail name or id>
        salt '*' pkg.latest_version <package name> chroot=/path/to/chroot
    iuujailuchrooturefreshuroottversions_as_listRRRu>=u1.6.0u/usearchu-Sunameu-Quversionu-eu-qu-Uucmd.runRGtoutput_loglevelutracetreversec3@s3|])}tjjjd|ddd��VqdS(tver1toperu>=tver2N(RRtversionstcompare(t.0RD(R%(s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pys	<genexpr>QsiN(R;R=t	list_pkgstTrueRRRSRTRR
RRJR9R:R&tsortedRt
splitlinesR8R tany(R@RARR!RRtrefreshRtpkgstquietRt	installed((R%s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytlatest_versionsN
!'	
(
"	

uavailable_versioncK@s�tgdD]$}tjjj|j|��^q
�r;iStjjj|�}t|||�}t|||dd�}|tkr'tj	t|�}	|s�t
d|	�ntjjj|�r#tj|i�}
tgtj
|	�D]2\}}|i|
j|d�d6|d6f^q��S|	Si}	i}
t
d	t|||�d
dgdd
dt�}x�tjjj|d�D]u}
|
s�q~ny.|
j�\}}|jdd�\}}Wntk
r�q~nXt
d|	||�||
|<q~Wt
d|	�tj	|	�t|<|
t|<|s9t
d|	�ntjjj|�r�tgtj
|	�D]2\}}|i|
j|d�d6|d6f^qa�S|	S(u�
    List the packages currently installed as a dict::

        {'<package_name>': '<version>'}

    jail
        List the packages in the specified jail

    chroot
        List the packages in the specified chroot (ignored if ``jail`` is
        specified)

    root
        List the packages in the specified root (ignored if ``jail`` is
        specified)

    with_origin : False
        Return a nested dictionary containing both the origin name and version
        for each installed package.

        .. versionadded:: 2014.1.0

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_pkgs
        salt '*' pkg.list_pkgs jail=<jail name or id>
        salt '*' pkg.list_pkgs chroot=/path/to/chroot
    uremovedu
purge_desiredR)u
pkg.originupkg_resource.stringifyuuoriginuversionucmd.run_stdoutuinfou-aoRNutraceRGu
u-iupkg_resource.add_pkgupkg_resource.sort_pkglist(uremovedu
purge_desired(RZRRR9R:R=R*R<tcopytdeepcopyRR>RR?RR
RRRR(RMRRRRBRARDtcontextkey_pkgtcontextkey_originsRRCREtoutR#RHtoriginR$R%((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyRVbsT%1F	

FcC@s.t�d}td|ddj|��tS(u�
    Updates remote package repo URL, PACKAGESITE var to be exact.

    Must use ``http://``, ``ftp://``, or ``https://`` protocol

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.update_package_site http://127.0.0.1/
    uconfig_fileufile.sedu
PACKAGESITE.*uPACKAGESITE	 : {0}(R7RR(RW(tnew_urltconfig_file((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytupdate_package_site�s
c	C@s�d}|r|d7}n|r,|d7}nt|||�}|jd�|re|jd|�ntd|ddd	t�}gtjjj|d
�D]}|jd�^q�S(u�
    Return pkgng stats.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.stats

    local
        Display stats only for the local package database.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.stats local=True

    remote
        Display stats only for the remote package database(s).

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.stats remote=True

    jail
        Retrieve stats from the specified jail.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.stats jail=<jail name or id>
            salt '*' pkg.stats jail=<jail name or id> local=True
            salt '*' pkg.stats jail=<jail name or id> remote=True

    chroot
        Retrieve stats from the specified chroot (ignored if ``jail`` is
        specified).

    root
        Retrieve stats from the specified root (ignored if ``jail`` is
        specified).

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.stats chroot=/path/to/chroot
            salt '*' pkg.stats chroot=/path/to/chroot local=True
            salt '*' pkg.stats chroot=/path/to/chroot remote=True
    uulurustatsu-ucmd.runRNutraceRGu
u	(	RRJRR
RRRRR(	tlocaltremoteRRRtoptsRRdRD((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytstats�s8


cC@sFtdt|||�dd|gdddt�}|jd�dS(	u8
    Export installed packages into yaml+mtree file

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.backup /tmp/pkg

    jail
        Backup packages from the specified jail. Note that this will run the
        command within the jail, and so the path to the backup file will be
        relative to the root of the jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.backup /tmp/pkg jail=<jail name or id>

    chroot
        Backup packages from the specified chroot (ignored if ``jail`` is
        specified). Note that this will run the command within the chroot, and
        so the path to the backup file will be relative to the root of the
        chroot.

    root
        Backup packages from the specified root (ignored if ``jail`` is
        specified). Note that this will run the command within the root, and
        so the path to the backup file will be relative to the root of the
        root.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.backup /tmp/pkg chroot=/path/to/chroot
    ucmd.runubackupu-dRNutraceRGu...i(RRR
R(R3RRRR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytbackups
'	cC@s3tdt|||�dd|gdddt�S(u�
    Reads archive created by pkg backup -d and recreates the database.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.restore /tmp/pkg

    jail
        Restore database to the specified jail. Note that this will run the
        command within the jail, and so the path to the file from which the pkg
        database will be restored is relative to the root of the jail.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.restore /tmp/pkg jail=<jail name or id>

    chroot
        Restore database to the specified chroot (ignored if ``jail`` is
        specified). Note that this will run the command within the chroot, and
        so the path to the file from which the pkg database will be restored is
        relative to the root of the chroot.

    root
        Restore database to the specified root (ignored if ``jail`` is
        specified). Note that this will run the command within the root, and
        so the path to the file from which the pkg database will be restored is
        relative to the root of the root.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.restore /tmp/pkg chroot=/path/to/chroot
    ucmd.runubackupu-rRNutraceRG(RRR
(R3RRR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytrestoreCs'cC@s0tdt|||�ddgdddt�S(uj
    Audits installed packages against known vulnerabilities

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.audit

    jail
        Audit packages within the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.audit jail=<jail name or id>

    chroot
        Audit packages within the specified chroot (ignored if ``jail`` is
        specified)

    root
        Audit packages within the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.audit chroot=/path/to/chroot
    ucmd.runuauditu-FRNutraceRG(RRR
(RRR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytauditqs!c"K@swy#td||||�\}}Wntk
rD}t|��nX|d-ksct|�dkrgiSi}d}tjjj|�r�|d7}ntjjj|�r�|d7}ntjjj|	�r�|d7}ntjjj|
�r�|d7}ntjjj|�r|d7}ntjjj|�r?|d	7}ntjjj|
�ra|d
7}ntjjj|�r�|d7}ntjjj|�r�|d7}ntjjj|�r�id
d6dd6}nt	d|d|d|�}|dkr5d}dj
g|D]}|dkr|^q�}|}n�|dkr�d}|d-kr�|jd�r�t|�dkr�i|jd�|6}ng}xatj
|�D]A\}}|d-kr�|j|�q�|jdj||��q�Wntd��t|||�}|j|�|r2|jd|g�n|rL|jd|�n|j|�|dkr�tjjj|�r�d j
|�Std!|d"d#d$td%|�}|d&dkr�|d'r�|d'g}ng}tjt|||�d-�tjt|||d(d)�d-�t	d|d|d|�} tjjj|| �}!|rstdd*i|d+6|!d,6��n|!S(.u7
    Install package(s) from a repository

    name
        The name of the package to install

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name>

    jail
        Install the package into the specified jail

    chroot
        Install the package into the specified chroot (ignored if ``jail`` is
        specified)

    root
        Install the package into the specified root (ignored if ``jail`` is
        specified)

    orphan
        Mark the installed package as orphan. Will be automatically removed
        if no other packages depend on them. For more information please
        refer to ``pkg-autoremove(8)``.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> orphan=True

    force
        Force the reinstallation of the package if already installed.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> force=True

    glob
        Treat the package names as shell glob patterns.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> glob=True

    local
        Do not update the repository catalogs with ``pkg-update(8)``.  A
        value of ``True`` here is equivalent to using the ``-U`` flag with
        ``pkg install``.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> local=True

    dryrun
        Dru-run mode. The list of changes to packages is always printed,
        but no changes are actually made.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> dryrun=True

    quiet
        Force quiet output, except when dryrun is used, where pkg install
        will always show packages to be installed, upgraded or deleted.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> quiet=True

    reinstall_requires
        When used with force, reinstalls any packages that require the
        given package.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> reinstall_requires=True force=True

        .. versionchanged:: 2014.7.0
            ``require`` kwarg renamed to ``reinstall_requires``

    fromrepo
        In multi-repo mode, override the pkg.conf ordering and only attempt
        to download packages from the named repository.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> fromrepo=repo

    regex
        Treat the package names as a regular expression

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <regular expression> regex=True

    pcre
        Treat the package names as extended regular expressions.

        CLI Example:

        .. code-block:: bash


    batch
        Use BATCH=true for pkg install, skipping all questions.
        Be careful when using in production.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.install <package name> batch=True
    upkg_resource.parse_targetsiuyuAufuguUunuquRuxuXutrueuBATCHuYESuASSUME_ALWAYS_YESRRRufileuadduuAfIMqu
repositoryuinstalluversioniu{0}-{1}u)Problem encountered installing package(s)u-ru-u ucmd.run_allRNutraceRGtenvuretcodeustderrR)u
pkg.origintinfouerrorsuchangesN(RRRR R;RRR9R:RVtjoinR=RR?RJR(RRR
R<R8R*t
compare_dicts("R!tfromrepoR\tsourcesRRRtorphanRKtglobRitdryrunR]treinstall_requirestregextpcretbatchRAt
pkg_paramstpkg_typetexcRpRktoldtpkg_cmdtoptttargetstparamtversion_numRRdterrorstnewR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytinstall�s��









.	- 

!
	"c
K@sZ~ytd||�d}
Wntk
r?}t|��nXg}td|d|d|dt�}x�|
j�D]�}|djd�dkr�|d}gtj|�D]"\}}|d|kr�|^q�d}n|d|krt|j	|d�qtqtW|siSd	}t
jjj
|�r6|d
7}nt
jjj
|�rX|d7}nt
jjj
|�rz|d7}nt
jjj
|�r�|d
7}nt
jjj
|�s�|d7}nt
jjj
|	�r�|d7}nt
jjj
|
�r|d7}nt
jjj
|�r$|d7}nt|||�}|j	d�|r]|j	d|�n|j|�td|dddt�}|ddkr�|dr�|dg}ng}tjt|||�d �tjt|||dd�d �td|d|d|dt�}t
jjj||�}|rVtddi|d6|d6��n|S(!u!
    Remove a package from the database and system

    .. note::

        This function can accessed using ``pkg.delete`` in addition to
        ``pkg.remove``, to more closely match the CLI usage of ``pkg(8)``.

    name
        The package to remove

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.remove <package name>

    jail
        Delete the package from the specified jail

    chroot
        Delete the package from the specified chroot (ignored if ``jail`` is
        specified)

    root
        Delete the package from the specified root (ignored if ``jail`` is
        specified)

    all_installed
        Deletes all installed packages from the system and empties the
        database. USE WITH CAUTION!

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.remove all all_installed=True force=True

    force
        Forces packages to be removed despite leaving unresolved
        dependencies.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.remove <package name> force=True

    glob
        Treat the package names as shell glob patterns.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.remove <package name> glob=True

    dryrun
        Dry run mode. The list of packages to delete is always printed, but
        no packages are actually deleted.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.remove <package name> dryrun=True

    recurse
        Delete all packages that require the listed package as well.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.remove <package name> recurse=True

    regex
        Treat the package names as regular expressions.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.remove <regular expression> regex=True

    pcre
        Treat the package names as extended regular expressions.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.remove <extended regular expression> pcre=True
    upkg_resource.parse_targetsiRRRRBu/uoriginuuaufugunuyuRuxuXudeleteu-ucmd.run_allRNutraceRGuretcodeustderrR)u
pkg.originu'Problem encountered removing package(s)RquerrorsuchangesN(RRRRVRWtitemstfindRR?RJRRR9R:RRR
R<R8R*R Rs(R!R\RRRt
all_installedRKRwRxtrecurseRzR{RAR}RR�R�RHRetktvRkRRdR�R�R((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytremove�sjk!
?









	"!udeleteupurgecO@s�|jdd�}|jdd�}|jdd�}|jdt�}|jdt�}|jdt�}|jdg�}d}	|r�|	d	7}	n|r�|	d
7}	n|r�|	d7}	n|s�|	d7}	nt|||�}
|
jd
�|	r	|
jd|	�n|r|
j|�n|r5|
j|�nt�}td|
dddt�}tjt	|||�d�tjt	|||dd�d�t�}
t
jjj
||
�}|ddkr�tddi|d6|d6��n|S(u
    Upgrade named or all packages (run a ``pkg upgrade``). If <package name> is
    omitted, the operation is executed on all packages.

    Returns a dictionary containing the changes:

    .. code-block:: python

        {'<package>':  {'old': '<old-version>',
                        'new': '<new-version>'}}


    CLI Example:

    .. code-block:: bash

        salt '*' pkg.upgrade <package name>

    jail
        Audit packages within the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.upgrade <package name> jail=<jail name or id>

    chroot
        Audit packages within the specified chroot (ignored if ``jail`` is
        specified)

    root
        Audit packages within the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.upgrade <package name> chroot=/path/to/chroot


    Any of the below options can also be used with ``jail`` or ``chroot``.

    force
        Force reinstalling/upgrading the whole set of packages.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.upgrade <package name> force=True

    local
        Do not update the repository catalogs with ``pkg-update(8)``. A value
        of ``True`` here is equivalent to using the ``-U`` flag with ``pkg
        upgrade``.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.upgrade <package name> local=True

    dryrun
        Dry-run mode: show what packages have updates available, but do not
        perform any upgrades. Repository catalogs will be updated as usual
        unless the local option is also given.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.upgrade <package name> dryrun=True
    ujailuchrooturootuforceulocaludryrunupkgsuufuLunuyuupgradeu-ucmd.run_allRNutraceRGR)u
pkg.originuretcodeiu&Problem encountered upgrading packagesRquchangesuresultN(R8R R
RRJRRVRR<R*RRR9RsR(R@RARRRRKRiRxR\RkRR�tresultR�R((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytupgradeGsJL




	
	"	cC@s�d}|r|d7}n|r,|d7}n
|d7}t|||�}|jd�|ro|jd|�ntd|dd	d
t�S(uA
    Cleans the local cache of fetched remote packages

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.clean

    jail
        Cleans the package cache in the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.clean jail=<jail name or id>

    chroot
        Cleans the package cache in the specified chroot (ignored if ``jail``
        is specified)

    root
        Cleans the package cache in the specified root (ignored if ``jail``
        is specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.clean chroot=/path/to/chroot

    clean_all
        Clean all packages from the local cache (not just those that have been
        superseded by newer versions).

        CLI Example:

        .. code-block:: bash

        salt '*' pkg.clean clean_all=True

    dryrun
        Dry-run mode. This list of changes to the local cache is always
        printed, but no changes are actually made.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.clean dryrun=True
    uuaunuyucleanu-ucmd.runRNutraceRG(RRJRR
(RRRt	clean_allRxRkR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytclean�s9



cC@svd}|r|d7}n
|d7}t|||�}|jd�|r\|jd|�ntd|ddd	t�S(
u�
    Delete packages which were automatically installed as dependencies and are
    not required anymore.

    dryrun
        Dry-run mode. The list of changes to packages is always printed,
        but no changes are actually made.

    CLI Example:

    .. code-block:: bash

         salt '*' pkg.autoremove
         salt '*' pkg.autoremove jail=<jail name or id>
         salt '*' pkg.autoremove dryrun=True
         salt '*' pkg.autoremove jail=<jail name or id> dryrun=True
    uunuyu
autoremoveu-ucmd.runRNutraceRG(RRJRR
(RRRRxRkR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt
autoremoves


cC@s�t|||f�sdSd}|r2|d7}n|rE|d7}n|rX|d7}nt|||�}|jd�|r�|jd|�ntd|d	d
dt�S(uO
    Sanity checks installed packages

    jail
        Perform the sanity check in the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.check jail=<jail name or id>

    chroot
        Perform the sanity check in the specified chroot (ignored if ``jail``
        is specified)

    root
        Perform the sanity check in the specified root (ignored if ``jail``
        is specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.check chroot=/path/to/chroot


    Of the below, at least one must be set to ``True``.

    depends
        Check for and install missing dependencies.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.check recompute=True

    recompute
        Recompute sizes and checksums of installed packages.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.check depends=True

    checksum
        Find invalid checksums for installed packages.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.check checksum=True
    u:One of depends, recompute, or checksum must be set to Trueuudyurusuchecku-ucmd.runRNutraceRG(RZRRJRR
(RRRtdependst	recomputetchecksumRkR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytcheck.s">



cC@s�d}|r|d7}n|r,|d7}nt|||�}|jd�|re|jd|�n|j|�td|ddd	t�S(
u�
    Displays which package installed a specific file

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.which <file name>

    jail
        Perform the check in the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.which <file name> jail=<jail name or id>

    chroot
        Perform the check in the specified chroot (ignored if ``jail`` is
        specified)

    root
        Perform the check in the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.which <file name> chroot=/path/to/chroot


    origin
        Shows the origin of the package instead of name-version.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.which <file name> origin=True

    quiet
        Quiet output.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.which <file name> quiet=True
    uuquouwhichu-ucmd.runRNutraceRG(RRJRR
(R,RRRReR]RkR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytwhich�s4



cC@sJd}|r|d7}n|r,|d7}n|r?|d7}n|rR|d7}n|re|d7}n|	rx|d7}n|
r�|d7}n|r�|d	7}n|r�|d
7}n|
r�|d7}n|r�|d7}n|r�|d
7}nt|||�}|jd�|r#|jd|�n|j|�td|dddt�S(u�

    Searches in remote package repositories

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.search pattern

    jail
        Perform the search using the ``pkg.conf(5)`` from the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern jail=<jail name or id>

    chroot
        Perform the search using the ``pkg.conf(5)`` from the specified chroot
        (ignored if ``jail`` is specified)

    root
        Perform the search using the ``pkg.conf(5)`` from the specified root
        (ignored if ``jail`` is specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern chroot=/path/to/chroot

    exact
        Treat pattern as exact pattern.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern exact=True

    glob
        Treat pattern as a shell glob pattern.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern glob=True

    regex
        Treat pattern as a regular expression.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern regex=True

    pcre
        Treat pattern as an extended regular expression.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern pcre=True

    comment
        Search for pattern in the package comment one-line description.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern comment=True

    desc
        Search for pattern in the package description.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern desc=True

    full
        Displays full information about the matching packages.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern full=True

    depends
        Displays the dependencies of pattern.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern depends=True

    size
        Displays the size of the package

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern size=True

    quiet
        Be quiet. Prints only the requested information without displaying
        many hints.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern quiet=True

    origin
        Displays pattern origin.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern origin=True

    prefix
        Displays the installation prefix for each package matching pattern.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.search pattern prefix=True
    uueuguxuXucuDufudusuquoupusearchu-ucmd.runRNutraceRG(RRJRR
(R!RRRtexactRwRzR{tcommenttdesctfullR�tsizeR]ReR)RkR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytsearch�sD�













cC@s
d}|r|d7}n|r,|d7}n|r?|d7}n|rR|d7}n|	re|d7}n|
rx|d7}n|r�|d7}nt|||�}
|
jd	d
g�|r�|
jd|g�n|r�|
jd|�n|
j|�td
|
dddt�S(u:
    Fetches remote packages

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.fetch <package name>

    jail
        Fetch package in the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <package name> jail=<jail name or id>

    chroot
        Fetch package in the specified chroot (ignored if ``jail`` is
        specified)

    root
        Fetch package in the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <package name> chroot=/path/to/chroot

    fetch_all
        Fetch all packages.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <package name> fetch_all=True

    quiet
        Quiet mode. Show less output.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <package name> quiet=True

    fromrepo
        Fetches packages from the given repo if multiple repo support
        is enabled. See ``pkg.conf(5)``.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <package name> fromrepo=repo

    glob
        Treat pkg_name as a shell glob pattern.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <package name> glob=True

    regex
        Treat pkg_name as a regular expression.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <regular expression> regex=True

    pcre
        Treat pkg_name is an extended regular expression.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <extended regular expression> pcre=True

    local
        Skip updating the repository catalogs with pkg-update(8). Use the
        local cache only.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <package name> local=True

    depends
        Fetch the package and its dependencies as well.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.fetch <package name> depends=True
    uuauquguxuXuLudufetchu-yu-ru-ucmd.runRNutraceRG(RRRJRR
(R!RRRt	fetch_allR]RtRwRzR{RiR�RkR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytfetch�s4v







cC@s�d}|r"|dj|�7}n|r>|dj|�7}nt|||�}|jd�|rw|jd|�n|j|�td|ddd	t�S(
u�'
    Displays UPDATING entries of software packages

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.updating foo

    jail
        Perform the action in the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.updating foo jail=<jail name or id>

    chroot
        Perform the action in the specified chroot (ignored if ``jail`` is
        specified)

    root
        Perform the action in the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.updating foo chroot=/path/to/chroot

    filedate
        Only entries newer than date are shown. Use a YYYYMMDD date format.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.updating foo filedate=20130101

    filename
        Defines an alternative location of the UPDATING file.

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.updating foo filename=/tmp/UPDATING
    uud {0}uf {0}uupdatingu-ucmd.runRNutraceRG(R(RRJRR
(R!RRRtfiledatetfilenameRkR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytupdating s9

cK@s�g}|r|j|�n
|j|�i}xT|D]L}t|t�rcttj|��}ni|d6id6td6dd6||<t||�sWdt	kr�t	dr�||j
dd�dj|�||d<q�t
||�r=||j
dt�d	j|�||d<d
||dd<d||dd<q�d
j|�||d<q6||j
dt�dj|�||d<q6W|S(u�
    Version-lock packages

    .. note::
        This function is provided primarily for compatibilty with some
        parts of :py:mod:`states.pkg <salt.states.pkg>`.
        Consider using Consider using :py:func:`pkg.lock <salt.modules.pkgng.lock>` instead. instead.

    name
        The name of the package to be held.

    Multiple Package Options:

    pkgs
        A list of packages to hold. Must be passed as a python list. The
        ``name`` parameter will be ignored if this option is passed.

    Returns a dict containing the changes.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.hold <package name>
        salt '*' pkg.hold pkgs='["foo", "bar"]'
    unameuchangesuresultuucommentutestR�uPackage {0} is set to be held.uPackage {0} is now being held.uholdunewuoldu"Package {0} was unable to be held.u&Package {0} is already set to be held.N(RRJt
isinstanceR>tnextRtiterkeysR
tlockedR
tupdateR R(tlockRW(R!R\RAR�Rttarget((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytholdks:


cK@s~g}|r|j|�n
|j|�i}xH|D]@}t|t�rcttj|��}ni|d6id6td6dd6||<t||�rKt	dr�||j
dd�dj|�||d<qvt
||�r1||j
dt�d	j|�||d<d||dd
<d||dd<qvd
j|�||d<q6||j
dt�dj|�||d<q6W|S(u�
    Remove version locks

    .. note::
        This function is provided primarily for compatibilty with some parts of
        :py:mod:`states.pkg <salt.states.pkg>`.  Consider using
        :py:func:`pkg.unlock <salt.modules.pkgng.unlock>` instead.

    name
        The name of the package to be unheld

    Multiple Package Options:

    pkgs
        A list of packages to unhold. Must be passed as a python list. The
        ``name`` parameter will be ignored if this option is passed.

    Returns a dict containing the changes.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.unhold <package name>
        salt '*' pkg.unhold pkgs='["foo", "bar"]'
    unameuchangesuresultuucommentutestR�u Package {0} is set to be unheld.uPackage {0} is no longer held.unewuholduoldu$Package {0} was unable to be unheld.uPackage {0} is not being held.N(RRJR�R>R�RR�R
R�R
R�R R(tunlockRW(R!R\RAR�RR�((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytunhold�s:



cK@s;gtddd|�D]!}dj|t||��^qS(uy
    Query the package database those packages which are
    locked against reinstallation, modification or deletion.

    Returns returns a list of package names with version strings

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_locked

    jail
        List locked packages within the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.list_locked jail=<jail name or id>

    chroot
        List locked packages within the specified chroot (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.list_locked chroot=/path/to/chroot

    root
        List locked packages within the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.list_locked root=/path/to/chroot

    ulockR!u{0}-{1}N(t_lockcmdR R(RF(RAR$((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytlist_locked�s+cK@s#|tddd|�krtStS(u�
    Query the package database to determine if the named package
    is locked against reinstallation, modification or deletion.

    Returns True if the named package is locked, False otherwise.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.locked <package name>

    jail
        Test if a package is locked within the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.locked <package name> jail=<jail name or id>

    chroot
        Test if a package is locked within the specified chroot (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.locked <package name> chroot=/path/to/chroot

    root
        Test if a package is locked within the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.locked <package name> root=/path/to/chroot

    ulockR!N(R�R RWR
(R!RA((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyR�s+cK@s |td||�krtStS(uZ
    Lock the named package against reinstallation, modification or deletion.

    Returns True if the named package was successfully locked.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.lock <package name>

    jail
        Lock packages within the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.lock <package name> jail=<jail name or id>

    chroot
        Lock packages within the specified chroot (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.lock <package name> chroot=/path/to/chroot

    root
        Lock packages within the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.lock <package name> root=/path/to/chroot

    ulock(R�RWR
(R!RA((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyR�Ms*cK@s |td||�krtStS(ul
    Unlock the named package against reinstallation, modification or deletion.

    Returns True if the named package was successfully unlocked.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.unlock <package name>

    jail
        Unlock packages within the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.unlock <package name> jail=<jail name or id>

    chroot
        Unlock packages within the specified chroot (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.unlock <package name> chroot=/path/to/chroot

    root
        Unlock packages within the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.unlock <package name> root=/path/to/chroot

    uunlock(R�R
RW(R!RA((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyR�}s*c
K@sw|jdd�}|jdd�}|jdd�}g}t|||�}|j|�|jd�|jd�|jd�|r�|j|�ntd|dd	d
t�}|ddkr�td
j|�di|d6��nxntj	j
j|dd�D]P}	|	sqny|	jdd�d}Wnt
k
rHqnX|j|�qWtjddj|��|S(u�
    Helper function for lock and unlock commands, because their syntax is identical.

    Run the lock/unlock command, and return a list of locked packages
    ujailuchrooturootu-yu--quietu
--show-lockeducmd.run_allRNutraceRGuretcodeiu#Problem encountered {0}ing packagesRquresultustdoutu
u-iuLocked packages: %su, N(R8R RRJRR
RR(RRRRRRRRRr(
tsubcmdR$RARRRtlocked_pkgsRRdR#((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyR��s4



#
cK@s�|jdd�}|jdd�}|jdd�}|jdd�}t|||�}|jdddg�|s�|jd�n|r�|jd	|g�ntd
|ddd
tdt�}d�tj	t
|�d�D�S(u8
    List those packages for which an upgrade is available

    The ``fromrepo`` argument is also supported, as used in pkg states.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.list_upgrades

    jail
        List upgrades within the specified jail

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.list_upgrades jail=<jail name or id>

    chroot
        List upgrades within the specified chroot (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.list_upgrades chroot=/path/to/chroot

    root
        List upgrades within the specified root (ignored if ``jail`` is
        specified)

        CLI Example:

        .. code-block:: bash

            salt '*' pkg.list_upgrades root=/path/to/chroot

    ujailuchrooturootufromrepouupgradeu	--dry-runu--quietu--no-repo-updateu--repositoryucmd.run_stdoutRNutraceRGtignore_retcodecS@s'i|]\}}|dd|�qS(uversionunew((RUR$tpkgstat((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pys
<dictcomp>	s	N(R8R RRRJRR
RWRR?t_parse_upgrade(R[RARRRRtRRd((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt
list_upgrades�s*"cC@s�tjd�}tjd�}tjd�}iid6id6id6id6id6}d}xjtjjj|d	�D]P}|s�d}qun|d
kr�d}qun|dkr�d}qun|dkr�d}qun|d
kr�d}qun|dkrd}qun|dks|dkr�|j|�}|r�ii|jd�d6|jd�d6d6|jd�d6|jd�d6|||jd�<q�t	j
d||�n|dkr1|j|�}|rii|jd�d6d6|jd�d6|jd�d6|||jd�<q1t	j
d||�n|dksI|dkru|j|�}|r�ii|jd�d6d6|jd�d6|jd�d6|||jd�<q�t	j
d||�ququW|S(u�
    Parse the output from the ``pkg upgrade --dry-run`` command

    Returns a dictionary of the expected actions:

    .. code-block:: yaml

        'upgrade':
          pkgname:
            'repo': repository
            'reason': reason
            'version':
              'current': n.n.n
              'new': n.n.n
        'install':
          pkgname:
            'repo': repository
            'reason': reason
            'version':
              'current': n.n.n
        'reinstall':
          pkgname:
            'repo': repository
            'reason': reason
            'version':
              'current': n.n.n
        'downgrade':
          pkgname:
            'repo': repository
            'reason': reason
            'version':
              'current': n.n.n
              'new': n.n.n
        'remove':
          pkgname:
            'repo': repository
            'reason': reason
            'version':
              'current': n.n.n
    uT^\s+([^:]+):\s([0-9a-z_,.]+)\s+->\s+([0-9a-z_,.]+)\s*(\[([^]]+)\])?\s*(\(([^)]+)\))?u?^\s+([^:]+):\s+([0-9a-z_,.]+)\s*(\[([^]]+)\])?\s*(\(([^)]+)\))?u@^\s+(\S+)-(?<=-)([0-9a-z_,.]+)\s*(\[([^]]+)\])?\s*(\(([^)]+)\))?uupgradeuinstallu	reinstalluremoveu	downgradeu
u"Installed packages to be UPGRADED:uNew packages to be INSTALLED:u%Installed packages to be REINSTALLED:u!Installed packages to be REMOVED:u$Installed packages to be DOWNGRADED:iucurrentiunewuversioniurepoiureasoniuUnable to parse %s: '%s'iiN(tretcompileR RRRRtmatchtgroupRterror(tstdoutt
upgrade_regext
install_regextreinstall_regexR�tactionR#R�((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyR�	sj*)'''cC@s�~idd6dd6dd6}yWddd	||g}td
|ddd
tdt�}|d|krt||dSWn tk
r�}tj|�nXdS(u
    Do a cmp-style comparison on two packages. Return -1 if pkg1 < pkg2, 0 if
    pkg1 == pkg2, and 1 if pkg1 > pkg2. Return None if there was a problem
    making the comparison.

    CLI Example:

    .. code-block:: bash

        salt '*' pkg.version_cmp '2.1.11' '2.1.12'
    i����u<iu>iu=upkguversionu--test-versionucmd.run_allRNutraceRGR�ustdoutN(RR
RWt	ExceptionRR�R (tpkg1tpkg2tignore_epochtsymRRR((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pytversion_cmp�	s 

	(Ht__doc__t
__future__RRRR`tloggingR+R�tsalt.utils.dataRtsalt.utils.filestsalt.utils.functoolstsalt.utils.itertoolstsalt.utils.pkgtsalt.utils.stringutilstsalt.utils.versionstsalt.exceptionsRRtsalt.extRt	getLoggert__name__RRRR RRR&R*R7RFRt	functoolstalias_functionRqR
RLR�R_tavailable_versionRVRhRlRmRnRoR�R�tdeletetpurgeR�R�R�R�R�R�RWR�R�R�R�R�R�R�R�R�R�R�R�(((s6/usr/lib/python2.7/site-packages/salt/modules/pkgng.pyt<module>&s�			4.	KS	F/.(��	xH#OG��FAA	/	1	0	0+=	w

Zerion Mini Shell 1.0