Tree @master (Download .tar.gz)
toolshelf
NOTE
As of 0.1-2016.0315, toolshelf is officially DEPRECATED.
Development will continue on Cat's Eye Technologies' shelf instead: https://github.com/catseye/shelf
This repository is retained for historical purposes only.
First, the metaphor:
Certain bulky technologies in your home — such as your washing machine and your refrigerator (let's call them appliances) — deserve to be installed. You're not going to move them much, and they might have to be hooked up to the water pipes and so forth.
But certain other, lighter technologies — such as your can opener and your broom and dustpan (let's call them tools) — aren't "installed" anywhere. Instead, you simply store them somewhere (say, on a shelf) until they're needed.
toolshelf applies this paradigm to software. Because you should never need to
install a can opener.
If this metaphor piques your curiosity, you can read more about
why toolshelf exists, where it shines, and where it doesn't
(tl;dr great for evaluating random projects off Github, maybe not so great
for getting X.org onto a machine.)
Description
toolshelf is a "package manager" which doesn't actually install any files.
Instead, it:
- stores ("docks") the source distributions of projects in a directory tree (usually located in your home directory);
- builds executables, libraries, etc. as needed in these source directories;
- creates "link farms" of symlinks to these executables, libraries, etc.; and
- extends your search paths to include these link farms.
The source distributions are typically version-controlled working directories (e.g. a local clone of a Git repository), but they can also be directory structures extracted from downloaded archives (so-called "tarballs" or "distfiles".)
The primary application (after acquiring and building a source) is to get
these executables from the source onto your $PATH, so that you can run them
from anywhere. The secondary application is to get shared components into
their respective paths, so they can be used from any other project that needs
them — this currently works with C, Python, and Lua, in many cases obviating
the need for package managers like pip and LuaRocks.
toolshelf is, in some sense, stateless. It does not record a database of
what has been docked (this information can mostly be gleaned from the
filesystem) and there is no package metadata (beyond "cookies", over which
you have control.)
The current released version of toolshelf is version 0.1. The current
development version is version 0.2-PRE. As indicated by the major version
number 0, it is a work in progress and subject to backwards-incompatible
changes.
toolshelf is written in Bourne shell and Python 2.7. It also requires the
presence of those tools it needs to use to get and build what it asks for.
Obviously, the less you ask for, the less it needs, but at least some of the
following will be helpful:
gitorhg(Mercurial)wgettarandgzipand/orbzip2unzipmake
The main toolshelf command is written as a Bourne shell function (to support
toolshelf cd), so it should work with bash, ash, and other Bourne-shell-
compatible shells. It has not been tested with zsh or others. It will not
work with csh.
toolshelf is distributed under an MIT-style license.
Quick Start
-
Start a shell. (On some OS'es, this means "Open a Terminal window.")
-
Download [
bootstrap-toolshelf.sh][], for example by running:wget https://raw.github.com/catseye/toolshelf/master/bootstrap-toolshelf.sh(If you don't have
wgetinstalled,curlshould also work. Or you can just download it from the link above with your web browser.) -
Run:
sh ./bootstrap-toolshelf.sh -
Follow the instructions given to you by the script.
-
Start a new shell to start using
toolshelf.
(If you don't want to use the bootstrap script, it's not very difficult to get toolshelf up and running manually; see below for instructions.)
Now, you can dock any source that toolshelf can handle, simply by typing,
for example,
toolshelf dock gh:nelhage/reptyr
When that completes, you can run reptyr by simply typing
reptyr
Convenient! And if you want to cd to where the reptyr sources are, to
hack on it or whatever, just
toolshelf_cd reptyr
And if you ever want to get rid of (almost) all trace of reptyr from your
system, simply run
rm -rf $TOOLSHELF/nelhage/reptyr
(For removal to be completely complete, you'd also want to run
toolshelf relink all, to remove the now-broken symbolic links to the
executable(s) that were in $TOOLSHELF/nelhage/reptyr.)
And, if you want to get rid of (almost) all trace of toolshelf and all of
the packages you've docked using it, simply
rm -rf $TOOLSHELF
(For removal to be completely complete, you'd also want to remove the commands
that bootstrap-toolshelf.sh added to your .bashrc. But if your $TOOLSHELF
directory doesn't exist, they won't run anyway.)
For a summary of the toolshelf commands, run toolshelf --help. If you
want to know more about how it works, you can read about
toolshelf's theory of operation.
Manual Setup
-
Decide where you want your toolshelf sources to be kept. I keep mine in a directory called
toolshelfin my home directory. In the following examples, I'll use/home/user/toolshelf. It is strongly recommended that this pathname not contain any spaces or other characters which normally require escaping for the shell; even iftoolshelfhandles all these cases correctly, there's a fair chance any random source that you dock won't. -
Make this directory:
mkdir -p /home/user/toolshelf -
Clone the
toolshelfrepo into.toolshelfin it, perhaps like so:git clone https://github.com/catseye/toolshelf /home/user/toolshelf/.toolshelfIf you prefer, you could use Mercurial and clone it from Bitbucket. Or get a zip of the
toolshelfdistribution, and unzip it to there. Any of these options should be fine. -
Add the following line to your
.profile, or.bash_profile, or.bashrc, or the startup script for whatever POSIX-compliant Bourne shell-alike you use:export TOOLSHELF=/home/user/toolshelf/ && . $TOOLSHELF/.toolshelf/init.sh -
Start a new shell and test that it works.
Related Work
- checkoutmanager
- Gobolinux
- pathify
- sources
- spackle
zero-install/0launchpkgviews
Curation
Commit History
@master
git clone https://git.catseye.tc/toolshelf/
- Seperate note() and debug() levels. Cat's Eye Technologies 12 years ago
- Make only_paths cookie hint work well enough to be usable now. Cat's Eye Technologies 12 years ago
- Source.linkable_files() returns each basename only once. Fewer "Trampling" messages. Cat's Eye Technologies 12 years ago
- Support distfiles that end in .tar.xz. Cat's Eye Technologies 12 years ago
- Add export command, --output-dir option. Update catalogs. Cat's Eye Technologies 12 years ago
- Cookies, uninteresting executables, fix up a regular expression. Cat's Eye Technologies 12 years ago
- Clean up some cookies. Cat's Eye Technologies 12 years ago
- Support "magic" local distfile names like github.com,catseye,flarzipan-master.zip. Cat's Eye Technologies 12 years ago
- Don't copy local distfiles to .distfile cache during dock. Cat's Eye Technologies 12 years ago
- Add cookie for Ophis. Cat's Eye Technologies 12 years ago
- This idea that .so's have to be executable is apparently wrong. Cat's Eye Technologies 12 years ago
- If configure.in exists, but not configure, try running autoconf. Cat's Eye Technologies 12 years ago
- Link static libs in the .lib farm, too. And an expedient cookie! Cat's Eye Technologies 12 years ago
- toolshelf --verbose test: list sources without obvious tests. Cat's Eye Technologies 12 years ago
- Default ./configure --prefix=`pwd`/install, to avoid trying to install files over themselves. Cat's Eye Technologies 12 years ago
- Shared objects are sometimes links to versioned ones, e.g. .so.6 Cat's Eye Technologies 12 years ago
- Ugly but hopefully generic cookie for tree utility. Cat's Eye Technologies 12 years ago
- Source specs for cookies are now globs. Easier than I thought! Cat's Eye Technologies 12 years ago
- Cookie for lua from distfile. Need to rework cookies, I think. Cat's Eye Technologies 12 years ago
- Cookies for Mercurial. Cat's Eye Technologies 12 years ago
- Add a cookie that shouldn't be necessary, but is, for now. Cat's Eye Technologies 12 years ago
- interesting_executables cookie hint, which overrides defaults. Cat's Eye Technologies 12 years ago
- More miscellany. Mainly this is a place to record it, is all. Cat's Eye Technologies 12 years ago
- Pyglet, z80sim, apple_emulator (sort of but not really.) Cat's Eye Technologies 12 years ago
- Add entry for pcc, newer version of bison and convoluted cookie. Cat's Eye Technologies 12 years ago
- Add some Schemes that were just lying around the place. Cat's Eye Technologies 12 years ago
- Several miscellaneous changes culminating in a seed7 cookie. Cat's Eye Technologies 12 years ago
- Ay yi yi. Get rid of compiled files. Cat's Eye Technologies 12 years ago
- Add version-stabilizing build_command cookie for hg-git. Cat's Eye Technologies 12 years ago
- Add mercurial-extensions.catalog. Cat's Eye Technologies 12 years ago