diff options
| -rw-r--r-- | meta/lib/oe/license_finder.py | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/meta/lib/oe/license_finder.py b/meta/lib/oe/license_finder.py index 097b324c58..be03e5d084 100644 --- a/meta/lib/oe/license_finder.py +++ b/meta/lib/oe/license_finder.py | |||
| @@ -14,16 +14,16 @@ import bb | |||
| 14 | 14 | ||
| 15 | logger = logging.getLogger("BitBake.OE.LicenseFinder") | 15 | logger = logging.getLogger("BitBake.OE.LicenseFinder") |
| 16 | 16 | ||
| 17 | def get_license_md5sums(d, static_only=False, linenumbers=False): | 17 | def get_license_md5sums(d): |
| 18 | import bb.utils | 18 | import bb.utils |
| 19 | import csv | 19 | import csv |
| 20 | md5sums = {} | 20 | md5sums = {} |
| 21 | if not static_only and not linenumbers: | 21 | |
| 22 | # Gather md5sums of license files in common license dir | 22 | # Gather md5sums of license files in common license dir |
| 23 | commonlicdir = d.getVar('COMMON_LICENSE_DIR') | 23 | commonlicdir = d.getVar('COMMON_LICENSE_DIR') |
| 24 | for fn in os.listdir(commonlicdir): | 24 | for fn in os.listdir(commonlicdir): |
| 25 | md5value = bb.utils.md5_file(os.path.join(commonlicdir, fn)) | 25 | md5value = bb.utils.md5_file(os.path.join(commonlicdir, fn)) |
| 26 | md5sums[md5value] = fn | 26 | md5sums[md5value] = fn |
| 27 | 27 | ||
| 28 | # The following were extracted from common values in various recipes | 28 | # The following were extracted from common values in various recipes |
| 29 | # (double checking the license against the license file itself, not just | 29 | # (double checking the license against the license file itself, not just |
| @@ -34,14 +34,9 @@ def get_license_md5sums(d, static_only=False, linenumbers=False): | |||
| 34 | csv_path = os.path.join(path, 'files', 'license-hashes.csv') | 34 | csv_path = os.path.join(path, 'files', 'license-hashes.csv') |
| 35 | if os.path.isfile(csv_path): | 35 | if os.path.isfile(csv_path): |
| 36 | with open(csv_path, newline='') as csv_file: | 36 | with open(csv_path, newline='') as csv_file: |
| 37 | fieldnames = ['md5sum', 'license', 'beginline', 'endline', 'md5'] | 37 | reader = csv.DictReader(csv_file, delimiter=',', fieldnames=['md5sum', 'license']) |
| 38 | reader = csv.DictReader(csv_file, delimiter=',', fieldnames=fieldnames) | ||
| 39 | for row in reader: | 38 | for row in reader: |
| 40 | if linenumbers: | 39 | md5sums[row['md5sum']] = row['license'] |
| 41 | md5sums[row['md5sum']] = ( | ||
| 42 | row['license'], row['beginline'], row['endline'], row['md5']) | ||
| 43 | else: | ||
| 44 | md5sums[row['md5sum']] = row['license'] | ||
| 45 | 40 | ||
| 46 | return md5sums | 41 | return md5sums |
| 47 | 42 | ||
