All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jiang Xin <worldhello.net@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Jiang Xin <zhiyou.jx@alibaba-inc.com>
Subject: Re: [PATCH v2 3/3] ci: install python on ubuntu
Date: Thu, 24 Nov 2022 13:23:05 +0100	[thread overview]
Message-ID: <221124.86a64gpmkb.gmgdl@evledraar.gmail.com> (raw)
In-Reply-To: <CANYiYbEHXwXTpRiha+0SoO_7_6LrJ7iE5c-fc-uzp21+aXKgBQ@mail.gmail.com>


On Thu, Nov 24 2022, Jiang Xin wrote:

> On Thu, Nov 24, 2022 at 7:06 PM Ævar Arnfjörð Bjarmason
> <avarab@gmail.com> wrote:
>>
>>
>> On Thu, Nov 24 2022, Jiang Xin wrote:
>>
>> > From: Jiang Xin <zhiyou.jx@alibaba-inc.com>
>> >
>> > Python is missing from the default ubuntu-22.04 runner image, which
>> > prevent git-p4 from working. To install python on ubuntu, we need to
>> > provide correct package name:
>> >
>> >  * 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, so its safe
>> > to use "python2" or "python3" package name.
>> >
>> > Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
>> > ---
>> >  ci/install-dependencies.sh | 2 +-
>> >  ci/lib.sh                  | 2 ++
>> >  2 files changed, 3 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh
>> > index 291e49bdde..e28d93a154 100755
>> > --- a/ci/install-dependencies.sh
>> > +++ b/ci/install-dependencies.sh
>> > @@ -15,7 +15,7 @@ case "$runs_on_os" 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"
>> > diff --git a/ci/lib.sh b/ci/lib.sh
>> > index a618d66b81..ebe702e0ea 100755
>> > --- a/ci/lib.sh
>> > +++ b/ci/lib.sh
>> > @@ -235,8 +235,10 @@ ubuntu)
>> >       if [ "$jobname" = linux-gcc ]
>> >       then
>> >               MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python3"
>> > +             PYTHON_PACKAGE=python3
>> >       else
>> >               MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/python2"
>> > +             PYTHON_PACKAGE=python2
>> >       fi
>>
>> Let's not copy/paste and repeat ourselves here for no reason. Part of
>> this is pre-existing, but if you just re-arrange these variable decls
>> you can do this instead:
>>
>>         PYTHON_PACKAGE=python2
>>         if test "$jobname" = linux-gcc
>>         then
>>                 PYTHON_PACKAGE=python3
>>         fi
>>         MAKEFLAGS="$MAKEFLAGS PYTHON_PATH=/usr/bin/${PYTHON_PACKAGE}"
>
> That was exactly my first edition, but I thought it was weird to write
> as "/usr/bin/${PYTHON_PACKAGE}". But if use two variables like
> PYTHON_BINARY and PYTHON_PACKAGE, looks even more silly. So I choose
> current solution.

I don't mind if you go for your inital version, it's not much
duplication, but why does it look silly? I don't think we need to worry
that the <package-name> on Ubuntu (and Debian) won't have a 1=1 mapping
to the /usr/bin/<package-name>. So defining the path in terms of the
package name seems like an obvious thing to do.

      reply	other threads:[~2022-11-24 12:26 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 15:02 [PATCH 0/2] Use fixed github-actions runner image Jiang Xin
2022-11-23 15:02 ` [PATCH 1/2] github-actions: run gcc-8 on ubuntu-20.04 image Jiang Xin
2022-11-24  8:11   ` Johannes Schindelin
2022-11-23 15:02 ` [PATCH 2/2] ci: upgrade version of p4 Jiang Xin
2022-11-24  8:16   ` Johannes Schindelin
2022-11-24  8:41     ` Johannes Schindelin
2022-11-24  8:54       ` Johannes Schindelin
2022-11-24  9:17         ` Jiang Xin
2022-11-24  9:41           ` Johannes Schindelin
2022-11-24  9:15     ` Jiang Xin
2022-11-24  8:18 ` [PATCH 0/2] Use fixed github-actions runner image Johannes Schindelin
2022-11-24  9:05 ` [PATCH v2 0/3] Fix broken CI on newer " Jiang Xin
2022-11-24  9:44   ` Johannes Schindelin
2022-11-24 10:48     ` Johannes Schindelin
2022-11-24 11:23       ` Jiang Xin
2022-11-24 12:28       ` python 2 EOL (was: [PATCH v2 0/3] Fix broken CI on newer github-actions runner image) Ævar Arnfjörð Bjarmason
2022-11-25  7:11         ` python 2 EOL Junio C Hamano
2022-11-24 15:39   ` [PATCH v3 0/4] Fix broken CI on newer github-actions runner image Jiang Xin
2022-11-25  9:59     ` [PATCH v4 " Jiang Xin
2022-11-25  9:59     ` [PATCH v4 1/4] github-actions: run gcc-8 on ubuntu-20.04 image Jiang Xin
2022-11-27  0:24       ` Junio C Hamano
2022-11-25  9:59     ` [PATCH v4 2/4] ci: remove the pipe after "p4 -V" to cache errors Jiang Xin
2022-11-27  0:24       ` Junio C Hamano
2022-11-27  9:14         ` Jiang Xin
2022-11-25  9:59     ` [PATCH v4 3/4] ci: p4 on Linux has the same version as on macOS Jiang Xin
2022-11-27  0:28       ` Junio C Hamano
2022-11-25  9:59     ` [PATCH v4 4/4] ci: install python on ubuntu Jiang Xin
2022-11-27  0:30       ` Junio C Hamano
2022-11-27  9:01         ` Jiang Xin
2022-11-27 23:36           ` Junio C Hamano
2022-11-24 15:39   ` [PATCH v3 1/4] github-actions: run gcc-8 on ubuntu-20.04 image Jiang Xin
2022-11-24 16:29     ` Ævar Arnfjörð Bjarmason
2022-11-24 15:39   ` [PATCH v3 2/4] ci: show error message of "p4 -V" Jiang Xin
2022-11-24 16:10     ` Ævar Arnfjörð Bjarmason
2022-11-25  4:48       ` Junio C Hamano
2022-11-24 15:39   ` [PATCH v3 3/4] ci: p4 on Linux has the same version as on macOS Jiang Xin
2022-11-24 15:39   ` [PATCH v3 4/4] ci: install python on ubuntu Jiang Xin
2022-11-24  9:05 ` [PATCH v2 1/3] github-actions: run gcc-8 on ubuntu-20.04 image Jiang Xin
2022-11-24 10:46   ` Ævar Arnfjörð Bjarmason
2022-11-25  7:21     ` Junio C Hamano
2022-11-24  9:05 ` [PATCH v2 2/3] ci: upgrade version of p4 to 21.2 Jiang Xin
2022-11-24 10:55   ` Ævar Arnfjörð Bjarmason
2022-11-24 12:56     ` Jiang Xin
2022-11-24  9:05 ` [PATCH v2 3/3] ci: install python on ubuntu Jiang Xin
2022-11-24 11:02   ` Ævar Arnfjörð Bjarmason
2022-11-24 11:37     ` Jiang Xin
2022-11-24 12:23       ` Ævar Arnfjörð Bjarmason [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=221124.86a64gpmkb.gmgdl@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=worldhello.net@gmail.com \
    --cc=zhiyou.jx@alibaba-inc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.