Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replicated copyright change to open embedded, and resolved multi-license ToDo #100

Merged
merged 12 commits into from
Dec 20, 2017
Merged
14 changes: 4 additions & 10 deletions superflore/generators/bitbake/yocto_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import hashlib
import os.path
import tarfile
from time import gmtime, strftime
from urllib.request import urlretrieve

from superflore.exceptions import NoPkgXml
Expand Down Expand Up @@ -114,7 +115,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'

Expand All @@ -136,16 +138,8 @@ def get_recipe_text(self, distributor, license_text, die_msg=None):
elif isinstance(self.license, list):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I don't think you need to use a join when self.license is a string. I think this line could just be

ret += 'LICENSE = "%s"\n' % getlicense(self.license)

Copy link
Contributor Author

@shaneallcroft shaneallcroft Dec 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, i didnt see that '[0]' on the end of line 136, thought it was just being made into a list there so i treated it the same, as when it was a list my b!

self.license = self.license[0].replace(' ', '-')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shaneallcroft this hackyness needs to be killed with fire. This just removes the list entirely and replaces it with its first element.

Therefore, this line and the one that immediately follows should be removed.

Copy link
Contributor Author

@shaneallcroft shaneallcroft Dec 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You got it! 👍 🔥 🔥

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 += ' '.join(self.license)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This prints the licences twice, once in a list format and once joined by strings. It's probably worth removing the above print and joining on ', ' for human readability. @allenh1 I assume this is optimized for human readability so comma separated list is best?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tfoote I'm actually not sure how Open Embedded wants multiple licenses to be handled... I think I'll just pull this change locally and try it out? I'm honestly unsure.

ret += '"\n'
"""
ret += 'LIC_FILES_CHKSUM = "file://package.xml;beginline='
ret += str(self.license_line)
ret += ';endline='
Expand Down
2 changes: 1 addition & 1 deletion tests/ebuild/simple_expected.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inherit ros-cmake

DESCRIPTION="an ebuild"
HOMEPAGE="https://www.website.com"
SRC_URI="https://www.website.com/download/${PN}/archive/${PN}/release/lunar/0.0.0.tar.gz -> ${PN}-lunar-release-${PV}.tar.gz"
SRC_URI="https://www.website.com/download/stuff.tar.gz -> ${PN}-lunar-release-${PV}.tar.gz"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change shouldn't be made -- perhaps this got pulled in during the rebase somehow?

Copy link
Contributor Author

@shaneallcroft shaneallcroft Dec 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats what probably happened, I'll revert that now 👍


LICENSE="LGPL-2"

Expand Down