# emerge -1 =rpm-4.4.6-r4 ... >>> Original instance of package unmerged safely. * RPM database found... Rebuilding database (may take a while)... rpmdb: /var/lib/rpm/Packages: unexpected file type or format error: cannot open Packages index using db3 - Invalid argument (22) * Byte compiling python modules for python-2.5 .. ... [ ok ] ... # file /var/lib/rpm/Packages /var/lib/rpm/Packages: Berkeley DB (Btree, version 9, native byte-order) I've noticed this error message quite by accident, as I had to remerge rpm due to an update of neon. Examining logs from previous runs, I can tell this happened before. Looks like I had rpm-5.0_beta4 installed before it got masked due to bug 205280, and this error happened ever since. So it might be the format created by rpm-5 is incompatible with rpm-4. However, I'd expect an ewarn in this case, so I know about the problem. Personally, I have no rpm-managed packages installed, so I can simply delete the database and run rpm --initdb. However, I could imagine that the consequences might be more severe for other users. I have no clue how much the formats differ, if there is any chance to convert the format, or if you should suggest users to unmask rpm-5 if they have any rpm packages installed.
rpm-4* and rpm-5* are nowadays completely different packages (as far as their source code goes). As such database format is not compatible (which you correctly guessed). I am closing this bug as INVALID because rpm-4 and rpm-5 are really not compatible and rpm-5* is hard-masked in portage. Therefore to trigger this bug you would have unmask the package yourself. Breakages are to be expected then. If you feel this is incorrect, feel free to re-open the bug.