RSS Feed

Lisp Project of the Day

trivial-package-manager

You can support this project by donating at:

Donate using PatreonDonate using Liberapay

Or see the list of project sponsors.

trivial-package-managerasdfasdf-extensionsystemtrivial

Documentation๐Ÿคจ
Docstrings๐Ÿ˜€
Tests ๐Ÿฅบ
Examples๐Ÿ˜€
RepositoryActivity๐Ÿฅบ
CI ๐Ÿฅบ

This small library, written by @guicho271828, can be used for similar purposes like bodge-blobs-support. The difference is that "trivial-package-manager" installs dependencies using the system's native package manager.

It supports: Apt, Yum, Dnf, Pacman, Yaourt, Brew, Macports, Fink, Choco as well as installation from sources.

You can use "trivial-package-manager" with ASDF or separately. It is able to install executables and libraries.

Let's install "wget" binary on my OSX laptop! To be able to see which command will be called, we'll apply TRACE to "uiop:run-program":

POFTHEDAY> (trace uiop:run-program)

POFTHEDAY> (tpm:ensure-program "wget"
                               :brew "wget"
                               :apt "wget")

  0: (UIOP/RUN-PROGRAM:RUN-PROGRAM ("which" "wget"))
  0: (UIOP/RUN-PROGRAM:RUN-PROGRAM ("which" "apt-get"))
  0: (UIOP/RUN-PROGRAM:RUN-PROGRAM ("which" "brew"))
  0: UIOP/RUN-PROGRAM:RUN-PROGRAM returned NIL NIL 0
  0: (UIOP/RUN-PROGRAM:RUN-PROGRAM ("brew" "install" "wget")
          :OUTPUT :INTERACTIVE :ERROR-OUTPUT
          :INTERACTIVE :INPUT :INTERACTIVE)
  0: UIOP/RUN-PROGRAM:RUN-PROGRAM returned NIL NIL 0

To install library or program during with you Lisp system installation, you need to call this function from "load-op" method:

(defsystem cl-wget
  :components ((:file "cl-wget"))
  :description "Toy system to call wget from Lisp"
  :defsystem-depends-on (:trivial-package-manager)
  :perform
  (load-op :before (op c)
           (uiop:symbol-call :trivial-package-manager
                             :ensure-program
                             "wget"
                             :apt "wget"
                             :brew "wget")))

After somebody will do "(ql:quickload :cl-wget)" you can be sure there is a wget binary in the system ready to be called by your program.


Brought to you by 40Ants under Creative Commons License