Skip to content

Commit

Permalink
fix copy logic
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Mar 20, 2024
1 parent 9f94bf3 commit 8bce0fe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/rtems_proxy/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ def copy_rtems():
"""
Copy RTEMS binaries to a location where the RTEMS IOC can access them
"""
root = GLOBALS.RTEMS_ROOT / GLOBALS.IOC_GROUP / GLOBALS.IOC_NAME
ioc_bins = GLOBALS.IOC / "bin" / GLOBALS.EPICS_TARGET_ARCH
root = GLOBALS.RTEMS_ROOT
ioc_bins = (GLOBALS.IOC / "bin") / GLOBALS.EPICS_TARGET_ARCH
bin_dest = root / "bin"

# because we are moving the ioc files we need to fix up startup script paths
startup = GLOBALS.IOC / "st.cmd"
startup = GLOBALS.RUNTIME / "st.cmd"
cmd_txt = startup.read_text()
cmd_txt = re.sub("/epics/", str(root), cmd_txt)
startup.write_text(cmd_txt)

# move all the files needed for runtime into the PVC that is being shared
# over nfs/tftp by the nfsv2-tftp service
shutil.copytree(GLOBALS.IOC, root, symlinks=True)
shutil.copytree(GLOBALS.RUNTIME, root)
shutil.copytree(GLOBALS.IOC, root / "ioc", symlinks=True, dirs_exist_ok=True)
shutil.copytree(GLOBALS.RUNTIME, root / "runtime", dirs_exist_ok=True)
Path.mkdir(bin_dest, exist_ok=True)
shutil.move(ioc_bins / "ioc.boot", bin_dest)
16 changes: 5 additions & 11 deletions src/rtems_proxy/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,15 @@ def __init__(self) -> None:

self.RUNTIME = self.EPICS_ROOT / "runtime"

self.EPICS_HOST_ARCH = os.getenv("EPICS_HOST_ARCH")
self.EPICS_HOST_ARCH = os.getenv("EPICS_HOST_ARCH", DEFAULT_ARCH)
""" Host architecture """

self.EPICS_TARGET_ARCH = os.getenv("EPICS_TARGET_ARCH")
self.EPICS_TARGET_ARCH = os.getenv("EPICS_TARGET_ARCH", DEFAULT_ARCH)
""" Cross compilation target architecture """

self.IOC = os.getenv("IOC")
self.IOC = Path(os.getenv("IOC", self.EPICS_ROOT / "ioc"))
""" The root folder for IOC source and binaries """

self.EPICS_HOST_ARCH = os.getenv("EPICS_HOST_ARCH")
""" Host architecture """

self.EPICS_HOST_ARCH = os.getenv("EPICS_HOST_ARCH")
""" Host architecture """

# TODO in future, shall we drop the RTEMS prefix and make this module
# generic?

Expand All @@ -59,10 +53,10 @@ def __init__(self) -> None:
self.RTEMS_CONSOLE = os.getenv("RTEMS_CONSOLE", "NO_CONSOLE")
""" address:port to connect to the IOC console """

self.IOC_NAME = os.getenv("IOC_NAME")
self.IOC_NAME = os.getenv("IOC_NAME", "NO_IOC_NAME")
""" the name of this IOC """

self.IOC_GROUP = os.getenv("IOC_GROUP")
self.IOC_GROUP = os.getenv("IOC_GROUP", "NO_IOC_GROUP")
""" the name of the repository that this IOC is grouped into """


Expand Down

0 comments on commit 8bce0fe

Please sign in to comment.