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

Replies