@@ -1878,6 +1878,124 @@ EOF
1878
1878
fi
1879
1879
}
1880
1880
1881
+ # <coverity-token>
1882
+ init_or_update_coverity_tool () {
1883
+ # check once per week whether there is a new version
1884
+ coverity_tool=.git/coverity-tool
1885
+ test ! -d $coverity_tool ||
1886
+ test $(( $(date +% s)- $(stat - c % Y $coverity_tool )) ) \
1887
+ -gt $(( 7 * 24 * 60 * 60 )) || return 0
1888
+ echo " Downloading current Coverity Scan Self-Build tool" >&2
1889
+ if test -f .git/coverity_tool.zip
1890
+ then
1891
+ timecond=.git/coverity_tool.zip
1892
+ else
1893
+ timecond=" 19700101 +0000"
1894
+ fi
1895
+ curl --form " token=$1 " \
1896
+ --form " project=git-for-windows" \
1897
+ --time-cond " $timecond " \
1898
+ -o .git/coverity_tool.zip.new \
1899
+ https://scan.coverity.com/download/win64 &&
1900
+ test -f .git/coverity_tool.zip.new || {
1901
+ echo " Nothing downloaded; will try again in another week" >&2
1902
+ touch $coverity_tool
1903
+ return
1904
+ }
1905
+ mv -f .git/coverity_tool.zip.new .git/coverity_tool.zip ||
1906
+ die " Could not overwrite coverity_tool.zip"
1907
+
1908
+ mkdir $coverity_tool .new &&
1909
+ (cd $coverity_tool .new &&
1910
+ unzip ../coverity_tool.zip) ||
1911
+ die " Could not unpack coverity_tool.zip"
1912
+ rm -rf $coverity_tool &&
1913
+ mv $coverity_tool .new $coverity_tool ||
1914
+ die " Could not switch to new Coverity tool version"
1915
+ }
1916
+
1917
+ submit_build_to_coverity () { # [--worktree=<dir>] <upstream-branch-or-tag>
1918
+ git_src_dir=" $sdk64 /usr/src/MINGW-packages/mingw-w64-git/src/git"
1919
+ while case " $1 " in
1920
+ --worktree=* )
1921
+ git_src_dir=${1#* =}
1922
+ test -d " $git_src_dir " ||
1923
+ die " Worktree does not exist: %s\n" " $git_src_dir "
1924
+ git rev-parse -q --verify e83c5163316f89bfbde7d ||
1925
+ die " Does not appear to be a Git checkout: %s\n" " $git_src_dir "
1926
+ ;;
1927
+ -* ) die " Unknown option: %s\n" " $1 " ;;
1928
+ * ) break ;;
1929
+ esac ; do shift ; done
1930
+ test $# = 1 ||
1931
+ die " Expected 1 argument, got $# : %s\n" " $* "
1932
+ branch=" $1 "
1933
+
1934
+ coverity_username=" $( git config coverity.username) "
1935
+ test -n " $coverity_username " ||
1936
+ die " Need a username to access Coverity's services\n"
1937
+
1938
+ coverity_token=" $( git config coverity.token) "
1939
+ test -n " $coverity_token " ||
1940
+ die " Need a token to access Coverity's services\n"
1941
+
1942
+ ensure_valid_login_shell 64 ||
1943
+ die " Could not ensure valid login shell\n"
1944
+
1945
+ sdk=" $sdk64 "
1946
+
1947
+ build_extra_dir=" $sdk64 /usr/src/build-extra"
1948
+ (cd " $build_extra_dir " &&
1949
+ sdk= pkgpath=$PWD ff_master) ||
1950
+ die " Could not update build-extra\n"
1951
+
1952
+ require_git_src_dir
1953
+
1954
+ (cd " $git_src_dir " &&
1955
+ case " $branch " in
1956
+ git-for-windows/* |v[1-9]* .windows.[1-9]* )
1957
+ require_remote git-for-windows \
1958
+ https://github.com/git-for-windows/git
1959
+ case " $branch " in git-for-windows/refs/pull/[0-9]* )
1960
+ git fetch git-for-windows \
1961
+ " ${branch# git-for-windows/ } :refs/remotes/$branch " ||
1962
+ die " Could not fetch %s from git-for-windows\n" \
1963
+ " ${branch# git-for-windows/ } "
1964
+ ;;
1965
+ esac
1966
+ ;;
1967
+ upstream/* |v[1-9]* )
1968
+ require_remote upstream https://github.com/git/git
1969
+ case " $branch " in upstream/refs/pull/[0-9]* )
1970
+ git fetch upstream " ${branch# upstream/ } :refs/remotes/$branch " ||
1971
+ die " Could not fetch %s from upstream\n" \
1972
+ " ${branch# upstream/ } "
1973
+ ;;
1974
+ esac
1975
+ ;;
1976
+ esac &&
1977
+ git checkout -f " $branch " &&
1978
+ git reset --hard &&
1979
+ init_or_update_coverity_tool " $coverity_token " &&
1980
+ coverity_bin_dir=$( echo $PWD /$coverity_tool /* /bin) &&
1981
+ if ! test -x " $coverity_bin_dir /cov-build.exe"
1982
+ then
1983
+ die " Unusable Coverity bin/ directory: '%s'\n" \
1984
+ " $coverity_bin_dir "
1985
+ fi &&
1986
+ PATH=" $coverity_bin_dir :$PATH " &&
1987
+ cov-build --dir cov-int \
1988
+ make -j15 DEVELOPER=1 CPPFLAGS=-DFLEX_ARRAY=65536 &&
1989
+ tar caf git-for-windows.lzma cov-int &&
1990
+ curl --form token=" $coverity_token " \
1991
+ --form email=" $coverity_username " \
1992
+ --form file=@git-for-windows.lzma \
1993
+ --form version=" $( git rev-parse HEAD) " \
1994
+ --form version=" $( date +%Y-%m-%s-%H-%M-%S) " \
1995
+ https://scan.coverity.com/builds? project=git-for-windows) ||
1996
+ die " Could not submit build to Coverity\n"
1997
+ }
1998
+
1881
1999
tag_git () { #
1882
2000
sdk=" $sdk64 " require w3m
1883
2001
0 commit comments