.. index:: packs
.. _packs/0:

.. rst-class:: right

**object**

``packs``
=========

Pack handling predicates.

| **Author:** Paulo Moura
| **Version:** 0:55:3
| **Date:** 2022-08-24

| **Compilation flags:**
|    ``static, context_switching_calls``


| **Imports:**
|    ``public`` :ref:`packs_common <packs_common/0>`
|    ``public`` :ref:`options <options/0>`
| **Uses:**
|    :ref:`list <list/0>`
|    :ref:`logtalk <logtalk/0>`
|    :ref:`os <os/0>`
|    :ref:`registries <registries/0>`
|    :ref:`type <type/0>`
|    :ref:`user <user/0>`

| **Remarks:**
|    (none)

| **Inherited public predicates:**
|     :ref:`options_protocol/0::check_option/1`  :ref:`options_protocol/0::check_options/1`  :ref:`options_protocol/0::default_option/1`  :ref:`options_protocol/0::default_options/1`  :ref:`packs_common/0::directory/1`  :ref:`packs_common/0::directory/2`  :ref:`packs_common/0::help/0`  :ref:`packs_common/0::logtalk_packs/0`  :ref:`packs_common/0::logtalk_packs/1`  :ref:`options_protocol/0::option/2`  :ref:`options_protocol/0::option/3`  :ref:`packs_common/0::pin/0`  :ref:`packs_common/0::pin/1`  :ref:`packs_common/0::pinned/1`  :ref:`packs_common/0::prefix/0`  :ref:`packs_common/0::prefix/1`  :ref:`packs_common/0::readme/1`  :ref:`packs_common/0::readme/2`  :ref:`packs_common/0::reset/0`  :ref:`packs_common/0::setup/0`  :ref:`packs_common/0::unpin/0`  :ref:`packs_common/0::unpin/1`  :ref:`options_protocol/0::valid_option/1`  :ref:`options_protocol/0::valid_options/1`  :ref:`packs_common/0::verify_commands_availability/0`  

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. raw:: html

   <div id="available/1"> </div>

.. index:: available/1
.. _packs/0::available/1:

``available/1``
^^^^^^^^^^^^^^^

Lists all the packs that are available for installation from the given registry.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``available(Registry)``
| **Mode and number of proofs:**
|    ``available(+atom)`` - ``one``


------------

.. raw:: html

   <div id="available/0"> </div>

.. index:: available/0
.. _packs/0::available/0:

``available/0``
^^^^^^^^^^^^^^^

Lists all the packs that are available for installation from all defined registries.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``available`` - ``one``


------------

.. raw:: html

   <div id="installed/4"> </div>

.. index:: installed/4
.. _packs/0::installed/4:

``installed/4``
^^^^^^^^^^^^^^^

Enumerates by backtracking all installed packs.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``installed(Registry,Pack,Version,Pinned)``
| **Mode and number of proofs:**
|    ``installed(?atom,?atom,?compound,?boolean)`` - ``zero_or_more``


------------

.. raw:: html

   <div id="installed/3"> </div>

.. index:: installed/3
.. _packs/0::installed/3:

``installed/3``
^^^^^^^^^^^^^^^

Enumerates by backtracking all installed packs.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``installed(Registry,Pack,Version)``
| **Mode and number of proofs:**
|    ``installed(?atom,?atom,?compound)`` - ``zero_or_more``


------------

.. raw:: html

   <div id="installed/0"> </div>

.. index:: installed/0
.. _packs/0::installed/0:

``installed/0``
^^^^^^^^^^^^^^^

Lists all the packs that are installed.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``installed`` - ``one``


------------

.. raw:: html

   <div id="outdated/4"> </div>

.. index:: outdated/4
.. _packs/0::outdated/4:

``outdated/4``
^^^^^^^^^^^^^^

Enumerates by backtracking all installed but outdated packs (together with the current version installed and the latest version available).

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``outdated(Registry,Pack,Version,LatestVersion)``
| **Mode and number of proofs:**
|    ``outdated(?atom,?atom,?compound,?compound)`` - ``zero_or_more``


------------

.. raw:: html

   <div id="outdated/1"> </div>

.. index:: outdated/1
.. _packs/0::outdated/1:

``outdated/1``
^^^^^^^^^^^^^^

Lists all the packs from the given registry that are installed but outdated.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``outdated(+atom)`` - ``one``


------------

.. raw:: html

   <div id="outdated/0"> </div>

.. index:: outdated/0
.. _packs/0::outdated/0:

``outdated/0``
^^^^^^^^^^^^^^

Lists all the packs that are installed but outdated.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``outdated`` - ``one``


------------

.. raw:: html

   <div id="orphaned/2"> </div>

.. index:: orphaned/2
.. _packs/0::orphaned/2:

``orphaned/2``
^^^^^^^^^^^^^^

Lists all the packs that are installed but whose registry is no longer defined.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``orphaned(Registry,Pack)``
| **Mode and number of proofs:**
|    ``orphaned(?atom,?atom)`` - ``zero_or_more``


------------

.. raw:: html

   <div id="orphaned/0"> </div>

.. index:: orphaned/0
.. _packs/0::orphaned/0:

``orphaned/0``
^^^^^^^^^^^^^^

Lists all the packs that are installed but whose registry is no longer defined.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``orphaned`` - ``one``


------------

.. raw:: html

   <div id="describe/2"> </div>

.. index:: describe/2
.. _packs/0::describe/2:

``describe/2``
^^^^^^^^^^^^^^

Describes a registered pack, including installed version if applicable.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``describe(Registry,Pack)``
| **Mode and number of proofs:**
|    ``describe(+atom,+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="describe/1"> </div>

.. index:: describe/1
.. _packs/0::describe/1:

``describe/1``
^^^^^^^^^^^^^^

Describes a registered pack, including installed version if applicable.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``describe(Pack)``
| **Mode and number of proofs:**
|    ``describe(+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="search/1"> </div>

.. index:: search/1
.. _packs/0::search/1:

``search/1``
^^^^^^^^^^^^

Searches packs whose name or description includes the search term (case sensitive).

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``search(Term)``
| **Mode and number of proofs:**
|    ``search(+atom)`` - ``one``


------------

.. raw:: html

   <div id="install/4"> </div>

.. index:: install/4
.. _packs/0::install/4:

``install/4``
^^^^^^^^^^^^^

Installs a new pack using the specified options. Fails if the pack is unknown or already installed but not using a ``force(true)`` option. Fails also if the pack version is unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``install(Registry,Pack,Version,Options)``
| **Mode and number of proofs:**
|    ``install(+atom,+atom,++compound,++list(compound))`` - ``zero_or_one``

| **Remarks:**

    - ``force(Boolean)`` option: Force re-installation if the pack is already installed. Default is ``false``.
    - ``clean(Boolean)`` option: Clean pack archive after installation. Default is ``false``.
    - ``verbose(Boolean)`` option: Verbose installing steps. Default is ``false``.
    - ``checksum(Boolean)`` option: Verify pack archive checksum. Default is ``true``.
    - ``checksig(Boolean)`` option: Verify pack archive signature. Default is ``false``.
    - ``curl(Atom)`` option: Extra command-line options. Default is ``''``.
    - ``gpg(Atom)`` option: Extra command-line options. Default is ``''``.
    - ``tar(Atom)`` option: Extra command-line options. Default is ``''``.


------------

.. raw:: html

   <div id="install/3"> </div>

.. index:: install/3
.. _packs/0::install/3:

``install/3``
^^^^^^^^^^^^^

Installs the specified version of a pack from the given registry using default options. Fails if the pack is already installed or unknown. Fails also if the pack version is unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``install(Registry,Pack,Version)``
| **Mode and number of proofs:**
|    ``install(+atom,+atom,?compound)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="install/2"> </div>

.. index:: install/2
.. _packs/0::install/2:

``install/2``
^^^^^^^^^^^^^

Installs the latest version of a pack from the given registry using default options. Fails if the pack is already installed or unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``install(Registry,Pack)``
| **Mode and number of proofs:**
|    ``install(+atom,+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="install/1"> </div>

.. index:: install/1
.. _packs/0::install/1:

``install/1``
^^^^^^^^^^^^^

Installs a pack (if its name is unique among all registries) using default options. Fails if the pack is already installed or unknown. Fails also if the pack is available from multiple registries.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``install(Pack)``
| **Mode and number of proofs:**
|    ``install(+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="update/3"> </div>

.. index:: update/3
.. _packs/0::update/3:

``update/3``
^^^^^^^^^^^^

Updates an outdated pack to the specified version using the specified options. Fails if the pack or the pack version is unknown or if the pack is not installed. Fails also if the pack is pinned and not using a ``force(true)`` option.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``update(Pack,Version,Options)``
| **Mode and number of proofs:**
|    ``update(+atom,++callable,++list(callable))`` - ``zero_or_one``

| **Remarks:**

    - ``force(Boolean)`` option: Force update if the pack is pinned. Default is ``false``.
    - ``clean(Boolean)`` option: Clean pack archive after updating. Default is ``false``.
    - ``verbose(Boolean)`` option: Verbose updating steps. Default is ``false``.
    - ``checksum(Boolean)`` option: Verify pack archive checksum. Default is ``true``.
    - ``checksig(Boolean)`` option: Verify pack archive signature. Default is ``false``.
    - ``curl(Atom)`` option: Extra command-line options. Default is ``''``.
    - ``gpg(Atom)`` option: Extra command-line options. Default is ``''``.
    - ``tar(Atom)`` option: Extra command-line options. Default is ``''``.


------------

.. raw:: html

   <div id="update/2"> </div>

.. index:: update/2
.. _packs/0::update/2:

``update/2``
^^^^^^^^^^^^

Updates an outdated pack to its latest version using the specified options. Fails if the pack is unknown or not installed. Fails also if the pack is pinned and not using a ``force(true)`` option.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``update(Pack,Options)``
| **Mode and number of proofs:**
|    ``update(+atom,++list(callable))`` - ``zero_or_one``

| **Remarks:**

    - ``force(Boolean)`` option: Force update if the pack is pinned. Default is ``false``.
    - ``clean(Boolean)`` option: Clean pack archive after updating. Default is ``false``.
    - ``verbose(Boolean)`` option: Verbose updating steps. Default is ``false``.
    - ``checksum(Boolean)`` option: Verify pack archive checksum. Default is ``true``.
    - ``checksig(Boolean)`` option: Verify pack archive signature. Default is ``false``.
    - ``curl(Atom)`` option: Extra command-line options. Default is ``''``.
    - ``gpg(Atom)`` option: Extra command-line options. Default is ``''``.
    - ``tar(Atom)`` option: Extra command-line options. Default is ``''``.


------------

.. raw:: html

   <div id="update/1"> </div>

.. index:: update/1
.. _packs/0::update/1:

``update/1``
^^^^^^^^^^^^

Updates an outdated pack to its latest version using default options. Fails if the pack is pinned, not installed, or unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``update(Pack)``
| **Mode and number of proofs:**
|    ``update(+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="update/0"> </div>

.. index:: update/0
.. _packs/0::update/0:

``update/0``
^^^^^^^^^^^^

Updades all outdated packs (that are not pinned) using default options.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``update`` - ``zero_or_one``


------------

.. raw:: html

   <div id="uninstall/2"> </div>

.. index:: uninstall/2
.. _packs/0::uninstall/2:

``uninstall/2``
^^^^^^^^^^^^^^^

Uninstalls a pack using the specified options. Fails if the pack is unknown or not installed. Fails also if the pack is pinned or have dependents and not using a ``force(true)`` option.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``uninstall(Pack,Options)``
| **Mode and number of proofs:**
|    ``uninstall(+atom,++list(compound))`` - ``zero_or_one``

| **Remarks:**

    - ``force(Boolean)`` option: Force deletion if the pack is pinned. Default is ``false``.
    - ``clean(Boolean)`` option: Clean pack archive after deleting. Default is ``false``.
    - ``verbose(Boolean)`` option: Verbose uninstalling steps. Default is ``false``.


------------

.. raw:: html

   <div id="uninstall/1"> </div>

.. index:: uninstall/1
.. _packs/0::uninstall/1:

``uninstall/1``
^^^^^^^^^^^^^^^

Uninstalls a pack using default options. Fails if the pack is pinned, have dependents, not installed, or unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``uninstall(Pack)``
| **Mode and number of proofs:**
|    ``uninstall(+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="uninstall/0"> </div>

.. index:: uninstall/0
.. _packs/0::uninstall/0:

``uninstall/0``
^^^^^^^^^^^^^^^

Uninstalls all packs using the ``force(true)`` option.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``uninstall`` - ``zero_or_one``


------------

.. raw:: html

   <div id="clean/2"> </div>

.. index:: clean/2
.. _packs/0::clean/2:

``clean/2``
^^^^^^^^^^^

Cleans all pack archives. Fails if the the pack is unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``clean(Registry,Pack)``
| **Mode and number of proofs:**
|    ``clean(+atom,+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="clean/1"> </div>

.. index:: clean/1
.. _packs/0::clean/1:

``clean/1``
^^^^^^^^^^^

Cleans all pack archives. Fails if the pack is not unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``clean(Pack)``
| **Mode and number of proofs:**
|    ``clean(+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="clean/0"> </div>

.. index:: clean/0
.. _packs/0::clean/0:

``clean/0``
^^^^^^^^^^^

Cleans all archives for all packs.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``clean`` - ``one``


------------

.. raw:: html

   <div id="save/2"> </div>

.. index:: save/2
.. _packs/0::save/2:

``save/2``
^^^^^^^^^^

Saves a list of all installed packs and registries plus pinning status to a file using the given options. Registries without installed packs are saved when using the option ``save(all)`` and skipped when using the option ``save(installed)`` (default).

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``save(File,Options)``
| **Mode and number of proofs:**
|    ``save(+atom,++list(compound))`` - ``one``


------------

.. raw:: html

   <div id="save/1"> </div>

.. index:: save/1
.. _packs/0::save/1:

``save/1``
^^^^^^^^^^

Saves a list of all installed packs and their registries plus pinning status to a file using default options.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``save(File)``
| **Mode and number of proofs:**
|    ``save(+atom)`` - ``one``


------------

.. raw:: html

   <div id="restore/2"> </div>

.. index:: restore/2
.. _packs/0::restore/2:

``restore/2``
^^^^^^^^^^^^^

Restores a list of registries and packs plus their pinning status from a file using the given options. Fails if restoring is not possible.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``restore(File,Options)``
| **Mode and number of proofs:**
|    ``restore(+atom,++list(compound))`` - ``zero_or_one``

| **Remarks:**

    - ``force(Boolean)`` option: Force restoring if a registry is already defined or a pack is already installed. Default is ``true``.
    - ``clean(Boolean)`` option: Clean registry and pack archives after restoring. Default is ``false``.
    - ``verbose(Boolean)`` option: Verbose restoring steps. Default is ``false``.
    - ``checksum(Boolean)`` option: Verify pack archive checksums. Default is ``true``.
    - ``checksig(Boolean)`` option: Verify pack archive signatures. Default is ``false``.
    - ``curl(Atom)`` option: Extra command-line options. Default is ``''``.
    - ``gpg(Atom)`` option: Extra command-line options. Default is ``''``.
    - ``tar(Atom)`` option: Extra command-line options. Default is ``''``.


------------

.. raw:: html

   <div id="restore/1"> </div>

.. index:: restore/1
.. _packs/0::restore/1:

``restore/1``
^^^^^^^^^^^^^

Restores a list of registries and packs plus their pinning status from a file using default options. Fails if restoring is not possible.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``restore(File)``
| **Mode and number of proofs:**
|    ``restore(+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="dependents/3"> </div>

.. index:: dependents/3
.. _packs/0::dependents/3:

``dependents/3``
^^^^^^^^^^^^^^^^

Returns a list of all installed packs that depend on the given pack from the given registry. Fails if the pack is unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``dependents(Registry,Pack,Dependents)``
| **Mode and number of proofs:**
|    ``dependents(+atom,+atom,-list(atom))`` - ``zero_or_one``


------------

.. raw:: html

   <div id="dependents/2"> </div>

.. index:: dependents/2
.. _packs/0::dependents/2:

``dependents/2``
^^^^^^^^^^^^^^^^

Prints a list of all installed packs that depend on the given pack from the given registry. Fails if the pack is unknown.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``dependents(Registry,Pack)``
| **Mode and number of proofs:**
|    ``dependents(+atom,+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="dependents/1"> </div>

.. index:: dependents/1
.. _packs/0::dependents/1:

``dependents/1``
^^^^^^^^^^^^^^^^

Prints a list of all installed packs that depend on the given pack if unique from all defined registries. Fails if the pack is unknown or available from multiple registries.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``dependents(Pack)``
| **Mode and number of proofs:**
|    ``dependents(+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="lint/2"> </div>

.. index:: lint/2
.. _packs/0::lint/2:

``lint/2``
^^^^^^^^^^

Checks the pack specification. Fails if the pack is unknown or if linting detects errors.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``lint(Registry,Pack)``
| **Mode and number of proofs:**
|    ``lint(+atom,+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="lint/1"> </div>

.. index:: lint/1
.. _packs/0::lint/1:

``lint/1``
^^^^^^^^^^

Checks the pack specification. Fails if the pack is unknown, or available from multiple registries, or if linting detects errors.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``lint(Pack)``
| **Mode and number of proofs:**
|    ``lint(+atom)`` - ``zero_or_one``


------------

.. raw:: html

   <div id="lint/0"> </div>

.. index:: lint/0
.. _packs/0::lint/0:

``lint/0``
^^^^^^^^^^

Checks all pack specifications.

| **Compilation flags:**
|    ``static``

| **Mode and number of proofs:**
|    ``lint`` - ``one``


------------

Protected predicates
--------------------

(no local declarations; see entity ancestors if any)

Private predicates
------------------

(no local declarations; see entity ancestors if any)

Operators
---------

(none)

