From 8a1f26792430f7227c57219e198e0406559b799f Mon Sep 17 00:00:00 2001 From: Javernaut Date: Sat, 7 Dec 2019 20:26:16 +0200 Subject: [PATCH] Reenabling FFmpeg's source code getting from the git repository --- scripts/ffmpeg/download.sh | 76 +++++++++++++++++++------------------- scripts/parse-arguments.sh | 20 +++++----- 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/scripts/ffmpeg/download.sh b/scripts/ffmpeg/download.sh index 185d4a7..554baa4 100755 --- a/scripts/ffmpeg/download.sh +++ b/scripts/ffmpeg/download.sh @@ -4,7 +4,6 @@ # Exports SOURCES_DIR_ffmpeg - path where actual sources are stored -# Utility function # Getting sources of a particular FFmpeg release. # Same argument (FFmpeg version) produces the same source set. function ensureSourcesTar() { @@ -21,46 +20,49 @@ function ensureSourcesTar() { export SOURCES_DIR_ffmpeg=$(pwd)/${FFMPEG_SOURCES} } -# Utility function -# Getting sources of a particular branch of ffmpeg's git repository. -# Same argument (branch name) may produce different source set, +# Getting sources of a particular branch or a tag of FFmpeg's git repository. +# Same branch name may produce different source set, # as the branch in origin repository may be updated in future. -# function ensureSourcesBranch() { -# BRANCH=$1 -# -# GIT_DIRECTORY=ffmpeg-git -# -# FFMPEG_SOURCES=${SOURCES_DIR}/${GIT_DIRECTORY} -# -# cd ${SOURCES_DIR} -# -# if [[ ! -d "$FFMPEG_SOURCES" ]]; then -# git clone https://git.ffmpeg.org/ffmpeg.git ${GIT_DIRECTORY} -# fi -# -# cd ${GIT_DIRECTORY} -# git checkout $BRANCH -# # Forcing the update of a branch -# git pull origin $BRANCH -# -# # Additional logging to keep track of an exact commit to build -# echo "Commit to build:" -# git rev-parse HEAD -# -# cd ${BASE_DIR} -# } +# Git tags lead to stable states of the source code. +function ensureSourcesGit() { + NAME_TO_CHECKOUT=${FFMPEG_SOURCE_VALUE} + GIT_DIRECTORY=ffmpeg-git + + FFMPEG_SOURCES=$(pwd)/${GIT_DIRECTORY} + + if [[ ! -d "$FFMPEG_SOURCES" ]]; then + git clone https://git.ffmpeg.org/ffmpeg.git ${GIT_DIRECTORY} + fi + + cd ${GIT_DIRECTORY} + git reset --hard + + git checkout $NAME_TO_CHECKOUT + if [ ${FFMPEG_SOURCE_TYPE} = "GIT_BRANCH" ]; then + # Forcing the update of a branch + git pull origin $BRANCH + fi + + # Additional logging to keep track of an exact commit to build + echo "Commit to build:" + git rev-parse HEAD + + export SOURCES_DIR_ffmpeg=${FFMPEG_SOURCES} +} + +# Actual code case ${FFMPEG_SOURCE_TYPE} in - # GIT_TAG) - # echo "Using FFmpeg ${SECOND_ARGUMENT}" - # ensureSourcesTag ${SECOND_ARGUMENT} - # ;; - # GIT_BRANCH) - # echo "Using FFmpeg git repository and its branch ${SECOND_ARGUMENT}" - # ensureSourcesBranch ${SECOND_ARGUMENT} - # ;; + GIT_TAG) + echo "Using FFmpeg git tag: ${FFMPEG_SOURCE_VALUE}" + ensureSourcesGit + ;; + GIT_BRANCH) + echo "Using FFmpeg git repository and its branch: ${FFMPEG_SOURCE_VALUE}" + ensureSourcesGit + ;; TAR) - echo "Using FFmpeg source archive ${FFMPEG_SOURCE_VALUE}" + echo "Using FFmpeg source archive: ${FFMPEG_SOURCE_VALUE}" ensureSourcesTar ;; esac diff --git a/scripts/parse-arguments.sh b/scripts/parse-arguments.sh index a611b0a..6404933 100755 --- a/scripts/parse-arguments.sh +++ b/scripts/parse-arguments.sh @@ -17,17 +17,17 @@ do shift ;; # Checkout the particular tag in the FFmpeg's git repository - # --source-git-tag=*) - # SOURCE_TYPE=GIT_TAG - # SOURCE_VALUE="${artument#*=}" - # shift - # ;; + --source-git-tag=*) + SOURCE_TYPE=GIT_TAG + SOURCE_VALUE="${artument#*=}" + shift + ;; # Checkout the particular branch in the FFmpeg's git repository - # --source-git-branch=*) - # SOURCE_TYPE=GIT_BRANCH - # SOURCE_VALUE="${artument#*=}" - # shift - # ;; + --source-git-branch=*) + SOURCE_TYPE=GIT_BRANCH + SOURCE_VALUE="${artument#*=}" + shift + ;; # Download the particular tar archive by its version --source-tar=*) SOURCE_TYPE=TAR