[pacman-dev] [PATCH 0/5] Version the local database

Allan McRae allan at archlinux.org
Fri Jul 19 20:51:51 EDT 2013


On 16/07/13 22:22, Allan McRae wrote:
> With removing directory symlink support, we need to make an adjustment to
> the users local database to adjust any path that relied in that "feature".
> 
> As this is not a readily detectable change, as was the case in our last
> local database adjustment, we need to add something to track the local
> database version.
> 
> The file ".alpm_db_version" is added to the local database root.  This file
> is automatically created whenever the local database directory is absent
> or empty.  This store the current database version as an integer.  I have
> chosen to use the (next) libalpm soname version so it is easy for us to
> track what versions are needed.
> 

Any comments on these?

I had one comment:
<toofishes> pacman -Qip should work without a local DB, for instance

Lets have a look at pacman-4.1.2:

# rm -rf /var/lib/pacman/
# pacman -Qip /tmp/pacman-git-4.1.2_67_g7977aab-1-x86_64.pkg.tar.xz
error: failed to initialize alpm library (could not find or read directory)

So, we need /var/lib/pacman to initialise the transaction already, so
having pacman automatically add the /var/lib/pacman/local directory and
a version file is not much of a burden.

That means the only change is when you have a local database and it is
not the correct version:

# pacman -Qip pacman-git-4.1.2_77_g5ee4a65-1-x86_64.pkg.tar.xz
error: failed to initialize alpm library (database is incorrect version)
error:   try running pacman-db-upgrade

(the spacing in that output is interesting...)

That requires a one-off database upgrade, which will be needed for any
pacman operation.  Given it blocks ALL pacman operations (which I am
fairly sure was the case when we remove "depends" files too), I think
this is fine.

Allan



More information about the pacman-dev mailing list