aboutsummaryrefslogtreecommitdiff
blob: 16b8dac5f3c72396f017b8b6db5ba6b750ca414e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- coding:utf-8 -*-


def _gen_arches(ebuild, options, repo_settings, profiles):
	'''Determines the arches for the ebuild following the profile rules

	@param ebuild: Ebuild which we check (object).
	@param profiles: dictionary
	@param options: cli options
	@param repo_settings: repository settings instance
	@returns: dictionary, including arches set
	'''
	if options.ignore_arches:
		arches = [[
			repo_settings.repoman_settings["ARCH"], repo_settings.repoman_settings["ARCH"],
			repo_settings.repoman_settings["ACCEPT_KEYWORDS"].split()]]
	else:
		arches = set()
		for keyword in ebuild.keywords:
			if keyword[0] == "-":
				continue
			elif keyword[0] == "~":
				arch = keyword[1:]
				if arch == "*":
					for expanded_arch in profiles:
						if expanded_arch == "**":
							continue
						arches.add(
							(keyword, expanded_arch, (
								expanded_arch, "~" + expanded_arch)))
				else:
					arches.add((keyword, arch, (arch, keyword)))
			else:
				# For ebuilds with stable keywords, check if the
				# dependencies are satisfiable for unstable
				# configurations, since use.stable.mask is not
				# applied for unstable configurations (see bug
				# 563546).
				if keyword == "*":
					for expanded_arch in profiles:
						if expanded_arch == "**":
							continue
						arches.add(
							(keyword, expanded_arch, (expanded_arch,)))
						arches.add(
						(keyword, expanded_arch,
							(expanded_arch, "~" + expanded_arch)))
				else:
					arches.add((keyword, keyword, (keyword,)))
					arches.add((keyword, keyword,
						(keyword, "~" + keyword)))
		if not arches:
			# Use an empty profile for checking dependencies of
			# packages that have empty KEYWORDS.
			arches.add(('**', '**', ('**',)))

	return arches