Stop pinning `CzechLight/dependencies` via `cla-sysrepo` and `netconf-cli`

Now that these two repos consume `master` (or whatever else is in the
patch queue at the check time), adapt this repo as well.

Change-Id: I01d56418bca3d6135477ae948f1cfdeb6465b38f
diff --git a/.gitmodules b/.gitmodules
index cb0eb34..7a7d552 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,9 @@
 [submodule "submodules/buildroot"]
 	path = submodules/buildroot
 	url = ../../github/buildroot/buildroot
+[submodule "submodules/dependencies"]
+	path = submodules/dependencies
+	url = ../dependencies
 [submodule "submodules/cla-sysrepo"]
 	path = submodules/cla-sysrepo
 	url = ../../CzechLight/cla-sysrepo
diff --git a/ci/build.sh b/ci/build.sh
index 7f9a4ee..8e0b0b8 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -24,23 +24,6 @@
 fi
 BR2_EXTERNAL_COMMIT=$(git --git-dir ${ZUUL_PROJECT_SRC_DIR}/.git rev-parse HEAD)
 
-# If we're being triggered via a change against another repo, use speculatively merged stuff from Zuul, not our submodules
-if [[ ${TRIGGERED_VIA_DEP} == 1 ]]; then
-    # C++ dependencies can be provided either via cla-sysrepo, or via netconf-cli.
-    # Whatever is the latest change in the queue wins.
-    USE_DEPENDENCIES_VIA=$(jq < ~/zuul-env.json -r '[.items[]? | select(.project.name == "CzechLight/cla-sysrepo" or .project.name == "CzechLight/netconf-cli")][-1]?.project.src_dir + ""')
-    if [[ ! -z "${USE_DEPENDENCIES_VIA}" ]]; then
-        sed -i "s|${ZUUL_PROJECT_SRC_DIR}/submodules/cla-sysrepo/submodules/dependencies/|${HOME}/${USE_DEPENDENCIES_VIA}/submodules/dependencies/|g" local.mk
-        # Our Zuul playbook only prepares submodules within CzechLight/br2-external, not submodules of other projects
-        pushd ${HOME}/${USE_DEPENDENCIES_VIA}
-        # ...and before we check out, make sure that relative URLs work, i.e,. no file:///dev/null
-        git config remote.origin.url $(pwd)
-        git submodule update --init --recursive
-        git config remote.origin.url file:///dev/null
-        popd
-    fi
-fi
-
 if [[ "${ZUUL_JOB_NAME}" =~ clearfog ]]; then
     make czechlight_clearfog_defconfig
 elif [[ "${ZUUL_JOB_NAME}" =~ beagleboneblack ]]; then
@@ -74,23 +57,24 @@
             rm -rf build/${PROJECT}-custom/ per-package/${PROJECT}/
         fi
     done
+fi
 
-    # Is there a change ahead which updates CzechLight/dependencies? If so, make sure these will get rebuilt
-    # This is (still) not foolproof. It will use a wrong version of dependencies if that change has been already merged, but br2-external doesn't have it merged.
-    # Also, we cannot remove all "leaf projects" like cla-sysrepo, netconf-cli, velia, etc. When there's a backwards-incompatible change,
-    # this project will get one rebuild per each "leaf" update. The resulting image might not even boot (think the update to libyang v2),
-    # but it's still important to check whether a given project at least *builds* for ARM. 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
-    fi
+# Is there a change ahead which updates CzechLight/dependencies? If so, make sure these will get rebuilt.
+# This is fragile; if we're triggered via an external module (e.g., `netconf-cli`) and its corresponding change
+# depends on a backwards-incompatible update in the NETCONF stack, and the other projects (e.g., `velia`) have not
+# been updated yet, this will result in a potentially broken result of the build.
+# We cannot simply rebuild all C++ leaf projects either, because we're being triggered one-at-a-time. Since Zuul
+# requires (some) build job ordering, there will always be at least one repo which is "too new" for the rest of the leaf projects.
+# 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
 fi
 
 make source -j${CI_PARALLEL_JOBS} --output-sync=target
diff --git a/dev-setup-git.sh b/dev-setup-git.sh
index 4f4316b..cc76c80 100755
--- a/dev-setup-git.sh
+++ b/dev-setup-git.sh
@@ -8,18 +8,18 @@
 # Configure the local.mk with path to the individual repositories
 CZECHLIGHT_BR2_EXT_LOC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 cat > local.mk <<EOF
-DOCOPT_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/docopt.cpp
-REPLXX_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/replxx
-CPPCODEC_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/cppcodec
-SDBUS_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/sdbus-cpp
+DOCOPT_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/docopt.cpp
+REPLXX_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/replxx
+CPPCODEC_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/cppcodec
+SDBUS_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/sdbus-cpp
 
-LIBYANG_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/libyang
-LIBYANG_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/libyang-cpp
-SYSREPO_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/sysrepo
-SYSREPO_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/sysrepo-cpp
+LIBYANG_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/libyang
+LIBYANG_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/libyang-cpp
+SYSREPO_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/sysrepo
+SYSREPO_CPP_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/sysrepo-cpp
 HOST_SYSREPO_POST_RSYNC_HOOKS += HOST_SYSREPO_PATCH_USE_FAKE_DEV_SHM
-LIBNETCONF2_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/libnetconf2
-NETOPEER2_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo/submodules/dependencies/Netopeer2
+LIBNETCONF2_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/libnetconf2
+NETOPEER2_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/dependencies/Netopeer2
 
 CLA_SYSREPO_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/cla-sysrepo
 NETCONF_CLI_OVERRIDE_SRCDIR = ${CZECHLIGHT_BR2_EXT_LOC}/submodules/netconf-cli
diff --git a/submodules/dependencies b/submodules/dependencies
new file mode 160000
index 0000000..07f0bd8
--- /dev/null
+++ b/submodules/dependencies
@@ -0,0 +1 @@
+Subproject commit 07f0bd86e8a12767e14ac5e3f51558e6d05e438a