diff options
Diffstat (limited to 'src/hydrilla_builder/build.py')
-rw-r--r-- | src/hydrilla_builder/build.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/hydrilla_builder/build.py b/src/hydrilla_builder/build.py index e70e360..dcd7e01 100644 --- a/src/hydrilla_builder/build.py +++ b/src/hydrilla_builder/build.py @@ -280,7 +280,8 @@ class Build: root_dir_path = Path(root_dir_name) def zippath(file_path): - return str(root_dir_path / file_path.relative_to(self.srcdir)) + file_path = root_dir_path / file_path.relative_to(self.srcdir) + return file_path.as_posix() with zipfile.ZipFile(fb, 'w') as xpi: for file_ref in self.files_by_path.values(): @@ -295,6 +296,9 @@ class Build: """ Process 'item_def' as definition of a resource/mapping and store in memory its processed form and files used by it. + + Return a minimal item reference suitable for using in source + description. """ copy_props = ['type', 'identifier', 'long_name', 'uuid', 'description'] if 'comment' in item_def: @@ -326,9 +330,14 @@ class Build: new_item_obj['version'] = normalize_version(item_def['version']) new_item_obj['api_schema_version'] = [1, 0, 1] + new_item_obj['source_copyright'] = self.copyright_file_refs + new_item_obj['source_name'] = self.source_name item_list.append(new_item_obj) + return dict([(prop, new_item_obj[prop]) + for prop in ('type', 'identifier', 'version')]) + def _process_index_json(self, index_obj: dict): """ Process 'index_obj' as contents of source package's index.json and store @@ -338,6 +347,8 @@ class Build: """ jsonschema.validate(index_obj, index_json_schema) + self.source_name = index_obj['source_name'] + generate_spdx = index_obj.get('reuse_generate_spdx_report', False) if generate_spdx: contents = generate_spdx_report(self.srcdir) @@ -347,7 +358,7 @@ class Build: spdx_ref.include_in_zipfile = False self.files_by_path[spdx_path] = spdx_ref - copyright_file_refs = \ + self.copyright_file_refs = \ [self._process_file(f['file']) for f in index_obj['copyright']] if generate_spdx and not spdx_ref.include_in_distribution: @@ -358,7 +369,7 @@ class Build: for file_ref in index_obj.get('additional_files', []): self._process_file(file_ref['file'], include_in_distribution=False) - root_dir_path = Path(index_obj['source_name']) + root_dir_path = Path(self.source_name) source_archives_obj = { 'zip' : { @@ -368,8 +379,8 @@ class Build: self.source_description = { 'api_schema_version': [1, 0, 1], - 'source_name': index_obj['source_name'], - 'source_copyright': copyright_file_refs, + 'source_name': self.source_name, + 'source_copyright': self.copyright_file_refs, 'upstream_url': index_obj['upstream_url'], 'definitions': item_refs, 'source_archives': source_archives_obj |