Gentoo Archives: gentoo-portage-dev

From: Pavel Kazakov <nullishzero@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Pavel Kazakov <nullishzero@g.o>
Subject: [gentoo-portage-dev] [PATCH 1/3] Move -MERGING- string to a constant variable.
Date: Thu, 13 Mar 2014 06:13:21
Message-Id: 1394691047-14156-1-git-send-email-nullishzero@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2] Add an emaint module that can scan for failed merges and that can fix failed merges. by Pavel Kazakov
1 ---
2 pym/portage/const.py | 1 +
3 pym/portage/dbapi/__init__.py | 4 +++-
4 pym/portage/dbapi/vartree.py | 8 ++++----
5 3 files changed, 8 insertions(+), 5 deletions(-)
6
7 diff --git a/pym/portage/const.py b/pym/portage/const.py
8 index 1785bff..fad69ef 100644
9 --- a/pym/portage/const.py
10 +++ b/pym/portage/const.py
11 @@ -74,6 +74,7 @@ MOVE_BINARY = "/bin/mv"
12 PRELINK_BINARY = "/usr/sbin/prelink"
13
14 INVALID_ENV_FILE = "/etc/spork/is/not/valid/profile.env"
15 +MERGING_IDENTIFIER = "-MERGING-"
16 REPO_NAME_FILE = "repo_name"
17 REPO_NAME_LOC = "profiles" + "/" + REPO_NAME_FILE
18
19 diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
20 index a20a1e8..6638352 100644
21 --- a/pym/portage/dbapi/__init__.py
22 +++ b/pym/portage/dbapi/__init__.py
23 @@ -16,6 +16,8 @@ portage.proxy.lazyimport.lazyimport(globals(),
24 'portage.versions:catsplit,catpkgsplit,vercmp,_pkg_str',
25 )
26
27 +from portage.const import MERGING_IDENTIFIER
28 +
29 from portage import os
30 from portage import auxdbkeys
31 from portage.eapi import _get_eapi_attrs
32 @@ -278,7 +280,7 @@ class dbapi(object):
33 return True
34
35 def invalidentry(self, mypath):
36 - if '/-MERGING-' in mypath:
37 + if MERGING_IDENTIFIER in mypath:
38 if os.path.exists(mypath):
39 writemsg(colorize("BAD", _("INCOMPLETE MERGE:"))+" %s\n" % mypath,
40 noiselevel=-1)
41 diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
42 index 6417a56..5f5f5ce 100644
43 --- a/pym/portage/dbapi/vartree.py
44 +++ b/pym/portage/dbapi/vartree.py
45 @@ -45,7 +45,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
46 )
47
48 from portage.const import CACHE_PATH, CONFIG_MEMORY_FILE, \
49 - PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH
50 + MERGING_IDENTIFIER, PORTAGE_PACKAGE_ATOM, PRIVATE_PATH, VDB_PATH
51 from portage.dbapi import dbapi
52 from portage.exception import CommandNotFound, \
53 InvalidData, InvalidLocation, InvalidPackageName, \
54 @@ -104,7 +104,7 @@ class vardbapi(dbapi):
55
56 _excluded_dirs = ["CVS", "lost+found"]
57 _excluded_dirs = [re.escape(x) for x in _excluded_dirs]
58 - _excluded_dirs = re.compile(r'^(\..*|-MERGING-.*|' + \
59 + _excluded_dirs = re.compile(r'^(\..*|' + MERGING_IDENTIFIER + '.*|' + \
60 "|".join(_excluded_dirs) + r')$')
61
62 _aux_cache_version = "1"
63 @@ -446,7 +446,7 @@ class vardbapi(dbapi):
64 if self._excluded_dirs.match(y) is not None:
65 continue
66 subpath = x + "/" + y
67 - # -MERGING- should never be a cpv, nor should files.
68 + # MERGING_IDENTIFIER should never be a cpv, nor should files.
69 try:
70 if catpkgsplit(subpath) is None:
71 self.invalidentry(self.getpath(subpath))
72 @@ -1504,7 +1504,7 @@ class dblink(object):
73 self.dbroot = normalize_path(os.path.join(self._eroot, VDB_PATH))
74 self.dbcatdir = self.dbroot+"/"+cat
75 self.dbpkgdir = self.dbcatdir+"/"+pkg
76 - self.dbtmpdir = self.dbcatdir+"/-MERGING-"+pkg
77 + self.dbtmpdir = self.dbcatdir+MERGING_IDENTIFIER+pkg
78 self.dbdir = self.dbpkgdir
79 self.settings = mysettings
80 self._verbose = self.settings.get("PORTAGE_VERBOSE") == "1"
81 --
82 1.8.3.2

Replies