diff --git a/images/base/Dockerfile b/images/base/Dockerfile index 743ed27..ee8dcf5 100644 --- a/images/base/Dockerfile +++ b/images/base/Dockerfile @@ -9,3 +9,4 @@ RUN \ apt-get -y clean ADD run_stage.sh /usr/bin/run_stage +ADD git-mini-clone.sh /usr/bin/git-mini-clone diff --git a/images/base/git-mini-clone.sh b/images/base/git-mini-clone.sh new file mode 100755 index 0000000..29ff3a8 --- /dev/null +++ b/images/base/git-mini-clone.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -xe +REPO="$1" +REF="$2" +DEST="$3" +git init "$DEST" +git -C "$DEST" remote add origin "$REPO" +git -C "$DEST" fetch --depth=1 origin "$REF" +git -C "$DEST" config advice.detachedHead false +git -C "$DEST" checkout FETCH_HEAD diff --git a/scripts.d/25-fribidi.sh b/scripts.d/25-fribidi.sh index 1bbd931..6dd80d0 100755 --- a/scripts.d/25-fribidi.sh +++ b/scripts.d/25-fribidi.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$FRIBIDI_REPO" fribidi || return -1 + git-mini-clone "$FRIBIDI_REPO" "$FRIBIDI_COMMIT" fribidi cd fribidi - git checkout "$FRIBIDI_COMMIT" || return -1 local myconf=( --prefix="$FFBUILD_PREFIX" diff --git a/scripts.d/25-libogg.sh b/scripts.d/25-libogg.sh index 7570ae2..8e896ff 100755 --- a/scripts.d/25-libogg.sh +++ b/scripts.d/25-libogg.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$OGG_REPO" ogg || return -1 + git-mini-clone "$OGG_REPO" "$OGG_COMMIT" ogg cd ogg - git checkout "$OGG_COMMIT" || return -1 ./autogen.sh || return -1 diff --git a/scripts.d/25-openssl.sh b/scripts.d/25-openssl.sh index 94d536a..26cd27b 100755 --- a/scripts.d/25-openssl.sh +++ b/scripts.d/25-openssl.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$OPENSSL_REPO" openssl || return -1 + git-mini-clone "$OPENSSL_REPO" "$OPENSSL_COMMIT" openssl cd openssl - git checkout "$OPENSSL_COMMIT" || return -1 local myconf=( threads diff --git a/scripts.d/45-harfbuzz.sh b/scripts.d/45-harfbuzz.sh index c084236..1d83044 100755 --- a/scripts.d/45-harfbuzz.sh +++ b/scripts.d/45-harfbuzz.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$HARFBUZZ_REPO" harfbuzz || return -1 + git-mini-clone "$HARFBUZZ_REPO" "$HARFBUZZ_COMMIT" harfbuzz cd harfbuzz - git checkout "$HARFBUZZ_COMMIT" || return -1 local myconf=( --prefix="$FFBUILD_PREFIX" diff --git a/scripts.d/49-libvorbis.sh b/scripts.d/49-libvorbis.sh index f0fa192..e83f844 100755 --- a/scripts.d/49-libvorbis.sh +++ b/scripts.d/49-libvorbis.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$VORBIS_REPO" vorbis || return -1 + git-mini-clone "$VORBIS_REPO" "$VORBIS_COMMIT" vorbis cd vorbis - git checkout "$VORBIS_COMMIT" || return -1 ./autogen.sh || return -1 diff --git a/scripts.d/50-amf.sh b/scripts.d/50-amf.sh index b445fa3..35ebd40 100755 --- a/scripts.d/50-amf.sh +++ b/scripts.d/50-amf.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$AMF_REPO" amf || return -1 + git-mini-clone "$AMF_REPO" "$AMF_COMMIT" amf cd amf - git checkout "$AMF_COMMIT" || return -1 mkdir -p "$FFBUILD_PREFIX"/include mv amf/public/include "$FFBUILD_PREFIX"/include/AMF || return -1 diff --git a/scripts.d/50-avisynth.sh b/scripts.d/50-avisynth.sh index a4d2629..6e5eee5 100755 --- a/scripts.d/50-avisynth.sh +++ b/scripts.d/50-avisynth.sh @@ -14,9 +14,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$AVISYNTH_REPO" avisynth || return -1 + git-mini-clone "$AVISYNTH_REPO" "$AVISYNTH_COMMIT" avisynth cd avisynth - git checkout "$AVISYNTH_COMMIT" || return -1 mkdir build && cd build diff --git a/scripts.d/50-dav1d.sh b/scripts.d/50-dav1d.sh index 6f43933..b0fd53a 100755 --- a/scripts.d/50-dav1d.sh +++ b/scripts.d/50-dav1d.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$DAV1D_REPO" dav1d || return -1 + git-mini-clone "$DAV1D_REPO" "$DAV1D_COMMIT" dav1d cd dav1d - git checkout "$DAV1D_COMMIT" || return -1 mkdir build && cd build diff --git a/scripts.d/50-ffnvcodec.sh b/scripts.d/50-ffnvcodec.sh index 4cce970..a70ca0e 100755 --- a/scripts.d/50-ffnvcodec.sh +++ b/scripts.d/50-ffnvcodec.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$FFNVCODEC_REPO" ffnvcodec || return -1 + git-mini-clone "$FFNVCODEC_REPO" "$FFNVCODEC_COMMIT" ffnvcodec pushd ffnvcodec - git checkout "$FFNVCODEC_COMMIT" || return -1 make PREFIX="$FFBUILD_PREFIX" install || return -1 diff --git a/scripts.d/50-libass.sh b/scripts.d/50-libass.sh index b85b9b6..b93753b 100755 --- a/scripts.d/50-libass.sh +++ b/scripts.d/50-libass.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$ASS_REPO" ass || return -1 + git-mini-clone "$ASS_REPO" "$ASS_COMMIT" ass cd ass - git checkout "$ASS_COMMIT" || return -1 ./autogen.sh || return -1 diff --git a/scripts.d/50-libopus.sh b/scripts.d/50-libopus.sh index b0b9a1c..b4439a4 100755 --- a/scripts.d/50-libopus.sh +++ b/scripts.d/50-libopus.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$OPUS_REPO" opus || return -1 + git-mini-clone "$OPUS_REPO" "$OPUS_COMMIT" opus cd opus - git checkout "$OPUS_COMMIT" || return -1 ./autogen.sh || return -1 diff --git a/scripts.d/50-libtheora.sh b/scripts.d/50-libtheora.sh index d904721..850f8a9 100755 --- a/scripts.d/50-libtheora.sh +++ b/scripts.d/50-libtheora.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$THEORA_REPO" theora || return -1 + git-mini-clone "$THEORA_REPO" "$THEORA_COMMIT" theora cd theora - git checkout "$THEORA_COMMIT" || return -1 ./autogen.sh || return -1 diff --git a/scripts.d/50-libvpx.sh b/scripts.d/50-libvpx.sh index 6f87bb6..f44af16 100755 --- a/scripts.d/50-libvpx.sh +++ b/scripts.d/50-libvpx.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$LIBVPX_REPO" libvpx || return -1 + git-mini-clone "$LIBVPX_REPO" "$LIBVPX_COMMIT" libvpx cd libvpx - git checkout "$LIBVPX_COMMIT" || return -1 local myconf=( --disable-shared diff --git a/scripts.d/50-mfx.sh b/scripts.d/50-mfx.sh index c8154cb..987ddf4 100755 --- a/scripts.d/50-mfx.sh +++ b/scripts.d/50-mfx.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$MFX_REPO" mfx || return -1 + git-mini-clone "$MFX_REPO" "$MFX_COMMIT" mfx cd mfx - git checkout "$MFX_COMMIT" || return -1 autoreconf -i || return -1 diff --git a/scripts.d/50-srt.sh b/scripts.d/50-srt.sh index c54eee7..a416cfc 100755 --- a/scripts.d/50-srt.sh +++ b/scripts.d/50-srt.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$SRT_REPO" srt || return -1 + git-mini-clone "$SRT_REPO" "$SRT_COMMIT" srt cd srt - git checkout "$SRT_COMMIT" || return -1 mkdir build && cd build diff --git a/scripts.d/50-x264.sh b/scripts.d/50-x264.sh index a538bd4..d811626 100755 --- a/scripts.d/50-x264.sh +++ b/scripts.d/50-x264.sh @@ -14,9 +14,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$X264_REPO" x264 || return -1 + git-mini-clone "$X264_REPO" "$X264_COMMIT" x264 pushd x264 - git checkout "$X264_COMMIT" || return -1 local myconf=( --disable-cli diff --git a/scripts.d/50-x265.sh b/scripts.d/50-x265.sh index 4675ca2..3c8b366 100755 --- a/scripts.d/50-x265.sh +++ b/scripts.d/50-x265.sh @@ -14,9 +14,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$X265_REPO" x265 || return -1 + git-mini-clone "$X265_REPO" "$X265_COMMIT" x265 cd x265 - git checkout "$X265_COMMIT" || return -1 mkdir 8bit 10bit 12bit diff --git a/scripts.d/50-zimg.sh b/scripts.d/50-zimg.sh index c362b4d..fc9e884 100755 --- a/scripts.d/50-zimg.sh +++ b/scripts.d/50-zimg.sh @@ -13,9 +13,8 @@ ffbuild_dockerstage() { } ffbuild_dockerbuild() { - git clone "$ZIMG_REPO" zimg || return -1 + git-mini-clone "$ZIMG_REPO" "$ZIMG_COMMIT" zimg cd zimg - git checkout "$ZIMG_COMMIT" || return -1 ./autogen.sh || return -1