diff options
author | Avi Halachmi (:avih) <avihpit@yahoo.com> | 2017-12-04 21:53:51 +0200 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2017-12-05 23:53:19 -0800 |
commit | 643618fcdb899f90392993b933cf16a43039dd49 (patch) | |
tree | aad4f6a37624d9ac2ee82994fb0e693b0e13df92 | |
parent | 42a4a1fa3705f1529ea6faca810f96e7813c2233 (diff) | |
download | mpv-build-643618fcdb899f90392993b933cf16a43039dd49.tar.bz2 mpv-build-643618fcdb899f90392993b933cf16a43039dd49.tar.xz |
update script: use arguments normally instead of constructing commands
Previously $checkout_<proj> were constructed as commands which were
executed later. This is not very flexible and also hard to follow and
modify.
Change them to be used as normal arguments which contain the value
release/master, possibly with additional space-separated '-' to indicate
that the config file should be ignored (used when invoked with --master
or --release).
-rwxr-xr-x | update | 73 |
1 files changed, 38 insertions, 35 deletions
@@ -44,9 +44,15 @@ versort_with_prefix() do_releasetag() { + local prefix= # by default, don't use a prefix + case "$1" in + ffmpeg) prefix=n;; # e.g. n3.3.1 + mpv) prefix=v;; # e.g. v0.26.0 + esac + ( cd "$1" - version=`git tag | grep -v rc | grep -v dev | versort_with_prefix "$2" | tail -n 1` + version=`git tag | grep -v rc | grep -v dev | versort_with_prefix "$prefix" | tail -n 1` git checkout refs/tags/"$version" ) } @@ -59,19 +65,35 @@ do_fixedref() ) } -checkout_ffmpeg=do_gitmaster -#checkout_fribidi=do_releasetag -checkout_libass=do_gitmaster -checkout_mpv=do_gitmaster +# args: $1: project name, $2: release/master [,$3: non-empty to ignore the config file] +checkout() +{ + local arg="$2" + if [ -z "$3" ] && [ -d config/ ] && [ -f config/branch-$1 ]; then + arg="$(cat config/branch-$1)" + fi + + case "$arg" in + master) do_gitmaster $1;; + *) do_releasetag $1;; + esac +} + +# fallback targets: release/master if no config file +checkout_ffmpeg=master +#checkout_fribidi=release +checkout_libass=master +checkout_mpv=master + checkout_all() { set -ex do_clone_all - $checkout_ffmpeg ffmpeg 'n' - #$checkout_fribidi fribidi '' - $checkout_libass libass - $checkout_mpv mpv 'v' + checkout ffmpeg $checkout_ffmpeg + #$checkout fribidi $checkout_fribidi + checkout libass $checkout_libass + checkout mpv $checkout_mpv } do_bootstrap() @@ -93,36 +115,17 @@ if [ x"$1" != x"--skip-selfupdate" ]; then fi shift -select_branch() -{ - if [ -d config/ ] && [ -f config/"branch-$1" ]; then - case `cat config/"branch-$1"` in - master) - echo do_gitmaster - ;; - *) - # "release" is the defined value; but default anything else to it - echo do_releasetag - ;; - esac - else - echo "$2" - fi -} - -checkout_ffmpeg=`select_branch ffmpeg $checkout_ffmpeg` -checkout_mpv=`select_branch mpv $checkout_mpv` - +# allow checkout master/release without checking the config files case "$1" in --master) - checkout_ffmpeg=do_gitmaster - #checkout_fribidi=do_gitmaster - checkout_libass=do_gitmaster - checkout_mpv=do_gitmaster + checkout_ffmpeg="master -" + #checkout_fribidi="master -" + checkout_libass="master -" + checkout_mpv="master -" ;; --release) - checkout_ffmpeg=do_releasetag - checkout_mpv=do_releasetag + checkout_ffmpeg="release -" + checkout_mpv="release -" ;; '') ;; |