Calculate path to package.mask file only once per profile.
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Gentoo.Org>
Sat, 6 Nov 2010 21:24:12 +0000 (22:24 +0100)
committerZac Medico <zmedico@gentoo.org>
Wed, 24 Nov 2010 01:57:34 +0000 (17:57 -0800)
pym/portage/package/ebuild/getmaskingreason.py

index 83757b798b805001be83d05953c8f1ed03501a35..c0746d0f2dca04bf46247fc21c63f66a6f7e48ee 100644 (file)
@@ -44,7 +44,10 @@ def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_lo
        locations.append(os.path.join(settings["PORTAGE_CONFIGROOT"],
                USER_CONFIG_PATH))
        locations.reverse()
-       pmasklists = [(x, grablines(os.path.join(x, "package.mask"), recursive=1)) for x in locations]
+       pmasklists = []
+       for profile in locations:
+               pmask_filename = os.path.join(profile, "package.mask")
+               pmasklists.append((pmask_filename, grablines(pmask_filename, recursive=1)))
 
        pmaskdict = settings._mask_manager._pmaskdict
        if mycp in pmaskdict:
@@ -54,7 +57,7 @@ def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_lo
                                for pmask in pmasklists:
                                        comment = ""
                                        comment_valid = -1
-                                       pmask_filename = os.path.join(pmask[0], "package.mask")
+                                       pmask_filename = pmask[0]
                                        for i in range(len(pmask[1])):
                                                l = pmask[1][i].strip()
                                                try:
@@ -76,7 +79,7 @@ def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_lo
                                                        else:
                                                                return comment
                                                elif comment_valid != -1:
-                                                       # Apparently this comment applies to muliple masks, so
+                                                       # Apparently this comment applies to multiple masks, so
                                                        # it remains valid until a blank line is encountered.
                                                        comment_valid += 1
        if return_location: