diff options
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/recipetool/create.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index a8c4cdef4a..277266be4e 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -1002,11 +1002,11 @@ def handle_license_vars(srctree, lines_before, handled, extravalues, d): | |||
1002 | handled.append(('license', licvalues)) | 1002 | handled.append(('license', licvalues)) |
1003 | return licvalues | 1003 | return licvalues |
1004 | 1004 | ||
1005 | def get_license_md5sums(d, static_only=False): | 1005 | def get_license_md5sums(d, static_only=False, linenumbers=False): |
1006 | import bb.utils | 1006 | import bb.utils |
1007 | import csv | 1007 | import csv |
1008 | md5sums = {} | 1008 | md5sums = {} |
1009 | if not static_only: | 1009 | if not static_only and not linenumbers: |
1010 | # Gather md5sums of license files in common license dir | 1010 | # Gather md5sums of license files in common license dir |
1011 | commonlicdir = d.getVar('COMMON_LICENSE_DIR') | 1011 | commonlicdir = d.getVar('COMMON_LICENSE_DIR') |
1012 | for fn in os.listdir(commonlicdir): | 1012 | for fn in os.listdir(commonlicdir): |
@@ -1024,10 +1024,14 @@ def get_license_md5sums(d, static_only=False): | |||
1024 | csv_path = os.path.join(path, 'lib', 'recipetool', 'licenses.csv') | 1024 | csv_path = os.path.join(path, 'lib', 'recipetool', 'licenses.csv') |
1025 | if os.path.isfile(csv_path): | 1025 | if os.path.isfile(csv_path): |
1026 | with open(csv_path, newline='') as csv_file: | 1026 | with open(csv_path, newline='') as csv_file: |
1027 | fieldnames = ['md5sum', 'license'] | 1027 | fieldnames = ['md5sum', 'license', 'beginline', 'endline', 'md5'] |
1028 | reader = csv.DictReader(csv_file, delimiter=',', fieldnames=fieldnames) | 1028 | reader = csv.DictReader(csv_file, delimiter=',', fieldnames=fieldnames) |
1029 | for row in reader: | 1029 | for row in reader: |
1030 | md5sums[row['md5sum']] = row['license'] | 1030 | if linenumbers: |
1031 | md5sums[row['md5sum']] = ( | ||
1032 | row['license'], row['beginline'], row['endline'], row['md5']) | ||
1033 | else: | ||
1034 | md5sums[row['md5sum']] = row['license'] | ||
1031 | 1035 | ||
1032 | return md5sums | 1036 | return md5sums |
1033 | 1037 | ||