apt-venv — apt virtual environment

Quickly collect information about packages in different Debian and Ubuntu releases.

apt-venv creates a sort of virtual environments in $HOME/.local/share/apt-venv (one for each release), able to exec bash sessions where apt thinks to be in another distro/release. In these sessions a $APT_VENV variable is set and points out the release name in use.

If you want to customize environment you can modify files in:

$HOME/.config/apt-venv/$release

apt-venv is already available in Debian and Ubuntu utopic unicorn.

Use case

Show which version of some package is in Debian and Ubuntu, simply:

# init apt database for releases
for release in unstable stable trusty lucid ; do
    apt-venv $release -u
done

# do what you want
for release in unstable stable trusty lucid ; do
    apt-venv $release -c "apt-cache madison base-files | grep Source | tail -1"
done

If you do not specify -c option you will entry an interactive shell.

Usage

$ apt-venv -h
usage: apt-venv [-h] [-D DEBUG] [-v] [-d] [-c COMMAND] [-l] [release]

positional arguments:
  release               the debian/ubuntu release

optional arguments:
  -h, --help            show this help message and exit
  -D DEBUG, --debug DEBUG
                        set debug level
  -v, --version         show program's version number and exit
  -c COMMAND, --command COMMAND
                        exec the given command instead of entry the interactive shell
  -d, --delete          delete venv for release
  -l, --list            list all venv installed in your system
  -u, --update          update the apt indexes

3 thoughts on “apt-venv — apt virtual environment

    1. l3on Post author

      Hi Stefano,

      I did not know “chdist” before start working on apt-venv (I discovered it only few days ago). What I can say now is “apt-venv” has a different approach and goal.

      It has been developed to provide user with a full virtual environment,
      where you can run any command/script you want.

      If fact, with no option ‘-c‘ it launches a new `bash` session with a custom $APT_CONFIG environment variable, which forces apt to use a different sources.list. In version 0.2.0 (soon in debian) it also supports apt-file.

      Perhaps, chdist may be patched to get this behavior… unfortunately, I don’t know perl.

      All the best,

      Leo.

      Reply
  1. Pingback: Leo Iannacone: apt-venv — apt virtual environment | Hi-tech news

Leave a Reply