Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tests/dragonfly/package_install_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import platform

import pytest
from testcontainers.core.container import DockerContainer


Expand All @@ -6,6 +9,7 @@ def check(container: DockerContainer, cmd: str):
assert result.exit_code == 0, f"command {cmd} failed with result {result}"


@pytest.mark.skipif(platform.processor() != "x86_64", reason="rpm is only built for x86_64")
Copy link

Choose a reason for hiding this comment

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

platform.processor() can return an empty string on some Linux environments, which could cause this test to be skipped even on x86_64; platform.machine() tends to be more reliable for architecture checks.

🤖 Was this useful? React with 👍 or 👎

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Consider this

@pytest.mark.skipif(
    platform.architecture()[0] != "64bit",
    reason="test requires 64-bit platform"
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

    platform.architecture()[0] != "64bit",

Because this analyzes the output of the file command, it will also return true on 64 bit ARM which we have to skip, eg from an arm machine

# uname -a
Linux ... aarch64 aarch64 aarch64 GNU/Linux
>>> platform.architecture()
('64bit', 'ELF')

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not apply the bot's suggestion because machine() can also return empty string on some environments, it doesn't appear to be any better than processor() which we already use in some other places in code.

async def test_install_package_on_fedora():
with DockerContainer(image="fedora:latest", tty=True) as fedora:
check(
Expand Down
9 changes: 5 additions & 4 deletions tools/packaging/osrepos/scripts/fetch-releases.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,15 @@ def collect_download_urls() -> list[Package]:
def download_packages(root: str, packages: list[Package]):
# The debian repository building tool, reprepo, only supports a single package per version by default.
# The ability to support multiple versions has been added but is not present in ubuntu-latest on
# github action runners yet. So we only download one package, the latest, for ubuntu.
# github action runners yet. So we only download one package per architecture, the latest, for ubuntu.
# The rest of the scripts work on a set of packages, so that when the Limit parameter is supported,
# we can remove this flag and start hosting more than the latest versions.
# Another alternative would be to use the components feature of reprepo, but it would involve updating
# the repository definition itself for each release, which is a bad experience for end users.
deb_done = False
deb_done = 0
for package in packages:
if package.kind == AssetKind.DEB and deb_done:
# Download the latest arm and amd64 package for .deb format
if package.kind == AssetKind.DEB and deb_done == 2:
Copy link

Choose a reason for hiding this comment

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

This logic assumes exactly two DEB architectures and relies on asset ordering; it may download two of the same arch across releases and miss the other. Tracking unique architectures downloaded would ensure one per arch regardless of order (also applies to the increment below).

🤖 Was this useful? React with 👍 or 👎

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a valid suggestion but kind of overkill as we have a specific schema and order for packages on the release page. It might be something to apply in a follow up PR

Copy link
Collaborator

Choose a reason for hiding this comment

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

no need

continue

print(f"Downloading {package.download_url}")
Expand All @@ -89,7 +90,7 @@ def download_packages(root: str, packages: list[Package]):
print(f"Downloaded {package.download_url}")
time.sleep(0.5)
if package.kind == AssetKind.DEB:
deb_done = True
deb_done += 1


def main(root: str):
Expand Down
Loading