Portage SQLite Cache

From Gentoo Linux Wiki
Jump to: navigation, search

Using SQLite for the cache backend can significantly speed up dependency calculations when running Emerge. This article explains how to enable the Portage SQLite cache backend.

Warning: By this time significant speed up is doubtful. Rather there is no improvement. As mentioned on the discussion page, this method may even slow dependency resolution down a bit.

Contents

[edit] Required Packages

You will need to build dev-lang/python with the sqlite USE flag enabled or install the Python SQLite wrapper dev-python/pysqlite:

emerge -av pysqlite

[edit] Configuration

Next we need to tell Portage to use the SQLite backend, this we do in /etc/portage/modules:

Note: This file does not exist by default so you might need to create it.
File: /etc/portage/modules
portdbapi.auxdbmodule = cache.sqlite.database


In addition, if you're using a Portage version later than sys-apps/portage-2.1.6.4 you'll need to add metadata-transfer to FEATURES:

File: /etc/make.conf
...
FEATURES="${FEATURES} metadata-transfer"
...

[edit] Regenerate Cache

Before you generate the Portage SQLite cache, remove the old cache:

rm -rf /var/cache/edb/dep

Now regenerate the cache:

emerge --metadata

[edit] eix

If you want eix to be able to use the SQLite backend you'll need to enable SQLite in Portage first (see above) and emerge app-portage/eix with the sqlite USE flag enabled. Depending on the metadata your local and layman overlays provide, the sqlite option might not work, so if you're experiencing errors, omit the OVERLAY_CACHE_METHOD variable. Configure eix to use SQLite:

File: /etc/eixrc
...
PORTDIR_CACHE_METHOD='sqlite'
OVERLAY_CACHE_METHOD='parse' # changed to parse. Otherwise eix doesn't show the overlay of an ebuild
...

Finally update eix cache by running eix-update for versions of eix newer than 0.17.0, or update-eix for previous ones.

[edit] Troubleshooting

[edit] ImportError: No module named pysqlite2

When making a major update of Python (like from 2.5 to 2.6) or anything that breaks SQLite (such as dev-libs/icu) you will get the error message:

"ImportError: No module named pysqlite2" 

while using emerge or python-updater. You'll have to disable the SQLite module commenting the line you added in /etc/portage/modules and run:

/usr/sbin/python-updater

You can now uncomment the lines in /etc/portage/modules and redo the Regenerate Cache part of this article.

Personal tools
In other languages