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

2016-11-10 Thread Zac Medico
On 11/10/2016 02:57 AM, Alexander Berntsen wrote:
> It's OK by me then.

Thanks, pushed:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=fb25c5d908c22bdd6868c7db44c56ef5cd459fe4
-- 
Thanks,
Zac



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

2016-11-10 Thread Alexander Berntsen
It's OK by me then.
-- 
Alexander
berna...@gentoo.org
https://secure.plaimi.net/~alexander



signature.asc
Description: OpenPGP digital signature


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

2016-11-09 Thread Zac Medico
Before a package is merged, 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.

The performance impact of this change is negligible. 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.

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(+)

[PATCH v2] fix up the commit message and comment on performanc impact

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