1 |
On Mon, Apr 30, 2012 at 03:36:17PM +0200, Ulrich Mueller wrote: |
2 |
> >>>>> On Mon, 30 Apr 2012, Thomas Sachau wrote: |
3 |
> |
4 |
> > Krzysztof Pawlik schrieb: |
5 |
> >> On 30/04/12 10:39, Ulrich Mueller wrote: |
6 |
> >>>>> If the eclass doesn't work with FEATURES="collision-protect" |
7 |
> >>>>> then it 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, so the package *has to overwrite* files that |
12 |
> >>>> are not owned by anyone (no package owns them). |
13 |
> >>> |
14 |
> >>> The usual approach to this problem was to have some cleanup code |
15 |
> >>> in pkg_setup or pkg_preinst that would remove the old files. |
16 |
> >> |
17 |
> >> Interesting idea - I see two problems: |
18 |
> >> - how I would get the list of files for already installed version |
19 |
> >> (the file list can (and will) differ between versions) |
20 |
> |
21 |
> > Simple workaround in pkg_preinst (just example code, nothing to |
22 |
> > copy/paste): |
23 |
> |
24 |
> > if has_version < first_good_version ; then |
25 |
> > for i in $(find ${D} -name *.{pyc,pyo}) ; do |
26 |
> > [[ -e ${i/${D}/${ROOT}/} ]] && rm ${i/${D}/${ROOT}/} |
27 |
> > done |
28 |
> > fi |
29 |
> |
30 |
> This wouldn't work, because collision protection runs _before_ |
31 |
> pkg_preinst. |
32 |
> |
33 |
> However, one could imagine a (somewhat dirty) workaround: |
34 |
> - At the end of src_install, rename all *.pyc and *.pyo in ${D} to |
35 |
> names that don't collide with the ones in ${ROOT}, so that collision |
36 |
> protection won't be triggered. |
37 |
> - At the beginning of pkg_preinst, rename them back to their original |
38 |
> names. |
39 |
> - Run above code. |
40 |
> |
41 |
> > Alternatively, you could take all .py files of the installed |
42 |
> > versions and blindly remove the pyo/pyc files for them in |
43 |
> > pkg_preinst (this should also prevent leaving dead files around). |
44 |
> |
45 |
> s/preinst/setup/ otherwise the same argument as above would apply. |
46 |
|
47 |
The checks above can misbehave. |
48 |
|
49 |
Pretty sure I've already suggested this route for this specific issue, |
50 |
but QA vars in the ebuild that portage can use for hints is a sane, |
51 |
non-cluster-fucky way to deal with this. Something along the lines of |
52 |
QA_COLLISION_PROTECT_IGNORE='*.pyc' |
53 |
|
54 |
Still has the potential for things going boom, but warnings can be |
55 |
setup for when collision-protect is on, and the portage version |
56 |
doesn't look new enough (those being details; point is the general |
57 |
approach). |
58 |
~harring |