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 / +72 lines)
Lines 627-633 Link Here
627
				sys.stderr.write(red("!!! Failed to get all metadata: "+str(e)+"\n"))
627
				sys.stderr.write(red("!!! Failed to get all metadata: "+str(e)+"\n"))
628
				sys.exit(1)
628
				sys.exit(1)
629
629
630
	def create(self,mybigkey,myparent=None,addme=1,myuse=None):
630
	def create(self,mybigkey,myparent=None,addme=1,myuse=None,mylicenses=None):
631
		"""creates the actual digraph of packages to merge.  return 1 on success, 0 on failure
631
		"""creates the actual digraph of packages to merge.  return 1 on success, 0 on failure
632
		mybigkey = specification of package to merge; myparent = parent package (one depending on me);
632
		mybigkey = specification of package to merge; myparent = parent package (one depending on me);
633
		addme = should I be added to the tree? (for the --onlydeps mode)"""
633
		addme = should I be added to the tree? (for the --onlydeps mode)"""
Lines 637-642 Link Here
637
		#"no downgrade" emerge
637
		#"no downgrade" emerge
638
		#print "mybigkey:",mybigkey
638
		#print "mybigkey:",mybigkey
639
		
639
		
640
		# get ACCEPT_LICENSES from if haven't done so already
641
		# does this code only include make.conf??
642
		if mylicenses == None:
643
			accept_licenses = string.split(portage.settings['ACCEPT_LICENSES'])
644
			mylicenses = []
645
			for x in accept_licenses:
646
				if x == "-*":
647
					mylicenses = []
648
					continue
649
				if x[0] != "+" and x[0] != "-":
650
					add = x
651
					rem = x
652
				elif x[0] == "+":
653
					rem = x[1:]
654
					add = x[1:]
655
				else:
656
					rem = x[1:]
657
					add = ""
658
				while rem in mylicenses:
659
					mylicenses.remove(rem)
660
				if add != "":
661
					mylicenses.append(add)
662
		
640
		jbigkey=string.join(mybigkey)
663
		jbigkey=string.join(mybigkey)
641
		if self.digraph.hasnode(jbigkey+" merge") or self.digraph.hasnode(jbigkey+" nomerge"):
664
		if self.digraph.hasnode(jbigkey+" merge") or self.digraph.hasnode(jbigkey+" nomerge"):
642
			#this conditional is needed to prevent infinite recursion on already-processed deps
665
			#this conditional is needed to prevent infinite recursion on already-processed deps
Lines 687-692 Link Here
687
		else:
710
		else:
688
			#onlydeps mode; don't merge
711
			#onlydeps mode; don't merge
689
			merging=2
712
			merging=2
713
			
714
		pkg_licenses = portage.portdb.aux_get(mybigkey[2], ["LICENSE"])[0]
715
		# the assumption here is that | means OR and that AND takes precedence
716
		# i.e. "(foo bar) | license" would be "foo bar | license"
717
		# parenthesis should not be necessary unless
718
		# there is a need for "(foo1 | foo2)  (bar1 | bar2)"
719
		for license_group in string.split(pkg_licenses,"|"):
720
			license_accepted = 1
721
			for license in string.split(license_group):
722
				if license not in mylicenses:
723
					license_accepted = 0
724
					break
725
			if license_accepted == 1:
726
				break
727
		# if license is missing, do the same as for blockers
728
		if license_accepted == 0:
729
			mybigkey[0]="license"
730
			mybigkey.append(string.replace(pkg_licenses, "|", "OR"))
731
			
690
		if merging==1:
732
		if merging==1:
691
			mybigkey.append("merge")
733
			mybigkey.append("merge")
692
		else:
734
		else:
Lines 695-700 Link Here
695
		# whatever the case, we need to add the node to our digraph so
737
		# whatever the case, we need to add the node to our digraph so
696
		# that children can depend upon it.
738
		# that children can depend upon it.
697
		self.digraph.addnode(string.join(mybigkey),myparent)
739
		self.digraph.addnode(string.join(mybigkey),myparent)
740
		
741
		# return here else trouble occurs ;-)
742
		if (mybigkey[0]=="license"):
743
			return 1
744
			
698
		if ("deep" not in myparams) and (not merging):
745
		if ("deep" not in myparams) and (not merging):
699
			return 1
746
			return 1
700
		elif "recurse" not in myparams:
747
		elif "recurse" not in myparams:
Lines 744-763 Link Here
744
791
745
		if myroot=="/":
792
		if myroot=="/":
746
			mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"]
793
			mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"]
747
			if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse):
794
			if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse,mylicenses=mylicenses):
748
				return 0
795
				return 0
749
		else:
796
		else:
750
			mydep["/"]=edepend["DEPEND"]
797
			mydep["/"]=edepend["DEPEND"]
751
			mydep[myroot]=edepend["RDEPEND"]
798
			mydep[myroot]=edepend["RDEPEND"]
752
			if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse):
799
			if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse,mylicenses=mylicenses):
753
				return 0
800
				return 0
754
			elif not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse):
801
			elif not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse,mylicenses=mylicenses):
755
				return 0
802
				return 0
756
803
757
		if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
804
		if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
758
			# Post Depend -- Add to the list without a parent, as it depends
805
			# Post Depend -- Add to the list without a parent, as it depends
759
			# on a package being present AND must be built after that package.
806
			# on a package being present AND must be built after that package.
760
			if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse):
807
			if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse,mylicenses=mylicenses):
761
				return 0
808
				return 0
762
			
809
			
763
		return 1
810
		return 1
Lines 835-841 Link Here
835
				break
882
				break
836
			alleb.remove(cand)
883
			alleb.remove(cand)
837
884
838
	def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None):
885
	def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,mylicenses=None):
839
		"given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure"
886
		"given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure"
840
		if "--debug" in myopts:
887
		if "--debug" in myopts:
841
			print
888
			print
Lines 934-945 Link Here
934
				#	myk=["ebuild",myroot,myeb]
982
				#	myk=["ebuild",myroot,myeb]
935
			if myparent:
983
			if myparent:
936
				#we are a dependency, so we want to be unconditionally added
984
				#we are a dependency, so we want to be unconditionally added
937
				if not self.create(myk,myparent,myuse=binpkguseflags):
985
				if not self.create(myk,myparent,myuse=binpkguseflags,mylicenses=mylicenses):
938
					return 0
986
					return 0
939
			else:
987
			else:
940
				#if mysource is not set, then we are a command-line dependency and should not be added
988
				#if mysource is not set, then we are a command-line dependency and should not be added
941
				#if --onlydeps is specified.
989
				#if --onlydeps is specified.
942
				if not self.create(myk,myparent,"--onlydeps" not in myopts,myuse=binpkguseflags):
990
				if not self.create(myk,myparent,"--onlydeps" not in myopts,myuse=binpkguseflags,mylicenses=mylicenses):
943
					return 0
991
					return 0
944
992
945
		if "--debug" in myopts:
993
		if "--debug" in myopts:
Lines 1088-1093 Link Here
1088
						print red("(from pkg "+x[3]+")")
1136
						print red("(from pkg "+x[3]+")")
1089
					else:
1137
					else:
1090
						print
1138
						print
1139
			elif x[0]=="license":
1140
				# As "license" is 7 characters, didn't include a symbolic letter
1141
				addl="  "+fetch+"  "
1142
				resolved=portage.db[x[1]]["vartree"].resolve_key(x[2])
1143
				# Is it just me or is there too much red?
1144
				print "["+red(x[0]+" "+addl)+"]",red(resolved),
1145
				print red("("+x[3]+")")
1091
			else:
1146
			else:
1092
				if x[-1]=="nomerge":
1147
				if x[-1]=="nomerge":
1093
					continue
1148
					continue
Lines 1269-1274 Link Here
1269
					print
1324
					print
1270
					if ("--pretend" not in myopts):
1325
					if ("--pretend" not in myopts):
1271
						sys.exit(1)
1326
						sys.exit(1)
1327
					
1328
				if x[0]=="license":
1329
					print "\n!!! Error: License(s) required by " + x[2]
1330
					print   "!!!        Please ensure that ACCEPT_LICENSES contains:"
1331
					print   "!!!        " +x[3]
1332
					# Is this necessary? When I emerge with --pretend, it never gets here.
1333
					if ("--pretend" not in myopts):
1334
						sys.exit(1)
1335
1272
1336
1273
		if ("--resume" in myopts):
1337
		if ("--resume" in myopts):
1274
			# We're resuming.
1338
			# We're resuming.
Lines 1911-1917 Link Here
1911
		myvars=['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK',
1975
		myvars=['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK',
1912
				'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR', 'PORTDIR_OVERLAY',
1976
				'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR', 'PORTDIR_OVERLAY',
1913
				'USE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS','ACCEPT_KEYWORDS', 
1977
				'USE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS','ACCEPT_KEYWORDS', 
1914
				'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES']
1978
				'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES', 'ACCEPT_LICENSES']
1915
	myvars.sort()
1979
	myvars.sort()
1916
	for x in myvars:
1980
	for x in myvars:
1917
		print x+'="'+portage.settings[x]+'"'
1981
		print x+'="'+portage.settings[x]+'"'

Return to bug 17367