Gentoo Archives: gentoo-dev

From: hasufell <hasufell@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] A more natural (human-friendly) syntax for dependencies
Date: Sat, 22 Sep 2012 19:43:20
Message-Id: 505E1466.5000508@gentoo.org
In Reply to: [gentoo-dev] A more natural (human-friendly) syntax for dependencies by "Michał Górny"
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 On 09/22/2012 09:55 AM, Michał Górny wrote:
5 > Hello,
6 >
7 > The current dependency syntax:
8 >
9 > [VERSION-OP] PACKAGE-NAME ["-" PACKAGE-VERSION]
10 >
11 > suffers a few problems:
12 >
13 >
14 > 1. It is not really human-friendly.
15 >
16 > People don't say things like:
17 >
18 > I need newer than monkey-1.2.
19 >
20 > They say instead:
21 >
22 > I need monkey, newer than version 1.2.
23 >
24 >
25 > 2. With long package names and versions, it becomes hard-to-read.
26 >
27 > Consider the following:
28 >
29 >> =dev-foo/bar-very-long-my-name-is-4-beta-17
30 >
31 > Where does the version number start? And yes, this is a valid
32 > package name to our rules.
33 >
34 >
35 > 3. Some potentially colliding package names are disallowed.
36 >
37 > A package name can't end up with something looking like version.
38 > Thus, if upstream names package:
39 >
40 > frobnicator-11
41 >
42 > We need to rename it in the tree, effectively losing the ability
43 > to follow upstream naming and introducing a bunch of unnecessary
44 > MY_P, S variables.
45 >
46 >
47 > 4. Adding, removing and changing versions is not friendly at all.
48 >
49 > Consider the following dep:
50 >
51 >> =dev-foo/bar-bas-bat-11.2.4_alpha
52 >
53 > Now, you want to bump the dep to 11.3. You need to find the
54 > version number, and modify it. Depending on the configuration, ^w
55 > is going to eat the whole package name or just a single component.
56 >
57 > Then, you want to remove the whole version. You need to first
58 > remove the version number, making sure it doesn't eat a bit of
59 > package name as well. Then, you have to go back to the beginning of
60 > the string, and remove the operator.
61 >
62 > Or you want to add a version. That one is simpler -- you just need
63 > to go to one end of the dep, add the operator, then to the other,
64 > and add the version.
65 >
66 >
67 > The fore-mentioned problems could be solved through introducing a
68 > more natural dependency syntax:
69 >
70 > PACKAGE-NAME [[*WSP] VERSION-OP [*WSP] PACKAGE-VERSION]]
71 >
72 >
73 > This way:
74 >
75 > 1. It follows exactly how people are reading it:
76 >
77 > PACKAGE-NAME [is VERSION-OP than PACKAGE-VERSION]
78 >
79 > 2. It is always clear what is the version, and what is not.
80 > Additionally, it allows you to introduce whitespace to increase
81 > readability even more:
82 >
83 > dev-foo/bar-very-long-my-name-is-4-beta >= 17
84 >
85 > 3. The optional (version dependency) part is at one side of the
86 > string, so it is easy to add, change or remove. Two times ^w and
87 > done!
88 >
89 > 4. It follows the syntax used by bash (for conditionals),
90 > pkg-config -- it is more natural in the environment.
91 >
92
93 KISS is not just about simplicity of a system, but also about
94 simplicity of changes and how big the gain is when the changes are not
95 simple.
96 -----BEGIN PGP SIGNATURE-----
97 Version: GnuPG v2.0.19 (GNU/Linux)
98 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
99
100 iQEcBAEBAgAGBQJQXhRmAAoJEFpvPKfnPDWzFJoH/jzjfVtHzbv3VUPJYl4WZSkq
101 ztNaFp8SPSeMS10sM48Pt2l3JkHnOlN8hiXS4zq9Gy9VLKT3rkP94h8g3Gmh8biP
102 pcHxGEpZOFV5ATuI2MNBDrF7LI8S0eVoOkutEQPAUwmI8NRzrj0DpEwYlmsUDxwE
103 aD5vtMWLl02X6dnZfdLUN/zBo/T3jNWuLUyPmKWwB7qkIH+2W0y3ZxdBJmdA4VYl
104 ImrIM7RAhUgBb3cPtmloPt7rfYH/AGoS1O2M6eEZo1N2TmeZ4YwwciOmYfZrHWkc
105 AZzGs9yt0ElMkZrNNdHZlblyQhdZJ8xO2WhJrvmeG+HtwUJgtxDtYbowkkunLoM=
106 =5PkR
107 -----END PGP SIGNATURE-----