* [gentoo-dev] emerge -e
@ 2003-11-25 17:19 Jason Stubbs
2003-11-25 18:30 ` Jason Stubbs
0 siblings, 1 reply; 2+ messages in thread
From: Jason Stubbs @ 2003-11-25 17:19 UTC (permalink / raw
To: gentoo-dev
Hello all,
How/where does emerge get out of the circular dependencies when using "emerge
-e"? I'm almost done with the patch to add license checking but this is the
last stumbling block.
Regards,
Jason
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [gentoo-dev] emerge -e
2003-11-25 17:19 [gentoo-dev] emerge -e Jason Stubbs
@ 2003-11-25 18:30 ` Jason Stubbs
0 siblings, 0 replies; 2+ messages in thread
From: Jason Stubbs @ 2003-11-25 18:30 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 854 bytes --]
On Wednesday 26 November 2003 02:19, Jason Stubbs wrote:
> How/where does emerge get out of the circular dependencies when using
> "emerge -e"? I'm almost done with the patch to add license checking but
> this is the last stumbling block.
Replying to myself again. Figured I should give more info.
Attached is my licenses patch and some of the output from an "emerge -ep
--debug world". The process continues jumping between libtool and gnuconfig
but I can't figure out why. More to the point, I can't figure out why it
doesn't do it when all the licenses are accepted. Any pointers?
With the patch, to see what I'm talking about, first remove the section headed
"# return here else trouble occurs ;-)". Otherwise, everything works
perfectly except that deps of packages that haven't had their licenses
accepted are not checked.
Regards,
Jason
[-- Attachment #2: emerge--emptytree --]
[-- Type: text/plain, Size: 2623 bytes --]
These are the packages that I would merge, in order:
Calculating world dependencies
Parent: license / sys-apps/man-pages-1.61 GPL-2 merge
Depstring: sys-apps/man
Candidates: ['sys-apps/man']
ebuild: sys-apps/man-1.5m
binpkg: None
Parent: license / sys-apps/man-1.5m GPL-2 merge
Depstring: virtual/glibc >=sys-apps/sed-4 !bootstrap? ( sys-devel/patch ) sys-apps/cronbase >=sys-apps/groff-1.18
Candidates: ['>=sys-apps/groff-1.18', '>=sys-apps/sed-4', 'sys-devel/patch', 'virtual/glibc', 'sys-apps/cronbase']
ebuild: sys-apps/groff-1.18.1-r3
binpkg: None
Parent: license / sys-apps/groff-1.18.1-r3 GPL-2 merge
Depstring: virtual/glibc >=sys-apps/texinfo-4.0 !bootstrap? ( sys-devel/patch ) virtual/glibc >=sys-apps/texinfo-4.0
Candidates: ['>=sys-apps/texinfo-4.0', 'sys-devel/patch', 'virtual/glibc']
ebuild: sys-apps/texinfo-4.6
binpkg: None
Parent: license / sys-apps/texinfo-4.6 GPL-2 merge
Depstring: virtual/glibc !build? ( >=sys-libs/ncurses-5.2-r2 >=sys-apps/sed-4.0.5 nls? ( sys-devel/gettext ) ) virtual/glibc !build? ( >=sys-libs/ncurses-5.2-r2 )
Candidates: ['>=sys-apps/sed-4.0.5', '>=sys-libs/ncurses-5.2-r2', 'virtual/glibc', 'sys-devel/gettext']
ebuild: sys-apps/sed-4.0.8
binpkg: None
Parent: license / sys-apps/sed-4.0.8 GPL-2 merge
Depstring: virtual/glibc nls? ( sys-devel/gettext ) sys-devel/gnuconfig !bootstrap? ( sys-devel/libtool ) virtual/glibc nls? ( sys-devel/gettext )
Candidates: ['sys-devel/libtool', 'sys-devel/gnuconfig', 'virtual/glibc', 'sys-devel/gettext']
ebuild: sys-devel/libtool-1.4.3-r3
binpkg: None
Parent: license / sys-devel/libtool-1.4.3-r3 GPL-2 merge
Depstring: virtual/glibc !bootstrap? ( sys-devel/patch ) sys-devel/gnuconfig !bootstrap? ( sys-devel/libtool ) virtual/glibc
Candidates: ['sys-devel/gnuconfig', 'sys-devel/libtool', 'sys-devel/patch', 'virtual/glibc']
ebuild: sys-devel/gnuconfig-20030708
binpkg: None
Parent: license / sys-devel/gnuconfig-20030708 GPL-2 merge
Depstring:
Candidates: []
Exiting... license / sys-devel/gnuconfig-20030708 GPL-2 merge
ebuild: sys-devel/libtool-1.4.3-r3
binpkg: None
Parent: license / sys-devel/libtool-1.4.3-r3 GPL-2 merge
Depstring: virtual/glibc !bootstrap? ( sys-devel/patch ) sys-devel/gnuconfig !bootstrap? ( sys-devel/libtool ) virtual/glibc
Candidates: ['sys-devel/gnuconfig', 'sys-devel/libtool', 'sys-devel/patch', 'virtual/glibc']
ebuild: sys-devel/gnuconfig-20030708
binpkg: None
Parent: license / sys-devel/gnuconfig-20030708 GPL-2 merge
Depstring:
Candidates: []
Exiting... license / sys-devel/gnuconfig-20030708 GPL-2 merge
ebuild: sys-devel/libtool-1.4.3-r3
binpkg: None
[-- Attachment #3: portage-2.0.49-r15.licenses.patch --]
[-- Type: text/x-diff, Size: 6234 bytes --]
--- /usr/bin/emerge 2003-11-03 00:25:09.000000000 +0900
+++ emerge.py 2003-11-26 01:04:13.170707376 +0900
@@ -627,7 +627,7 @@
sys.stderr.write(red("!!! Failed to get all metadata: "+str(e)+"\n"))
sys.exit(1)
- def create(self,mybigkey,myparent=None,addme=1,myuse=None):
+ def create(self,mybigkey,myparent=None,addme=1,myuse=None,mylicenses=None):
"""creates the actual digraph of packages to merge. return 1 on success, 0 on failure
mybigkey = specification of package to merge; myparent = parent package (one depending on me);
addme = should I be added to the tree? (for the --onlydeps mode)"""
@@ -637,6 +637,29 @@
#"no downgrade" emerge
#print "mybigkey:",mybigkey
+ # get ACCEPT_LICENSES from if haven't done so already
+ # does this code only include make.conf??
+ if mylicenses == None:
+ accept_licenses = string.split(portage.settings['ACCEPT_LICENSES'])
+ mylicenses = []
+ for x in accept_licenses:
+ if x == "-*":
+ mylicenses = []
+ continue
+ if x[0] != "+" and x[0] != "-":
+ add = x
+ rem = x
+ elif x[0] == "+":
+ rem = x[1:]
+ add = x[1:]
+ else:
+ rem = x[1:]
+ add = ""
+ while rem in mylicenses:
+ mylicenses.remove(rem)
+ if add != "":
+ mylicenses.append(add)
+
jbigkey=string.join(mybigkey)
if self.digraph.hasnode(jbigkey+" merge") or self.digraph.hasnode(jbigkey+" nomerge"):
#this conditional is needed to prevent infinite recursion on already-processed deps
@@ -687,6 +710,25 @@
else:
#onlydeps mode; don't merge
merging=2
+
+ pkg_licenses = portage.portdb.aux_get(mybigkey[2], ["LICENSE"])[0]
+ # the assumption here is that | means OR and that AND takes precedence
+ # i.e. "(foo bar) | license" would be "foo bar | license"
+ # parenthesis should not be necessary unless
+ # there is a need for "(foo1 | foo2) (bar1 | bar2)"
+ for license_group in string.split(pkg_licenses,"|"):
+ license_accepted = 1
+ for license in string.split(license_group):
+ if license not in mylicenses:
+ license_accepted = 0
+ break
+ if license_accepted == 1:
+ break
+ # if license is missing, do the same as for blockers
+ if license_accepted == 0:
+ mybigkey[0]="license"
+ mybigkey.append(string.replace(pkg_licenses, "|", "OR"))
+
if merging==1:
mybigkey.append("merge")
else:
@@ -695,6 +737,11 @@
# whatever the case, we need to add the node to our digraph so
# that children can depend upon it.
self.digraph.addnode(string.join(mybigkey),myparent)
+
+ # return here else trouble occurs ;-)
+ if (mybigkey[0]=="license"):
+ return 1
+
if ("deep" not in myparams) and (not merging):
return 1
elif "recurse" not in myparams:
@@ -744,20 +791,20 @@
if myroot=="/":
mydep["/"]=edepend["DEPEND"]+" "+edepend["RDEPEND"]
- if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse):
+ if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse,mylicenses=mylicenses):
return 0
else:
mydep["/"]=edepend["DEPEND"]
mydep[myroot]=edepend["RDEPEND"]
- if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse):
+ if not self.select_dep("/",mydep["/"],myparent=mp,myuse=myuse,mylicenses=mylicenses):
return 0
- elif not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse):
+ elif not self.select_dep(myroot,mydep[myroot],myparent=mp,myuse=myuse,mylicenses=mylicenses):
return 0
if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
# Post Depend -- Add to the list without a parent, as it depends
# on a package being present AND must be built after that package.
- if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse):
+ if not self.select_dep(myroot,edepend["PDEPEND"],myuse=myuse,mylicenses=mylicenses):
return 0
return 1
@@ -835,7 +882,7 @@
break
alleb.remove(cand)
- def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None):
+ def select_dep(self,myroot,depstring,myparent=None,arg=None,myuse=None,mylicenses=None):
"given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure"
if "--debug" in myopts:
print
@@ -934,12 +982,12 @@
# myk=["ebuild",myroot,myeb]
if myparent:
#we are a dependency, so we want to be unconditionally added
- if not self.create(myk,myparent,myuse=binpkguseflags):
+ if not self.create(myk,myparent,myuse=binpkguseflags,mylicenses=mylicenses):
return 0
else:
#if mysource is not set, then we are a command-line dependency and should not be added
#if --onlydeps is specified.
- if not self.create(myk,myparent,"--onlydeps" not in myopts,myuse=binpkguseflags):
+ if not self.create(myk,myparent,"--onlydeps" not in myopts,myuse=binpkguseflags,mylicenses=mylicenses):
return 0
if "--debug" in myopts:
@@ -1088,6 +1136,13 @@
print red("(from pkg "+x[3]+")")
else:
print
+ elif x[0]=="license":
+ # As "license" is 7 characters, didn't include a symbolic letter
+ addl=" "+fetch+" "
+ resolved=portage.db[x[1]]["vartree"].resolve_key(x[2])
+ # Is it just me or is there too much red?
+ print "["+red(x[0]+" "+addl)+"]",red(resolved),
+ print red("("+x[3]+")")
else:
if x[-1]=="nomerge":
continue
@@ -1269,6 +1324,15 @@
print
if ("--pretend" not in myopts):
sys.exit(1)
+
+ if x[0]=="license":
+ print "\n!!! Error: License(s) required by " + x[2]
+ print "!!! Please ensure that ACCEPT_LICENSES contains:"
+ print "!!! " +x[3]
+ # Is this necessary? When I emerge with --pretend, it never gets here.
+ if ("--pretend" not in myopts):
+ sys.exit(1)
+
if ("--resume" in myopts):
# We're resuming.
@@ -1911,7 +1975,7 @@
myvars=['GENTOO_MIRRORS', 'CONFIG_PROTECT', 'CONFIG_PROTECT_MASK',
'PORTDIR', 'DISTDIR', 'PKGDIR', 'PORTAGE_TMPDIR', 'PORTDIR_OVERLAY',
'USE', 'COMPILER', 'CHOST', 'CFLAGS', 'CXXFLAGS','ACCEPT_KEYWORDS',
- 'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES']
+ 'MAKEOPTS', 'AUTOCLEAN', 'SYNC', 'FEATURES', 'ACCEPT_LICENSES']
myvars.sort()
for x in myvars:
print x+'="'+portage.settings[x]+'"'
[-- Attachment #4: Type: text/plain, Size: 37 bytes --]
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-11-25 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-11-25 17:19 [gentoo-dev] emerge -e Jason Stubbs
2003-11-25 18:30 ` Jason Stubbs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox