1 |
On 2/20/08, Felipe Contreras <felipe.contreras@×××××.com> wrote: |
2 |
> Hi gentooists, |
3 |
> |
4 |
> I've been reading news sites about some changes happening in Gentoo |
5 |
> and I thought it might be a good time to submit some ideas I've been |
6 |
> baking for several years. |
7 |
> |
8 |
> I come from a Linux From Scratch background, I like the feeling of |
9 |
> knowing every single corner of my system and the fact that there isn't |
10 |
> anything that I don't want or need. However, typing every single |
11 |
> command by hand is far from ideal, so at first I started writing some |
12 |
> scripts and eventually I wrote a build system that suited my needs. I |
13 |
> did it in bash for several reasons. |
14 |
> |
15 |
> After a while I realized bash wasn't exactly the best language to |
16 |
> write such thing. Mainly because: |
17 |
> |
18 |
> a) The code ends up with a lot of stuff for handling strings properly |
19 |
> (like escaping sequences) |
20 |
|
21 |
Yes this is annoying |
22 |
|
23 |
> b) Error are difficult to handle since bash doesn't have exceptions |
24 |
|
25 |
I disagree here: most errors are fatal anyway any non fatal errors can |
26 |
be printed and saved via the elog facility. |
27 |
|
28 |
> c) Persistent information is difficult to achieve (no database stuff) |
29 |
|
30 |
How is this a bash limitation? Most languages don't have 'database |
31 |
stuff' built in. |
32 |
I don't see how saving stuff to files is much different than the env |
33 |
dumping we do in bash? |
34 |
|
35 |
> d) Package information is difficult to fetch/store (no objects/struct) |
36 |
|
37 |
Yes. |
38 |
|
39 |
> |
40 |
> A more featured language could allow for example: filtered output, |
41 |
> exception handling->state storage->resuming. |
42 |
> |
43 |
> But the big deal is with the package definition, recently I learned |
44 |
> about Domain Specific Languages, and I think that is the best option. |
45 |
> |
46 |
> A new dsl allows many interesting features in the package definition |
47 |
> itself like: inheritance, exceptions, arrays, hash tables, objects, |
48 |
> modules, documentation, information messages, etc. |
49 |
|
50 |
Note that most languages allow for the same things...so why would we |
51 |
author our own language? What runtime would it use? |
52 |
|
53 |
> |
54 |
> Take this example: |
55 |
> |
56 |
> package Binutils < Gnu |
57 |
> definition |
58 |
> @version = "2.17" |
59 |
> @name = "binutils" |
60 |
> super() # run the Gnu definition stuff |
61 |
> |
62 |
> @config_opts = "--disable-nls --with-sysroot=\"#{$sys_root}\" |
63 |
> --enable-shared --disable-multilib" |
64 |
> end |
65 |
> |
66 |
> steps |
67 |
> build |
68 |
> cd #{$top_build_dir} |
69 |
> mkdir -p #{@build_dir} |
70 |
> cd #{@build_dir} |
71 |
> :configure "script" => "../#{@dir}/configure", "opts" => @config_opts |
72 |
> make configure-host |
73 |
> make |
74 |
> end |
75 |
> |
76 |
> install |
77 |
> cd #{$top_build_dir} |
78 |
> cd #{@build_dir} |
79 |
> make install |
80 |
> end |
81 |
> end |
82 |
> end |
83 |
> |
84 |
> This is based on an already working prototype made in Ruby, so it's |
85 |
> biased towards Ruby facilities. |
86 |
|
87 |
It looks Rakish ;) |
88 |
|
89 |
> |
90 |
> I've tried different build systems: rpm, dpkg, autopackage. |
91 |
> Unfortunately I never tried ebuild because it was based on bash as far |
92 |
> as I could tell. |
93 |
|
94 |
Typically a 'build system' would refer to 'autotools' or 'ant' or |
95 |
'setuptools' not an ebuild. |
96 |
|
97 |
> |
98 |
> After almost a decade of using Linux I still haven't found a build |
99 |
> system that suits all my needs. AFAIK ebuild is the most advanced but |
100 |
> it's still relying on ancient technology (bash scripts) so there will |
101 |
> always be limitations despite the brilliant ideas. |
102 |
|
103 |
Bash is not 'ancient' and it works suprisingly well for the vast |
104 |
majority of cases. I realize using a high level language would |
105 |
probably make some tasks easier (mmm dicts and real arrays). There is |
106 |
the matter of porting over 10000 ebuilds however ;) |
107 |
|
108 |
> |
109 |
> The core of a distribution is the "packaging" system, and the core of |
110 |
> the packaging system is the building system, which has no reason not |
111 |
> to be distribution agnostic, and actually, packaging system agnostic. |
112 |
> |
113 |
> Why not create a new build system with a state of the art programming |
114 |
> language, and an advanced DSL that actually other distributions could |
115 |
> use? |
116 |
|
117 |
I would talk to Drobbins, he was talking about something like this to |
118 |
manage complexity. |
119 |
|
120 |
> |
121 |
> I would like to hear your opinions on this matter. |
122 |
> |
123 |
> -- |
124 |
> Felipe Contreras |
125 |
> |
126 |
> -- |
127 |
> gentoo-dev@l.g.o mailing list |
128 |
> |
129 |
> |
130 |
-- |
131 |
gentoo-dev@l.g.o mailing list |