prolog_pack.pl -- A package manager for Prolog
The library(prolog_pack) provides the SWI-Prolog package manager. This library lets you inspect installed packages, install packages, remove packages, etc. This library complemented by the built-in predicates such as attach_packs/2 that makes installed packages available as libraries.
The important functionality of this library is encapsulated in the app
pack
. For help, run
swipl pack help
- current_pack(?Pack) is nondet[private]
- current_pack(?Pack, ?Dir) is nondet[private]
- True if Pack is a currently installed pack.
- pack_list_installed is det
- List currently installed packages and report possible dependency issues.
- pack_info(+Pack)
- Print more detailed information about Pack.
- pack_info_term(+PackDir, ?Info) is nondet[private]
- True when Info is meta-data for the package PackName.
- term_in_file(:Valid, +File, -Term) is nondet[private]
- True when Term appears in file and
call(Valid, Term)
is true. - pack_info_term(?Term) is nondet[private]
- True when Term describes name and arguments of a valid package info term.
- pack_list(+Query) is det
- pack_list(+Query, +Options) is det
- pack_search(+Query) is det
- Query package server and installed packages and display results.
Query is matches case-insensitively against the name and title of
known and installed packages. For each matching package, a single
line is displayed that provides:
- Installation status
- p: package, not installed
- i: installed package; up-to-date with public version
- a: as i, but installed only as dependency
- U: installed package; can be upgraded
- A: installed package; newer than publically available
- l: installed package; not on server
- Name@Version
- Name@Version(ServerVersion)
- Title
Options processed:
- installed(true)
- Only list packages that are locally installed. Contacts the server to compare our local version to the latest available version.
- outdated(true)
- Only list packages that need to be updated. This option
implies
installed(true)
. - server((Server|false))
- If
false
, do not contact the server. This impliesinstalled(true)
. Otherwise, use the given pack server.
Hint:
?- pack_list('').
lists all known packages.The predicates pack_list/1 and pack_search/1 are synonyms. Both contact the package server at https://www.swi-prolog.org to find available packages. Contacting the server can be avoided using the
server(false)
option. - Installation status
- join_status(+PacksIn, -PacksOut) is det[private]
- Combine local and remote information to assess the status of each
package. PacksOut is a list of
pack(Name, Status, Version, URL)
. If the versions do not match, Version isVersionInstalled-VersionRemote
and similar for thee URL. - local_search(+Query, -Packs:list(atom)) is det[private]
- Search locally installed packs.
- pack_install(+Spec:atom) is det
- pack_install(+SpecOrList, +Options) is det
- Install one or more packs from SpecOrList. SpecOrList is a single
specification or a list of specifications. A specification is one of
- A pack name. This queries the pack repository at https://www.swi-prolog.org
- Archive file name
- A
http(s)
URL of an archive file name. This URL may contain a star (*) for the version. In this case pack_install/1 asks for the directory content and selects the latest version. - An https GIT URL
- A local directory name given as
file://
URL '.'
, in which case a relative symlink is created to the current directory (all other options for Spec make a copy of the files). Installation using a symlink is normally used during development of a pack.
Processes the options below. Default options as would be used by pack_install/1 are used to complete the provided Options. Note that pack_install/2 can be used through the SWI-Prolog command line app
pack
as below. Most of the options of this predicate are available as command line options.swipl pack install <name>
Options:
- url(+URL)
- Source for downloading the package
- pack_directory(+Dir)
- Directory into which to install the package.
- global(+Boolean)
- If
true
, install in the XDG common application data path, making the pack accessible to everyone. Iffalse
, install in the XDG user application data path, making the pack accessible for the current user only. If the option is absent, use the first existing and writable directory. If that doesn't exist find locations where it can be created and prompt the user to do so. - insecure(+Boolean)
- When
true
(defaultfalse
), do not perform any checks on SSL certificates when downloading usinghttps
. - interactive(+Boolean)
- Use default answer without asking the user if there is a default action.
- silent(+Boolean)
- If
true
(default false), suppress informational progress messages. - upgrade(+Boolean)
- If
true
(defaultfalse
), upgrade package if it is already installed. - rebuild(Condition)
- Rebuild the foreign components. Condition is one of
if_absent
(default, do nothing if the directory with foreign resources exists),make
(runmake
) ortrue
(run `make distclean` followed by the default configure and build steps). - test(Boolean)
- If
true
(default), run the pack tests. - git(+Boolean)
- If
true
(defaultfalse
unless URL ends with =.git=), assume the URL is a GIT repository. - link(+Boolean)
- Can be used if the installation source is a local directory and the file system supports symbolic links. In this case the system adds the current directory to the pack registration using a symbolic link and performs the local installation steps.
- version(+Version)
- Demand the pack to satisfy some version requirement. Version
is as defined by require_version/3. For example
'1.5'
is the same as>=('1.5')
. - branch(+Branch)
- When installing from a git repository, clone this branch.
- commit(+Commit)
- When installing from a git repository, checkout this commit.
Commit is either a hash, a tag, a branch or
'HEAD'
. - build_type(+Type)
- When building using CMake, use
-DCMAKE_BUILD_TYPE=Type
. Default is the build type of Prolog orRelease
. - register(+Boolean)
- If
true
(default), register packages as downloaded after performing the download. This contacts the server with the meta-data of each pack that was downloaded. The server will either register the location as a new version or increment the download count. The server stores the IP address of the client. Subsequent downloads of the same version from the same IP address are ignored. - server(+URL)
- Pack server to contact. Default is the setting
prolog_pack:server
, by default set tohttps://www.swi-prolog.org/pack/
Non-interactive installation can be established using the option
interactive(false)
. It is adviced to install from a particular trusted URL instead of the plain pack name for unattented operation. - pack_default_options(+Spec, -Pack, +OptionsIn, -Options) is det[private]
- Establish the pack name (Pack) and install options from a
specification and options (OptionsIn) provided by the user. Cases:
- Already installed. We must pass that as pack_default_options/4 is called twice from pack_install/2.
- Install from a URL due to a
url(URL)
option. Determine whether the URL is a GIT repository, get the version and pack from the URL. - Install a local archive file. Extract the pack and version from the archive name.
- Install from a git URL. Determines the pack, sets
git(true)
and adds the URL as option. - Install from a directory. Get the info from the
packs.pl
file. - Install from
'.'
. Create a symlink to make the current dir accessible as a pack. - Install from a non-git URL Determine pack and version.
- Pack name. Query the server to find candidate packs and select an adequate pack.
- pack_install_dir(-PackDir, +Options) is det[private]
- Determine the directory below which to install new packs. This find
or creates a writeable directory. Options:
pack_directory(+PackDir)
Use PackDir. PackDir is created if it does not exist.global(+Boolean)
Iftrue
, find a writeable global directory based on the file search pathcommon_app_data
. Iffalse
, find a user-specific writeable directory based onuser_app_data
- If neither of the above is given, use the search path
pack
.
If no writeable directory is found, generate possible location where this directory can be created and ask the user to create one of them.
- pack_unpack_from_local(+Source, +PackTopDir, +Name, -PackDir, +Options)[private]
- Unpack a package from a local media. If Source is a directory,
either copy or link the directory. Else, Source must be an archive
file. Options:
- link(+Boolean)
- If the source is a directory, link or copy the directory?
- upgrade(true)
- If the target is already there, wipe it and make a clean install.
- pack_unpack(+SourceFile, +PackDir, +Pack, +Options)[private]
- Unpack an archive to the given package dir.
- pack_install_local(:Spec, +Dir, +Options) is det
- Install a number of packages in a local directory. This predicate supports installing packages local to an application rather than globally.
- known_media(+Pair) is semidet[private]
- True when the options specify installation from a known media. If that applies to all packs, there is no need to query the server. We first download and unpack the known media, then examine the requirements and, if necessary, go to the server to resolve these.
- pack_resolve(+Pairs, +Existing, +Versions, -Plan, +Options) is det[private]
- Generate an installation plan. Pairs is a list of Pack-Options pairs
that specifies the desired packages. Existing is a list of
pack(Pack, i, Title, Version, URL)
terms that represents the already installed packages. Versions is obtained from the server. Seepack.pl
from the web server for details. On success, this results in a Plan to satisfies the requirements. The plan is a list of packages to install with their location. The steps satisfy the partial ordering of dependencies, such that dependencies are installed before the dependents. Options:- upgrade(true)
- When specified, we try to install the latest version of all the packages. Otherwise, we try to minimise the installation.
- insert_existing(+Existing, +Available, -Candidates, +Options) is det[private]
- Combine the already existing packages with the ones reported as
available by the server to a list of Candidates, where the candidate
of each package is ordered according by preference. When
upgrade(true)
is specified, the existing is merged into the set of Available versions. Otherwise Existing is prepended to Available, so it is selected as first. - can_upgrade(+Installed, +Versions, -Installed2) is det[private]
- Add a
latest_version
key to Installed if its version is older than the latest available version. - mark_installed(+PlanA, +Existing, -Plan) is det[private]
- Mark already up-to-date packs from the plan and add a key
upgrade:true
to elements of PlanA in Existing that are not the same. - select_version(+PackAndOptions, +Available, +Options)// is nondet[private]
- True when the output is a list of pack info dicts that satisfy the installation requirements of PackAndOptions from the packs known to be Available.
- add_to_plan(+Info, +Versions, +Options) is semidet[private]
- Add Info to the plan. If an Info about the same pack is already in the plan, but this is a different version of the pack, we must fail as we cannot install two different versions of a pack.
- info_conflicts(+Info1, +Info2) is semidet[private]
- True if Info2 is in conflict with Info2. The relation is symetric.
- pack_satisfies(+Pack, +Version, +Info0, -Info, +Options) is semidet[private]
- True if Pack@Version with Info satisfies the pack installation options provided by Options.
- satisfies_version(+Pack, +PackVersion, +RequiredVersion) is semidet[private]
- satisfies_req(+Provides, +Required) is semidet[private]
- Check a token requirements.
- pack_options_to_versions(+PackOptionsPair, -Versions) is det[private]
- Create an available package term from Pack and Options if it
contains a
url(URL)
option. This allows installing packages that are not known to the server. In most cases, the URL will be a git URL or the URL to download an archive. It can also be afile://
url to install from a local archive.The first clause deals with a wildcard URL. See pack_default_options/4, case (7).
- compatible_version(+Pack, +Version, +Options) is semidet[private]
- Fails if Options demands a version and Version is not compatible with Version.
- pack_options_compatible_with_info(+Info, +PackOptions) is semidet[private]
- Ignore information from the server that is incompatible with the request.
- download_plan(+Targets, +Plan, +Options) is semidet[private]
- Download or update all packages from Plan. We need to do this as a first step because we may not have (up-to-date) dependency information about all packs. For example, a pack may be installed at the git HEAD revision that is not yet know to the server or it may be installed from a url that is not known at all at the server.
- plan_unsatisfied_dependencies(+Plan, -Deps) is det[private]
- True when Deps is a list of dependency tokens in Plan that is not satisfied.
- build_plan(+Plan, -Built, +Options) is det[private]
- Run post installation steps. We build dependencies before their dependents, so we first do a topological sort on the packs based on the pack dependencies.
- needs_rebuild(+PackDir, +Options) is semidet[private]
- True when we need to rebuilt the pack in PackDir.
- is_built(+PackDir, +Options) is semidet[private]
- True if the pack in PackDir has been built.
- order_builds(+ToBuild, -Ordered) is det[private]
- Order the build processes by building dependencies before the packages that rely on them as they may need them during the build.
- exec_plan_rebuild_step(+Options, +Info) is det[private]
- Execute the rebuild steps for the given Info.
- attach_from_info(+Options, +Info) is det[private]
- Make the package visible. Similar to pack_make_available/3.
- download_from_info(+Options, +Info0, -Info) is det[private]
- Download a package guided by Info. Note that this does not run any scripts. This implies that dependencies do not matter and we can proceed in any order. This is important because we may use packages at their git HEAD, which implies that requirements may be different from what is in the Info terms.
- reload_info(+PackDir, +Info0, -Info) is det[private]
- Update the requires and provides metadata. Info0 is what we got from the server, but the package may be different as we may have asked for the git HEAD or the package URL may not have been known by the server at all.
- work_done(+Targets, +Plan, +PlanB, +Built, +Options) is det[private]
- Targets has successfully been installed and the packs Built have successfully ran their build scripts.
- local_packs(+Dir, -Packs) is det[private]
- True when Packs is a list with information for all installed packages.
- prolog_description(-Description) is det[private]
- Provide a description of the running Prolog system. Version terms:
prolog(Dialect, Version)
- is_prolog_token(+Token) is semidet[private]
- True when Token describes a property of the target Prolog system.
- prolog_satisfies(+Token) is semidet[private]
- True when the running Prolog system satisfies token. Processes
requires(Token)
terms for- prolog Cmp Version Demand a Prolog version (range).
- prolog:Flag
- prolog:Flag(Value)
- prolog:
library(Lib)
- pack_archive_info(+Archive, +Pack, -Info, -Strip)[private]
- True when Archive archives Pack. Info is unified with the terms
from
pack.pl
in the pack and Strip is the strip-option for archive_extract/3.Requires library(archive), which is lazily loaded when needed.
- pack_git_info(+GitDir, -Hash, -Info) is det[private]
- Retrieve info from a cloned git repository that is compatible with pack_archive_info/4.
- download_file_sanity_check(+Archive, +Pack, +Info) is semidet[private]
- Perform basic sanity checks on DownloadFile
- prepare_pack_dir(+Dir, +Options)[private]
- Prepare for installing the package into Dir. This
- If the directory exist and is empty, done.
- Else if the directory exists, remove the directory and recreate it. Note that if the directory is a symlink this just deletes the link.
- Else if some entry (file, link, ...) exists, delete it and create a new directory.
- Else create the directory.
- empty_directory(+Directory) is semidet[private]
- True if Directory is empty (holds no files or sub-directories).
- remove_existing_pack(+PackDir, +Options) is semidet[private]
- Remove a possible existing pack directory if the option
upgrade(true)
is present. This is used to remove an old installation before unpacking a new archive, copy or link a directory with the new contents. - pack_download_from_url(+URL, +PackDir, +Pack, +Options)[private]
- Download a package from a remote source. For git repositories, we
simply clone. Archives are downloaded. Options:
- git(true)
- Assume URL refers to a git repository.
- pack_dir(-Dir)
- Dir is unified with the location where the pack is installed.
- git_checkout_version(+PackDir, +Options) is det[private]
- Given a checked out version of a repository, put the repo at the
desired version. Options:
- commit(+Commit)
- Target commit or
'HEAD'
. If'HEAD'
, get the HEAD of the explicit (optionbranch(Branch)
), current or default branch. If the commit is a hash and it is the tip of a branch, checkout this branch. Else simply checkout the hash. - branch(+Branch)
- Used with
commit('HEAD')
. - version(+Version)
- Checkout a tag. If there is a tag matching Version use that, otherwise try to find a tag that ends with Version and demand the prefix to be letters, optionally followed by a dash or underscore. Examples: 2.1, V2.1, v_2.1.
- update(true)
- If none of the above is given update the repo. If it is on a branch, pull. Else, put it on the default branch and pull.
- git_ensure_on_branch(+PackDir, +Branch) is det[private]
- Ensure PackDir is on Branch.
- download_file(+URL, +Pack, -File, +Options) is det[private]
- Determine the file into which to download URL. The second clause deals with GitHub downloads from a release tag.
- pack_url_file(+URL, -File) is det
- True if File is a unique id for the referenced pack and version. Normally, that is simply the base name, but GitHub archives destroy this picture. Needed by the pack manager in the web server.
- download_url(@URL) is semidet[private]
- True if URL looks like a URL we can download from. Noet that urls
like
ftp://
are also download URLs, but we cannot download from them. - pack_post_install(+Pack, +PackDir, +Options) is det[private]
- Process post installation work. Steps:
- Create foreign resources
- Register directory as autoload library
- Attach the package
- pack_rebuild is det
- pack_rebuild(+Pack) is det
- Rebuild possible foreign components of Pack. The predicate pack_rebuild/0 rebuilds all registered packs.
- post_install_foreign(+Pack, +PackDir, +Options) is det[private]
- Install foreign parts of the package. Options:
- rebuild(When)
- Determine when to rebuild. Possible values:
- if_absent
- Only rebuild if we have no existing foreign library. This is the default.
- true
- Always rebuild.
- foreign_present(+PackDir, +Arch) is semidet[private]
- True if we find one or more modules in the pack
lib
directory for the current architecture. - is_foreign_pack(+PackDir, -Type) is nondet[private]
- True when PackDir contains files that indicate the need for a specific class of build tools indicated by Type.
- post_install_autoload(+PackDir, +Options)[private]
- Create an autoload index if the package demands such.
- pack_upgrade(+Pack) is semidet
- Upgrade Pack. Shorthand for
pack_install(Pack, [upgrade(true)])
. - pack_remove(+Name) is det
- pack_remove(+Name, +Options) is det
- Remove the indicated package. If packages depend (indirectly) on
this pack, ask to remove these as well. Options:
- interactive(false)
- Do not prompt the user.
- dependencies(Boolean)
- If
true
delete dependencies without asking.
- pack_publish(+Spec, +Options) is det
- Publish a package. There are two ways typical ways to call this. We
recommend developing a pack in a GIT repository. In this scenario
the pack can be published using
?- pack_publish('.', []).
Alternatively, an archive file has been uploaded to a public location. In this scenario we can publish the pack using
?- pack_publish(URL, [])
In both scenarios, pack_publish/2 by default creates an isolated environment and installs the package in this directory from the public URL. On success it triggers the pack server to register the URL as a new pack or a new release of a pack.
Packs may also be published using the app
pack
, e.g.swipl pack publish .
Options:
- git(Boolean)
- If
true
, and Spec is a git managed directory, install using the remote repo. - sign(Boolean)
- Sign the repository with the current version. This runs
git tag -s <tag>
. - force(Boolean)
- Force the git tag. This runs
git tag -f <tag>
. - branch(+Branch)
- Branch used for releases. Defined by git_default_branch/2 if not specified.
- register(+Boolean)
- If
false
(defaulttrue
), perform the installation, but do not upload to the server. This can be used for testing. - isolated(+Boolean)
- If
true
(default), install and build all packages in an isolated package directory. Iffalse
, use other packages installed for the environment. The latter may be used to speedup debugging. - pack_directory(+Dir)
- Install the temporary packages in Dir. If omitted pack_publish/2 creates a temporary directory and deletes this directory after completion. An explict target Dir is created if it does not exist and is not deleted on completion.
- clean(+Boolean)
- If
true
(default), clean the destination directory first
- prepare_repository(+Dir, +Metadata, +Options) is semidet[private]
- Prepare the git repository. If
register(false)
is provided, this is a test run and therefore we do not need this. Otherwise we demand the working directory to be clean, we tag the current commit and push the current branch. - tag_git_dir(+Dir, +Metadata, -Action, +Options) is semidet[private]
- Add a version tag to the git repository.
- git_to_https_url(+GitURL, -HTTP_URL) is semidet[private]
- Get the HTTP(s) URL for a git repository, given a git url. Whether or not this is available and how to translate the one into the other depends in the server software.
- pack_property(?Pack, ?Property) is nondet
- True when Property is a property of an installed Pack. This
interface is intended for programs that wish to interact with the
package manager. Defined properties are:
- directory(Directory)
- Directory into which the package is installed
- version(Version)
- Installed version
- title(Title)
- Full title of the package
- author(Author)
- Registered author
- download(URL)
- Official download URL
- readme(File)
- Package
README
file (if present) - todo(File)
- Package
TODO
file (if present)
- pack_version_file(-Pack, -Version:atom, +File) is semidet[private]
- True if File is the name of a file or URL of a file that
contains Pack at Version. File must have an extension and the
basename must be of the form <pack>-<n>{.<m>}*. E.g.,
mypack-1.5
. - safe_pack_name(+Name:atom) is semidet[private]
- Verifies that Name is a valid pack name. This avoids trickery with pack file names to make shell commands behave unexpectly.
- pack_version(-Pack:atom, -Version:atom)// is semidet[private]
- True when the input statifies <pack>-<version>
- git_url(+URL, -Pack) is semidet[private]
- True if URL describes a git url for Pack
- github_release_url(+URL, -Pack, -Version:atom) is semidet[private]
- True when URL is the URL of a GitHub release. Such releases are
accessible as
https:/github.com/<owner>/<pack>/archive/[vV]?<version>.zip'
- tag_version(+GitTag, -Version) is semidet[private]
- True when a GIT tag describes version Version. GitTag must
satisfy
[vV]?int(\.int)*
. - git_archive_url(+URL, -Archive, +Options) is semidet[private]
- If we do not have git installed, some git services offer downloading the code as an archive using HTTP. This predicate makes this translation.
- publish_download(+Infos, +Options) is semidet[private]
- register_downloads(+Infos, +Options) is det[private]
- Register our downloads with the pack server.
- query_pack_server(+Query, -Result, +Options)[private]
- Send a Prolog query to the package server and process its results.
- available_download_versions(+URL, -Versions:list(atom)) is det[private]
- Deal with wildcard URLs, returning a list of Version-URL pairs, sorted by version.
- sort_version_pairs(+Pairs, -Sorted) is det[private]
- Sort a list of Version-Data by decreasing version.
- github_url(+URL, -User, -Repo) is semidet[private]
- True when URL refers to a github repository.
- github_version(+User, +Repo, -Version, -VersionURI) is nondet[private]
- True when Version is a release version and VersionURI is the download location for the zip file.
- pack_provides(?Pack, -Provides) is multi[private]
- pack_requires(?Pack, -Requires) is nondet[private]
- pack_conflicts(?Pack, -Conflicts) is nondet[private]
- Provide logical access to pack dependency relations.
- pack_depends_on(?Pack, ?Dependency) is nondet[private]
- True when Pack depends on pack Dependency. This predicate does not deal with transitive dependency.
- dependents(+Pack, -Dependents) is semidet[private]
- True when Dependents is a list of packs that (indirectly) depend on Pack.
- validate_dependencies is det[private]
- Validate all dependencies, reporting on failures
- pack_dependency_issue(?Pack, -Issue) is nondet[private]
- True when Issue is a dependency issue regarding Pack. Issue is one
of
- unsatisfied(Pack, Requires)
- The requirement Requires of Pack is not fulfilled.
- conflicts(Pack, Conflict)
- Pack conflicts with Conflict.
- pack_assert(+PackDir, ++Fact) is det[private]
- Add/update a fact about packs. These facts are stored in
PackDir/status.db. Known facts are:
- built(Arch, Version, How)
- Pack has been built by SWI-Prolog Version for Arch. How is one
of
built
if we built it ordownloaded
if it was downloaded. - automatic(Boolean)
- If
true
, pack was installed as dependency. - archive(Archive, URL)
- Available when the pack was installed by unpacking Archive that was retrieved from URL.
- pack_status(?Pack, ?Fact)[private]
- pack_status_dir(+PackDir, ?Fact)[private]
- True when Fact is true about the package in PackDir. Facts
are asserted a file
status.db
. - update_automatic(+Info) is det[private]
- Update the automatic status of a package. If we install it has no automatic status and we install it as a dependency we mark it as automatic. Else, we mark it as non-automatic as it has been installed explicitly.
- menu(Question, +Alternatives, +Default, -Selection, +Options)[private]
- confirm(+Question, +Default, +Options) is semidet[private]
- Ask for confirmation.
- install_plan(+Plan, -Actions)// is det[private]
- install_label(+Actions)// is det[private]
- Describe the overall installation plan before downloading.
- msg_build_plan(+Plan)//[private]
- Describe the build plan before running the build steps.
Re-exported predicates
The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
- pack_list(+Query) is det
- pack_list(+Query, +Options) is det
- pack_search(+Query) is det
- Query package server and installed packages and display results.
Query is matches case-insensitively against the name and title of
known and installed packages. For each matching package, a single
line is displayed that provides:
- Installation status
- p: package, not installed
- i: installed package; up-to-date with public version
- a: as i, but installed only as dependency
- U: installed package; can be upgraded
- A: installed package; newer than publically available
- l: installed package; not on server
- Name@Version
- Name@Version(ServerVersion)
- Title
Options processed:
- installed(true)
- Only list packages that are locally installed. Contacts the server to compare our local version to the latest available version.
- outdated(true)
- Only list packages that need to be updated. This option
implies
installed(true)
. - server((Server|false))
- If
false
, do not contact the server. This impliesinstalled(true)
. Otherwise, use the given pack server.
Hint:
?- pack_list('').
lists all known packages.The predicates pack_list/1 and pack_search/1 are synonyms. Both contact the package server at https://www.swi-prolog.org to find available packages. Contacting the server can be avoided using the
server(false)
option. - Installation status
- pack_list(+Query) is det
- pack_list(+Query, +Options) is det
- pack_search(+Query) is det
- Query package server and installed packages and display results.
Query is matches case-insensitively against the name and title of
known and installed packages. For each matching package, a single
line is displayed that provides:
- Installation status
- p: package, not installed
- i: installed package; up-to-date with public version
- a: as i, but installed only as dependency
- U: installed package; can be upgraded
- A: installed package; newer than publically available
- l: installed package; not on server
- Name@Version
- Name@Version(ServerVersion)
- Title
Options processed:
- installed(true)
- Only list packages that are locally installed. Contacts the server to compare our local version to the latest available version.
- outdated(true)
- Only list packages that need to be updated. This option
implies
installed(true)
. - server((Server|false))
- If
false
, do not contact the server. This impliesinstalled(true)
. Otherwise, use the given pack server.
Hint:
?- pack_list('').
lists all known packages.The predicates pack_list/1 and pack_search/1 are synonyms. Both contact the package server at https://www.swi-prolog.org to find available packages. Contacting the server can be avoided using the
server(false)
option. - Installation status
- pack_install(+Spec:atom) is det
- pack_install(+SpecOrList, +Options) is det
- Install one or more packs from SpecOrList. SpecOrList is a single
specification or a list of specifications. A specification is one of
- A pack name. This queries the pack repository at https://www.swi-prolog.org
- Archive file name
- A
http(s)
URL of an archive file name. This URL may contain a star (*) for the version. In this case pack_install/1 asks for the directory content and selects the latest version. - An https GIT URL
- A local directory name given as
file://
URL '.'
, in which case a relative symlink is created to the current directory (all other options for Spec make a copy of the files). Installation using a symlink is normally used during development of a pack.
Processes the options below. Default options as would be used by pack_install/1 are used to complete the provided Options. Note that pack_install/2 can be used through the SWI-Prolog command line app
pack
as below. Most of the options of this predicate are available as command line options.swipl pack install <name>
Options:
- url(+URL)
- Source for downloading the package
- pack_directory(+Dir)
- Directory into which to install the package.
- global(+Boolean)
- If
true
, install in the XDG common application data path, making the pack accessible to everyone. Iffalse
, install in the XDG user application data path, making the pack accessible for the current user only. If the option is absent, use the first existing and writable directory. If that doesn't exist find locations where it can be created and prompt the user to do so. - insecure(+Boolean)
- When
true
(defaultfalse
), do not perform any checks on SSL certificates when downloading usinghttps
. - interactive(+Boolean)
- Use default answer without asking the user if there is a default action.
- silent(+Boolean)
- If
true
(default false), suppress informational progress messages. - upgrade(+Boolean)
- If
true
(defaultfalse
), upgrade package if it is already installed. - rebuild(Condition)
- Rebuild the foreign components. Condition is one of
if_absent
(default, do nothing if the directory with foreign resources exists),make
(runmake
) ortrue
(run `make distclean` followed by the default configure and build steps). - test(Boolean)
- If
true
(default), run the pack tests. - git(+Boolean)
- If
true
(defaultfalse
unless URL ends with =.git=), assume the URL is a GIT repository. - link(+Boolean)
- Can be used if the installation source is a local directory and the file system supports symbolic links. In this case the system adds the current directory to the pack registration using a symbolic link and performs the local installation steps.
- version(+Version)
- Demand the pack to satisfy some version requirement. Version
is as defined by require_version/3. For example
'1.5'
is the same as>=('1.5')
. - branch(+Branch)
- When installing from a git repository, clone this branch.
- commit(+Commit)
- When installing from a git repository, checkout this commit.
Commit is either a hash, a tag, a branch or
'HEAD'
. - build_type(+Type)
- When building using CMake, use
-DCMAKE_BUILD_TYPE=Type
. Default is the build type of Prolog orRelease
. - register(+Boolean)
- If
true
(default), register packages as downloaded after performing the download. This contacts the server with the meta-data of each pack that was downloaded. The server will either register the location as a new version or increment the download count. The server stores the IP address of the client. Subsequent downloads of the same version from the same IP address are ignored. - server(+URL)
- Pack server to contact. Default is the setting
prolog_pack:server
, by default set tohttps://www.swi-prolog.org/pack/
Non-interactive installation can be established using the option
interactive(false)
. It is adviced to install from a particular trusted URL instead of the plain pack name for unattented operation. - pack_rebuild is det
- pack_rebuild(+Pack) is det
- Rebuild possible foreign components of Pack. The predicate pack_rebuild/0 rebuilds all registered packs.
- pack_remove(+Name) is det
- pack_remove(+Name, +Options) is det
- Remove the indicated package. If packages depend (indirectly) on
this pack, ask to remove these as well. Options:
- interactive(false)
- Do not prompt the user.
- dependencies(Boolean)
- If
true
delete dependencies without asking.