Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 17367 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/bin/emerge (-9 / +80 lines)
Lines 863-869 Link Here
863
		if "--usepkg" in myopts:
863
		if "--usepkg" in myopts:
864
			portage.db["/"]["bintree"].populate(("--getbinpkg" in myopts), ("--getbinpkgonly" in myopts))
864
			portage.db["/"]["bintree"].populate(("--getbinpkg" in myopts), ("--getbinpkgonly" in myopts))
865
865
866
	def create(self,mybigkey,myparent=None,addme=1,myuse=None):
866
	def create(self,mybigkey,myparent=None,addme=1,myuse=None,mylicenses=None):
867
		"""creates the actual digraph of packages to merge.  return 1 on success, 0 on failure
867
		"""creates the actual digraph of packages to merge.  return 1 on success, 0 on failure
868
		mybigkey = specification of package to merge; myparent = parent package (one depending on me);
868
		mybigkey = specification of package to merge; myparent = parent package (one depending on me);
869
		addme = should I be added to the tree? (for the --onlydeps mode)"""
869
		addme = should I be added to the tree? (for the --onlydeps mode)"""
Lines 873-878 Link Here
873
		#"no downgrade" emerge
873
		#"no downgrade" emerge
874
		#print "mybigkey:",mybigkey
874
		#print "mybigkey:",mybigkey
875
		
875
		
876
		# get ACCEPT_LICENSES from if haven't done so already
877
		# does this code only include make.conf??
878
		# this gets done multiple times - need to fix
879
		if mylicenses == None:
880
			accept_licenses = string.split(portage.settings['ACCEPT_LICENSE'])
881
			mylicenses = []
882
			for x in accept_licenses:
883
				if x == "*":
884
					for y in [portage.settings['PORTDIR']+"/licenses", portage.settings["PORTDIR_OVERLAY"]+"/licenses"]:
885
						if os.access(y,os.F_OK):
886
							for z in os.listdir(y):
887
								if z not in mylicenses:
888
									mylicenses.append(z)
889
				if x == "-*":
890
					mylicenses = []
891
					continue
892
				if x[0] != "+" and x[0] != "-":
893
					add = x
894
					rem = x
895
				elif x[0] == "+":
896
					rem = x[1:]
897
					add = x[1:]
898
				else:
899
					rem = x[1:]
900
					add = ""
901
				while rem in mylicenses:
902
					mylicenses.remove(rem)
903
				if add != "":
904
					mylicenses.append(add)
905
		
876
		jbigkey=string.join(mybigkey)
906
		jbigkey=string.join(mybigkey)
877
		if self.digraph.hasnode(jbigkey+" merge") or self.digraph.hasnode(jbigkey+" nomerge"):
907
		if self.digraph.hasnode(jbigkey+" merge") or self.digraph.hasnode(jbigkey+" nomerge"):
878
			#this conditional is needed to prevent infinite recursion on already-processed deps
908
			#this conditional is needed to prevent infinite recursion on already-processed deps
Lines 923-928 Link Here
923
		else:
953
		else:
924
			#onlydeps mode; don't merge
954
			#onlydeps mode; don't merge
925
			merging=2
955
			merging=2
956
			
957
		pkg_licenses = portage.portdb.aux_get(mybigkey[2], ["LICENSE"])[0]
958
		# the assumption here is that | means OR and that AND takes precedence
959
		# i.e. "(foo bar) | license" would be "foo bar | license"
960
		# parenthesis should not be necessary unless
961
		# there is a need for "(foo1 | foo2)  (bar1 | bar2)"
962
		for license_group in string.split(pkg_licenses,"|"):
963
			license_accepted = 1
964
			for license in string.split(license_group):
965
				if license not in mylicenses:
966
					license_accepted = 0
967
					break
968
			if license_accepted == 1:
969
				break
970
		# if license is missing, do the same as for blockers
971
		if license_accepted == 0:
972
			mybigkey[0]="license"
973
			mybigkey.append(string.replace(pkg_licenses, "|", "OR"))
974
			
926
		if merging==1:
975
		if merging==1:
927
			mybigkey.append("merge")
976
			mybigkey.append("merge")
928
		else:
977
		else:
Lines 931-936 Link Here
931
		# whatever the case, we need to add the node to our digraph so
980
		# whatever the case, we need to add the node to our digraph so
932
		# that children can depend upon it.
981
		# that children can depend upon it.
933
		self.digraph.addnode(string.join(mybigkey),myparent)
982
		self.digraph.addnode(string.join(mybigkey),myparent)
983
		
984
		# return here else get into an infinite loop
985
		# when using --deep or --emptytree
986
		if (mybigkey[0]=="license"):
987
			return 1
988
			
934
		if ("deep" not in myparams) and (not merging):
989
		if ("deep" not in myparams) and (not merging):
935
			return 1
990
			return 1
936
		elif "recurse" not in myparams:
991
		elif "recurse" not in myparams:
Lines 972-991 Link Here
972
1027
973
		if myroot=="/":
1028
		if myroot=="/":
974
			mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"]
1029
			mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"]
975
			if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse):
1030
			if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse,mylicenses=mylicenses):
976
				return 0
1031
				return 0
977
		else:
1032
		else:
978
			mydep["/"]=edepend["DEPEND"]
1033
			mydep["/"]=edepend["DEPEND"]
979
			mydep[myroot]=edepend["RDEPEND"]
1034
			mydep[myroot]=edepend["RDEPEND"]
980
			if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse):
1035
			if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse,mylicenses=mylicenses):
981
				return 0
1036
				return 0
982
			if not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse):
1037
			if not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse,mylicenses=mylicenses):
983
				return 0
1038
				return 0
984
1039
985
		if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
1040
		if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
986
			# Post Depend -- Add to the list without a parent, as it depends
1041
			# Post Depend -- Add to the list without a parent, as it depends
987
			# on a package being present AND must be built after that package.
1042
			# on a package being present AND must be built after that package.
988
			if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse):
1043
			if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse,mylicenses=mylicenses):
989
				return 0
1044
				return 0
990
			
1045
			
991
		return 1
1046
		return 1
Lines 1100-1106 Link Here
1100
					if curslot == myslot:
1155
					if curslot == myslot:
1101
						return match
1156
						return match
1102
1157
1103
	def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None):
1158
	def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,mylicenses=None):
1104
		"given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure"
1159
		"given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure"
1105
		if "--debug" in myopts:
1160
		if "--debug" in myopts:
1106
			print
1161
			print
Lines 1258-1269 Link Here
1258
				#	myk=["ebuild",myroot,myeb]
1313
				#	myk=["ebuild",myroot,myeb]
1259
			if myparent:
1314
			if myparent:
1260
				#we are a dependency, so we want to be unconditionally added
1315
				#we are a dependency, so we want to be unconditionally added
1261
				if not self.create(myk,myparent,myuse=binpkguseflags):
1316
				if not self.create(myk,myparent,myuse=binpkguseflags,mylicenses=mylicenses):
1262
					return 0
1317
					return 0
1263
			else:
1318
			else:
1264
				#if mysource is not set, then we are a command-line dependency and should not be added
1319
				#if mysource is not set, then we are a command-line dependency and should not be added
1265
				#if --onlydeps is specified.
1320
				#if --onlydeps is specified.
1266
				if not self.create(myk,myparent,"--onlydeps" not in myopts,myuse=binpkguseflags):
1321
				if not self.create(myk,myparent,"--onlydeps" not in myopts,myuse=binpkguseflags,mylicenses=mylicenses):
1267
					return 0
1322
					return 0
1268
1323
1269
		if "--debug" in myopts:
1324
		if "--debug" in myopts:
Lines 1448-1453 Link Here
1448
						print red("(is blocking "+x[3]+")")
1503
						print red("(is blocking "+x[3]+")")
1449
					else:
1504
					else:
1450
						print
1505
						print
1506
			elif x[0]=="license":
1507
				# As "license" is 7 characters, didn't include a symbolic letter
1508
				addl="  "+fetch+"  "
1509
				resolved=portage.db[x[1]]["vartree"].resolve_key(x[2])
1510
				# Is it just me or is there too much red?
1511
				print "["+red(x[0]+" "+addl)+"]",red(resolved),
1512
				print red("("+x[3]+")")
1451
			else:
1513
			else:
1452
				if (x[0]!="binary") and ("fetch" in string.split(portage.portdb.aux_get(x[2],["RESTRICT"])[0])):
1514
				if (x[0]!="binary") and ("fetch" in string.split(portage.portdb.aux_get(x[2],["RESTRICT"])[0])):
1453
					fetch = red("F")
1515
					fetch = red("F")
Lines 1721-1726 Link Here
1721
					print
1783
					print
1722
					if ("--pretend" not in myopts):
1784
					if ("--pretend" not in myopts):
1723
						sys.exit(1)
1785
						sys.exit(1)
1786
					
1787
				if x[0]=="license":
1788
					print "\n!!! Error: License(s) required by " + x[2]
1789
					print   "!!!        Please ensure that ACCEPT_LICENSE contains:"
1790
					print   "!!!        " +x[3]
1791
					# Is this necessary? When I emerge with --pretend, it never gets here.
1792
					if ("--pretend" not in myopts):
1793
						sys.exit(1)
1794
1724
1795
1725
		#buildsyspkg: I need mysysdict also on resume (moved from the else block)
1796
		#buildsyspkg: I need mysysdict also on resume (moved from the else block)
1726
		mysysdict=genericdict(syslist)
1797
		mysysdict=genericdict(syslist)
Lines 2760-2766 Link Here
2760
		myvars = ['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK',
2831
		myvars = ['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK',
2761
		          'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR',
2832
		          'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR',
2762
		          'PORTDIR_OVERLAY', 'USE', 'CHOST', 'CFLAGS', 'CXXFLAGS',
2833
		          'PORTDIR_OVERLAY', 'USE', 'CHOST', 'CFLAGS', 'CXXFLAGS',
2763
		          'ACCEPT_KEYWORDS', 'SYNC', 'FEATURES']
2834
		          'ACCEPT_KEYWORDS', 'SYNC', 'FEATURES','ACCEPT_LICENSE']
2764
2835
2765
		myvars.extend(portage_util.grabfile(portage.settings["PORTDIR"]+"/profiles/info_vars"))
2836
		myvars.extend(portage_util.grabfile(portage.settings["PORTDIR"]+"/profiles/info_vars"))
2766
2837

Return to bug 17367