The trivial-package-manager Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The trivial-package-manager Reference Manual

This is the trivial-package-manager Reference Manual, version 0.1, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 12:42:08 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

Trivial-Package-Manager

This library provides two simple functions for detecting an available package manager and install the binary package. Paired with ASDF, it solves the problem of external library dependency.

Use it in a ASDF system definition

Sophisticated ASDF integration is still on the way, but you can do this, for example:

(defsystem cl-sat.minisat
  :version "0.1"
  :author "Masataro Asai"
  :mailto "guicho2.71828@gmail.com"
  :license "LLGPL"
  :depends-on (:trivia :alexandria :iterate :cl-sat)
  :components ((:module "src"
                        :components
                        ((:file "package"))))
  :description "Common Lisp API to minisat"
  :in-order-to ((test-op (test-op :cl-sat.minisat.test)))
  :defsystem-depends-on (:trivial-package-manager)
  :perform
  (load-op :before (op c)
           (uiop:symbol-call :trivial-package-manager
                             :ensure-program
                             "minisat"
                             :apt "minisat"
                             :dnf "minisat2"
                             :yum "minisat2"
                             :brew "minisat"
                             :from-source (format nil "make -C ~a"
                                                  (asdf:system-source-directory :cl-sat.minisat)))))

API

Package trivial-package-manager (nicknamed as tpm):

browse-package (query-string)

  QUERY-STRING is a string. It opens several package search engines on a browser (with trivial-open-browser).
  URL templates for FORMAT are stored in an exported special variable *SEARCH-ENGINES* .

ensure-program (program &key apt dnf yum pacman yaourt brew macports fink choco from-source env-alist)
ensure-library (library &key apt dnf yum pacman yaourt brew macports fink choco from-source env-alist)
do-install             (&key apt dnf yum pacman yaourt brew macports fink choco from-source)

  PROGRAM is a program name (string) to be checked by `which` command.
  LIBRARY is a library name (string) to be checked by `pkg-config` command. Includes "lib" i.e. libcurl.

  Each keyword argument specifies the package names to be passed on to the corresponding package manager.
  The value of each argument can be a string or a list of strings.

  Specified packages are installed when the program/library is missing.
  DO-INSTALL installs the packages unconditionally.
  
  ENV-ALIST is an alist of the environment variable/values which are set during the call
  and restored to the original value by unwind-protect. They are used for e.g.

  * Probing the PROGRAM/LIBRARY compiled through FROM-SOURCE by modifying the PATH and LD_LIBRARY_PATH
  * Building a PROGRAM from source using another locally compiled LIBRARY.
  
  For package managers which require the sudo access,
  it uses `gksudo` when it is present and DISPLAY variable is set,
  or `sudo` when it is available and `sudo -v` succeeds.
  
  If none of the package managers are available / when the package is missing (e.g. older distro),
  FROM-SOURCE argument can specify the shell command for fetching/building/installing the program from
  the source code. The command is executed in the *default-pathname-defaults*,
  so care must be taken to bind the appropriate value to the variable.
  The command is usually just "make -C <asdf system definition directory>".

  APT target can be an unofficial repository installable by add-apt-repository.
  "<user>/<repo>/<pkg>" invokes "add-apt-repository ppa:<user>/<repo>", "apt-get update" then "apt-get install <pkg>".

  Homebrew target can be an unofficial repository installable by brew tap.
  "<user>/<repo>/<formula>" invokes "brew tap <user>/<repo>" then "brew install <user>/<repo>/<formula>".
  "<user>/<repo>/<formula> URL" invokes "brew tap <user>/<repo> URL" then "brew install <user>/<repo>/<formula>".

  Examples:
  
   (ensure-program "gnome-mines" :apt "gnome-mines")
   (ensure-program "gnome-mines" :apt '("gnome-mines")) ; both are ok
   (ensure-library "libcurl" :apt "libcurl4-openssl-dev"
                             :dnf "curl"
                             :yum "curl"
                             :pacman "curl"
                             :brew "curl")

Dependencies

This library is at least tested on implementation listed below:

Also, it depends on the following libraries:

Installation

Author

Copyright

Copyright (c) 2017 Masataro Asai (guicho2.71828@gmail.com)

License

Licensed under the LLGPL License.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 trivial-package-manager

Author

Masataro Asai

Contact

guicho2.71828@gmail.com

License

LLGPL

Description

Functions for installing packages from distro-specific package manager.

Version

0.1

Dependencies
Source

trivial-package-manager.asd (file)

Component

package.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 trivial-package-manager.asd

Location

/home/quickref/quicklisp/dists/quicklisp/software/trivial-package-manager-20171227-git/trivial-package-manager.asd

Systems

trivial-package-manager (system)

Packages

trivial-package-manager-asd


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 trivial-package-manager/package.lisp

Parent

trivial-package-manager (system)

Location

package.lisp

Packages

trivial-package-manager

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Next: , Previous: , Up: Packages   [Contents][Index]

4.1 trivial-package-manager-asd

Source

/home/quickref/quicklisp/dists/quicklisp/software/trivial-package-manager-20171227-git/trivial-package-manager.asd

Use List

Previous: , Up: Packages   [Contents][Index]

4.2 trivial-package-manager

Source

package.lisp (file)

Nickname

tpm

Use List
Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Special variables

Special Variable: *search-engines*
Package

trivial-package-manager

Source

package.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: browse-package QUERY-STRING

Query-String is a string designator.
Open several package search engines on a browser

Package

trivial-package-manager

Source

package.lisp (file)

Function: do-install &key APT DNF YUM PACMAN YAOURT BREW MACPORTS FINK CHOCO FROM-SOURCE ENV-ALIST

Install the specified packages when the corresponding package manager is present in the system. Managers are detected simply by ‘which‘ command.

Package

trivial-package-manager

Source

package.lisp (file)

Function: ensure-library LIBRARY &rest REST &key APT DNF YUM PACMAN YAOURT BREW MACPORTS FINK CHOCO FROM-SOURCE ENV-ALIST

Library is a shared library name to be checked by PKG-CONFIG command.
Each keyword argument specifies the package names to be passed on to the corresponding package manager. The value of each argument can be a string or a list of strings.

If none of the package managers are available / when the package is missing (e.g. older distro), FROM-SOURCE argument can specify the shell command for fetching/building/installing the program from the source code. The command is executed in the *default-pathname-defaults*,
so care must be taken to bind the appropriate value to the variable.

Example:

(ensure-library "libcurl" :apt "libcurl4-openssl-dev")
(ensure-library "libcurl" :apt ’("libcurl4-openssl-dev")) ; both are ok

Package

trivial-package-manager

Source

package.lisp (file)

Function: ensure-program PROGRAM &rest REST &key APT DNF YUM PACMAN YAOURT BREW MACPORTS FINK CHOCO FROM-SOURCE ENV-ALIST

PROGRAM is a program name to be checked by WHICH command.
Each keyword argument specifies the package names to be passed on to the corresponding package manager. The value of each argument can be a string or a list of strings.

If none of the package managers are available / when the package is missing (e.g. older distro), FROM-SOURCE argument can specify the shell command for fetching/building/installing the program from the source code. The command is executed in the *default-pathname-defaults*,
so care must be taken to bind the appropriate value to the variable.

Example:

(ensure-program "gnome-mines" :apt "gnome-mines")
(ensure-program "gnome-mines" :apt ’("gnome-mines")) ; both are ok

Package

trivial-package-manager

Source

package.lisp (file)

Function: pkg-config NAME
Package

trivial-package-manager

Source

package.lisp (file)

Function: which NAME
Package

trivial-package-manager

Source

package.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Functions

Function: %run ARGS

Simple wrapper for run-program, input/error/output are inherited.

Package

trivial-package-manager

Source

package.lisp (file)

Function: %run-p ARGS
Package

trivial-package-manager

Source

package.lisp (file)

Function: call-with-env ENV-ALIST FN
Package

trivial-package-manager

Source

package.lisp (file)

Function: sudo COMMANDS
Package

trivial-package-manager

Source

package.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   T  
Index Entry  Section

F
File, Lisp, trivial-package-manager.asd: The trivial-package-manager<dot>asd file
File, Lisp, trivial-package-manager/package.lisp: The trivial-package-manager/package<dot>lisp file

L
Lisp File, trivial-package-manager.asd: The trivial-package-manager<dot>asd file
Lisp File, trivial-package-manager/package.lisp: The trivial-package-manager/package<dot>lisp file

T
trivial-package-manager.asd: The trivial-package-manager<dot>asd file
trivial-package-manager/package.lisp: The trivial-package-manager/package<dot>lisp file

Jump to:   F   L   T  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   %  
B   C   D   E   F   P   S   W  
Index Entry  Section

%
%run: Internal functions
%run-p: Internal functions

B
browse-package: Exported functions

C
call-with-env: Internal functions

D
do-install: Exported functions

E
ensure-library: Exported functions
ensure-program: Exported functions

F
Function, %run: Internal functions
Function, %run-p: Internal functions
Function, browse-package: Exported functions
Function, call-with-env: Internal functions
Function, do-install: Exported functions
Function, ensure-library: Exported functions
Function, ensure-program: Exported functions
Function, pkg-config: Exported functions
Function, sudo: Internal functions
Function, which: Exported functions

P
pkg-config: Exported functions

S
sudo: Internal functions

W
which: Exported functions

Jump to:   %  
B   C   D   E   F   P   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*search-engines*: Exported special variables

S
Special Variable, *search-engines*: Exported special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   S   T  
Index Entry  Section

P
Package, trivial-package-manager: The trivial-package-manager package
Package, trivial-package-manager-asd: The trivial-package-manager-asd package

S
System, trivial-package-manager: The trivial-package-manager system

T
trivial-package-manager: The trivial-package-manager system
trivial-package-manager: The trivial-package-manager package
trivial-package-manager-asd: The trivial-package-manager-asd package

Jump to:   P   S   T