Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] RFC: new feature to disable merging into stray locations
Date: Mon, 30 Apr 2012 13:37:23
Message-Id: 20382.38225.587502.685943@a1i15.kph.uni-mainz.de
In Reply to: Re: [gentoo-dev] RFC: new feature to disable merging into stray locations by Thomas Sachau
1 >>>>> On Mon, 30 Apr 2012, Thomas Sachau wrote:
2
3 > Krzysztof Pawlik schrieb:
4 >> On 30/04/12 10:39, Ulrich Mueller wrote:
5 >>>>> If the eclass doesn't work with FEATURES="collision-protect"
6 >>>>> then it needs to be fixed.
7 >>>
8 >>>> Long story short: older eclass compiled Python byte code in live
9 >>>> file system, new one does it in src_install so .pyo/.pyc gets
10 >>>> properly recorded, so the package *has to overwrite* files that
11 >>>> are not owned by anyone (no package owns them).
12 >>>
13 >>> The usual approach to this problem was to have some cleanup code
14 >>> in pkg_setup or pkg_preinst that would remove the old files.
15 >>
16 >> Interesting idea - I see two problems:
17 >> - how I would get the list of files for already installed version
18 >> (the file list can (and will) differ between versions)
19
20 > Simple workaround in pkg_preinst (just example code, nothing to
21 > copy/paste):
22
23 > if has_version < first_good_version ; then
24 > for i in $(find ${D} -name *.{pyc,pyo}) ; do
25 > [[ -e ${i/${D}/${ROOT}/} ]] && rm ${i/${D}/${ROOT}/}
26 > done
27 > fi
28
29 This wouldn't work, because collision protection runs _before_
30 pkg_preinst.
31
32 However, one could imagine a (somewhat dirty) workaround:
33 - At the end of src_install, rename all *.pyc and *.pyo in ${D} to
34 names that don't collide with the ones in ${ROOT}, so that collision
35 protection won't be triggered.
36 - At the beginning of pkg_preinst, rename them back to their original
37 names.
38 - Run above code.
39
40 > Alternatively, you could take all .py files of the installed
41 > versions and blindly remove the pyo/pyc files for them in
42 > pkg_preinst (this should also prevent leaving dead files around).
43
44 s/preinst/setup/ otherwise the same argument as above would apply.
45
46 Ulrich

Replies

Subject Author
Re: [gentoo-dev] RFC: new feature to disable merging into stray locations Brian Harring <ferringb@×××××.com>