Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: Gentoo Developer Mailing List <gentoo-dev@l.g.o>
Subject: [gentoo-dev] A more natural (human-friendly) syntax for dependencies
Date: Sat, 22 Sep 2012 07:56:26
Message-Id: 20120922095508.1f07dce5@pomiocik.lan
1 Hello,
2
3 The current dependency syntax:
4
5 [VERSION-OP] PACKAGE-NAME ["-" PACKAGE-VERSION]
6
7 suffers a few problems:
8
9
10 1. It is not really human-friendly.
11
12 People don't say things like:
13
14 I need newer than monkey-1.2.
15
16 They say instead:
17
18 I need monkey, newer than version 1.2.
19
20
21 2. With long package names and versions, it becomes hard-to-read.
22
23 Consider the following:
24
25 >=dev-foo/bar-very-long-my-name-is-4-beta-17
26
27 Where does the version number start? And yes, this is a valid package
28 name to our rules.
29
30
31 3. Some potentially colliding package names are disallowed.
32
33 A package name can't end up with something looking like version. Thus,
34 if upstream names package:
35
36 frobnicator-11
37
38 We need to rename it in the tree, effectively losing the ability to
39 follow upstream naming and introducing a bunch of unnecessary MY_P, S
40 variables.
41
42
43 4. Adding, removing and changing versions is not friendly at all.
44
45 Consider the following dep:
46
47 >=dev-foo/bar-bas-bat-11.2.4_alpha
48
49 Now, you want to bump the dep to 11.3. You need to find the version
50 number, and modify it. Depending on the configuration, ^w is going to
51 eat the whole package name or just a single component.
52
53 Then, you want to remove the whole version. You need to first remove
54 the version number, making sure it doesn't eat a bit of package name
55 as well. Then, you have to go back to the beginning of the string,
56 and remove the operator.
57
58 Or you want to add a version. That one is simpler -- you just need to
59 go to one end of the dep, add the operator, then to the other, and add
60 the version.
61
62
63 The fore-mentioned problems could be solved through introducing a more
64 natural dependency syntax:
65
66 PACKAGE-NAME [[*WSP] VERSION-OP [*WSP] PACKAGE-VERSION]]
67
68
69 This way:
70
71 1. It follows exactly how people are reading it:
72
73 PACKAGE-NAME [is VERSION-OP than PACKAGE-VERSION]
74
75 2. It is always clear what is the version, and what is not.
76 Additionally, it allows you to introduce whitespace to increase
77 readability even more:
78
79 dev-foo/bar-very-long-my-name-is-4-beta >= 17
80
81 3. The optional (version dependency) part is at one side
82 of the string, so it is easy to add, change or remove. Two times ^w
83 and done!
84
85 4. It follows the syntax used by bash (for conditionals), pkg-config
86 -- it is more natural in the environment.
87
88 --
89 Best regards,
90 Michał Górny

Attachments

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

Replies