Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Development (http://www.linux-archive.org/gentoo-development/)
-   -   A more natural (human-friendly) syntax for dependencies (http://www.linux-archive.org/gentoo-development/706315-more-natural-human-friendly-syntax-dependencies.html)

Michał Górny 09-22-2012 07:55 AM

A more natural (human-friendly) syntax for dependencies
 
Hello,

The current dependency syntax:

[VERSION-OP] PACKAGE-NAME ["-" PACKAGE-VERSION]

suffers a few problems:


1. It is not really human-friendly.

People don't say things like:

I need newer than monkey-1.2.

They say instead:

I need monkey, newer than version 1.2.


2. With long package names and versions, it becomes hard-to-read.

Consider the following:

>=dev-foo/bar-very-long-my-name-is-4-beta-17

Where does the version number start? And yes, this is a valid package
name to our rules.


3. Some potentially colliding package names are disallowed.

A package name can't end up with something looking like version. Thus,
if upstream names package:

frobnicator-11

We need to rename it in the tree, effectively losing the ability to
follow upstream naming and introducing a bunch of unnecessary MY_P, S
variables.


4. Adding, removing and changing versions is not friendly at all.

Consider the following dep:

>=dev-foo/bar-bas-bat-11.2.4_alpha

Now, you want to bump the dep to 11.3. You need to find the version
number, and modify it. Depending on the configuration, ^w is going to
eat the whole package name or just a single component.

Then, you want to remove the whole version. You need to first remove
the version number, making sure it doesn't eat a bit of package name
as well. Then, you have to go back to the beginning of the string,
and remove the operator.

Or you want to add a version. That one is simpler -- you just need to
go to one end of the dep, add the operator, then to the other, and add
the version.


The fore-mentioned problems could be solved through introducing a more
natural dependency syntax:

PACKAGE-NAME [[*WSP] VERSION-OP [*WSP] PACKAGE-VERSION]]


This way:

1. It follows exactly how people are reading it:

PACKAGE-NAME [is VERSION-OP than PACKAGE-VERSION]

2. It is always clear what is the version, and what is not.
Additionally, it allows you to introduce whitespace to increase
readability even more:

dev-foo/bar-very-long-my-name-is-4-beta >= 17

3. The optional (version dependency) part is at one side
of the string, so it is easy to add, change or remove. Two times ^w
and done!

4. It follows the syntax used by bash (for conditionals), pkg-config
-- it is more natural in the environment.

--
Best regards,
Michał Górny

Ulrich Mueller 09-22-2012 08:18 AM

A more natural (human-friendly) syntax for dependencies
 
>>>>> On Sat, 22 Sep 2012, Michał Górny wrote:

> A package name can't end up with something looking like version.

> Thus, if upstream names package:

> frobnicator-11

> We need to rename it in the tree, effectively losing the ability to
> follow upstream naming and introducing a bunch of unnecessary MY_P,
> S variables.

You need to be more precise here. Package names like "foo-1a" or
"foo-2_alpha" are perfectly legal, see the discussion in bug 174536.

What is currently not allowed are package names ending with a hyphen
followed by digits only (as in your above example). This seems to be
completely arbitrary, and we could remove this limitation, even with
existing dependency syntax.

Ulrich

Michał Górny 09-22-2012 08:26 AM

A more natural (human-friendly) syntax for dependencies
 
On Sat, 22 Sep 2012 10:18:31 +0200
Ulrich Mueller <ulm@gentoo.org> wrote:

> >>>>> On Sat, 22 Sep 2012, Michał Górny wrote:
>
> > A package name can't end up with something looking like version.
>
> > Thus, if upstream names package:
>
> > frobnicator-11
>
> > We need to rename it in the tree, effectively losing the ability to
> > follow upstream naming and introducing a bunch of unnecessary MY_P,
> > S variables.
>
> You need to be more precise here. Package names like "foo-1a" or
> "foo-2_alpha" are perfectly legal, see the discussion in bug 174536.
>
> What is currently not allowed are package names ending with a hyphen
> followed by digits only (as in your above example). This seems to be
> completely arbitrary, and we could remove this limitation, even with
> existing dependency syntax.

I doubt we can. And we just extended it into repository names, didn't
we?

--
Best regards,
Michał Górny

Ulrich Mueller 09-22-2012 09:05 AM

A more natural (human-friendly) syntax for dependencies
 
>>>>> On Sat, 22 Sep 2012, Michał Górny wrote:

>> What is currently not allowed are package names ending with a hyphen
>> followed by digits only (as in your above example). This seems to be
>> completely arbitrary, and we could remove this limitation, even with
>> existing dependency syntax.

> I doubt we can.

Nobody could tell me a technical reason why this limitation exists.
Why should "foo-1" be forbidden for PN if "foo-1a" is allowed?

> And we just extended it into repository names, didn't we?

Indeed, looks like I've missed this. But it shouldn't be a problem, if
we loosen the spec for package names, the one for repository names
just follows it.

Ulrich

Alex Alexander 09-22-2012 09:07 AM

A more natural (human-friendly) syntax for dependencies
 
On Sep 22, 2012 10:58 AM, "Michał Górny" <mgorny@gentoo.org> wrote:

>

> Hello,

>

> The current dependency syntax:

>

> * [VERSION-OP] PACKAGE-NAME ["-" PACKAGE-VERSION]

>

> suffers a few problems:

The syntax you are describing is used all over portage, not just dependencies. Some examples are the /etc/portage/package.* files, has_version or exact version matching when emerging.

Changing it just for dependencies would most certainly confuse people and tbh I like the current syntax :-)

Alex | wired

Luca Barbato 09-22-2012 03:12 PM

A more natural (human-friendly) syntax for dependencies
 
On 09/22/2012 09:55 AM, Michał Górny wrote:
> Hello,
>
> The current dependency syntax:
>
> [VERSION-OP] PACKAGE-NAME ["-" PACKAGE-VERSION]
>
> suffers a few problems:

I like the current syntax.

lu

Ciaran McCreesh 09-22-2012 03:13 PM

A more natural (human-friendly) syntax for dependencies
 
On Sat, 22 Sep 2012 09:55:08 +0200
Michał Górny <mgorny@gentoo.org> wrote:
> The fore-mentioned problems could be solved through introducing a more
> natural dependency syntax:
>
> PACKAGE-NAME [[*WSP] VERSION-OP [*WSP] PACKAGE-VERSION]]

If we'd rather not break backwards compatibility and add in all kinds
of whitespace-related mess, another option is cat/pkg[>=2.3].

--
Ciaran McCreesh

Michał Górny 09-22-2012 03:37 PM

A more natural (human-friendly) syntax for dependencies
 
On Sat, 22 Sep 2012 17:12:04 +0200
Luca Barbato <lu_zero@gentoo.org> wrote:

> On 09/22/2012 09:55 AM, Michał Górny wrote:
> > Hello,
> >
> > The current dependency syntax:
> >
> > [VERSION-OP] PACKAGE-NAME ["-" PACKAGE-VERSION]
> >
> > suffers a few problems:
>
> I like the current syntax.

Does that invalidate my arguments?

--
Best regards,
Michał Górny

Luca Barbato 09-22-2012 04:13 PM

A more natural (human-friendly) syntax for dependencies
 
On 09/22/2012 09:55 AM, Michał Górny wrote:
> Hello,
>
> The current dependency syntax:
>
> [VERSION-OP] PACKAGE-NAME ["-" PACKAGE-VERSION]
>
> suffers a few problems:

I like the current one your proposal seems quite a problem for a large
deal of usecases.

> 1. It is not really human-friendly.
>
> People don't say things like:
>
> I need newer than monkey-1.2.
>
> They say instead:
>
> I need monkey, newer than version 1.2.

"I need monkey-1.2 or newer" sounds natural to me.

> 2. With long package names and versions, it becomes hard-to-read.
>
> Consider the following:
>
> >=dev-foo/bar-very-long-my-name-is-4-beta-17
>
> Where does the version number start? And yes, this is a valid package
> name to our rules.


> 4. Adding, removing and changing versions is not friendly at all.
>
> Consider the following dep:
>
> >=dev-foo/bar-bas-bat-11.2.4_alpha
>
> Now, you want to bump the dep to 11.3. You need to find the version
> number, and modify it. Depending on the configuration, ^w is going to
> eat the whole package name or just a single component.

Use a better editor.

> Then, you want to remove the whole version. You need to first remove
> the version number, making sure it doesn't eat a bit of package name
> as well. Then, you have to go back to the beginning of the string,
> and remove the operator.

> PACKAGE-NAME [[*WSP] VERSION-OP [*WSP] PACKAGE-VERSION]]

whitespace as separator for atoms looks a huge can of worms waiting to
be opened. how you'd pass that to emerge? How you make a list of atoms?

Please try not fix/break what is not broken.

lu

Michał Górny 09-22-2012 04:30 PM

A more natural (human-friendly) syntax for dependencies
 
On Sat, 22 Sep 2012 18:13:48 +0200
Luca Barbato <lu_zero@gentoo.org> wrote:

> On 09/22/2012 09:55 AM, Michał Górny wrote:
> > Hello,
> >
> > The current dependency syntax:
> >
> > [VERSION-OP] PACKAGE-NAME ["-" PACKAGE-VERSION]
> >
> > suffers a few problems:
>
> I like the current one your proposal seems quite a problem for a large
> deal of usecases.
>
> > 1. It is not really human-friendly.
> >
> > People don't say things like:
> >
> > I need newer than monkey-1.2.
> >
> > They say instead:
> >
> > I need monkey, newer than version 1.2.
>
> "I need monkey-1.2 or newer" sounds natural to me.

'monkey-1.2' or 'monkey version 1.2'? The former being a package name.

> > 4. Adding, removing and changing versions is not friendly at all.
> >
> > Consider the following dep:
> >
> > >=dev-foo/bar-bas-bat-11.2.4_alpha
> >
> > Now, you want to bump the dep to 11.3. You need to find the version
> > number, and modify it. Depending on the configuration, ^w is going
> > to eat the whole package name or just a single component.
>
> Use a better editor.

Which one has automagic atom stripping?

> > Then, you want to remove the whole version. You need to first remove
> > the version number, making sure it doesn't eat a bit of package name
> > as well. Then, you have to go back to the beginning of the string,
> > and remove the operator.
>
> > PACKAGE-NAME [[*WSP] VERSION-OP [*WSP] PACKAGE-VERSION]]
>
> whitespace as separator for atoms looks a huge can of worms waiting to
> be opened. how you'd pass that to emerge? How you make a list of
> atoms?

emerge 'foo >= 1.1' 'bar < 1.0'?
emerge foo '>=' 1.1 bar '<' 1.0?

And what do you mean by 'a list of atoms'? I don't see a single problem
parsing this syntax. It's a very simple stream of tokens.

> Please try not fix/break what is not broken.

So we're now switching Gentoo to EOL and just fixing bugs?

--
Best regards,
Michał Górny


All times are GMT. The time now is 12:30 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.