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

(cherry picked from commit f787acf2587de1e8b5968f8b68b931ab659e9f01) (edited)
edited:
- remove --fitler as it's not supported in git 2.11.0 used by 3.0 Dockers
cherry-pick-c5513cf9
Steve Lhomme 2 years ago
parent
commit
9acdb3addb
  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 --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