Re: [gentoo-portage-dev] [PATCH] preserve-libs: handle manually removed libraries better (bug 599240)

2016-11-09 Thread Zac Medico
On 11/09/2016 03:49 AM, Alexander Berntsen wrote:
> On 09/11/16 10:05, Zac Medico wrote:
>> Before a package is merge
> +d

Thanks, fixed.

> Looks okay. What's the performance impact, if non-negligible?

It's negligible. The relevant code already executes a couple of other
times while merging a package. It uses one lstat call for each preserved
library, and the plib_registry.store() call does not actually write to
disk unless it has found something to remove from the registry.
-- 
Thanks,
Zac



Re: [gentoo-portage-dev] [PATCH] preserve-libs: handle manually removed libraries better (bug 599240)

2016-11-09 Thread Alexander Berntsen
On 09/11/16 10:05, Zac Medico wrote:
> Before a package is merge
+d

Looks okay. What's the performance impact, if non-negligible?
-- 
Alexander
berna...@gentoo.org
https://secure.plaimi.net/~alexander



signature.asc
Description: OpenPGP digital signature


[gentoo-portage-dev] [PATCH] preserve-libs: handle manually removed libraries better (bug 599240)

2016-11-09 Thread Zac Medico
Before a package is merge, prune any libraries from the registry that no
longer exist on disk, in case they have been manually removed. This has
to be done prior to merge, since after merge it is non-trivial to
distinguish these files from files that have just been merged.

X-Gentoo-Bug: 599240
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=599240
---
 pym/portage/dbapi/vartree.py | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 2cb96ea..5053801 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -4252,6 +4252,20 @@ class dblink(object):
#if we have a file containing previously-merged config file 
md5sums, grab it.
self.vartree.dbapi._fs_lock()
try:
+   # This prunes any libraries from the registry that no 
longer
+   # exist on disk, in case they have been manually 
removed.
+   # This has to be done prior to merge, since after merge 
it
+   # is non-trivial to distinguish these files from files
+   # that have just been merged.
+   plib_registry = self.vartree.dbapi._plib_registry
+   if plib_registry:
+   plib_registry.lock()
+   try:
+   plib_registry.load()
+   plib_registry.store()
+   finally:
+   plib_registry.unlock()
+
# Always behave like --noconfmem is enabled for 
downgrades
# so that people who don't know about this option are 
less
# likely to get confused when doing upgrade/downgrade 
cycles.
-- 
2.7.4