Gentoo Archives: gentoo-dev

From: Thomas Sachau <tommy@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:20:50
Message-Id: 4F9E91D8.8050500@gentoo.org
In Reply to: Re: [gentoo-dev] RFC: new feature to disable merging into stray locations by Krzysztof Pawlik
1 Krzysztof Pawlik schrieb:
2 > On 30/04/12 10:39, Ulrich Mueller wrote:
3 >>>>>>> On Mon, 30 Apr 2012, Krzysztof Pawlik wrote:
4 >>
5 >>> On 30/04/12 10:12, Ulrich Mueller wrote:
6 >>>> If the eclass doesn't work with FEATURES="collision-protect" then it
7 >>>> needs to be fixed.
8 >>
9 >>> Long story short: older eclass compiled Python byte code in live
10 >>> file system, new one does it in src_install so .pyo/.pyc gets
11 >>> properly recorded,
12 >>
13 >> That's a good change.
14 >
15 > :)
16 >
17 >>> so the package *has to overwrite* files that are not owned by anyone
18 >>> (no package owns them).
19 >>
20 >> The usual approach to this problem was to have some cleanup code in
21 >> pkg_setup or pkg_preinst that would remove the old files.
22 >
23 > Interesting idea - I see two problems:
24 > - how I would get the list of files for already installed version (the file
25 > list can (and will) differ between versions)
26
27 Simple workaround in pkg_preinst (just example code, nothing to copy/paste):
28
29 if has_version < first_good_version ; then
30 for i in $(find ${D} -name *.{pyc,pyo}) ; do
31 [[ -e ${i/${D}/${ROOT}/} ]] && rm ${i/${D}/${ROOT}/}
32 done
33 fi
34
35 Alternatively, you could take all .py files of the installed versions
36 and blindly remove the pyo/pyc files for them in pkg_preinst (this
37 should also prevent leaving dead files around).
38
39
40 --
41
42 Thomas Sachau
43 Gentoo Linux Developer

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies