From a4aa6d713cba74210b3aeb16a1d5bf3b3a1a1075 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Thu, 29 Feb 2024 19:11:43 +0000 Subject: [PATCH 01/10] updates to build pmac on rtems --- .devcontainer/.bashrc | 84 ------------------- .devcontainer/devcontainer.json | 12 +-- .devcontainer/initializeCommand | 13 +-- .devcontainer/postCreateCommand | 27 +++--- .github/workflows/build.yml | 2 +- Dockerfile | 6 +- build | 9 +- ibek-support | 2 +- ioc/configure/CONFIG_SITE | 1 - ioc/configure/CONFIG_SITE.Common.linux-x86_64 | 1 + user_examples/.bashprofile_dev_container | 15 ---- user_examples/.bashrc_dev_container | 28 ------- user_examples/README.md | 13 --- 13 files changed, 31 insertions(+), 182 deletions(-) delete mode 100644 .devcontainer/.bashrc create mode 100644 ioc/configure/CONFIG_SITE.Common.linux-x86_64 delete mode 100644 user_examples/.bashprofile_dev_container delete mode 100644 user_examples/.bashrc_dev_container delete mode 100644 user_examples/README.md diff --git a/.devcontainer/.bashrc b/.devcontainer/.bashrc deleted file mode 100644 index 1a3a80e..0000000 --- a/.devcontainer/.bashrc +++ /dev/null @@ -1,84 +0,0 @@ -################################################################################ -# epics-containers developer shell configuration. -# This is a standard ubuntu .bashrc plus a PS1 prompt with container name -# and a call to .bashrc_dev_container in the user's home directory on the -# host machine. -################################################################################ - -# ~/.bashrc: executed by bash(1) for non-login shells. -# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) -# for examples - -# If not running interactively, don't do anything -[ -z "$PS1" ] && return - -# don't put duplicate lines in the history. See bash(1) for more options -# ... or force ignoredups and ignorespace -HISTCONTROL=ignoredups:ignorespace - -# append to the history file, don't overwrite it -shopt -s histappend - -# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) -HISTSIZE=1000 -HISTFILESIZE=2000 - -# check the window size after each command and, if necessary, -# update the values of LINES and COLUMNS. -shopt -s checkwinsize - -# make less more friendly for non-text input files, see lesspipe(1) -[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" - -# set variable identifying the chroot you work in (used in the prompt below) -if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then - debian_chroot=$(cat /etc/debian_chroot) -fi - -PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' - -# enable color support of ls and also add handy aliases -if [ -x /usr/bin/dircolors ]; then - test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - alias ls='ls --color=auto' - #alias dir='dir --color=auto' - #alias vdir='vdir --color=auto' - - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' -fi - -# some more ls aliases -alias ll='ls -alF' -alias la='ls -A' -alias l='ls -CF' - -# Alias definitions. -# You may want to put all your additions into a separate file like -# ~/.bash_aliases, instead of adding them here directly. -# See /usr/share/doc/bash-doc/examples in the bash-doc package. - -if [ -f ~/.bash_aliases ]; then - . ~/.bash_aliases -fi - -function parse_git_branch { - git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' -} - -# make a useful prompt, including current container name -EC_PROJECT=${EC_PROJECT:-container} -PS1="\[\e[32m\]\$(parse_git_branch)\[\e[m\][\[\e[34m\]\[\e[m\]\W]\$ " -export PS1="[\[\e[31m\]${EC_PROJECT#'ioc-'}\[\e[m\]]${PS1}" - -# ibek cli completion -source <(ibek --show-completion bash) - -# add user's custom .bashrc_dev_container -if [ -f ~/.bashrc_dev_container ]; then - . ~/.bashrc_dev_container -fi - - - diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9d2fd2d..4b185dd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -58,16 +58,6 @@ // we also mount the project folder into a know location in the container // this is where the ibek-support and ioc folders reside in the container build // in this way the devcontainer and runtime look very similar - "source=${localWorkspaceFolder},target=/epics/generic-source,type=bind", - // this provides eternal bash history in and out of the container - "source=${localEnv:HOME}/.bash_eternal_history,target=/root/.bash_eternal_history,type=bind", - // this bashrc hooks up the .bashrc_dev_container in the following mount - "source=${localWorkspaceFolder}/.devcontainer/.bashrc,target=/root/.bashrc,type=bind", - // provides a place for you to put your shell customizations for all your dev containers - "source=${localEnv:HOME}/.bashrc_dev_container,target=/root/.bashrc_dev_container,type=bind", - // provides a place to install any packages you want to have across all your dev containers - "source=${localEnv:HOME}/.bashprofile_dev_container,target=/root/.bashprofile_dev_container,type=bind", - // provides the same command line editing experience as your host - "source=${localEnv:HOME}/.inputrc,target=/root/.inputrc,type=bind" + "source=${localWorkspaceFolder},target=/epics/generic-source,type=bind" ] } \ No newline at end of file diff --git a/.devcontainer/initializeCommand b/.devcontainer/initializeCommand index 4f32aa2..732ec1f 100644 --- a/.devcontainer/initializeCommand +++ b/.devcontainer/initializeCommand @@ -1,15 +1,6 @@ #!/bin/bash -# make sure all the files we mount into the container exist -for i in \ - .bash_eternal_history \ - .bashrc_dev_container \ - .bashprofile_dev_container \ - .inputrc - do - if [ ! -f $HOME/$i ] ; then - touch $HOME/$i; - fi -done +# custom initialization goes here - runs outside of the dev container +# just before the container is launched but after the container is created echo "devcontainerID ${1}" diff --git a/.devcontainer/postCreateCommand b/.devcontainer/postCreateCommand index f8160b3..b0261da 100644 --- a/.devcontainer/postCreateCommand +++ b/.devcontainer/postCreateCommand @@ -1,5 +1,8 @@ #!/bin/bash +# Custom initialization goes here if needed. +# Runs inside the dev container after the container is created + ################################################################################ # When using docker we will not be root inside the container # the following steps are then required @@ -9,21 +12,21 @@ if [[ $USER != "root" ]] ; then # make sure the non-root user can build iocs and (mounted in) support modules sudo chown -R ${USER}:${USER} /epics/ibek-defs /epics/pvi-defs /epics/support/configure /venv sudo chown -h ${USER}:${USER} /epics /epics/ioc /epics/support - - # also give non-root user access to the same bash config we use in podman - sudo chmod a+rx /root - for f in .inputrc .bash_eternal_history .bashrc .bashrc_dev_container; do - sudo chmod a+rw /root/$f - ln -sf /root/$f $HOME/$f - done fi ################################################################################ -# Custom install script for each developer to add whatever they like to -# all epics-containers devcontainers +# Shell customizations for Generic IOC devcontainers ################################################################################ -# add user's custom profile container creation script -if [ -f ~/.bashprofile_dev_container ]; then - . ~/.bashprofile_dev_container +# add ibek completion to bash and zsh +echo 'source <(ibek --show-completion bash)' >> $HOME/.bashrc +echo 'source <(ibek --show-completion zsh)' >> $HOME/.zshrc + +# pick a theme that does not cause completion corruption in zsh +sed -i $HOME/.zshrc -e 's/ZSH_THEME="devcontainers"/ZSH_THEME="eastwood"/' + +# allow personalization of all devcontainers in this subdirectory +# by placing a .devcontainer_rc file in the workspace root +if [[ -f /workspaces/.devcontainer_rc ]] ; then + source /workspaces/.devcontainer_rc fi diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe03d58..3206449 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,7 +16,7 @@ jobs: max-parallel: 1 # take advantage of caching matrix: target: [developer, runtime] - architecture: [linux] + architecture: [linux, rtems] include: - os: ubuntu-latest platforms: linux/amd64 diff --git a/Dockerfile b/Dockerfile index 40b5d6f..a648310 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ##### build stage ############################################################## ARG TARGET_ARCHITECTURE -ARG BASE=7.0.7ec3 +ARG BASE=7.0.8ec1b1 ARG REGISTRY=ghcr.io/epics-containers FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS developer @@ -21,8 +21,8 @@ WORKDIR ${SOURCE_FOLDER}/ibek-support # copy the global ibek files COPY ibek-support/_global/ _global -COPY ibek-support/iocStats/ iocStats -RUN iocStats/install.sh 3.1.16 +# COPY ibek-support/iocStats/ iocStats +# RUN iocStats/install.sh 3.1.16 COPY ibek-support/asyn/ asyn/ RUN asyn/install.sh R4-42 diff --git a/build b/build index 7c5d905..f37afdc 100755 --- a/build +++ b/build @@ -17,11 +17,16 @@ set -xe cd $(dirname ${0}) # use docker if available else use podman -if ! docker version &>/dev/null; then alias docker=podman; fi +if ! docker version &>/dev/null; then docker=podman; else docker=docker; fi + +if ! $docker buildx version &>/dev/null; then + echo "buildx required. (install with 'apt install docker-buildx')" + exit 1 +fi # make sure new repos get their submodule ibek-support git submodule update --init # build and developer images -docker build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A --target $TARGET . +$docker buildx build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A --target $TARGET . diff --git a/ibek-support b/ibek-support index a0f9375..e5c2a2b 160000 --- a/ibek-support +++ b/ibek-support @@ -1 +1 @@ -Subproject commit a0f9375d41872377fd238be78df9d767dfbd9121 +Subproject commit e5c2a2b21d5fb13956eda652f6681054f1715d73 diff --git a/ioc/configure/CONFIG_SITE b/ioc/configure/CONFIG_SITE index 7eaf11b..64da6a6 100644 --- a/ioc/configure/CONFIG_SITE +++ b/ioc/configure/CONFIG_SITE @@ -1,5 +1,4 @@ # CONFIG_SITE -CROSS_COMPILER_TARGET_ARCHS = CHECK_RELEASE = NO diff --git a/ioc/configure/CONFIG_SITE.Common.linux-x86_64 b/ioc/configure/CONFIG_SITE.Common.linux-x86_64 new file mode 100644 index 0000000..02b85ae --- /dev/null +++ b/ioc/configure/CONFIG_SITE.Common.linux-x86_64 @@ -0,0 +1 @@ +VALID_BUILDS=Host diff --git a/user_examples/.bashprofile_dev_container b/user_examples/.bashprofile_dev_container deleted file mode 100644 index e5af527..0000000 --- a/user_examples/.bashprofile_dev_container +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -################################################################################ -# Custom profile for epics-containers devcontainer # -# # -# This will run inside the devcontainer after creation # -################################################################################ - -# apt-get update -# apt-get -y --no-install-recommends install vimdiff -# apt-get install what you like - -# add command line completion to the ibek tool -ibek --install-completion bash - diff --git a/user_examples/.bashrc_dev_container b/user_examples/.bashrc_dev_container deleted file mode 100644 index 0ca306a..0000000 --- a/user_examples/.bashrc_dev_container +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -################################################################################ -###### This is sourced by all terminals epics-containers IOC devcontainer ###### -###### personal .bashrc_dev for setting up environment in devcontainers ###### -################################################################################ - -export LS_OPTIONS='--color=auto' -eval "$(dircolors)" 2> /dev/null -alias ls='ls $LS_OPTIONS' -alias ll='ls $LS_OPTIONS -l' -alias l='ls $LS_OPTIONS -lA' - -# Save all history forever -# Add these to your user's .bashrc to keep a single history inside and out of containers -export HISTCONTROL=ignoreboth:erasedups # Remove adjacent duplicate entries -export HISTSIZE= # Unlimited history -export HISTFILESIZE= # Unlimited history -# Use a unique bash history file so it doesn't get manually trucated by applications -export HISTFILE=${HOME}/.bash_eternal_history -shopt -s histappend # Append to history, don't overwrite it -export PROMPT_COMMAND='history -a' - -# add git completion -if [[ ! -f /tmp/git-completion.bash ]]; then - wget -q -P /tmp https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash -fi -source /tmp/git-completion.bash diff --git a/user_examples/README.md b/user_examples/README.md deleted file mode 100644 index 94bc520..0000000 --- a/user_examples/README.md +++ /dev/null @@ -1,13 +0,0 @@ -User Customization Examples -=========================== - -Users can customize their epics-containers developer containers by copying -the files in this folder into their home directory and customizing them as -required. - -epics-containers .devcontainer configuration will automatically pick up -these files from the home directory. - -- .bashrc_dev_container: runs on start of every new shell in the container. -- /bashprofile_dev_container: runs once immediately after the creation - of a devcontainer. \ No newline at end of file From baffa86604da38fbf7f43e8be3ce5cba5088b218 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Thu, 29 Feb 2024 21:46:26 +0000 Subject: [PATCH 02/10] getting calc to compile and link in rtems --- .devcontainer/devcontainer.json | 2 +- Dockerfile | 11 ++++------- ibek-support | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4b185dd..390c549 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "dockerfile": "../Dockerfile", "target": "developer", "args": { - "TARGET_ARCHITECTURE": "linux" + "TARGET_ARCHITECTURE": "rtems" } }, "remoteEnv": { diff --git a/Dockerfile b/Dockerfile index a648310..0d25894 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,17 +33,14 @@ RUN autosave/install.sh R5-11 COPY ibek-support/busy/ busy/ RUN busy/install.sh R1-7-3 -COPY ibek-support/sscan/ sscan/ -RUN sscan/install.sh R2-11-6 - COPY ibek-support/calc/ calc/ RUN calc/install.sh R3-7-5 -COPY ibek-support/motor/ motor/ -RUN motor/install.sh R7-3-1 +# COPY ibek-support/motor/ motor/ +# RUN motor/install.sh R7-3-1 -COPY ibek-support/pmac/ pmac/ -RUN pmac/install.sh 2-6-2b1 +# COPY ibek-support/pmac/ pmac/ +# RUN pmac/install.sh 2-6-2b1 # get the ioc source and build it COPY ioc ${SOURCE_FOLDER}/ioc diff --git a/ibek-support b/ibek-support index e5c2a2b..a63530d 160000 --- a/ibek-support +++ b/ibek-support @@ -1 +1 @@ -Subproject commit e5c2a2b21d5fb13956eda652f6681054f1715d73 +Subproject commit a63530dd4b2106cb059c119577b8877263bafa8c From a5e90440c12a47cb1c799eb581e4108dbc57f80f Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Sun, 3 Mar 2024 09:58:32 +0000 Subject: [PATCH 03/10] RTEMS compile working --- .devcontainer/devcontainer.json | 8 +++----- .devcontainer/postCreateCommand | 2 +- Dockerfile | 11 ++++++----- build | 16 +++++++--------- ibek-support | 2 +- ioc/configure/CONFIG_SITE.Common.linux-x86_64 | 2 +- ioc/install.sh | 12 ++++++++++++ ioc/iocApp/src/Makefile | 4 ++-- 8 files changed, 33 insertions(+), 24 deletions(-) create mode 100755 ioc/install.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 390c549..8c51da6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "dockerfile": "../Dockerfile", "target": "developer", "args": { - "TARGET_ARCHITECTURE": "rtems" + "TARGET_ARCHITECTURE": "linux" } }, "remoteEnv": { @@ -39,11 +39,9 @@ ] } }, - // Make sure the files we are mapping into the container exist on the host - // You can place any other outside of the container before-launch commands here + // You can place any outside of the container before-launch commands here "initializeCommand": "bash .devcontainer/initializeCommand ${devcontainerId}", - // Hooks the global .bashprofile_dev_container but also can add any other commands - // to run in the container at creation in here + // One time global setup commands inside the container "postCreateCommand": "bash .devcontainer/postCreateCommand ${devcontainerId}", "runArgs": [ // Allow the container to access the host X11 display and EPICS CA diff --git a/.devcontainer/postCreateCommand b/.devcontainer/postCreateCommand index b0261da..def9745 100644 --- a/.devcontainer/postCreateCommand +++ b/.devcontainer/postCreateCommand @@ -23,7 +23,7 @@ echo 'source <(ibek --show-completion bash)' >> $HOME/.bashrc echo 'source <(ibek --show-completion zsh)' >> $HOME/.zshrc # pick a theme that does not cause completion corruption in zsh -sed -i $HOME/.zshrc -e 's/ZSH_THEME="devcontainers"/ZSH_THEME="eastwood"/' +sed -i $HOME/.zshrc -e 's/ZSH_THEME="devcontainers"/ZSH_THEME="dst"/' # allow personalization of all devcontainers in this subdirectory # by placing a .devcontainer_rc file in the workspace root diff --git a/Dockerfile b/Dockerfile index 0d25894..38fe620 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ WORKDIR ${SOURCE_FOLDER}/ibek-support # copy the global ibek files COPY ibek-support/_global/ _global +# TODO needs patching for rtems # COPY ibek-support/iocStats/ iocStats # RUN iocStats/install.sh 3.1.16 @@ -36,15 +37,15 @@ RUN busy/install.sh R1-7-3 COPY ibek-support/calc/ calc/ RUN calc/install.sh R3-7-5 -# COPY ibek-support/motor/ motor/ -# RUN motor/install.sh R7-3-1 +COPY ibek-support/motor/ motor/ +RUN motor/install.sh R7-3-1 -# COPY ibek-support/pmac/ pmac/ -# RUN pmac/install.sh 2-6-2b1 +COPY ibek-support/pmac/ pmac/ +RUN pmac/install.sh 2-6-2b1 # get the ioc source and build it COPY ioc ${SOURCE_FOLDER}/ioc -RUN cd ${IOC} && make +RUN cd ${IOC} && ./install.sh && make ##### runtime preparation stage ################################################ diff --git a/build b/build index f37afdc..67676b6 100755 --- a/build +++ b/build @@ -16,17 +16,15 @@ set -xe cd $(dirname ${0}) -# use docker if available else use podman +# use docker if available else use podman, also use buildx if available if ! docker version &>/dev/null; then docker=podman; else docker=docker; fi - -if ! $docker buildx version &>/dev/null; then - echo "buildx required. (install with 'apt install docker-buildx')" - exit 1 -fi +if $docker buildx version &>/dev/null; then builx=buildx; load=--load; fi # make sure new repos get their submodule ibek-support -git submodule update --init +# allow failure so that we can rebuild with dirty submodules +git submodule update --init || true -# build and developer images -$docker buildx build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A --target $TARGET . +$docker $buildx build -t ${TAG} $load \ + --build-arg TARGET_ARCHITECTURE=$T_A \ + --target $TARGET . diff --git a/ibek-support b/ibek-support index a63530d..0149383 160000 --- a/ibek-support +++ b/ibek-support @@ -1 +1 @@ -Subproject commit a63530dd4b2106cb059c119577b8877263bafa8c +Subproject commit 01493834b7dc1e608a384170fa038bb088b52a88 diff --git a/ioc/configure/CONFIG_SITE.Common.linux-x86_64 b/ioc/configure/CONFIG_SITE.Common.linux-x86_64 index 02b85ae..8b13789 100644 --- a/ioc/configure/CONFIG_SITE.Common.linux-x86_64 +++ b/ioc/configure/CONFIG_SITE.Common.linux-x86_64 @@ -1 +1 @@ -VALID_BUILDS=Host + diff --git a/ioc/install.sh b/ioc/install.sh new file mode 100755 index 0000000..03a2529 --- /dev/null +++ b/ioc/install.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# global install script for support all support modules to reference + +x86_cfg='./configure/CONFIG_SITE.Common.linux-x86_64' + +# for RTEMS builds don't build for the host architecture, target only +if [[ $TARGET_ARCHITECTURE == "rtems" ]]; then + touch ${x86_cfg} + sed -i '/VALID_BUILDS/d' ${x86_cfg} + echo "VALID_BUILDS=Host" >> ${x86_cfg} +fi diff --git a/ioc/iocApp/src/Makefile b/ioc/iocApp/src/Makefile index f7d5648..53abd95 100644 --- a/ioc/iocApp/src/Makefile +++ b/ioc/iocApp/src/Makefile @@ -12,8 +12,8 @@ ioc_DBD += $(shell cat /epics/support/configure/dbd_list) ioc_SRCS += ioc_registerRecordDeviceDriver.cpp -# add in the libs collected by ibek during container build -ioc_LIBS += $(shell cat /epics/support/configure/lib_list) +# add in the libs collected by ibek during container build (in reverse order) +ioc_LIBS += $(shell tac /epics/support/configure/lib_list) ioc_LIBS += $(EPICS_BASE_IOC_LIBS) ioc_SRCS += iocMain.cpp From bd9ca92653b7e43ddc4c267a41908736b1033e90 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Sun, 3 Mar 2024 12:20:57 +0000 Subject: [PATCH 04/10] restore iocStats --- .github/workflows/build.yml | 2 ++ Dockerfile | 4 ++-- ibek-support | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3206449..583fcd5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -53,6 +53,8 @@ jobs: load: true - name: Test image + # can't test rtems without some hardware to run on + if: ${{ matrix.architecture != 'rtems' }} run: tests/run-tests.sh - name: Push image diff --git a/Dockerfile b/Dockerfile index 38fe620..73b5dfd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,8 @@ WORKDIR ${SOURCE_FOLDER}/ibek-support COPY ibek-support/_global/ _global # TODO needs patching for rtems -# COPY ibek-support/iocStats/ iocStats -# RUN iocStats/install.sh 3.1.16 +COPY ibek-support/iocStats/ iocStats +RUN iocStats/install.sh 3.2.0 COPY ibek-support/asyn/ asyn/ RUN asyn/install.sh R4-42 diff --git a/ibek-support b/ibek-support index 0149383..15a657a 160000 --- a/ibek-support +++ b/ibek-support @@ -1 +1 @@ -Subproject commit 01493834b7dc1e608a384170fa038bb088b52a88 +Subproject commit 15a657ab5e94951a201ed4eb8757793b04fc63da From 1cc0c834ef61865c44f41e6c0055e683cd703168 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Sun, 3 Mar 2024 12:31:56 +0000 Subject: [PATCH 05/10] use multiple pipelines --- .github/workflows/build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 583fcd5..03fffd7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,7 +13,6 @@ jobs: packages: write strategy: fail-fast: false - max-parallel: 1 # take advantage of caching matrix: target: [developer, runtime] architecture: [linux, rtems] From ebe589905a859cf960e0003abf98bcc03f54ca50 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Mon, 4 Mar 2024 16:18:48 +0000 Subject: [PATCH 06/10] adopt template 3.2.0b1 --- .copier-answers.yml | 8 ++++++++ .github/dependabot.yml | 4 ---- Dockerfile | 3 +-- README.md | 19 +++++++++++++++---- build | 9 ++++----- ioc/start.sh | 22 ++++++++++++++++------ requirements.txt | 2 +- 7 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 .copier-answers.yml diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..2e49ebe --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,8 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +_commit: 3.2.0b1 +_src_path: gh:epics-containers/ioc-template +description: Generic IOC for the Delta Tau turbo pmac and power pmac motion controllers +git_platform: github.com +github_org: epics-containers +name: ioc-pmac +repo_uri: git@github.com:epics-containers/ioc-pmac.git diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5c6e6ec..b9e8b67 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,7 +6,3 @@ updates: directory: "/" schedule: interval: "daily" - - package-ecosystem: "pip" - directory: "/" - schedule: - interval: "daily" diff --git a/Dockerfile b/Dockerfile index 73b5dfd..c627b3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS develop # The devcontainer mounts the project root to /epics/generic-source # Using the same location here makes devcontainer/runtime differences transparent. ENV SOURCE_FOLDER=/epics/generic-source -# connect ioc source folder its know location +# connect ioc source folder to its know location RUN ln -s ${SOURCE_FOLDER}/ioc ${IOC} # Get latest ibek while in development. Will come from epics-base when stable @@ -21,7 +21,6 @@ WORKDIR ${SOURCE_FOLDER}/ibek-support # copy the global ibek files COPY ibek-support/_global/ _global -# TODO needs patching for rtems COPY ibek-support/iocStats/ iocStats RUN iocStats/install.sh 3.2.0 diff --git a/README.md b/README.md index 3530e3c..08ecdcd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,18 @@ -An epics-containers generic IOC source file for Delta Tau pmac motion controllers. +# Generic IOC Template Repository ioc-pmac -Generates a Generic IOC for running in a container and -creating IOC instances to control pmac motion controllers. +## Description +Generic IOC for the Delta Tau turbo pmac and power pmac motion controllers -See the https://epics-containers.github.io +## Template Info +This repository was generated by +[ioc-template](https://github.com/epics-containers/ioc-template) +To update to the latest version of the template: + +```bash +# activate a python virtual environment + +pip install copier +cd ioc-pmac +copier update -A --trust . +``` \ No newline at end of file diff --git a/build b/build index 67676b6..80ef712 100755 --- a/build +++ b/build @@ -16,15 +16,14 @@ set -xe cd $(dirname ${0}) -# use docker if available else use podman, also use buildx if available +# use docker if available else use podman if ! docker version &>/dev/null; then docker=podman; else docker=docker; fi if $docker buildx version &>/dev/null; then builx=buildx; load=--load; fi # make sure new repos get their submodule ibek-support -# allow failure so that we can rebuild with dirty submodules +# allow failure to support working with modified submodule git submodule update --init || true -$docker $buildx build -t ${TAG} $load \ - --build-arg TARGET_ARCHITECTURE=$T_A \ - --target $TARGET . +# build and developer images +$docker build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A $load --target $TARGET . diff --git a/ioc/start.sh b/ioc/start.sh index 344edef..a45b094 100755 --- a/ioc/start.sh +++ b/ioc/start.sh @@ -30,13 +30,23 @@ description=' 2. ioc.yaml ************************************************************* If the config folder contains a yaml file we invoke the ibek tool to generate the startup script and database. Then launch with the generated - startup script. The file name should be the name of the ioc with a 'yaml' - extension e.g. bl38p-ea-panda-02.yaml. Using a unique name allows for: + startup script. The file name should always be 'ioc.yaml'. The ioc instance + can determine its own name with the following as the first line in 'ioc.yaml' - ioc_name: "{{ ioc_yaml_file_name }}" + ioc_name: ""{{ __utils__.get_env('IOC_NAME') }}"" at the top of the file and in turn "{{ ioc_name }}"" can be used in any - of the fields within the file. + of the fields within the file. For example: by default Kubernetes will be + looking at the iocStats PV IOC_NAME:Uptime to validate health of the IOC, + therefore most IOC instances should include: + + entities: + - type: epics.EpicsEnvSet + name: EPICS_TZ + value: "GMT0BST" + + - type: devIocStats.iocAdminSoft + IOC: "{{ ioc_name | upper }}" 3. st.cmd + ioc.subst ********************************************************* If the config folder contains a st.cmd script and a ioc.subst file then @@ -121,7 +131,7 @@ elif [ -f ${ibek_src} ]; then # get the ibek support yaml files this ioc's support modules defs=/epics/ibek-defs/*.ibek.support.yaml - ibek runtime generate ${ibek_src} ${defs} --out ${final_ioc_startup} --db-out ${db_src} + ibek runtime generate ${ibek_src} ${defs} # build expanded database using msi if [ -f ${db_src} ]; then @@ -129,7 +139,7 @@ elif [ -f ${ibek_src} ]; then bash -c "msi -o${epics_db} ${includes} -I${RUNTIME_DIR} -S${db_src}" fi -# 2. st.cmd + ioc.subst ************************************************ +# 3. st.cmd + ioc.subst ************************************************ elif [ -f ${ioc_startup} ] ; then if [ -f ${CONFIG_DIR}/ioc.subst ]; then diff --git a/requirements.txt b/requirements.txt index ca6692b..c856080 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -ibek==1.6.3 +ibek==1.7.0 # to install direct from github during development in a branch # git+https://github.com/epics-containers/ibek.git@fix-extract-assets From e1b8b1c5e5d9b55379ee3dc16d8d13a5903e123a Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Mon, 4 Mar 2024 16:18:48 +0000 Subject: [PATCH 07/10] adopt template 3.2.0b1 --- .copier-answers.yml | 8 ++++++++ .github/dependabot.yml | 4 ---- Dockerfile | 3 +-- README.md | 19 +++++++++++++++---- build | 9 ++++----- ioc/start.sh | 22 ++++++++++++++++------ requirements.txt | 2 +- 7 files changed, 45 insertions(+), 22 deletions(-) create mode 100644 .copier-answers.yml diff --git a/.copier-answers.yml b/.copier-answers.yml new file mode 100644 index 0000000..2e49ebe --- /dev/null +++ b/.copier-answers.yml @@ -0,0 +1,8 @@ +# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY +_commit: 3.2.0b1 +_src_path: gh:epics-containers/ioc-template +description: Generic IOC for the Delta Tau turbo pmac and power pmac motion controllers +git_platform: github.com +github_org: epics-containers +name: ioc-pmac +repo_uri: git@github.com:epics-containers/ioc-pmac.git diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5c6e6ec..b9e8b67 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -6,7 +6,3 @@ updates: directory: "/" schedule: interval: "daily" - - package-ecosystem: "pip" - directory: "/" - schedule: - interval: "daily" diff --git a/Dockerfile b/Dockerfile index 73b5dfd..c627b3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS develop # The devcontainer mounts the project root to /epics/generic-source # Using the same location here makes devcontainer/runtime differences transparent. ENV SOURCE_FOLDER=/epics/generic-source -# connect ioc source folder its know location +# connect ioc source folder to its know location RUN ln -s ${SOURCE_FOLDER}/ioc ${IOC} # Get latest ibek while in development. Will come from epics-base when stable @@ -21,7 +21,6 @@ WORKDIR ${SOURCE_FOLDER}/ibek-support # copy the global ibek files COPY ibek-support/_global/ _global -# TODO needs patching for rtems COPY ibek-support/iocStats/ iocStats RUN iocStats/install.sh 3.2.0 diff --git a/README.md b/README.md index 3530e3c..08ecdcd 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,18 @@ -An epics-containers generic IOC source file for Delta Tau pmac motion controllers. +# Generic IOC Template Repository ioc-pmac -Generates a Generic IOC for running in a container and -creating IOC instances to control pmac motion controllers. +## Description +Generic IOC for the Delta Tau turbo pmac and power pmac motion controllers -See the https://epics-containers.github.io +## Template Info +This repository was generated by +[ioc-template](https://github.com/epics-containers/ioc-template) +To update to the latest version of the template: + +```bash +# activate a python virtual environment + +pip install copier +cd ioc-pmac +copier update -A --trust . +``` \ No newline at end of file diff --git a/build b/build index 67676b6..80ef712 100755 --- a/build +++ b/build @@ -16,15 +16,14 @@ set -xe cd $(dirname ${0}) -# use docker if available else use podman, also use buildx if available +# use docker if available else use podman if ! docker version &>/dev/null; then docker=podman; else docker=docker; fi if $docker buildx version &>/dev/null; then builx=buildx; load=--load; fi # make sure new repos get their submodule ibek-support -# allow failure so that we can rebuild with dirty submodules +# allow failure to support working with modified submodule git submodule update --init || true -$docker $buildx build -t ${TAG} $load \ - --build-arg TARGET_ARCHITECTURE=$T_A \ - --target $TARGET . +# build and developer images +$docker build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A $load --target $TARGET . diff --git a/ioc/start.sh b/ioc/start.sh index 344edef..a45b094 100755 --- a/ioc/start.sh +++ b/ioc/start.sh @@ -30,13 +30,23 @@ description=' 2. ioc.yaml ************************************************************* If the config folder contains a yaml file we invoke the ibek tool to generate the startup script and database. Then launch with the generated - startup script. The file name should be the name of the ioc with a 'yaml' - extension e.g. bl38p-ea-panda-02.yaml. Using a unique name allows for: + startup script. The file name should always be 'ioc.yaml'. The ioc instance + can determine its own name with the following as the first line in 'ioc.yaml' - ioc_name: "{{ ioc_yaml_file_name }}" + ioc_name: ""{{ __utils__.get_env('IOC_NAME') }}"" at the top of the file and in turn "{{ ioc_name }}"" can be used in any - of the fields within the file. + of the fields within the file. For example: by default Kubernetes will be + looking at the iocStats PV IOC_NAME:Uptime to validate health of the IOC, + therefore most IOC instances should include: + + entities: + - type: epics.EpicsEnvSet + name: EPICS_TZ + value: "GMT0BST" + + - type: devIocStats.iocAdminSoft + IOC: "{{ ioc_name | upper }}" 3. st.cmd + ioc.subst ********************************************************* If the config folder contains a st.cmd script and a ioc.subst file then @@ -121,7 +131,7 @@ elif [ -f ${ibek_src} ]; then # get the ibek support yaml files this ioc's support modules defs=/epics/ibek-defs/*.ibek.support.yaml - ibek runtime generate ${ibek_src} ${defs} --out ${final_ioc_startup} --db-out ${db_src} + ibek runtime generate ${ibek_src} ${defs} # build expanded database using msi if [ -f ${db_src} ]; then @@ -129,7 +139,7 @@ elif [ -f ${ibek_src} ]; then bash -c "msi -o${epics_db} ${includes} -I${RUNTIME_DIR} -S${db_src}" fi -# 2. st.cmd + ioc.subst ************************************************ +# 3. st.cmd + ioc.subst ************************************************ elif [ -f ${ioc_startup} ] ; then if [ -f ${CONFIG_DIR}/ioc.subst ]; then diff --git a/requirements.txt b/requirements.txt index ca6692b..c856080 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -ibek==1.6.3 +ibek==1.7.0 # to install direct from github during development in a branch # git+https://github.com/epics-containers/ibek.git@fix-extract-assets From 48ee1f59e000b4fef74418c6f26f10d3f7ecd7b5 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Tue, 5 Mar 2024 08:32:34 +0000 Subject: [PATCH 08/10] update to ibek-support with all changes --- ibek-support | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ibek-support b/ibek-support index 15a657a..4ac3142 160000 --- a/ibek-support +++ b/ibek-support @@ -1 +1 @@ -Subproject commit 15a657ab5e94951a201ed4eb8757793b04fc63da +Subproject commit 4ac314286df837998d5e3f4d2909d25a1eed2106 From bb83bdd6e0d413891366b095530d6bc8b8a22d35 Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Tue, 5 Mar 2024 08:34:25 +0000 Subject: [PATCH 09/10] update to template 3.2.0b3 --- .copier-answers.yml | 2 +- build | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.copier-answers.yml b/.copier-answers.yml index 2e49ebe..ca38853 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier; NEVER EDIT MANUALLY -_commit: 3.2.0b1 +_commit: 3.2.0b3 _src_path: gh:epics-containers/ioc-template description: Generic IOC for the Delta Tau turbo pmac and power pmac motion controllers git_platform: github.com diff --git a/build b/build index 80ef712..c1aacfd 100755 --- a/build +++ b/build @@ -21,8 +21,7 @@ if ! docker version &>/dev/null; then docker=podman; else docker=docker; fi if $docker buildx version &>/dev/null; then builx=buildx; load=--load; fi # make sure new repos get their submodule ibek-support -# allow failure to support working with modified submodule -git submodule update --init || true +if [ ! -d ibek-support ] ; then git submodule update --init ; fi # build and developer images $docker build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A $load --target $TARGET . From 4a065fc88e2613c7dd1e41b0a9a222550531372a Mon Sep 17 00:00:00 2001 From: Giles Knap Date: Tue, 5 Mar 2024 15:38:44 +0000 Subject: [PATCH 10/10] add sequencer in Dockerfile --- .devcontainer/devcontainer.json | 2 +- Dockerfile | 12 +++++++++--- build | 8 ++++---- ibek-support | 2 +- 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 8c51da6..f057bad 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "dockerfile": "../Dockerfile", "target": "developer", "args": { - "TARGET_ARCHITECTURE": "linux" + "TARGET_ARCHITECTURE": "rtems" } }, "remoteEnv": { diff --git a/Dockerfile b/Dockerfile index c627b3f..f98c30e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ##### build stage ############################################################## ARG TARGET_ARCHITECTURE -ARG BASE=7.0.8ec1b1 +ARG BASE=7.0.8ec1b3 ARG REGISTRY=ghcr.io/epics-containers FROM ${REGISTRY}/epics-base-${TARGET_ARCHITECTURE}-developer:${BASE} AS developer @@ -21,17 +21,23 @@ WORKDIR ${SOURCE_FOLDER}/ibek-support # copy the global ibek files COPY ibek-support/_global/ _global +COPY ibek-support/sequencer sequencer +RUN sequencer/install.sh R2-2-9 + COPY ibek-support/iocStats/ iocStats RUN iocStats/install.sh 3.2.0 COPY ibek-support/asyn/ asyn/ -RUN asyn/install.sh R4-42 +RUN asyn/install.sh R4-44-2 COPY ibek-support/autosave/ autosave/ RUN autosave/install.sh R5-11 COPY ibek-support/busy/ busy/ -RUN busy/install.sh R1-7-3 +RUN busy/install.sh R1-7-4 + +COPY ibek-support/sscan/ sscan/ +RUN sscan/install.sh R2-11-6 COPY ibek-support/calc/ calc/ RUN calc/install.sh R3-7-5 diff --git a/build b/build index c1aacfd..8091be7 100755 --- a/build +++ b/build @@ -1,7 +1,7 @@ #!/bin/bash ################################################################################ -# generic local build script for epics-containers ioc repositories # +# generic local build script for epics-containers repositories # ################################################################################ # set TARGET_ARCHITECTURE to rtems for RTEMS based targets @@ -11,7 +11,7 @@ TARGET=${TARGET:-developer} # set TAG to override the default tag TAG=${TAG:-ec_test} -# log commands and stop on erros +# log commands and stop on errors set -xe cd $(dirname ${0}) @@ -24,5 +24,5 @@ if $docker buildx version &>/dev/null; then builx=buildx; load=--load; fi if [ ! -d ibek-support ] ; then git submodule update --init ; fi # build and developer images -$docker build -t ${TAG} --build-arg TARGET_ARCHITECTURE=$T_A $load --target $TARGET . - +$docker build $buildx -t ${TAG} --build-arg \ + TARGET_ARCHITECTURE=$T_A $load --target $TARGET . diff --git a/ibek-support b/ibek-support index 4ac3142..dd34444 160000 --- a/ibek-support +++ b/ibek-support @@ -1 +1 @@ -Subproject commit 4ac314286df837998d5e3f4d2909d25a1eed2106 +Subproject commit dd34444d0a5b0433c05e9757bf8e213e6c0d952f