travis-ci: install packages in 'ci/install-dependencies.sh'

Ever since we started using Travis CI, we specified the list of packages to install in '.travis.yml' via the APT addon. While running our builds on Travis CI's container-based infrastructure we didn't have another choice, because that environment didn't support 'sudo', and thus we didn't have permission to install packages ourselves. With the switch to the VM-based infrastructure in the previous patch we do get a working 'sudo', so we can install packages by running 'sudo apt-get -y install ...' as well. Let's make use of this and install necessary packages in 'ci/install-dependencies.sh', so all the dependencies (i.e. both packages and "non-packages" (P4 and Git-LFS)) are handled in the same file. Install gcc-8 only in the 'linux-gcc' build job; so far it has been unnecessarily installed in the 'linux-clang' build job as well. Print the versions of P4 and Git-LFS conditionally, i.e. only when they have been installed; with this change even the static analysis and documentation build jobs start using 'ci/install-dependencies.sh' to install packages, and neither of these two build jobs depend on and thus install those. This change will presumably be beneficial for the upcoming Azure Pipelines integration [1]: preliminary versions of that patch series run a couple of 'apt-get' commands to install the necessary packages before running 'ci/install-dependencies.sh', but with this patch it will be sufficient to run only 'ci/install-dependencies.sh'. [1] https://public-inbox.org/git/1a22efe849d6da79f2c639c62a1483361a130238.1539598316.git.gitgitgadget@gmail.com/ Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Nov 1, 2018 at 12:47 UTC 0f0c51181dfb8ca0045ef94715f147f780bc63dd
2 files changed +29 -27
.travis.yml
-21
@@ -12,16 +12,6 @@ compiler:
12 - clang
13 - gcc
14
15 -addons:
16 - apt:
17 - sources:
18 - - ubuntu-toolchain-r-test
19 - packages:
20 - - language-pack-is
21 - - git-svn
22 - - apache2
23 - - gcc-8
24 -
15 matrix:
16 include:
17 - env: jobname=GETTEXT_POISON
@@ -50,22 +40,11 @@ matrix:
40 - env: jobname=StaticAnalysis
41 os: linux
42 compiler:
53 - addons:
54 - apt:
55 - packages:
56 - - coccinelle
57 - before_install:
43 script: ci/run-static-analysis.sh
44 after_failure:
45 - env: jobname=Documentation
46 os: linux
47 compiler:
63 - addons:
64 - apt:
65 - packages:
66 - - asciidoc
67 - - xmlto
68 - before_install:
48 script: ci/test-documentation.sh
49 after_failure:
50
ci/install-dependencies.sh
+29 -6
@@ -10,6 +10,15 @@ LFSWHENCE=https://github.com/github/git-lfs/releases/download/v$LINUX_GIT_LFS_VE
10
11 case "$jobname" in
12 linux-clang|linux-gcc)
13 + sudo apt-add-repository -y "ppa:ubuntu-toolchain-r/test"
14 + sudo apt-get -q update
15 + sudo apt-get -q -y install language-pack-is git-svn apache2
16 + case "$jobname" in
17 + linux-gcc)
18 + sudo apt-get -q -y install gcc-8
19 + ;;
20 + esac
21 +
22 mkdir --parents "$P4_PATH"
23 pushd "$P4_PATH"
24 wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
@@ -32,11 +41,25 @@ osx-clang|osx-gcc)
41 brew link --force gettext
42 brew install caskroom/cask/perforce
43 ;;
44 +StaticAnalysis)
45 + sudo apt-get -q update
46 + sudo apt-get -q -y install coccinelle
47 + ;;
48 +Documentation)
49 + sudo apt-get -q update
50 + sudo apt-get -q -y install asciidoc xmlto
51 + ;;
52 esac
53
37 -echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
38 -p4d -V | grep Rev.
39 -echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
40 -p4 -V | grep Rev.
41 -echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
42 -git-lfs version
54 +if type p4d >/dev/null && type p4 >/dev/null
55 +then
56 + echo "$(tput setaf 6)Perforce Server Version$(tput sgr0)"
57 + p4d -V | grep Rev.
58 + echo "$(tput setaf 6)Perforce Client Version$(tput sgr0)"
59 + p4 -V | grep Rev.
60 +fi
61 +if type git-lfs >/dev/null
62 +then
63 + echo "$(tput setaf 6)Git-LFS Version$(tput sgr0)"
64 + git-lfs version
65 +fi