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 |
# this gets done multiple times - need to fix |
643 |
if mylicenses == None: |
644 |
accept_licenses = string.split(portage.settings['ACCEPT_LICENSE']) |
645 |
mylicenses = [] |
646 |
for x in accept_licenses: |
647 |
if x == "*": |
648 |
for y in [portage.settings['PORTDIR']+"/licenses", portage.settings["PORTDIR_OVERLAY"]+"/licenses"]: |
649 |
if os.access(y,os.F_OK): |
650 |
for z in os.listdir(y): |
651 |
if z not in mylicenses: |
652 |
mylicenses.append(z) |
653 |
if x == "-*": |
654 |
mylicenses = [] |
655 |
continue |
656 |
if x[0] != "+" and x[0] != "-": |
657 |
add = x |
658 |
rem = x |
659 |
elif x[0] == "+": |
660 |
rem = x[1:] |
661 |
add = x[1:] |
662 |
else: |
663 |
rem = x[1:] |
664 |
add = "" |
665 |
while rem in mylicenses: |
666 |
mylicenses.remove(rem) |
667 |
if add != "": |
668 |
mylicenses.append(add) |
669 |
|
640 |
jbigkey=string.join(mybigkey) |
670 |
jbigkey=string.join(mybigkey) |
641 |
if self.digraph.hasnode(jbigkey+" merge") or self.digraph.hasnode(jbigkey+" nomerge"): |
671 |
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 |
672 |
#this conditional is needed to prevent infinite recursion on already-processed deps |
Lines 687-692
Link Here
|
687 |
else: |
717 |
else: |
688 |
#onlydeps mode; don't merge |
718 |
#onlydeps mode; don't merge |
689 |
merging=2 |
719 |
merging=2 |
|
|
720 |
|
721 |
pkg_licenses = portage.portdb.aux_get(mybigkey[2], ["LICENSE"])[0] |
722 |
# the assumption here is that | means OR and that AND takes precedence |
723 |
# i.e. "(foo bar) | license" would be "foo bar | license" |
724 |
# parenthesis should not be necessary unless |
725 |
# there is a need for "(foo1 | foo2) (bar1 | bar2)" |
726 |
for license_group in string.split(pkg_licenses,"|"): |
727 |
license_accepted = 1 |
728 |
for license in string.split(license_group): |
729 |
if license not in mylicenses: |
730 |
license_accepted = 0 |
731 |
break |
732 |
if license_accepted == 1: |
733 |
break |
734 |
# if license is missing, do the same as for blockers |
735 |
if license_accepted == 0: |
736 |
mybigkey[0]="license" |
737 |
mybigkey.append(string.replace(pkg_licenses, "|", "OR")) |
738 |
|
690 |
if merging==1: |
739 |
if merging==1: |
691 |
mybigkey.append("merge") |
740 |
mybigkey.append("merge") |
692 |
else: |
741 |
else: |
Lines 695-700
Link Here
|
695 |
# whatever the case, we need to add the node to our digraph so |
744 |
# whatever the case, we need to add the node to our digraph so |
696 |
# that children can depend upon it. |
745 |
# that children can depend upon it. |
697 |
self.digraph.addnode(string.join(mybigkey),myparent) |
746 |
self.digraph.addnode(string.join(mybigkey),myparent) |
|
|
747 |
|
748 |
# return here else get into an infinite loop |
749 |
# when using --deep or --emptytree |
750 |
if (mybigkey[0]=="license"): |
751 |
return 1 |
752 |
|
698 |
if ("deep" not in myparams) and (not merging): |
753 |
if ("deep" not in myparams) and (not merging): |
699 |
return 1 |
754 |
return 1 |
700 |
elif "recurse" not in myparams: |
755 |
elif "recurse" not in myparams: |
Lines 744-763
Link Here
|
744 |
|
799 |
|
745 |
if myroot=="/": |
800 |
if myroot=="/": |
746 |
mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"] |
801 |
mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"] |
747 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse): |
802 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse,mylicenses=mylicenses): |
748 |
return 0 |
803 |
return 0 |
749 |
else: |
804 |
else: |
750 |
mydep["/"]=edepend["DEPEND"] |
805 |
mydep["/"]=edepend["DEPEND"] |
751 |
mydep[myroot]=edepend["RDEPEND"] |
806 |
mydep[myroot]=edepend["RDEPEND"] |
752 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse): |
807 |
if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse,mylicenses=mylicenses): |
753 |
return 0 |
808 |
return 0 |
754 |
elif not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse): |
809 |
elif not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse,mylicenses=mylicenses): |
755 |
return 0 |
810 |
return 0 |
756 |
|
811 |
|
757 |
if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: |
812 |
if edepend.has_key("PDEPEND") and edepend["PDEPEND"]: |
758 |
# Post Depend -- Add to the list without a parent, as it depends |
813 |
# 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. |
814 |
# on a package being present AND must be built after that package. |
760 |
if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse): |
815 |
if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse,mylicenses=mylicenses): |
761 |
return 0 |
816 |
return 0 |
762 |
|
817 |
|
763 |
return 1 |
818 |
return 1 |
Lines 835-841
Link Here
|
835 |
break |
890 |
break |
836 |
alleb.remove(cand) |
891 |
alleb.remove(cand) |
837 |
|
892 |
|
838 |
def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None): |
893 |
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" |
894 |
"given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure" |
840 |
if "--debug" in myopts: |
895 |
if "--debug" in myopts: |
841 |
print |
896 |
print |
Lines 934-945
Link Here
|
934 |
# myk=["ebuild",myroot,myeb] |
989 |
# myk=["ebuild",myroot,myeb] |
935 |
if myparent: |
990 |
if myparent: |
936 |
#we are a dependency, so we want to be unconditionally added |
991 |
#we are a dependency, so we want to be unconditionally added |
937 |
if not self.create(myk,myparent,myuse=binpkguseflags): |
992 |
if not self.create(myk,myparent,myuse=binpkguseflags,mylicenses=mylicenses): |
938 |
return 0 |
993 |
return 0 |
939 |
else: |
994 |
else: |
940 |
#if mysource is not set, then we are a command-line dependency and should not be added |
995 |
#if mysource is not set, then we are a command-line dependency and should not be added |
941 |
#if --onlydeps is specified. |
996 |
#if --onlydeps is specified. |
942 |
if not self.create(myk,myparent,"--onlydeps" not in myopts,myuse=binpkguseflags): |
997 |
if not self.create(myk,myparent,"--onlydeps" not in myopts,myuse=binpkguseflags,mylicenses=mylicenses): |
943 |
return 0 |
998 |
return 0 |
944 |
|
999 |
|
945 |
if "--debug" in myopts: |
1000 |
if "--debug" in myopts: |
Lines 1088-1093
Link Here
|
1088 |
print red("(from pkg "+x[3]+")") |
1143 |
print red("(from pkg "+x[3]+")") |
1089 |
else: |
1144 |
else: |
1090 |
print |
1145 |
print |
|
|
1146 |
elif x[0]=="license": |
1147 |
# As "license" is 7 characters, didn't include a symbolic letter |
1148 |
addl=" "+fetch+" " |
1149 |
resolved=portage.db[x[1]]["vartree"].resolve_key(x[2]) |
1150 |
# Is it just me or is there too much red? |
1151 |
print "["+red(x[0]+" "+addl)+"]",red(resolved), |
1152 |
print red("("+x[3]+")") |
1091 |
else: |
1153 |
else: |
1092 |
if x[-1]=="nomerge": |
1154 |
if x[-1]=="nomerge": |
1093 |
continue |
1155 |
continue |
Lines 1269-1274
Link Here
|
1269 |
print |
1331 |
print |
1270 |
if ("--pretend" not in myopts): |
1332 |
if ("--pretend" not in myopts): |
1271 |
sys.exit(1) |
1333 |
sys.exit(1) |
|
|
1334 |
|
1335 |
if x[0]=="license": |
1336 |
print "\n!!! Error: License(s) required by " + x[2] |
1337 |
print "!!! Please ensure that ACCEPT_LICENSE contains:" |
1338 |
print "!!! " +x[3] |
1339 |
# Is this necessary? When I emerge with --pretend, it never gets here. |
1340 |
if ("--pretend" not in myopts): |
1341 |
sys.exit(1) |
1342 |
|
1272 |
|
1343 |
|
1273 |
if ("--resume" in myopts): |
1344 |
if ("--resume" in myopts): |
1274 |
# We're resuming. |
1345 |
# We're resuming. |
Lines 1911-1917
Link Here
|
1911 |
myvars=['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK', |
1982 |
myvars=['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK', |
1912 |
'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR', 'PORTDIR_OVERLAY', |
1983 |
'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR', 'PORTDIR_OVERLAY', |
1913 |
'USE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS','ACCEPT_KEYWORDS', |
1984 |
'USE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS','ACCEPT_KEYWORDS', |
1914 |
'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES'] |
1985 |
'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES', 'ACCEPT_LICENSE'] |
1915 |
myvars.sort() |
1986 |
myvars.sort() |
1916 |
for x in myvars: |
1987 |
for x in myvars: |
1917 |
print x+'="'+portage.settings[x]+'"' |
1988 |
print x+'="'+portage.settings[x]+'"' |