Skip to content

Commit

Permalink
fixup generate-bom.py
Browse files Browse the repository at this point in the history
  • Loading branch information
neoaggelos committed May 10, 2024
1 parent e3d3dbf commit b87ac5a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions build-scripts/generate-bom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
SNAPCRAFT_PART_BUILD = Path(os.getenv("SNAPCRAFT_PART_BUILD", ""))
SNAPCRAFT_PART_INSTALL = Path(os.getenv("SNAPCRAFT_PART_INSTALL", ""))

BUILD_DIRECTORY = SNAPCRAFT_PART_BUILD.exists() and SNAPCRAFT_PART_BUILD or DIR / ".build"
INSTALL_DIRECTORY = SNAPCRAFT_PART_INSTALL.exists() and SNAPCRAFT_PART_INSTALL or DIR / ".install"
BUILD_DIRECTORY = (
SNAPCRAFT_PART_BUILD.exists() and SNAPCRAFT_PART_BUILD or DIR / ".build"
)
INSTALL_DIRECTORY = (
SNAPCRAFT_PART_INSTALL.exists() and SNAPCRAFT_PART_INSTALL or DIR / ".install"
)

# List of tools used to build or bundled in the snap
TOOLS = {
Expand Down Expand Up @@ -51,11 +55,15 @@ def _read_file(path: Path) -> str:
component_dir = DIR / "components" / component

try:
version = _read_file([component_dir / "version"])
patches = _parse_output([sys.executable, DIR / "print-patches-for.py", component, version])
version = _read_file(component_dir / "version")
patches = _parse_output(
[sys.executable, DIR / "print-patches-for.py", component, version]
)
clean_patches = []
if patches:
clean_patches = [p[p.find("build-scripts/") :] for p in patches.split("\n")]
clean_patches = [
p[p.find("build-scripts/") :] for p in patches.split("\n")
]

BOM["components"][component] = {
"repository": _read_file(component_dir / "repository"),
Expand Down

0 comments on commit b87ac5a

Please sign in to comment.