Gentoo Archives: gentoo-dev

From: Felipe Contreras <felipe.contreras@×××××.com>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] The future of ebuild
Date: Wed, 20 Feb 2008 20:40:18
Message-Id: 94a0d4530802201240v19dde77vff199cb11ece0bbd@mail.gmail.com
1 Hi gentooists,
2
3 I've been reading news sites about some changes happening in Gentoo
4 and I thought it might be a good time to submit some ideas I've been
5 baking for several years.
6
7 I come from a Linux From Scratch background, I like the feeling of
8 knowing every single corner of my system and the fact that there isn't
9 anything that I don't want or need. However, typing every single
10 command by hand is far from ideal, so at first I started writing some
11 scripts and eventually I wrote a build system that suited my needs. I
12 did it in bash for several reasons.
13
14 After a while I realized bash wasn't exactly the best language to
15 write such thing. Mainly because:
16
17 a) The code ends up with a lot of stuff for handling strings properly
18 (like escaping sequences)
19 b) Error are difficult to handle since bash doesn't have exceptions
20 c) Persistent information is difficult to achieve (no database stuff)
21 d) Package information is difficult to fetch/store (no objects/struct)
22
23 A more featured language could allow for example: filtered output,
24 exception handling->state storage->resuming.
25
26 But the big deal is with the package definition, recently I learned
27 about Domain Specific Languages, and I think that is the best option.
28
29 A new dsl allows many interesting features in the package definition
30 itself like: inheritance, exceptions, arrays, hash tables, objects,
31 modules, documentation, information messages, etc.
32
33 Take this example:
34
35 package Binutils < Gnu
36 definition
37 @version = "2.17"
38 @name = "binutils"
39 super() # run the Gnu definition stuff
40
41 @config_opts = "--disable-nls --with-sysroot=\"#{$sys_root}\"
42 --enable-shared --disable-multilib"
43 end
44
45 steps
46 build
47 cd #{$top_build_dir}
48 mkdir -p #{@build_dir}
49 cd #{@build_dir}
50 :configure "script" => "../#{@dir}/configure", "opts" => @config_opts
51 make configure-host
52 make
53 end
54
55 install
56 cd #{$top_build_dir}
57 cd #{@build_dir}
58 make install
59 end
60 end
61 end
62
63 This is based on an already working prototype made in Ruby, so it's
64 biased towards Ruby facilities.
65
66 I've tried different build systems: rpm, dpkg, autopackage.
67 Unfortunately I never tried ebuild because it was based on bash as far
68 as I could tell.
69
70 After almost a decade of using Linux I still haven't found a build
71 system that suits all my needs. AFAIK ebuild is the most advanced but
72 it's still relying on ancient technology (bash scripts) so there will
73 always be limitations despite the brilliant ideas.
74
75 The core of a distribution is the "packaging" system, and the core of
76 the packaging system is the building system, which has no reason not
77 to be distribution agnostic, and actually, packaging system agnostic.
78
79 Why not create a new build system with a state of the art programming
80 language, and an advanced DSL that actually other distributions could
81 use?
82
83 I would like to hear your opinions on this matter.
84
85 --
86 Felipe Contreras
87 --
88 gentoo-dev@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] The future of ebuild Duncan Coutts <dcoutts@g.o>
Re: [gentoo-dev] The future of ebuild Alec Warner <antarus@g.o>