Pkg

A simple but powerful package manager for the ULua distribution.


local pkg = require 'pkg'

pkg.available()            -- List all available packages.
pkg.available('?penlight') -- List available packages matching in name or description 'penlight'.
pkg.available('pl')        -- Detailed info about Penlight.

pkg.add('pl')              -- Install Penlight and its dependencies.
pkg.remove('pl')           -- Remove Penlight and all packages that depend on it.

pkg.update()               -- Update all packages.

Configuration

The behavior of PKG is configured by setting the following keys in ulua/host/config.lua:


proxy      = 'address of web proxy server'
proxyauth  = 'username and password of web proxy server as user:password'
noconfirm  = 'true if confirmation should be skipped when adding, removing or updating packages'
silent     = 'true if no information should be printed when adding, removing or updating packages'

Upkg

An helper command is available as ulua/bin/upkg which replicates the functionality available in the PKG package. To avoid clashes with the shell, searches are performed by adding the -s flag (instead of adding '?' in front of name).


upkg command [-s] [name] [version]
  command : one of "status", "available", "add", "remove", "update"
  -s      : enable searching (only for "status" and "available" commands)
  name    : package name
  version : package version

API

pkg = require "pkg"

Returns the loaded module (no global variable is set).

pkg.available(str or nil)

If no argument is passed, information is displayed about all available packages. If a string which begins with '?' is passed, information is displayed about all packages matching (description included) the remaining part of the string. Otherwise detailed information is displayed about the package str.

pkg.status(str or nil)

Same behavior as pkg.available() for packages which are currently installed (instead of packages which are available to be installed).

pkg.add(name, version or nil)

Installs package name and all the required dependencies. If version is not passed, the latest stable version is selected. Otherwise the most recent version which have equal major component and that satisfies the remaining components is selected.

pkg.remove(name, version or nil)

Removes package name and all the packages which depends on it. If version is not passed, the latest stable version is selected. Otherwise the most recent version which have equal major component and that satisfies the remaining components is selected.

pkg.update()

Updates all packages to the latest available version.