Use a correct version of the CzechLight/dependencies repo

Now that these are no longer pinned via cla-sysrepo or netconf-cli, it's
possible to support taking a specific commit in two different ways:

- as a git submodule, i.e., whatever is in the repo, ignoring Zuul,
- or from Zuul's job dependencies, overriding whatever is pinned via the git submodule

In a way, this achieves a similar end result with what we're currently
doing for `velia`, `cla-sysrepo`, `netconf-cli` and `rousette` -- except
these are BR-level packages which map 1:1 to a git submodule, whereas
the `CzechLight/dependencies` is a magic snowflake which determines
versions of a zillion of other packages.

Fixes: 69c92de Fix git version reporting of `CzechLight/dependencies`
Fixes: 32ca34f Stop pinning `CzechLight/dependencies` via `cla-sysrepo` and `netconf-cli`
Change-Id: Iac701db50f5d349a053aa548c9ce4b960349e95a
Depends-on: https://gerrit.cesnet.cz/c/ci/zuul-jobs-cesnet/+/5618
diff --git a/ci/build.sh b/ci/build.sh
index 8e0b0b8..d7a6ada 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -54,6 +54,7 @@
 
             # `make ${pkg}-reconfigure` is *not* enough with BR2_PER_PACKAGE_DIRECTORIES=y
             # Even this is possibly fragile if these packages were not the "leaf" ones (in terms of BR-level dependencies).
+            # But any change to CzechLight/dependencies is handled explicitly below.
             rm -rf build/${PROJECT}-custom/ per-package/${PROJECT}/
         fi
     done
@@ -68,13 +69,17 @@
 # After a "big" update there should always be a standalone sync to `br2-external` as the very last step anyway.
 HAS_CHANGE_OF_DEPENDENCIES=$(jq < ~/zuul-env.json -r '[.items[]? | select(.project.name == "CzechLight/dependencies")][-1]?.project.src_dir + ""')
 if [[ ! -z "${HAS_CHANGE_OF_DEPENDENCIES}" ]]; then
-for PROJECT in \
-	libyang sysrepo libnetconf2 netopeer2 \
-	libyang-cpp sysrepo-cpp \
-	docopt-cpp replxx cppcodec sdbus-cpp \
-	; do
-    rm -rf build/{,host-}${PROJECT}-custom/ per-package/{,host-}${PROJECT}/
-done
+    # redirect BR packages to a Zuul-injected dependency
+    sed -i "s|${ZUUL_PROJECT_SRC_DIR}/submodules/dependencies|${HOME}/${HAS_CHANGE_OF_DEPENDENCIES}|g" local.mk
+
+    # persuade BR to rebuild them
+    for PROJECT in \
+            libyang sysrepo libnetconf2 netopeer2 \
+            libyang-cpp sysrepo-cpp \
+            docopt-cpp replxx cppcodec sdbus-cpp \
+            ; do
+        rm -rf build/{,host-}${PROJECT}-custom/ per-package/{,host-}${PROJECT}/
+    done
 fi
 
 make source -j${CI_PARALLEL_JOBS} --output-sync=target