Skip to content

Commit

Permalink
Merge pull request #192 from epics-containers/improve-runtime
Browse files Browse the repository at this point in the history
streamline the asset copying to runtime target
  • Loading branch information
gilesknap authored Mar 24, 2024
2 parents 3d2af27 + 55417cf commit 03015d9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 14 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ generating IOC Instances from those Generic IOCs at container runtime. It is
targetted at running IOCs in Kubernetes, but the images it
creates can execute in any container runtime, such as docker or podman.


============== ==============================================================
PyPI ``pip install ibek``
Source code https://github.com/epics-containers/ibek
Expand Down
31 changes: 18 additions & 13 deletions src/ibek/ioc_cmds/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,31 @@ def extract_assets(
GLOBALS.IBEK_DEFS,
IOC_FOLDER, # get the IOC folder symlink
Path.readlink(IOC_FOLDER), # get contents of IOC folder
]
Path("/venv"), # get the virtualenv
] + list(
source.glob("ibek*")
) # get ibek-support and related folders
else:
default_assets = []

# folder names with binary files in them
binary = ["bin", "lib"]

# move the default assets and extras in their entirety
extra_files = default_assets + extras
for asset in extra_files:
src = source / asset
if src.exists():
dest_file = destination / asset.relative_to("/")
if dry_run:
typer.echo(f"Would move extra asset {src} to {dest_file} with {binary}")
else:
move_file(src, dest_file, binary)
else:
typer.echo(f"WARNING: runtime asset {src} missing")

# identify EPICS modules as folders with binary output folders
# and move only their output folders as specified by asset_matches
binaries: List[Path] = []
for find in binary:
# only look two levels deep
Expand Down Expand Up @@ -99,15 +116,3 @@ def extract_assets(
typer.echo(f"Would move {src} to {dest_file} with {binary}")
else:
move_file(src, dest_file, binary)

extra_files = default_assets + extras
for asset in extra_files:
src = source / asset
if src.exists():
dest_file = destination / asset.relative_to("/")
if dry_run:
typer.echo(f"Would move extra asset {src} to {dest_file} with {binary}")
else:
move_file(src, dest_file, binary)
else:
typer.echo(f"WARNING: runtime asset {src} missing")
6 changes: 5 additions & 1 deletion src/ibek/support_cmds/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ def compile(
path = SUPPORT / module

command = f"make -C {path} -j $(nproc) " + " ".join(ctx.args)
exit(subprocess.call(["bash", "-c", command]))
result = subprocess.call(["bash", "-c", command])
# save size of developer container with make clean
command = f"make -C {path} -j $(nproc) clean"
subprocess.call(["bash", "-c", command])
exit(result)


@support_cli.command()
Expand Down

0 comments on commit 03015d9

Please sign in to comment.