public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:prefix commit in: pym/portage/
Date: Fri, 18 May 2018 19:46:09 +0000 (UTC)	[thread overview]
Message-ID: <1526672430.38cc817c5cecee61407ce78165c7eaebc1634664.grobian@gentoo> (raw)

commit:     38cc817c5cecee61407ce78165c7eaebc1634664
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri May 18 19:40:30 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri May 18 19:40:30 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=38cc817c

versions: change inter-revisions not to require a leading 0

There is need by some for being able to version ebuilds shadowed from
the main tree, so we drop the special flagging from this feature to make
it more general consumptive.

 pym/portage/versions.py | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/pym/portage/versions.py b/pym/portage/versions.py
index 7f75d1cc9..0b1d50e7c 100644
--- a/pym/portage/versions.py
+++ b/pym/portage/versions.py
@@ -51,8 +51,8 @@ _pkg = {
 }
 
 _v = r'(\d+)((\.\d+)*)([a-z]?)((_(pre|p|beta|alpha|rc)\d*)*)'
-# PREFIX_LOCAL hack: -r(\d+) -> -r(\d+|0\d+\.\d+) (see below)
-_rev = r'(\d+|0\d+\.\d+)'
+# PREFIX_LOCAL hack: -r(\d+) -> -r(\d+|\d+\.\d+) (see below)
+_rev = r'(\d+|\d+\.\d+)'
 # END_PREFIX_LOCAL
 _vr = _v + '(-r(' + _rev + '))?'
 
@@ -254,16 +254,22 @@ def vercmp(ver1, ver2, silent=1):
 
 	# PREFIX_LOCAL
 	# The suffix part is equal too, so finally check the revision
-	# Prefix hack: a revision starting with 0 is an 'inter-revision',
-	# which means that it is possible to create revisions on revisions.
-	# An example is -r01.1 which is the first revision of -r1.  Note
-	# that a period (.) is used to separate the real revision and the
-	# secondary revision number.  This trick is in use to allow revision
-	# bumps in ebuilds synced from the main tree for Prefix changes,
-	# while still staying in the main tree versioning scheme.
+	# Prefix hack: historically a revision starting with 0 was an
+	# 'inter-revision', which means that it is possible to create
+	# revisions on revisions.  An example is -r01.1 which is the
+	# first revision of -r1.  Note that a period (.) is used to
+	# separate the real revision and the secondary revision number.
+	# In the current state, the leading 0 is no longer used, and
+	# versions just can have a dot, which means the version is an
+	# inter-revision.
+	# This trick is in use to allow revision bumps in ebuilds synced
+	# from the main tree for Prefix changes, while still staying in
+	# the main tree versioning scheme.  As such it can be used in
+	# any other overlay where ebuilds from the another tree are
+	# shadowed.
 	if match1.group(9):
-		if match1.group(9)[0] == '0' and '.' in match1.group(9):
-			t = match1.group(9)[1:].split(".")
+		if '.' in match1.group(9):
+			t = match1.group(9).split(".")
 			r1 = int(t[0])
 			r3 = int(t[1])
 		else:
@@ -273,8 +279,8 @@ def vercmp(ver1, ver2, silent=1):
 		r1 = 0
 		r3 = 0
 	if match2.group(9):
-		if match2.group(9)[0] == '0' and '.' in match2.group(9):
-			t = match2.group(9)[1:].split(".")
+		if '.' in match2.group(9):
+			t = match2.group(9).split(".")
 			r2 = int(t[0])
 			r4 = int(t[1])
 		else:


             reply	other threads:[~2018-05-18 19:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-18 19:46 Fabian Groffen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-12-12  8:13 [gentoo-commits] proj/portage:prefix commit in: pym/portage/ Fabian Groffen
2013-01-27 21:51 Fabian Groffen
2012-10-02 11:59 Fabian Groffen
2012-09-30 11:10 Fabian Groffen
2012-09-30 11:10 Fabian Groffen
2012-03-01 20:32 Fabian Groffen
2012-01-18  7:58 Fabian Groffen
2011-12-14 15:29 Fabian Groffen
2011-12-10 12:55 Fabian Groffen
2011-12-10 12:12 Fabian Groffen
2011-12-10 12:06 Fabian Groffen
2011-12-09 20:39 Fabian Groffen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1526672430.38cc817c5cecee61407ce78165c7eaebc1634664.grobian@gentoo \
    --to=grobian@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox