Skip to content

Commit 1b92c0c

Browse files
committed
update tutorials with ansible build changes
1 parent cb8715b commit 1b92c0c

File tree

2 files changed

+101
-154
lines changed

2 files changed

+101
-154
lines changed

docs/tutorials/debug_generic_ioc.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,17 @@ In this tutorial we will look debugging the build from *inside* the container.
2626

2727
Let us break the build of our ioc-lakeshore340 project in the last
2828
tutorial. Open the the file
29-
`ioc-lakeshore340/ibek-support/StreamDevice/install.sh`.
30-
Comment out the apt-install line like this:
29+
`ioc-lakeshore340/ibek-support/StreamDevice/StreamDevice.install.yml`.
30+
Comment out the app_developer section like this:
3131

32-
```bash
33-
# ibek support apt-install libpcre3-dev
32+
```yaml
33+
# apt_developer:
34+
# - libpcre3-dev
3435
```
3536

36-
Now rebuild the container - do this command from a new terminal *outside* of
37-
the devcontainer:
37+
This removes installation of the system dependency on the `libpcre3-dev` package and StreamDevice will therefore fail to build.
38+
39+
Now rebuild the container - do this command from a new terminal *outside* of the devcontainer:
3840

3941
```bash
4042
# for docker users - builkit complicates debugging at present
@@ -66,21 +68,21 @@ investigate the build failure by running a shell in the container.
6668
- scroll up the page until you see the last successful build step e.g.
6769

6870
```bash
69-
STEP 14/19: COPY ibek-support/StreamDevice/ StreamDevice/
70-
--> 631291db1751
71-
STEP 15/19: RUN StreamDevice/install.sh 2.8.24
71+
--> 43eb74c72eab
72+
STEP 17/22: COPY ibek-support/StreamDevice/ StreamDevice
73+
--> da81452bc214
74+
STEP 18/22: RUN ansible.sh StreamDevice
7275
... etc ...
7376
```
7477

75-
- copy the hash of the step you want to debug e.g. `631291db1751` in this case
76-
- `docker run -it --entrypoint /bin/bash 631291db1751 # (the hash you copied)`
78+
- copy the hash of the step you want to debug e.g. `da81452bc214` in this case
79+
- `docker run -it --entrypoint /bin/bash da81452bc214 # (the hash you copied)`
7780

7881
Now we have a prompt inside the part-built container and can retry the failed
7982
command.
8083

8184
```bash
82-
cd /workspaces/ioc-lakeshore340/ibek-support
83-
StreamDevice/install.sh 2.8.24
85+
ansible.sh StreamDevice
8486
```
8587

8688
You should see the same error again.
@@ -129,28 +131,29 @@ Now we can install the missing package in the container and retry the build:
129131

130132
```bash
131133
apt-get install -y libpcre3-dev
132-
StreamDevice/install.sh 2.8.24
134+
ansible.sh StreamDevice
133135
```
134136

135-
You should find the build succeeds. But this is not the whole story. There
136-
is another line in `install.h` that I added to make this work:
137+
You should find the build succeeds. But this is not the whole story. There is another section in `StreamDevice.install.yml` that I added to make this work:
137138

138-
```bash
139-
ibek support add-config-macro ${NAME} PCRE_LIB /usr/lib/x86_64gnu
139+
```yaml
140+
patch_lines:
141+
- path: "{{ config_linux_host }}"
142+
regexp: PCRE_LIB
143+
line: PCRE_LIB=/usr/lib/x86_64-linux-gnu
144+
when: "{{ is_linux }}"
140145
```
141146

142147
This added a macro to `CONFIG_SITE.linux-x86_64.Common` that tells the
143148
Makefiles to add an extra include path to the compiler command line. working
144149
out how to do this is a matter of taking a look in the Makefiles. But the
145150
nice thing is that you can experiment with things inside the container and
146151
get them working without having to keep rebuilding the container.
152+
(TODO: strictly speaking this could be improved, we should remove the {{ is_linux }} and use the path {{ config_linux_target }} instead, that updates CONFIG_SITE.Common.linux-x86_64 which only affects the linux-x86_64 target)
147153

148-
Note that `ibek support add-config-macro` is idempotent, so you can run it
149-
multiple times without getting repeated entries in the CONFIG. All `ibek`
150-
commands behave this way as far as possible.
154+
Note that ansible is idempotent, so you can run it multiple times without getting repeated entries in the CONFIG.
151155

152-
Once you are happy with your manual changes you can make them permanent by
153-
adding to the install.sh or Dockerfile, then try a full rebuild.
156+
Once you are happy with your manual changes you can make them permanent by adding to the `<module>install.yml` or Dockerfile, then try a full rebuild.
154157

155158
## Tools Inside the Container
156159

0 commit comments

Comments
 (0)