Skip to content

Commit

Permalink
fix copy logic again
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Mar 20, 2024
1 parent 8bce0fe commit 273d9f2
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/rtems_proxy/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,24 @@ def copy_rtems():
"""
Copy RTEMS binaries to a location where the RTEMS IOC can access them
"""
# root of pvc mount into which we copy the IOC files for the RTEMS IOC to access
root = GLOBALS.RTEMS_ROOT
ioc_bins = (GLOBALS.IOC / "bin") / GLOBALS.EPICS_TARGET_ARCH
bin_dest = root / "bin"
# root of the path that the RTEMS IOC expects to find the IOC files
rtems_root = Path("/iocs") / GLOBALS.IOC_GROUP / GLOBALS.IOC_NAME
# the binary blob to load into the RTEMS IOC via TFTP
ioc_bin = (GLOBALS.IOC / "bin") / GLOBALS.EPICS_TARGET_ARCH / "ioc.boot"
# where to copy the Generic IOC folder to (at present only holds the dbd folder)
dest_ioc = root / "ioc"

# because we are moving the ioc files we need to fix up startup script paths
startup = GLOBALS.RUNTIME / "st.cmd"
cmd_txt = startup.read_text()
cmd_txt = re.sub("/epics/", str(root), cmd_txt)
cmd_txt = re.sub("/epics/", f"{str(rtems_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 / "ioc", symlinks=True, dirs_exist_ok=True)
Path.mkdir(dest_ioc, exist_ok=True)
shutil.copytree(GLOBALS.IOC / "dbd", dest_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)
shutil.copy(ioc_bin, root)

0 comments on commit 273d9f2

Please sign in to comment.