From ec69f2e23fcb00b18800344f633b9f3917e8047c Mon Sep 17 00:00:00 2001 From: Shane Allcroft Date: Tue, 19 Dec 2017 23:59:08 -0600 Subject: [PATCH] Replicated copyright change to open embedded, and resolved multi-license ToDo (#100) Replicated copyright change to open imbedded, and resolved multi license to do --- superflore/generators/bitbake/yocto_recipe.py | 23 ++++++------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/superflore/generators/bitbake/yocto_recipe.py b/superflore/generators/bitbake/yocto_recipe.py index a1799bb4..0395ad6e 100644 --- a/superflore/generators/bitbake/yocto_recipe.py +++ b/superflore/generators/bitbake/yocto_recipe.py @@ -26,9 +26,11 @@ import hashlib import os.path import tarfile +from time import gmtime, strftime from urllib.request import urlretrieve from superflore.exceptions import NoPkgXml +from superflore.utils import get_license from superflore.utils import get_pkg_version from superflore.utils import info from superflore.utils import resolve_dep @@ -114,7 +116,8 @@ def get_recipe_text(self, distributor, license_text, die_msg=None): Generate the Yocto Recipe, given the distributor line and the license text. """ - ret = '# Copyright 2017 ' + distributor + '\n' + ret = "# Copyright " + strftime("%Y", gmtime()) + " " + ret += distributor + "\n" ret += '# Distributed under the terms of the ' + license_text ret += ' license\n\n' @@ -130,22 +133,10 @@ def get_recipe_text(self, distributor, license_text, die_msg=None): ret += 'SECTION = "devel"\n' self.get_license_line() if isinstance(self.license, str): - self.license = self.license.split(',')[0] - self.license = self.license.replace(' ', '-') - ret += 'LICENSE = "' + self.license + '"\n' + ret += 'LICENSE = "%s"\n' % get_license(self.license) elif isinstance(self.license, list): - self.license = self.license[0].replace(' ', '-') - ret += 'LICENSE = "' + self.license + '"\n' - """ - TODO(allenh1): add this functionality - first = True - for lic in self.license: - if not first: - ret += ' ' - first = False - ret += lic - ret += '"\n' - """ + ret += 'LICENSE = "' + ret += ' & '.join([get_license(l) for l in self.license]) + '"\n' ret += 'LIC_FILES_CHKSUM = "file://package.xml;beginline=' ret += str(self.license_line) ret += ';endline='