Did you know ... Search Documentation:
pack.pl
PublicShow source
Source pack_query(+Request)[private]
Handle package query requests from remote installers. Content is of type application/x-prolog. Reply is also a Prolog term.
Source proxy_master(Request)[private]
Proxy the request to the master to make sure the central package database remains synchronised.
Source pack_query(+Query, +Peer, -Reply) is det[private]
Implements the various queries from the pack_install/1. Currently defined Query values are:
install(+URL, +SHA1, +Info)
User tries to install from URL an object with the indicated hash and Info.
downloaded(+Data)
Register download for indicated Data
locate(+Pack)
Query download locations for Pack.
versions(+Packs, +Options)
Query download and versions for a set of packs and all (recursive) dependencies.
search(+Keyword)
Find packs that match Keyword.
info(+Packs)
Return a list of meta-data terms for the latest version of Packs. Unknown packs are omitted from the result list.
Source pack_admin(+Pack)//[private]
Display pack admin options
Source pack_delete(+Request)[private]
HTTP handler to delete a pack
Source install_info(+URL, +SHA1, -Info) is nondet[private]
Info is relevant information for the client who whishes to install URL, which has the given SHA1 hash. Currently provided info is:
alt_hash(Downloads, URLs, Hash)
Another file with the same (base) name was registered that has a different hash. This file was downloaded Downloads times, resides on the given URLs (a list) and has the given Hash.
downloads(Downloads)
This hash was downloaded Downloads times from a unique IP address
dependency(Token, Pack, Version, URLs, SubSeps)
The requirement Token can be provided by Pack@Version, which may be downloaded from the given URLs (a list). Pack has install info as specified by SubSeps (recursive dependencies)
Source is_prolog_token(+Token) is semidet[private]
To be done
- : share with library(pack_install).
Source pack_version_hashes(+Pack, -VersionHashesPairs) is semidet
True when HashesByVersion is an ordered list Version-Hashes, latest version first.
Source pack_version_urls_v1(+Pack, -Locations) is det[private]
True when Locations is a set of Version-list(URL) pairs used for installing Pack.
Arguments:
Locations- is a list Version-URLs, sorted latest version first.
See also
- pack_version_urls_v2/3
Source pack_versions(+Packs, -PackVersions, +Options) is det[private]
Given a single or multiple packs, return information on all these packs as well as their dependencies. PackVersions is a list of Pack-Versions. Versions is a list of Version-InfoList. InfoList is a list of dicts, each holding
info.pack
Pack name
info.hash
Hash of the version. This is either a GIT hash or the sha1 of the archive file.
info.provides
List of provided tokens. Each provide is either a simple token or a term @(Token,Version).
info.requires
List of required tokens. Each requirement is either a simple token or a term `Token cmp Version`, where cmp is one of <, =<, =, >= or >.
info.conflicts
Similar to info.requires, declaring conflicts
info.url
URL for downloading the archive or URL of the git repo.
info.git
Boolean expressing wether the URL is a git repo or archive.
info.downloads
Download count.
Source search_packs(+Search, -Packs) is det[private]
Search packs by keyword, returning a list
pack(Pack, Status, Version, Title, URLs).
Source delete_pack(+PackName) is det[private]
Remove a pack from the database.
Source delete_hash(Hash) is det[private]
Remove Hash from the database
Source save_request(+Peer, +Data, -Result)[private]
Update the database with the given information. We only update if the request is new, which means the same SHA1 has not been downloaded from the same Peer.
Source valid_request(+Hash, +Info0, -Info) is det[private]
Validate the hash and pack name of a request and remove all malformed elements from the pack info. The info is provided by the client and is later used for file names as well as for rendering HTML.
Errors
- domain_error(pack_hash, Hash) or domain_error(pack_name, Name)
Source is_pack_hash(@Hash) is semidet
True if Hash is a SHA1 (or SHA256) hash in hexadecimal notation.
Source is_pack_name(@Name) is semidet
True if Name is a valid pack name. Pack names are used as directory names.
Source valid_info_term(@Term) is semidet[private]
True if Term is a well-formed pack info term. Info terms are stored and rendered as HTML, so they may only contain plain text (atoms, strings and numbers), lists thereof and, for dependency declarations, small terms such as prolog>='9.3.15' or prolog:library(sgml). Dependencies are rendered using format/2 and never as HTML markup.
Source accept_url(+URL, +Pack, +IsGit) is det[private]
True when URL is an aceptable URL for Pack. We only register this on the first submission of a pack. URL must be an http(s) URL on a public host, as we download from it.
Source set_allowed_url(+Request)[private]
Set the URL pattern for a pack.
Source register_pack(+SHA1, +Pack) is det[private]
 register_url(+SHA1, +IsGIT, +URL) is det[private]
Register we have that data loaded from URL has signature SHA1.
Source is_github_release(+URL) is semidet[private]
True when URL reflects a GitHub release pack download. These have the unpeleasant habbit to change exact content.
Source hash_git_url(+SHA1, -GitURL) is semidet
True when SHA1 was installed using GIT from GitURL.
Source hash_file_url(+SHA1, -FileURL) is nondet
True when SHA1 was installed using GIT from GitURL.
Source pack_url_hash(?URL, ?Hash) is nondet
True when Hash is the registered hash for URL.
Source pack(?Pack) is nondet
True when Pack is a currently known pack.
Source pack_list(+Request)[private]
List available packages.
Source pack_table(+Packs, +Options)// is det
Show a table of packs.
Source current_pack(+Filter:list, -Pack) is nondet
True when Pack is a pack that satisfies Filter. Filter is a list of filter expressions. Currently defined filters are:
author(+Author)
Pack is claimed by this author.
Source sort_packs(+Field, +Packs, -Sorted)
Source pack_latest_version(+Pack, -SHA1, -Version, -OlderCount)[private]
True when SHA1 is the latest version of Pack at the given Version and there are OlderCount older versions.
Source pack_info(+Pack)//[private]
Provided detailed information about a package.
To be done
- provide many more details
- Show dependency for requirements/provides
Source pack_info_table(+Pack)// is det[private]
Provide basic information on the package
Source link(+URL, +Label)//[private]
Render a link from pack info. Only http(s) URLs become links, so pack authors cannot inject e.g. `javascript:` URLs.
Source pack_file_table(+Pack)// is det[private]
Provide a table with the files, sorted by version, providing statistics on downloads.
Source pack_file_details(+Request)[private]
HTTP handler to provide details on a file in a pack
Source atom_version(?Atom, ?Version)[private]
Translate between atomic version representation and term representation. The term representation is a list of version components as integers and can be compared using @>