Browse Source

contrib: AMF: improve sparse checkout

git sparse-checkout was only added in 2.25 (2020) [1]. Older git (1.7+) can
handle a sparse checkout setting the .git/info/sparse-checkout data.

We also clone with --filter=blob:none --no-checkout which downloads less from the host.

[1] https://stackoverflow.com/a/13738951
pull/162/head
Steve Lhomme 2 years ago
committed by Jean-Baptiste Kempf
parent
commit
18d58433da
  1. 4
      contrib/src/amf/rules.mak

4
contrib/src/amf/rules.mak

@ -22,8 +22,8 @@ $(TARBALLS)/AMF-$(AMF_GITVERSION).tar.xz:
rm -rf "$(@:.tar.xz=)"
mkdir "$(@:.tar.xz=)"
# clone the top of the branch and only checkout amf/public/include
cd "$(@:.tar.xz=)" && git clone -n --depth=1 --filter=tree:0 --branch $(AMF_BRANCH) $(AMF_GITURL) "$(notdir $(@:.tar.xz=))"
cd "$(@:.tar.xz=)/$(notdir $(@:.tar.xz=))" && git sparse-checkout set --no-cone amf/public/include && git checkout
cd "$(@:.tar.xz=)" && git clone -n --depth=1 --filter=blob:none --no-checkout --branch $(AMF_BRANCH) $(AMF_GITURL) "$(notdir $(@:.tar.xz=))"
cd "$(@:.tar.xz=)/$(notdir $(@:.tar.xz=))" && git config core.sparseCheckout true && echo "amf/public/include" >> .git/info/sparse-checkout && git checkout
cd "$(@:.tar.xz=)" && tar cJf "$(notdir $(@))" --exclude=$(notdir $(@:.tar.xz=))/.git $(notdir $(@:.tar.xz=))
cd "$(@:.tar.xz=)/$(notdir $(@:.tar.xz=))" && echo "`git rev-parse HEAD` $(@)" > "../tmp.githash"
mv -f -- "$(@:.tar.xz=)/tmp.githash" "$(@:.tar.xz=.githash)"

Loading…
Cancel
Save