On Mon, Jul 16, 2007 at 11:43:38AM +0200, ngaba@petra.hos.u-szeged.hu wrote:
Hi!
Well, you probably will ask me to send patch, but I'm waiting for your decision. First, here is the problem: ===requiredby005.py== self.description = "Remove lp1, requiredby should move from lp1 to lp2"
lp1 = pmpkg("foo") lp1.requiredby = ["pkg3"] self.addpkg2db("local", lp1)
lp2 = pmpkg("pkg2") lp2.provides = ["foo"] self.addpkg2db("local", lp2)
lp3 = pmpkg("pkg3") lp3.depends = ["foo"] self.addpkg2db("local", lp3)
self.args = "-R %s" % lp1.name
self.addrule("PACMAN_RETCODE=0") self.addrule("!PKG_EXIST=foo") self.addrule("PKG_EXIST=pkg2") self.addrule("PKG_REQUIREDBY=pkg2|pkg3") ------------------------- This test fails and hence the database becomes corrupt: alpm_checkdeps is clever enough to let pacman remove foo, however update of pkg2's requiredby is missing after the remove. However, this is not a pactest to commit: as you see, pkg2's requiredby field is missing: this can happen, if pkg3 was the last installed package, because _alpm_trans_update_depends works in a "funny" way: it fills in the "literal" satisfier's requiredby only or _all_ "provider" satisfiers' requiredby. So, my question, how I fix this? How should we store multiple satisfiers in localdb? case 1: We find all satisfier package and fill in _all_ requiredby fields. case 2: We flag only one package as a satisfier with requiredby, and we handle properly these requiredby "moves". case 3: any other idea? We must choose one, because this is not defined in pacman now. I prefer case 1. Pros: -easy to implement (only _alpm_trans_update_depends needs patching) -by doing this, we clean up _alpm_trans_update_depends using alpm_depcmp -_alpm_pkg_update_requiredby prefers this way now -this won't break prepare/commit hierarchy (because alpm_checkdeps should somehow inform remove_commit in case 2) -when using -d switch, implement case 2 is difficult Contras: -slower!! (we need to check for providers always) -some users may have corrupted(?) localdb as shown in the pactest file (this is rare) -one satisfier is enough
Oh yes, please, clean that update_depends function, trying to read it almost killed me. (so go with case 1 I guess). About corrupted db, most db are already corrupted, but in a less important way : extra required by field (fixed by your upgraderm patch), instead of missing required by fields as it's the case here. But so, couldn't we have an option in pacman for repairing requiredby fields or something ?