From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id D4840139694 for ; Fri, 24 Mar 2017 19:10:02 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2437F21C08B; Fri, 24 Mar 2017 19:09:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E9FB821C08B for ; Fri, 24 Mar 2017 19:09:55 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D430A33D3C7 for ; Fri, 24 Mar 2017 19:09:54 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F3FC773A4 for ; Fri, 24 Mar 2017 19:09:51 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1490382574.65b336275435fabceacd8829e042eb8b745ecf4f.grobian@gentoo> Subject: [gentoo-commits] proj/portage:prefix commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/vartree.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 65b336275435fabceacd8829e042eb8b745ecf4f X-VCS-Branch: prefix Date: Fri, 24 Mar 2017 19:09:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: a728ea2f-923f-4949-8578-e3955c87cf4f X-Archives-Hash: c6bdc54af56103cfa079d87e1064c38d commit: 65b336275435fabceacd8829e042eb8b745ecf4f Author: Fabian Groffen gentoo org> AuthorDate: Fri Mar 24 19:09:34 2017 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Fri Mar 24 19:09:34 2017 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=65b33627 vartree: simplify case-insensitivity matching a bit pym/portage/dbapi/vartree.py | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 9df69860f..232697f72 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2944,24 +2944,21 @@ class dblink(object): os_filename_arg.path.join(destroot, filename.lstrip(os_filename_arg.path.sep))) - pkgfiles = self.getcontents() - + dstfile = destfile + pkgfiles = dict((k, k) for k in 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) + dstfile = destfile.lower() pkgfiles = dict((k.lower(), v) for k, v in pkgfiles.items()) - if pkgfiles and destfile in pkgfiles: - if preserve_case is not None: - return self._contents.contains(preserve_case[destfile]) + if dstfile in pkgfiles: return self._contents.unmap_key(destfile) if pkgfiles: - basename = os_filename_arg.path.basename(destfile) + basename = os_filename_arg.path.basename(dstfile) if self._contents_basenames is None: try: - for x in pkgfiles: + for _, x in pkgfiles.items(): _unicode_encode(x, encoding=_encodings['merge'], errors='strict') @@ -2970,7 +2967,7 @@ class dblink(object): # different value of sys.getfilesystemencoding(), # so fall back to utf_8 if appropriate. try: - for x in pkgfiles: + for _, x in pkgfiles.items(): _unicode_encode(x, encoding=_encodings['fs'], errors='strict') @@ -3001,7 +2998,7 @@ class dblink(object): if os is _os_merge: try: - for x in pkgfiles: + for _, x in pkgfiles.items(): _unicode_encode(x, encoding=_encodings['merge'], errors='strict') @@ -3010,7 +3007,7 @@ class dblink(object): # different value of sys.getfilesystemencoding(), # so fall back to utf_8 if appropriate. try: - for x in pkgfiles: + for _, x in pkgfiles.items(): _unicode_encode(x, encoding=_encodings['fs'], errors='strict') @@ -3021,13 +3018,13 @@ class dblink(object): self._contents_inodes = {} parent_paths = set() - for x in pkgfiles: + for x, r in pkgfiles.items(): p_path = os.path.dirname(x) if p_path in parent_paths: continue parent_paths.add(p_path) try: - s = os.stat(p_path) + s = os.stat(os.path.dirname(r)) except OSError: pass else: @@ -3047,9 +3044,7 @@ 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 self._contents.unmap_key(preserve_case[x]) - return self._contents.unmap_key(x) + return self._contents.unmap_key(pkgfiles[x]) return False