Jump to content

pm

From Hugo's wiki

pm is a package manager that reads a Lua configuration file and coordinates the download, build and installation of packages from remote URLs. Packages are processed in parallel using POSIX threads.

Why another package manager? I don't know either. Unlike the previous attempts, this one works.

Installation

pm needs lua, libcurl and libcrypto (OpenSSL).

$ git clone https://github.com/hugoocoto/pm
$ cd pm
$ make          # release build
$ make debug    # debug build with sanitizers

The Makefile also installs the man page to ~/.local/share/man/man1/pm.1.

Usage

pm [option]...
Command Description
pm Fetch, build and install all packages from the config
pm init, pm i Create a template config (default: ~/.config/pm/init.lua)
pm list, pm l List all packages defined in the config
pm system, pm s Print system configuration paths and settings
pm threads N, pm t N Use at most N threads (default: CPU count)
pm config FILE, pm c FILE Use a different config file
pm --color Enable colored output
pm --help, pm -h Show help and exit
pm --version, pm -v Show version and exit

Configuration

The config file lives at ~/.config/pm/init.lua:

System = {
    build = { path = os.getenv("HOME") .. "/.local/share/pm/cache/" },
    bin   = { path = os.getenv("HOME") .. "/.local/share/pm/bin/" },
}

Packages = {
    {
        url = "...",
        build = "...",
        artifact = "...",
    },
}
Tip It is plain Lua, so you can use require, helper functions, and split packages across multiple files.

Instead of writing every package by hand you can pull definitions from the user repository.

See also