Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Preserving mtimes for EAPI3
Date: Mon, 30 Mar 2009 17:14:12
Message-Id: 18896.64993.644287.120866@a1ihome1.kph.uni-mainz.de
In Reply to: [gentoo-dev] Preserving mtimes for EAPI3 by "Marijn Schouten (hkBst)"
1 >>>>> On Mon, 30 Mar 2009, Marijn Schouten (hkBst) wrote:
2
3 > On behalf of the Lisp project (which includes the Emacs subproject)
4 > I'd like to propose that preservation of mtimes be included as a
5 > requirement of EAPI3.
6
7 > [...]
8
9 > Background: Dynamic languages such as Common Lisp and Elisp, but
10 > also python (and ruby?) compile source files to some form which
11 > loads and executes faster; in Lisp-speak these are called fasl's
12 > (for FASt Load), for python these are the pyc files. Need for
13 > recompilation is determined by comparing the mtimes of the original
14 > source and the fasl. Both source and fasl are usually installed.
15 > If the mtimes are modified such that the fasl is not newer than
16 > the original source anymore then implementations will attempt to
17 > recompile these sources and will try to write the output alongside
18 > the sources. This will cause a sandbox violation if it happens in
19 > an ebuild or fail due to permissions when done as a user.
20
21 I'll try to summarise the current state of discussion in
22 <https://bugs.gentoo.org/264130>. The goal is to satisfy two
23 (apparently contradictory) requirements:
24
25 a) Some packages need a preserved ordering of file modification
26 times, therwise things will break at run time (see above).
27
28 b) Files in the installed system should not have mtimes that are
29 older than the build time of the package.
30
31 Currently, Portage and Pkgcore preserve file modification times when
32 merging, which doesn't always fulfil b). Paludis updates mtimes, which
33 breaks a).
34
35 Now, is it possible to satisfy both? I think that the following
36 procedure would accomplish it:
37
38 1. Record two timestamps:
39 before calling pkg_setup, timestamp1;
40 after src_install has completed, timestamp2.
41
42 2. After src_install and before merging (the exact time would be
43 implementation dependent), scan ${D} for files having
44 mtime < timestamp1 or mtime > timestamp2.
45 Update their mtimes to timestamp1 or timestamp2, respectively.
46
47 3. Otherwise (i.e. for files with timestamp1 <= mtime <= timestamp2),
48 preserve modification times when merging ${D} to ${ROOT}.
49
50 This way, any files generated during the build process (*.pyc, *.fasl,
51 *.elc) would end up with timestamps newer than their corresponding
52 source files (*.py, *.lisp, *.el).
53
54 Problems remain for packages with pre-compiled files, or for packages
55 requiring exact mtimes (like ghdl). But I think this affects only very
56 few packages, and it could be fixed on the ebuild level. For example,
57 a Lisp package with both *.lisp and precompiled *.fasl could touch its
58 fasl files at the end of src_install.
59
60
61 I am aware of the fact that we are late for EAPI 3 (partly because I
62 didn't expect that the change would require an EAPI bump). Question to
63 the council: is it still possible to include this? Considering that
64 there is a lot of breakage, as well as strange workarounds related to
65 the current inconsistent behaviour of package managers.
66
67 Ulrich

Replies

Subject Author
Re: [gentoo-dev] Preserving mtimes for EAPI3 "Petteri Räty" <betelgeuse@g.o>
Re: [gentoo-dev] Preserving mtimes for EAPI3 Michael Haubenwallner <haubi@g.o>