-
Notifications
You must be signed in to change notification settings - Fork 257
Adding Lockfile #728
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
Merged
Merged
Adding Lockfile #728
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
7f18db5
Load and store lockfile
blueluna 911877d
Updated lock file format
blueluna 6775543
Default to not using lockfile
blueluna e12886d
Control lockfile usage from command line
blueluna 2fb78ed
Initial testing of version fixup from lockfile
blueluna 1d2831c
Version comparison changes
blueluna 9877808
Added tests for vlvn compare_relation
blueluna 017d822
Minor changes
blueluna 837c249
Use lockfile argument as file path, do not write lock file.
blueluna b3975f5
Focus on loading lock file
blueluna 4fe597a
Fixed lockfile virtual mapping issue, added tests
blueluna e200b3c
Remove virtuals from lockfile
blueluna 2cad3ab
Added warning for partial lock file
blueluna 5d85323
Review update
blueluna 5f67a2b
Added support for pinning top core.
blueluna 9681cc9
Changed lock file to contain map of cores
blueluna 4be367b
Added try block for loading lock file, minor fixes
blueluna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import json | ||
import logging | ||
import os | ||
import pathlib | ||
|
||
import fastjsonschema | ||
|
||
import fusesoc.utils | ||
from fusesoc.version import version | ||
from fusesoc.vlnv import Vlnv | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
lockfile_schema = """ | ||
{ | ||
"$schema": "https://json-schema.org/draft/2020-12/schema", | ||
"title": "FuseSoC Lockfile", | ||
"description": "FuseSoC Lockfile", | ||
"type": "object", | ||
"properties": { | ||
"cores": { | ||
"description": "Cores used in the build", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"description": "Core VLVN", | ||
"type": "string" | ||
} | ||
} | ||
} | ||
}, | ||
"fusesoc_version": { | ||
"description": "FuseSoC version which generated the lockfile", | ||
"type": "string" | ||
}, | ||
"lockfile_version": { | ||
"description": "Lockfile version", | ||
"type": "integer" | ||
} | ||
} | ||
} | ||
""" | ||
|
||
|
||
def load_lockfile(filepath: pathlib.Path): | ||
try: | ||
lockfile_data = fusesoc.utils.yaml_fread(filepath) | ||
try: | ||
validator = fastjsonschema.compile( | ||
json.loads(lockfile_schema), detailed_exceptions=False | ||
) | ||
validator(lockfile_data) | ||
except fastjsonschema.JsonSchemaDefinitionException as e: | ||
raise SyntaxError(f"Error parsing JSON Schema: {e}") | ||
except fastjsonschema.JsonSchemaException as e: | ||
raise SyntaxError(f"Error validating {e}") | ||
except FileNotFoundError: | ||
logger.warning(f"Lockfile {filepath} not found") | ||
return None | ||
|
||
cores = {} | ||
for core in lockfile_data.setdefault("cores", []): | ||
if "name" in core: | ||
vlnv = Vlnv(core["name"]) | ||
vln = vlnv.vln_str() | ||
if vln in map(Vlnv.vln_str, cores.keys()): | ||
raise SyntaxError(f"Core {vln} defined multiple times in lock file") | ||
cores[vlnv] = {"name": vlnv} | ||
else: | ||
raise SyntaxError(f"Core definition without a name") | ||
lockfile = { | ||
"cores": cores, | ||
} | ||
return lockfile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CAPI=2: | ||
# Copyright FuseSoC contributors | ||
# Licensed under the 2-Clause BSD License, see LICENSE for details. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
name: ::dependencies-top | ||
|
||
filesets: | ||
fs1: | ||
depend: | ||
- '>::used:1.0' | ||
|
||
targets: | ||
default: | ||
filesets: | ||
- fs1 | ||
toplevel: | ||
- top |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CAPI=2: | ||
# Copyright FuseSoC contributors | ||
# Licensed under the 2-Clause BSD License, see LICENSE for details. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
name: ::used:1.0 | ||
filesets: | ||
rtl: | ||
files: | ||
- used-1.0.sv | ||
file_type: systemVerilogSource | ||
|
||
|
||
targets: | ||
default: | ||
filesets: | ||
- rtl | ||
toplevel: used_1_0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CAPI=2: | ||
# Copyright FuseSoC contributors | ||
# Licensed under the 2-Clause BSD License, see LICENSE for details. | ||
# SPDX-License-Identifier: BSD-2-Clause | ||
|
||
name: ::used:1.1 | ||
filesets: | ||
rtl: | ||
files: | ||
- used-1.1.sv | ||
file_type: systemVerilogSource | ||
|
||
|
||
targets: | ||
default: | ||
filesets: | ||
- rtl | ||
toplevel: used_1_1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cores: | ||
- name: "::used:1.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
cores: | ||
- name: "::used:1.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
cores: | ||
- name: "::used:1.1" | ||
- name: "::dependencies-top:0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
lockfile_version: 1 | ||
fusesoc_version: 2.4.2 | ||
cores: | ||
- name: ":lib:pin:0.1" | ||
- name: ":lib:pin:0.2" | ||
- name: ":lib:gpio:0.1" | ||
- name: ":common:gpio_ctrl:0.1" | ||
- name: ":product:toppy:0.1" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
lockfile_version: 1 | ||
fusesoc_version: 2.4.2 | ||
cores: | ||
- name: ":lib:pin:0.1" | ||
- name: ":lib:gpio:0.1" | ||
- name: ":common:gpio_ctrl:0.1" | ||
- name: ":product:toppy:0.1" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.