Add profile-formats to profile_complex

(cherry picked from commit 1d351a59a57e018e9c79a371f0cae21505c2249c)

Change-Id: If95b8f571e5f7e4dde876a8286460401d761ad2f
Reviewed-on: https://chromium-review.googlesource.com/225512
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Bertrand Simonnet <bsimonnet@chromium.org>
diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py
index 4427f1d..8bf321c 100644
--- a/pym/portage/package/ebuild/_config/LocationsManager.py
+++ b/pym/portage/package/ebuild/_config/LocationsManager.py
@@ -31,7 +31,7 @@
 	'use.mask', 'use.force'])
 
 _profile_node = collections.namedtuple('_profile_node',
-	'location portage1_directories user_config')
+	'location portage1_directories user_config profile_formats')
 
 _allow_parent_colon = frozenset(
 	["portage-2"])
@@ -132,7 +132,7 @@
 				self.user_profile_dir = custom_prof
 				self.profiles.append(custom_prof)
 				self.profiles_complex.append(
-					_profile_node(custom_prof, True, True))
+					_profile_node(custom_prof, True, True, ()))
 			del custom_prof
 
 		self.profiles = tuple(self.profiles)
@@ -151,6 +151,7 @@
 		allow_parent_colon = True
 		repo_loc = None
 		compat_mode = False
+		current_formats = ()
 
 		eapi_file = os.path.join(currentPath, "eapi")
 		eapi = "0"
@@ -183,6 +184,8 @@
 				layout_data['profile-formats'] == ('portage-1-compat',)
 			allow_parent_colon = any(x in _allow_parent_colon
 				for x in layout_data['profile-formats'])
+			current_formats = tuple(layout_data['profile-formats'])
+
 
 		if compat_mode:
 			offenders = _PORTAGE1_DIRECTORIES.intersection(os.listdir(currentPath))
@@ -233,7 +236,8 @@
 
 		self.profiles.append(currentPath)
 		self.profiles_complex.append(
-			_profile_node(currentPath, allow_directories, False))
+			_profile_node(currentPath, allow_directories, False,
+				current_formats))
 
 	def _expand_parent_colon(self, parentsFile, parentPath,
 		repo_loc, repositories):