Skip to content
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

Create symbolic links in db for devices with identical fabric #1889

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,18 @@ db-format-$(1):
@$(IN_ENV) cd database/$(1); python3 ../../utils/sort_db.py
@if [ -e database/Info.md ]; then $(IN_ENV) ./utils/info_md.py --keep; fi

.PHONY: db-prepare-$(1) db-$(1) db-check-$(1) db-format-$(1) db-extras-$(1) db-extras-$(1)-parts db-extra-$(1)-roi db-extras-$(1)-harness
db-extras-$(1)-links:
@source settings/$(1).sh && $(IN_ENV) ./utils/create_db_links.py

db-extras-$(1): db-extras-$(1)-parts db-extras-$(1)-roi db-extras-$(1)-harness
.PHONY: db-prepare-$(1) db-$(1) db-check-$(1) db-format-$(1) db-extras-$(1) db-extras-$(1)-parts db-extra-$(1)-roi db-extras-$(1)-harness db-extras-$(1)-links

db-extras-$(1): db-extras-$(1)-parts db-extras-$(1)-roi db-extras-$(1)-harness db-extras-$(1)-links

db-$(1)-all: db-$(1) db-extras-$(1)-parts
# Build harnesses after database is complete
$$(MAKE) db-extras-$(1)-roi
$$(MAKE) db-extras-$(1)-harness
$$(MAKE) db-extras-$(1)-links

db-check: db-check-$(1)
db-format: db-format-$(1)
Expand Down
40 changes: 40 additions & 0 deletions utils/create_db_links.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 The SymbiFlow Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
import argparse
import os
from prjxray import util


def main():
"""Script for creating symlinks to device files within the db directory
in case a device has an identical fabric.

"""
parser = argparse.ArgumentParser(
description="Creates symlinks for devices with identical fabric.")

util.db_root_arg(parser)
args = parser.parse_args()

# Create links for all devices listed in the devices.yaml mapping file
devices = util.get_devices(args.db_root)
for device in devices:
dst = os.path.join(args.db_root, device)
if os.path.exists(dst):
continue
fabric = devices[device]['fabric']
src = os.path.join(args.db_root, fabric)
assert os.path.exists(src), "Fabric db files don't exist"
os.symlink(src, dst)


if __name__ == '__main__':
main()