summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2019-08-30 17:49:04 +0200
committerJonathan Bauer2019-08-30 17:49:04 +0200
commit77fc965cf5c96e3bd2f1149686be590925a148b0 (patch)
tree2924d0c451f42ef445851a2baaf85bd2ef8d7b7b
parent[slx-network] only try to set ip address (diff)
downloadsystemd-init-77fc965cf5c96e3bd2f1149686be590925a148b0.tar.gz
systemd-init-77fc965cf5c96e3bd2f1149686be590925a148b0.tar.xz
systemd-init-77fc965cf5c96e3bd2f1149686be590925a148b0.zip
build-initramfs.sh: fix broken shallow submodule
cloning ... the git submodule foreach never worked (?) or at least it got broken somehow. Change to "manually" shallow-cloning the modules, quite ugly but speeds things up quite a bit
-rwxr-xr-xbuilder/build-initramfs.sh22
1 files changed, 16 insertions, 6 deletions
diff --git a/builder/build-initramfs.sh b/builder/build-initramfs.sh
index 50ce7c1e..28f6b8af 100755
--- a/builder/build-initramfs.sh
+++ b/builder/build-initramfs.sh
@@ -38,12 +38,22 @@ if ! [[ -d "$_needed_location" ]]; then
"$_git_source" "$_temporary_repository_location"
pushd "$_temporary_repository_location"
git submodule init
- # shellcheck disable=SC2016
- git submodule foreach '
- branch="$(git config --file "$toplevel/.gitmodules" "submodule.$name.branch")"
- git clone --depth 1 --branch "$branch"
- '
- git submodule update # --remote <- this seems like a bad idea
+ # try to clone submodules as shallowy as possible, since we cannot just
+ # use '--depth 1' on submodules residing on non-master branches...
+ for mod in $(awk '$1 == "[submodule" {gsub(/"|]/,"",$2); print $2}' .gitmodules); do
+ url="$(git config -f .gitmodules --get submodule.${mod}.url)"
+ path="$(git config -f .gitmodules --get submodule.${mod}.path)"
+ branch="$(git config -f .gitmodules --get submodule.${mod}.branch)"
+ commit="$(git submodule status $path | grep -oE '[0-9a-f]{40}')"
+ [ "$mod" = "dnbd3" ] && depth_arg=("--shallow-since" "2019-02-12")
+ [ "$mod" = "rebash" ] && depth_arg=("--shallow-since" "2016-11-30")
+ [ "$mod" = "qemu-xmount" ] && depth_arg=("--shallow-since" "2016-01-01")
+ [ "$mod" = "xmount" ] && depth_arg=("--depth" "1")
+ git clone -n --no-tags "${depth_arg[@]}" --branch "$branch" "$url" "$path"
+ pushd "$path"
+ git checkout "$commit"
+ popd
+ done
# apply patches for submodules
git submodule foreach '
for p in $(find ${toplevel}/builder/patches/${path##*/} -type f -name "*.patch" | sort -n); do