]> git.ipfire.org Git - thirdparty/git.git/commitdiff
ci: install python on ubuntu
authorJiang Xin <zhiyou.jx@alibaba-inc.com>
Fri, 25 Nov 2022 09:59:54 +0000 (17:59 +0800)
committerJunio C Hamano <gitster@pobox.com>
Sun, 27 Nov 2022 00:33:43 +0000 (09:33 +0900)
Python is missing from the default ubuntu-22.04 runner image, which
prevents git-p4 from working. To install python on ubuntu, we need
to provide the correct package names:

 * On Ubuntu 18.04 (bionic), "/usr/bin/python2" is provided by the
   "python" package, and "/usr/bin/python3" is provided by the "python3"
   package.

 * On Ubuntu 20.04 (focal) and above, "/usr/bin/python2" is provided by
   the "python2" package which has a different name from bionic, and
   "/usr/bin/python3" is provided by "python3".

Since the "ubuntu-latest" runner image has a higher version, its
safe to use "python2" or "python3" package name.

Helped-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
ci/install-dependencies.sh
ci/lib.sh

index b569893b38c21cc0de8a6ec671d1be2674750936..d8fafc8ed2d6f6fed2f330c08aa6f29091fc9ea5 100755 (executable)
@@ -15,7 +15,7 @@ case "$runs_on_pool" in
 ubuntu-*)
        sudo apt-get -q update
        sudo apt-get -q -y install language-pack-is libsvn-perl apache2 \
-               $UBUNTU_COMMON_PKGS $CC_PACKAGE
+               $UBUNTU_COMMON_PKGS $CC_PACKAGE $PYTHON_PACKAGE
        mkdir --parents "$P4_PATH"
        pushd "$P4_PATH"
                wget --quiet "$P4WHENCE/bin.linux26x86_64/p4d"
index 39d07f9788d23ddf9dfe4d8e99d2cf35e1cceefc..fe37e87807870e339c92f6384718d9f11eeaa7ea 100755 (executable)
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -232,12 +232,12 @@ ubuntu-*)
                break
        fi
 
-       if [ "$jobname" = linux-gcc ]
+       PYTHON_PACKAGE=python2
+       if test "$jobname" = linux-gcc
        then
-               MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3"
-       else
-               MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python2"
+               PYTHON_PACKAGE=python3
        fi
+       MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/$PYTHON_PACKAGE"
 
        export GIT_TEST_HTTPD=true