* [gentoo-commits] portage r13368 - in main/branches/prefix: man pym/portage pym/portage/dbapi
@ 2009-04-19 7:12 Fabian Groffen (grobian)
0 siblings, 0 replies; only message in thread
From: Fabian Groffen (grobian) @ 2009-04-19 7:12 UTC (permalink / raw
To: gentoo-commits
Author: grobian
Date: 2009-04-19 07:12:23 +0000 (Sun, 19 Apr 2009)
New Revision: 13368
Modified:
main/branches/prefix/man/portage.5
main/branches/prefix/pym/portage/__init__.py
main/branches/prefix/pym/portage/dbapi/porttree.py
main/branches/prefix/pym/portage/locks.py
main/branches/prefix/pym/portage/versions.py
Log:
Merged from trunk -r13350:13355
| 13351 | Fix typo from previous commit. |
| zmedico | |
| 13352 | Add support for repos.conf 'aliases' attribute which allows |
| zmedico | alias substitution in metadata/layout.conf repository |
| | references. |
| 13353 | Bug #266493 - Never return a long from vercmp() since that |
| zmedico | can trigger an OverflowError if it's returned by a __cmp__ |
| | implementation. Thanks to Douglas Anderson <dja@gendja.com> |
| | for the initial patch. I've modified it to use the (a > b) - |
| | (a < b) construct as suggested in the py3k docs, since cmp() |
| | is no longer supported in py3k. |
| 13354 | Simplify pkgcmp(). Thanks to Douglas Anderson |
| zmedico | <dja@gendja.com> for this patch from bug #266493. |
| 13355 | Fix lockfile() docstring to correctly document the |
| zmedico | wantnewlockfile behavior. Thanks to Arfrever for reporting. |
Modified: main/branches/prefix/man/portage.5
===================================================================
--- main/branches/prefix/man/portage.5 2009-04-19 07:05:16 UTC (rev 13367)
+++ main/branches/prefix/man/portage.5 2009-04-19 07:12:23 UTC (rev 13368)
@@ -554,23 +554,26 @@
such as \fBrepoman\fR(1) and \fBegencache\fR(1) since their operations
are inherently \fBnot\fR \fIsite\-specific\fR. \fBWARNING:\fR Use of
\fBrepos.conf\fR is generally not recommended since resulting changes in
-eclass inheritance (especially due ot \fBeclass\-overrides\fR) may trigger
+eclass inheritance (especially due to \fBeclass\-overrides\fR) may trigger
performance issues under some circumstances (see \fBbug #124041\fR).
.I Example:
.nf
+[DEFAULT]
# make all repositories inherit eclasses from the java\-overlay and
# java\-experimental repositories, with eclasses from java\-experimental
# taking precedence over those from java\-overlay
-[DEFAULT]
eclass\-overrides = java\-overlay java\-experimental
+[gentoo]
# disable all eclass overrides for ebuilds from the gentoo repository
-[gentoo]
eclass\-overrides =
+# when processing metadata/layout.conf from other repositories, substitute
+# 'gentoo' in place of references to repositories named 'foo' and 'bar'
+aliases = foo bar
+[kde-testing]
# override the metadata/layout.conf masters setting from the kde-testing repo
-[kde-testing]
masters = gentoo kde
.fi
.RE
Modified: main/branches/prefix/pym/portage/__init__.py
===================================================================
--- main/branches/prefix/pym/portage/__init__.py 2009-04-19 07:05:16 UTC (rev 13367)
+++ main/branches/prefix/pym/portage/__init__.py 2009-04-19 07:12:23 UTC (rev 13368)
@@ -1002,10 +1002,15 @@
return regex
class _local_repo_config(object):
- __slots__ = ('eclass_overrides', 'masters', 'name',)
+ __slots__ = ('aliases', 'eclass_overrides', 'masters', 'name',)
def __init__(self, name, repo_opts):
self.name = name
+ aliases = repo_opts.get('aliases')
+ if aliases is not None:
+ aliases = tuple(aliases.split())
+ self.aliases = aliases
+
eclass_overrides = repo_opts.get('eclass-overrides')
if eclass_overrides is not None:
eclass_overrides = tuple(eclass_overrides.split())
Modified: main/branches/prefix/pym/portage/dbapi/porttree.py
===================================================================
--- main/branches/prefix/pym/portage/dbapi/porttree.py 2009-04-19 07:05:16 UTC (rev 13367)
+++ main/branches/prefix/pym/portage/dbapi/porttree.py 2009-04-19 07:12:23 UTC (rev 13368)
@@ -200,8 +200,23 @@
eclass_dbs = {porttree_root : self.eclassdb}
local_repo_configs = self.mysettings._local_repo_configs
default_loc_repo_config = None
+ repo_aliases = {}
if local_repo_configs is not None:
default_loc_repo_config = local_repo_configs.get('DEFAULT')
+ for repo_name, loc_repo_conf in local_repo_configs.iteritems():
+ if loc_repo_conf.aliases is not None:
+ for alias in loc_repo_conf.aliases:
+ overridden_alias = repo_aliases.get(alias)
+ if overridden_alias is not None:
+ writemsg_level(("!!! Alias '%s' " + \
+ "created for '%s' overrides " + \
+ "'%s' alias in " + \
+ "'%s'\n") % (alias, repo_name,
+ overridden_alias,
+ self.mysettings._local_repo_conf_path),
+ level=logging.WARNING, noiselevel=-1)
+ repo_aliases[alias] = repo_name
+
for path in self.porttrees:
if path in self._repo_info:
continue
@@ -228,6 +243,7 @@
masters = layout_data.get('masters', '').split()
for master_name in masters:
+ master_name = repo_aliases.get(master_name, master_name)
master_path = self.treemap.get(master_name)
if master_path is None:
writemsg_level(("Unavailable repository '%s' " + \
Modified: main/branches/prefix/pym/portage/locks.py
===================================================================
--- main/branches/prefix/pym/portage/locks.py 2009-04-19 07:05:16 UTC (rev 13367)
+++ main/branches/prefix/pym/portage/locks.py 2009-04-19 07:12:23 UTC (rev 13368)
@@ -29,8 +29,10 @@
def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
waiting_msg=None, flags=0):
- """Creates all dirs upto, the given dir. Creates a lockfile
- for the given directory as the file: directoryname+'.portage_lockfile'."""
+ """
+ If wantnewlockfile is True then this creates a lockfile in the parent
+ directory as the file: '.' + basename + '.portage_lockfile'.
+ """
import fcntl
if not mypath:
Modified: main/branches/prefix/pym/portage/versions.py
===================================================================
--- main/branches/prefix/pym/portage/versions.py 2009-04-19 07:05:16 UTC (rev 13367)
+++ main/branches/prefix/pym/portage/versions.py 2009-04-19 07:12:23 UTC (rev 13368)
@@ -125,9 +125,12 @@
vercmp_cache[mykey] = 1
return 1
elif list1[i] != list2[i]:
- vercmp_cache[mykey] = list1[i] - list2[i]
- return list1[i] - list2[i]
-
+ a = list1[i]
+ b = list2[i]
+ rval = (a > b) - (a < b)
+ vercmp_cache[mykey] = rval
+ return rval
+
# main version is equal, so now compare the _suffix part
list1 = match1.group(6).split("_")[1:]
list2 = match2.group(6).split("_")[1:]
@@ -143,7 +146,11 @@
else:
s2 = suffix_regexp.match(list2[i]).groups()
if s1[0] != s2[0]:
- return suffix_value[s1[0]] - suffix_value[s2[0]]
+ a = suffix_value[s1[0]]
+ b = suffix_value[s2[0]]
+ rval = (a > b) - (a < b)
+ vercmp_cache[mykey] = rval
+ return rval
if s1[1] != s2[1]:
# it's possible that the s(1|2)[1] == ''
# in such a case, fudge it.
@@ -155,16 +162,18 @@
r2 = int(s2[1])
except ValueError:
r2 = 0
- if r1 - r2:
- return r1 - r2
-
- # the suffix part is equal to, so finally check the revision
+ rval = (r1 > r2) - (r1 < r2)
+ if rval:
+ vercmp_cache[mykey] = rval
+ return rval
+
+ # 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,
+ # bumps in ebuilds synced from the main tree for Prefix changes,
# while still staying in the main tree versioning scheme.
if match1.group(10):
if match1.group(10)[0] == '0' and '.' in match1.group(10):
@@ -189,8 +198,9 @@
if r1 == r2 and (r3 != 0 or r4 != 0):
r1 = r3
r2 = r4
- vercmp_cache[mykey] = r1 - r2
- return r1 - r2
+ rval = (r1 > r2) - (r1 < r2)
+ vercmp_cache[mykey] = rval
+ return rval
def pkgcmp(pkg1, pkg2):
"""
@@ -216,16 +226,8 @@
"""
if pkg1[0] != pkg2[0]:
return None
- mycmp = vercmp("-".join(pkg1[1:]), "-".join(pkg2[1:]))
- if mycmp is None:
- return mycmp
- if mycmp > 0:
- return 1
- if mycmp < 0:
- return -1
- return 0
+ return vercmp("-".join(pkg1[1:]), "-".join(pkg2[1:]))
-
pkgcache={}
def pkgsplit(mypkg,silent=1):
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-19 7:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-19 7:12 [gentoo-commits] portage r13368 - in main/branches/prefix: man pym/portage pym/portage/dbapi Fabian Groffen (grobian)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox