From 20ac8ab77f427a252145e90196baa6aa33399ac0 Mon Sep 17 00:00:00 2001
From: chaeh03
Date: Mon, 30 Sep 2024 11:34:02 +0900
Subject: [PATCH 1/4] Create scancode_update.yml
---
.github/workflows/scancode_update.yml | 48 +++++++++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100644 .github/workflows/scancode_update.yml
diff --git a/.github/workflows/scancode_update.yml b/.github/workflows/scancode_update.yml
new file mode 100644
index 00000000..088b13aa
--- /dev/null
+++ b/.github/workflows/scancode_update.yml
@@ -0,0 +1,48 @@
+name: ScanCode_update_test
+
+on:
+ schedule:
+ - cron: '0 0 1 * *'
+ workflow_dispatch:
+
+jobs:
+ test_scancode:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.9'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install tox
+
+ - name: Install latest ScanCode version
+ run: |
+ pip install scancode-toolkit
+
+ - name: Run ScanCode on test files
+ run: |
+ scancode -l --json-pp results.json path_to_test_files
+ continue-on-error: true
+
+ - name: Verify license detection count
+ run: |
+ python check_license_count.py results.json
+ continue-on-error: true
+
+ - name: Create Pull Request if test passes
+ if: success()
+ run: |
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git checkout -b update-scancode
+ git commit -am "Update to latest ScanCode version"
+ git push origin update-scancode
+ gh pr create --title "Update ScanCode version" --body "Automatically created PR to update ScanCode version"
From a6fc02bc623f9793819fae8bdc1adfa26cbd6aee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=8B=AC=EC=B1=84=ED=98=84?=
Date: Mon, 30 Sep 2024 15:43:10 +0900
Subject: [PATCH 2/4] Update ScanCode GitHub Action
---
src/fosslight_source.egg-info/PKG-INFO | 73 +++++++++++++++++++
src/fosslight_source.egg-info/SOURCES.txt | 21 ++++++
.../dependency_links.txt | 1 +
.../entry_points.txt | 3 +
src/fosslight_source.egg-info/requires.txt | 12 +++
src/fosslight_source.egg-info/top_level.txt | 1 +
6 files changed, 111 insertions(+)
create mode 100644 src/fosslight_source.egg-info/PKG-INFO
create mode 100644 src/fosslight_source.egg-info/SOURCES.txt
create mode 100644 src/fosslight_source.egg-info/dependency_links.txt
create mode 100644 src/fosslight_source.egg-info/entry_points.txt
create mode 100644 src/fosslight_source.egg-info/requires.txt
create mode 100644 src/fosslight_source.egg-info/top_level.txt
diff --git a/src/fosslight_source.egg-info/PKG-INFO b/src/fosslight_source.egg-info/PKG-INFO
new file mode 100644
index 00000000..4cde9027
--- /dev/null
+++ b/src/fosslight_source.egg-info/PKG-INFO
@@ -0,0 +1,73 @@
+Metadata-Version: 2.1
+Name: fosslight-source
+Version: 2.0.0
+Summary: FOSSLight Source Scanner
+Home-page: https://github.com/fosslight/fosslight_source_scanner
+Download-URL: https://github.com/fosslight/fosslight_source_scanner
+Author: LG Electronics
+License: Apache-2.0
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
+Classifier: Programming Language :: Python :: 3.10
+Classifier: Programming Language :: Python :: 3.11
+Requires-Python: >=3.8
+Description-Content-Type: text/markdown
+License-File: LICENSE
+Requires-Dist: pyparsing
+Requires-Dist: scancode-toolkit==32.0.*,>=32.0.2
+Requires-Dist: scanoss
+Requires-Dist: XlsxWriter
+Requires-Dist: fosslight_util>=2.0.0
+Requires-Dist: PyYAML
+Requires-Dist: wheel>=0.38.1
+Requires-Dist: intbitset
+Requires-Dist: fosslight_binary>=5.0.0
+Requires-Dist: typecode-libmagic; sys_platform != "darwin"
+
+
+
+
+ [Korean]
+
+
+
+# FOSSLight Source Scanner
+
+
[](https://api.reuse.software/info/github.com/fosslight/fosslight_source_scanner) [](https://fosslight.org/fosslight-guide-en/scanner/2_source.html)
+
+
+```note
+Detect the license for the source code.
+Use Source Code Scanner and process the scanner results.
+```
+
+**FOSSLight Source Scanner** uses source code scanners, [ScanCode][sc] and [SCANOSS][scanoss]. [ScanCode][sc] detects copyright and license phrases contained in the file and [SCANOSS][scanoss] searches OSS Name, OSS Version, download location, copyright and license information from [OSSKB][osskb]. Some files (ex- build script), binary files, directory and files in specific directories (ex-test) are excluded from the result. And removes words such as "-only" and "-old-style" from the license name to be printed. The output result is generated in spreadsheet format.
+
+
+[sc]: https://github.com/nexB/scancode-toolkit
+[scanoss]: https://github.com/scanoss/scanoss.py
+[osskb]: https://osskb.org/
+
+
+## ๐ User Guide
+
+We describe the user guide in the FOSSLight guide page.
+Please see the [**User Guide**](https://fosslight.org/fosslight-guide-en/scanner/2_source.html) for more information on how to install and run it.
+
+
+## ๐ Contributing Guide
+
+We always welcome your contributions.
+Please see the [CONTRIBUTING guide](https://fosslight.org/fosslight-guide-en/learn/1_contribution.html) for how to contribute.
+
+
+## ๐ License
+
+FOSSLight Source Scanner is Apache-2.0, as found in the [LICENSE][l] file.
+
+[l]: https://github.com/fosslight/fosslight_source_scanner/blob/main/LICENSE
diff --git a/src/fosslight_source.egg-info/SOURCES.txt b/src/fosslight_source.egg-info/SOURCES.txt
new file mode 100644
index 00000000..cadf5c9a
--- /dev/null
+++ b/src/fosslight_source.egg-info/SOURCES.txt
@@ -0,0 +1,21 @@
+LICENSE
+MANIFEST.in
+README.md
+requirements.txt
+setup.py
+src/fosslight_source/__init__.py
+src/fosslight_source/_help.py
+src/fosslight_source/_license_matched.py
+src/fosslight_source/_parsing_scancode_file_item.py
+src/fosslight_source/_parsing_scanoss_file.py
+src/fosslight_source/_scan_item.py
+src/fosslight_source/cli.py
+src/fosslight_source/run_scancode.py
+src/fosslight_source/run_scanoss.py
+src/fosslight_source/run_spdx_extractor.py
+src/fosslight_source.egg-info/PKG-INFO
+src/fosslight_source.egg-info/SOURCES.txt
+src/fosslight_source.egg-info/dependency_links.txt
+src/fosslight_source.egg-info/entry_points.txt
+src/fosslight_source.egg-info/requires.txt
+src/fosslight_source.egg-info/top_level.txt
\ No newline at end of file
diff --git a/src/fosslight_source.egg-info/dependency_links.txt b/src/fosslight_source.egg-info/dependency_links.txt
new file mode 100644
index 00000000..8b137891
--- /dev/null
+++ b/src/fosslight_source.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/src/fosslight_source.egg-info/entry_points.txt b/src/fosslight_source.egg-info/entry_points.txt
new file mode 100644
index 00000000..d9390d40
--- /dev/null
+++ b/src/fosslight_source.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+fosslight_source = fosslight_source.cli:main
+run_scancode = fosslight_source.run_scancode:main
diff --git a/src/fosslight_source.egg-info/requires.txt b/src/fosslight_source.egg-info/requires.txt
new file mode 100644
index 00000000..12fae345
--- /dev/null
+++ b/src/fosslight_source.egg-info/requires.txt
@@ -0,0 +1,12 @@
+pyparsing
+scancode-toolkit==32.0.*,>=32.0.2
+scanoss
+XlsxWriter
+fosslight_util>=2.0.0
+PyYAML
+wheel>=0.38.1
+intbitset
+fosslight_binary>=5.0.0
+
+[:sys_platform != "darwin"]
+typecode-libmagic
diff --git a/src/fosslight_source.egg-info/top_level.txt b/src/fosslight_source.egg-info/top_level.txt
new file mode 100644
index 00000000..10e0713e
--- /dev/null
+++ b/src/fosslight_source.egg-info/top_level.txt
@@ -0,0 +1 @@
+fosslight_source
From 3feeba007add41249cd395c6b38da614e9cd9bec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=8B=AC=EC=B1=84=ED=98=84?=
Date: Mon, 30 Sep 2024 15:47:55 +0900
Subject: [PATCH 3/4] Update tox.ini with ScanCode test configuration
---
tox.ini | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tox.ini b/tox.ini
index 1bfee848..1520b43f 100644
--- a/tox.ini
+++ b/tox.ini
@@ -23,11 +23,14 @@ filterwarnings = ignore::DeprecationWarning
[testenv:test_run]
deps =
-r{toxinidir}/requirements-dev.txt
+ scancode-toolkit # ScanCode๋ฅผ test_run ํ๊ฒฝ์ ์ถ๊ฐ
commands =
rm -rf test_scan
fosslight_source -p tests/test_files -j -m -o test_scan
fosslight_source -p tests -e test_files/test cli_test.py -j -m -o test_scan2
+ scancode -l --json-pp results.json tests/test_files # ScanCode ์คํ
+ python check_license_count.py results.json 3 # License ์นด์ดํธ ์ฒดํฌ
[testenv:release]
deps =
@@ -50,4 +53,4 @@ commands =
[testenv:flake8]
deps = flake8
-commands = flake8
\ No newline at end of file
+commands = flake8 # Flake8 ๊ฒ์ฌ ์คํ
From 27a9e3c48702c64b50f7af7ba615049687608fa7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EC=8B=AC=EC=B1=84=ED=98=84?=
Date: Mon, 30 Sep 2024 16:07:53 +0900
Subject: [PATCH 4/4] Add check_license_count script for license threshold
---
check_license_count.py | 51 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 check_license_count.py
diff --git a/check_license_count.py b/check_license_count.py
new file mode 100644
index 00000000..72161757
--- /dev/null
+++ b/check_license_count.py
@@ -0,0 +1,51 @@
+import sys
+import json
+import os
+
+def check_license_count(json_file, threshold):
+ try:
+ with open(json_file, 'r', encoding='utf-8') as f:
+ data = json.load(f)
+
+ total_count = 0
+ licenses = {}
+ # Extract license information from the 'license_detections'
+ for detection in data.get('license_detections', []):
+ license_expression = detection['license_expression']
+ detection_count = detection['detection_count']
+ licenses[license_expression] = detection_count
+ total_count += detection_count
+
+ print(f"Detected licenses: {licenses}")
+ print(f"Total number of detected licenses: {total_count}")
+
+ if total_count >= threshold:
+ print(f"License detection meets the threshold ({threshold}). Test passed!")
+ sys.exit(0) # Exit with success
+ else:
+ print(f"License detection is below the threshold ({threshold}). Test failed.")
+ sys.exit(1) # Exit with failure
+
+ except Exception as e:
+ print(f"Error occurred: {str(e)}")
+ sys.exit(1)
+
+if __name__ == "__main__":
+ if len(sys.argv) < 2:
+ print("Usage: python check_license_count.py [threshold]")
+ sys.exit(1)
+
+ json_file = sys.argv[1]
+
+ # Use an environment variable for threshold if available, or default to 3
+ threshold = int(os.getenv('LICENSE_THRESHOLD', 3))
+
+ # If a threshold is provided as an argument, override the default
+ if len(sys.argv) > 2:
+ try:
+ threshold = int(sys.argv[2])
+ except ValueError:
+ print("Threshold must be an integer.")
+ sys.exit(1)
+
+ check_license_count(json_file, threshold)