@@ -, +, @@ --- man/make.conf.5 | 4 ++++ pym/portage/const.py | 1 + pym/portage/dbapi/vartree.py | 28 ++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) --- a/man/make.conf.5 +++ a/man/make.conf.5 @@ -265,6 +265,10 @@ Build binary packages for just packages in the system set. Enable a special progress indicator when \fBemerge\fR(1) is calculating dependencies. .TP +.B case\-insensitive\-fs +Use case\-insensitive file name comparisions when merging and unmerging +files. +.TP .B ccache Enable portage support for the ccache package. If the ccache dir is not present in the user's environment, then portage will default to --- a/pym/portage/const.py +++ a/pym/portage/const.py @@ -125,6 +125,7 @@ SUPPORTED_FEATURES = frozenset([ "buildpkg", "buildsyspkg", "candy", + "case-insensitive-fs", "ccache", "cgroup", "chflags", --- a/pym/portage/dbapi/vartree.py +++ a/pym/portage/dbapi/vartree.py @@ -1052,6 +1052,11 @@ class vardbapi(dbapi): def add(self, cpv): eroot_len = len(self._vardb._eroot) contents = self._vardb._dblink(cpv).getcontents() + + if "case-insensitive-fs" in self._vardb.settings.features: + contents = dict((k.lower(), v) + for k, v in contents.items()) + pkg_hash = self._hash_pkg(cpv) if not contents: # Empty path is a code used to represent empty contents. @@ -1189,6 +1194,8 @@ class vardbapi(dbapi): hash_pkg = owners_cache._hash_pkg hash_str = owners_cache._hash_str base_names = self._vardb._aux_cache["owners"]["base_names"] + case_insensitive = "case-insensitive-fs" \ + in vardb.settings.features dblink_cache = {} @@ -1205,6 +1212,8 @@ class vardbapi(dbapi): while path_iter: path = path_iter.pop() + if case_insensitive: + path = path.lower() is_basename = os.sep != path[:1] if is_basename: name = path @@ -1236,6 +1245,8 @@ class vardbapi(dbapi): if is_basename: for p in dblink(cpv).getcontents(): + if case_insensitive: + p = p.lower() if os.path.basename(p) == name: owners.append((cpv, p[len(root):])) else: @@ -1265,8 +1276,12 @@ class vardbapi(dbapi): if not path_list: return + case_insensitive = "case-insensitive-fs" \ + in self._vardb.settings.features path_info_list = [] for path in path_list: + if case_insensitive: + path = path.lower() is_basename = os.sep != path[:1] if is_basename: name = path @@ -1285,6 +1300,8 @@ class vardbapi(dbapi): for path, name, is_basename in path_info_list: if is_basename: for p in dblnk.getcontents(): + if case_insensitive: + p = p.lower() if os.path.basename(p) == name: search_pkg.results.append((dblnk, p[len(root):])) else: @@ -2762,7 +2779,16 @@ class dblink(object): filename.lstrip(os_filename_arg.path.sep))) pkgfiles = self.getcontents() + + preserve_case = None + if "case-insensitive-fs" in self.settings.features: + destfile = destfile.lower() + preserve_case = dict((k.lower(), k) for k in pkgfiles) + pkgfiles = dict((k.lower(), v) for k, v in pkgfiles.items()) + if pkgfiles and destfile in pkgfiles: + if preserve_case is not None: + return preserve_case[destfile] return destfile if pkgfiles: basename = os_filename_arg.path.basename(destfile) @@ -2855,6 +2881,8 @@ class dblink(object): for p_path in p_path_list: x = os_filename_arg.path.join(p_path, basename) if x in pkgfiles: + if preserve_case is not None: + return preserve_case[x] return x return False --