Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Improve install_command test #22

Open
gardar opened this issue Jun 28, 2022 · 1 comment
Open

Improve install_command test #22

gardar opened this issue Jun 28, 2022 · 1 comment

Comments

@gardar
Copy link
Contributor

gardar commented Jun 28, 2022

install_command() {
# Run test if this binary exists
PACKAGE=$1
TEST_BINARY=$PACKAGE
podman exec --user root:root "$CONTAINER_ID" /bin/bash -c 'if ! type '"$TEST_BINARY"' >/dev/null 2>&1; then

I think the install_command test could be improved as the packages listed under the dependencies don't all contain binaries that are equal to the name of the package.
The ca-certificates package for example does not contain any binary called ca-certificates (at least not on archlinux/debian/redhat) which causes the ca-certificates package to be installed in every job.
This can count for a significant amount of time, especially on yum based distros that have a lot of repos enabled.

Possible solutions:

  • Adding a second argument to install_command for a file to check (or perhaps a command to run).
  • Check if a package is installed instead of relying on the existence of a certain file/binary. This would need to be distro specific but it would be possible to use dpkg/rpm/etc. instead of apt/yum/dnf (using rpm is significantly faster than relying on yum/dnf).
@jonasbb
Copy link
Owner

jonasbb commented Jun 28, 2022

It is indeed unfortunate that this always tries to install the package, but I am not aware how to check these things properly in a distro-agnostic version. Another problem I see is that the install command gets executed multiple times instead of installing all missing packages at once.
If someone wants to improve the situation, I am happy to merge that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants