Gentoo Archives: gentoo-dev

From: Gerion Entrup <gerion.entrup@×××××.de>
To: gentoo-dev <gentoo-dev@l.g.o>
Subject: Re: [gentoo-dev] Declare the type of source
Date: Mon, 28 Jun 2021 14:31:13
Message-Id: 7966887.NyiUUSuA9g@gump
In Reply to: Re: [gentoo-dev] Declare the type of source by Rich Freeman
1 Am Montag, 28. Juni 2021, 16:13:41 CEST schrieb Rich Freeman:
2 > On Mon, Jun 28, 2021 at 9:46 AM Michael Orlitzky <mjo@g.o> wrote:
3 > >
4 > > On Mon, 2021-06-28 at 15:00 +0200, Agostino Sarubbo wrote:
5 > > >
6 > > > Instead, imagine that each ebuild declares a variable called SOURCETYPE ( or
7 > > > similar, or in metadata.xml if you prefer ) and with a tool like equery/eix we
8 > > > are able to get the list of all packages that compiles C code.
9 > > >
10 > >
11 > > I think all you are really asking for is that we stop omitting a random
12 > > subset of @system from *DEPEND.
13 > >
14 > > This is long overdue, for many reasons, but in particular it would
15 > > force us to declare a dependency on a C compiler if one is needed and
16 > > allow you to re-test only those packages that use a C compiler.
17 >
18 > ++ - this would also support parallel building of @system.
19 >
20 > Obviously we'll still need a core set of packages needed for
21 > bootstrapping/etc, but there is no reason @system couldn't just be
22 > another virtual.
23 >
24 > You could also have convenience virtuals for things like the C
25 > toolchain and so on. This will both support alternate implementations
26 > and avoid having to have laundry lists of deps in every ebuild.
27 >
28 > A simple way to transition would be to create a system virtual and add
29 > it to all ebuilds, but ask that this be removed in future updates in
30 > favor of more specific dependencies. Over time then the tree would
31 > move to specified true deps. Catalyst could still use a virtual as a
32 > target for bootstrapping stages.
33 >
34 > Another tool that would be useful is what some other distros do - use
35 > mount namespaces/etc to allow build systems to only see parts of the
36 > filesystem (down to the file level) that are specified in
37 > dependencies. This would basically eliminate unspecified or automagic
38 > dependencies, since anything not specified basically doesn't exist at
39 > build time. If you didn't want to use mount namespaces then our
40 > sandbox already allows limiting read access to only specified files -
41 > we just configure it to allow read-only to everything for every
42 > package.
43 >
44 >
45
46 Hello,
47
48 I was already writing an answer, which describes basically the same idea,
49 when Rich's mail arrived. I want to post my mail anyway. Maybe it provides
50 some additional information:
51
52 Wouldn't the right place be in BDEPEND, maybe hidden by some eclass magic?
53
54 Some time ago, I have looked into Nix. They try to get reliable input by path
55 manipulation and therefore can depend on the compiler (with a specific
56 version). If I get there build system right, it only builds a software if
57 all dependencies are installed beforehand in a specific input specific
58 folder.
59
60 I'm questioning myself, if this is also possible in a Gentoo compatible
61 way with Linux namespaces?:
62 1. Create a new namespace for / (consisting of no files).
63 2. Bindmount/Link every file of each dependency into it at the exact same place.
64 3. Link some socket(?) to communicate with the outer portage.
65 4. Trigger the build process.
66
67 I imagine something like the the TemporaryFileSystem feature of Systemd
68 together with BindPaths [1]. This uses Linux namespaces internally, too.
69
70 In a pseudo service file syntax:
71 ```
72 [Service]
73 ExecStart=ebuild mytool-1.0.2 compile
74 TemporaryFileSystem=:ro
75 BindPaths=$(equery files $(equery depgraph =mytool-1.0.2))
76 ```
77
78 This should only build, if _all_ build dependencies are present
79 (including every compiler and base system tool). Of course, it needs a
80 bigger rework of the portage build process.
81
82 Gerion
83
84 [1] https://www.freedesktop.org/software/systemd/man/systemd.exec.html#BindPaths=

Attachments

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

Replies

Subject Author
Re: [gentoo-dev] Declare the type of source Michael Orlitzky <mjo@g.o>