diff --git a/src/rtems_proxy/copy.py b/src/rtems_proxy/copy.py index 5b2736c..67dbf0f 100644 --- a/src/rtems_proxy/copy.py +++ b/src/rtems_proxy/copy.py @@ -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) diff --git a/src/rtems_proxy/globals.py b/src/rtems_proxy/globals.py index 8ee26b7..35e346c 100644 --- a/src/rtems_proxy/globals.py +++ b/src/rtems_proxy/globals.py @@ -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? @@ -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 """