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

Detect wurfl commercial license #3163

Merged
merged 4 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions etc/scripts/licenses/buildrules.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def load_data(location="00-new-licenses.txt"):
Load rules metadata and text from file at ``location``. Return a list of
RuleData.
"""
with io.open(location, encoding="utf-8") as o:
with open(location) as o:
lines = o.read().splitlines(False)

rules = []
Expand Down Expand Up @@ -262,7 +262,7 @@ def cli(licenses_file):
print(existing_msg.format(**locals()))
continue
else:
print(f"Adding new rule: {identifier}")
print(f"Adding new rule: file://{identifier}")
rl = models.update_ignorables(rulerec, verbose=False)
rl.dump(rules_data_dir=models.rules_data_dir)

Expand Down
11 changes: 11 additions & 0 deletions src/licensedcode/data/rules/commercial-license_80.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
license_expression: commercial-license
is_license_notice: yes
notes: Seen in wurfl.h https://github.com/haproxy/haproxy/commit/cd9b9bd3e47cb2814eaab6c07d1facf222f013a9#diff-be9afa6e330d524179c2f689a4858fd7645bb3d1f05e54871b962f829f2580e8
---

This software package is the property of ScientiaMobile Inc. and is licensed
commercially according to a contract between the Licensee and ScientiaMobile Inc. (Licensor).
If you represent the Licensee, please refer to the licensing agreement which has been signed
between the two parties. If you do not represent the Licensee, you are not authorized to use
this software in any way.
8 changes: 8 additions & 0 deletions src/licensedcode/data/rules/commercial-license_81.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
license_expression: commercial-license
is_license_notice: yes
relevance: 100
notes: Seen in wurfl.h https://github.com/haproxy/haproxy/commit/cd9b9bd3e47cb2814eaab6c07d1facf222f013a9#diff-be9afa6e330d524179c2f689a4858fd7645bb3d1f05e54871b962f829f2580e8
---

software package is the property
8 changes: 8 additions & 0 deletions src/licensedcode/data/rules/commercial-license_82.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
license_expression: commercial-license
is_license_notice: yes
relevance: 100
notes: Seen in wurfl.h https://github.com/haproxy/haproxy/commit/cd9b9bd3e47cb2814eaab6c07d1facf222f013a9#diff-be9afa6e330d524179c2f689a4858fd7645bb3d1f05e54871b962f829f2580e8
---

licensed commercially
8 changes: 8 additions & 0 deletions src/licensedcode/data/rules/commercial-license_83.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
license_expression: commercial-license
is_license_notice: yes
relevance: 100
notes: Seen in wurfl.h https://github.com/haproxy/haproxy/commit/cd9b9bd3e47cb2814eaab6c07d1facf222f013a9#diff-be9afa6e330d524179c2f689a4858fd7645bb3d1f05e54871b962f829f2580e8
---

licensed commercially according to a contract
8 changes: 8 additions & 0 deletions src/licensedcode/data/rules/commercial-license_84.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
license_expression: commercial-license
is_license_notice: yes
relevance: 100
notes: Seen in wurfl.h https://github.com/haproxy/haproxy/commit/cd9b9bd3e47cb2814eaab6c07d1facf222f013a9#diff-be9afa6e330d524179c2f689a4858fd7645bb3d1f05e54871b962f829f2580e8
---

refer to the licensing agreement which has been signed
8 changes: 8 additions & 0 deletions src/licensedcode/data/rules/commercial-license_85.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
license_expression: commercial-license
is_license_notice: yes
relevance: 100
notes: Seen in wurfl.h https://github.com/haproxy/haproxy/commit/cd9b9bd3e47cb2814eaab6c07d1facf222f013a9#diff-be9afa6e330d524179c2f689a4858fd7645bb3d1f05e54871b962f829f2580e8
---

you are not authorized to use this software in any way.
8 changes: 8 additions & 0 deletions src/licensedcode/data/rules/commercial-license_86.RULE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
license_expression: commercial-license
is_license_notice: yes
relevance: 100
notes: Seen in wurfl.h https://github.com/haproxy/haproxy/commit/cd9b9bd3e47cb2814eaab6c07d1facf222f013a9#diff-be9afa6e330d524179c2f689a4858fd7645bb3d1f05e54871b962f829f2580e8
---

not authorized to use this software
28 changes: 8 additions & 20 deletions src/licensedcode/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,20 +425,13 @@ def dump(self, licenses_data_dir):
- the license data as YAML frontmatter
- the license text
"""

def write(location, byte_string):
# we write as binary because rules and licenses texts and data are
# UTF-8-encoded bytes
with io.open(location, 'wb') as of:
of.write(byte_string)

metadata = self.to_dict()
content = self.text.encode('utf-8')
content = self.text
rule_post = FrontmatterPost(content=content, handler=SaneYAMLHandler(), **metadata)
output_string = dumps_frontmatter(post=rule_post)

output = dumps_frontmatter(post=rule_post)
license_file = self.license_file(licenses_data_dir=licenses_data_dir)
write(license_file, output_string.encode('utf-8'))
with open(license_file, 'w') as of:
of.write(output)

def load(self, license_file, check_consistency=True):
"""
Expand Down Expand Up @@ -2078,19 +2071,14 @@ def dump(self, rules_data_dir):
if self.is_from_license or self.is_synthetic:
return

def write(location, byte_string):
# we write as binary because rules and licenses texts and data are
# UTF-8-encoded bytes
with io.open(location, 'wb') as of:
of.write(byte_string)

rule_file = self.rule_file(rules_data_dir=rules_data_dir)

metadata = self.to_dict()
content = self.text.encode('utf-8')
content = self.text
rule_post = FrontmatterPost(content=content, handler=SaneYAMLHandler(), **metadata)
output_string = dumps_frontmatter(post=rule_post)
write(rule_file, output_string.encode('utf-8'))
output = dumps_frontmatter(post=rule_post)
with open(rule_file, 'w') as of:
of.write(output)

def load(self, rule_file, with_checks=True):
"""
Expand Down
9 changes: 2 additions & 7 deletions src/scancode/cli_test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,8 @@ def run_scan_click(


def get_opts(options):
try:
return ' '.join(options)
except:
try:
return b' '.join(options)
except:
return b' '.join(map(repr, options))
opts = [o if isinstance(o, str) else repr(o) for o in options]
return ' '.join(opts)


WINDOWS_CI_TIMEOUT = '222.2'
Expand Down
17 changes: 17 additions & 0 deletions tests/licensedcode/data/datadriven/lic4/wurfl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* InFuze C API - HAPROXY Dummy library version of include
*
* Copyright (c) ScientiaMobile, Inc.
* http://www.scientiamobile.com
*
* This software package is the property of ScientiaMobile Inc. and is licensed
* commercially according to a contract between the Licensee and ScientiaMobile Inc. (Licensor).
* If you represent the Licensee, please refer to the licensing agreement which has been signed
* between the two parties. If you do not represent the Licensee, you are not authorized to use
* this software in any way.
*
*/

#ifndef _WURFL_H_
#define _WURFL_H_

3 changes: 3 additions & 0 deletions tests/licensedcode/data/datadriven/lic4/wurfl.h.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
license_expressions:
- commercial-license