Gentoo Archives: gentoo-dev

From: konsolebox <konsolebox@×××××.com>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Request to add ~> atom prefix operator on Portage.
Date: Mon, 14 Sep 2015 04:35:29
Message-Id: CAJnmqwZ3LqWRO9zgodNpH7oY3=nVQnhwJEVc7bvXMOkxePsLxQ@mail.gmail.com
1 Many times we need to match packages like this: something-1.0.2a.*
2
3 But that expression is not allowed with ~ (only targets revisions) and
4 neither with * (.*) is invalid.
5
6 So my suggestion is to add ~> as another operator. With it we can
7 have an expression like '~>pkg-1.0.2a' and it would be equivalent to
8 '>=pkg-1.0.2a' and '<pkg-1.0.2b'. Another expression like
9 '~>pkg-1.0.2' would be equivalent to '>=pkg-1.0.2' and '<pkg-1.0.3'.
10
11 If comparing by arithmetic operations turns out to be difficult (i.e.
12 predicting the next version to compare against), then maybe we could
13 just compare it with pattern(s). For example if we have 'pkg-1.02a'
14 as the base version, then the valid versions we need to get are
15 'pkg-1.02a', 'pkg-1.02a.*' and
16 'pkg-1.02a(_(alpha|beta|pre|p)|-r)[0-9]+'.
17
18 The operator is copied from Ruby's Gemfile so it would be familiar to
19 anyone developing Ruby as well.

Replies