Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xx-info: handle rhel arch #52

Merged
merged 1 commit into from
Nov 14, 2021
Merged

Conversation

crazy-max
Copy link
Collaborator

Handle RHEL based distrib for xx-info. This is partially needed for docker/buildx#840 to handle RPM arch package properly. Following distribs are currently handled:

$ docker run --rm -it fedora:35 cat /etc/os-release
NAME="Fedora Linux"
VERSION="35 (Container Image)"
ID=fedora
VERSION_ID=35
VERSION_CODENAME=""
PLATFORM_ID="platform:f35"
PRETTY_NAME="Fedora Linux 35 (Container Image)"
ANSI_COLOR="0;38;2;60;110;180"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:35"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f35/system-administrators-guide/"
SUPPORT_URL="https://ask.fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=35
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=35
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
VARIANT="Container Image"
VARIANT_ID=container
$ docker run --rm -it centos:8 cat /etc/os-release
NAME="CentOS Linux"
VERSION="8"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
$ docker run --rm -it rockylinux/rockylinux cat /etc/os-release
NAME="Rocky Linux"
VERSION="8.4 (Green Obsidian)"
ID="rocky"
ID_LIKE="rhel fedora"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Rocky Linux 8.4 (Green Obsidian)"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:rocky:rocky:8.4:GA"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky Linux"
ROCKY_SUPPORT_PRODUCT_VERSION="8"
$ docker run --rm -it redhat/ubi8 cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.5 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.5"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.5 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.5
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.5"

I wonder if we should not take into account ID_LIKE to properly handle RHEL based distrib. Same could be done for Debian based in #49.

In a follow-up we could start thinking about xx-yum.

Signed-off-by: CrazyMax [email protected]

args = {
TEST_BASE_TYPE = "rhel"
TEST_BASE_IMAGE = "fedora:35"
TEST_CMDS = "info"
Copy link
Collaborator Author

@crazy-max crazy-max Nov 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this line in a follow-up when windres is hanlded for rhel:

#24 [test  6/11] RUN --mount=type=cache,target=/pkg-cache     [ "${TEST_CMDS:-windres}" = "${TEST_CMDS#*windres}" ] && exit 0; ./test-windres.bats
#24 0.173 1..3
#24 0.254 not ok 1 invalid
#24 0.254 # (from function `xxrun' in file test_helper.bash, line 54,
#24 0.254 #  from function `add' in file test_helper.bash, line 7,
#24 0.254 #  in test file test-windres.bats, line 7)
#24 0.255 #   `add llvm' failed with status 127
#24 0.255 # /work/test_helper.bash: line 54: apt: command not found
#24 0.319 not ok 2 basic
#24 0.319 # (from function `assert_success' in file bats-assert/src/assert.bash, line 114,
#24 0.319 #  in test file test-windres.bats, line 20)
#24 0.319 #   `assert_success' failed
#24 0.319 #
#24 0.319 # -- command failed --
#24 0.319 # status : 1
#24 0.319 # output : llvm-rc not installed
#24 0.319 # --
#24 0.320 #
#24 0.359 ok 3 clean
#24 ERROR: process "/bin/sh -c [ \"${TEST_CMDS:-windres}\" = \"${TEST_CMDS#*windres}\" ] && exit 0; ./test-windres.bats" did not complete successfully: exit code: 1
------
 > [test  6/11] RUN --mount=type=cache,target=/pkg-cache     [ "${TEST_CMDS:-windres}" = "${TEST_CMDS#*windres}" ] && exit 0; ./test-windres.bats:
#24 0.319 # (from function `assert_success' in file bats-assert/src/assert.bash, line 114,
#24 0.319 #  in test file test-windres.bats, line 20)
#24 0.319 #   `assert_success' failed
#24 0.319 #
#24 0.319 # -- command failed --
#24 0.319 # status : 1
#24 0.319 # output : llvm-rc not installed
#24 0.319 # --
#24 0.320 #
#24 0.359 ok 3 clean

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a check for this in https://github.com/tonistiigi/xx/pull/49/files#diff-97b6828de99e6a75768dba426569ce1a89f0e32542b0ea9c7a3349f47a99263bR16 . Does centos really ship with very old llvm or why isn't this installed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does centos really ship with very old llvm or why isn't this installed?

I have not yet updated the test_helper.bash to include yum/dnf. I can add the add/del implementation so the test would pass but we might also need to add xx-yum or xx-dnf.

Copy link
Collaborator Author

@crazy-max crazy-max Nov 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also centos and rhel don't have the bats pkg available in their main repo so I might need to fix sources for the test-base-rhel target in the Dockerfile.

@tonistiigi tonistiigi merged commit b04e56e into tonistiigi:master Nov 14, 2021
@crazy-max crazy-max deleted the rhel-arch branch November 14, 2021 19:34
@panekj panekj mentioned this pull request Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants