On Sunday 23 November 2003 01:56, Jason Stubbs wrote:
> I've done a small patch which checks for licenses but have come across an
> issue while testing. Take the following:
>
> xfree contains LICENSE="X11 MSttfEULA"
> qt contains LICENSE="QPL-1.0 | GPL-2"
>
> What other lexical forms are there? The ebuild howto doesn't even mention
> the above construct. Will I find something like "(LIC1 LIC2) | LIC3"?
>
> Most importantly, though, does portage already contain the code to parse
> these somewhere?
Okay, I've assumed that | is the only modifier, that it means OR and that AND
takes precedence. Attached is a very simple patch to emerge. You'll probably
notice straight away that I've never really worked with python before.
I also ran it for emerge -ep world and ended up with this is my make.conf.
ACCEPT_LICENSES="GPL-2 Artistic MIT ZLIB BZIP2 as-is FLEX CRACKLIB LGPL-2
LGPL-2.1 BSD fontconfig Info-ZIP X11 MSttfEULA PSF-2.2 NVIDIA freedist
BAEKMUK Arphic free-noncomm sun-bcla-java-vm DB IPL-1 DIVX MOTIF XAnim
public-domain FDL-1.1 wxWinLL-3 OpenSoftware"
There is also no checking of * or -, but I'm guessing that's already
abstracted in portage. Or does it only apply to USE? Anyway, will check on
that later. Should try to get at least some sleep before the new work day.
BTW, at what time should I post this to bugzilla?
Regards,
Jason
--- emerge.orig 2003-11-03 00:25:09.000000000 +0900
+++ emerge.new 2003-11-23 02:42:53.978695912 +0900
@@ -1911,7 +1911,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]+'"'
@@ -2120,6 +2120,28 @@
if ("--usepkgonly" in myopts) and mydepgraph.missingbins:
sys.stderr.write(red("The following binaries are not available for merging...\n"))
+ accept_licenses = string.split(portage.settings['ACCEPT_LICENSES'])
+ print accept_licenses
+ all_licenses_accepted = 1
+ for pkg in mydepgraph.altlist():
+ pkg_licenses = portage.portdb.aux_get(pkg[2], ["LICENSE"])[0]
+ for license_group in string.split(pkg_licenses,"|"):
+ license_accepted = 1
+ for license in string.split(license_group):
+ try:
+ temp = accept_licenses.index(license)
+ except Exception,e:
+ license_accepted = 0
+ if license_accepted == 1:
+ break
+ if license_accepted == 0:
+ print "\n!!! License(s) " + string.replace(pkg_licenses, "|", "or") + " required by " + pkg[2]
+ print "!!! has not been accepted. Please review and add to ACCEPT_LICENSES."
+ all_licenses_accepted = 0
+ if all_licenses_accepted == 0:
+ print
+ sys.exit(1)
+
if mydepgraph.missingbins:
for x in mydepgraph.missingbins:
sys.stderr.write(" "+str(x)+"\n")
--
[EMAIL PROTECTED] mailing list