diff --git a/e2e/MODULE.bazel b/e2e/MODULE.bazel index 33678bec1..3ce100e64 100644 --- a/e2e/MODULE.bazel +++ b/e2e/MODULE.bazel @@ -123,4 +123,18 @@ uv.lockfile( hub_name = "pypi", venv_name = "psql", ) +uv.declare_venv( + hub_name = "pypi", + venv_name = "source-build", +) +uv.lockfile( + src = "//cases/uv-deps-650/source_crossbuild:uv.lock", + hub_name = "pypi", + venv_name = "source-build", +) +uv.unstable_annotate_requirements( + src = "//cases/uv-deps-650/source_crossbuild:annotations.toml", + hub_name = "pypi", + venv_name = "source-build", +) use_repo(uv, "pypi") diff --git a/e2e/cases/uv-deps-650/source_crossbuild/BUILD.bazel b/e2e/cases/uv-deps-650/source_crossbuild/BUILD.bazel new file mode 100644 index 000000000..b26e8d5d0 --- /dev/null +++ b/e2e/cases/uv-deps-650/source_crossbuild/BUILD.bazel @@ -0,0 +1,111 @@ +load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup") +load("@aspect_rules_py//py:defs.bzl", "py_image_layer") +load("@aspect_rules_py//py/tests/py_image_layer:asserts.bzl", "assert_tar_listing") +load("@aspect_rules_py//py/unstable:defs.bzl", "py_venv_binary") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_image_index") + +platform( + name = "arm64_linux", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:aarch64", + ], + exec_properties = { + "OSFamily": "Linux", + "Arch": "arm64", + }, + flags = [ + "--@aspect_rules_py//uv/private/constraints/platform:platform_libc=glibc", + "--@aspect_rules_py//uv/private/constraints/platform:platform_version=2.39", + "--@rules_rust//:extra_rustc_flag=-Cstrip=debuginfo", + "--@rules_rust//rust/settings:lto=fat", + "--stripopt=--strip-all", + ], +) + +platform( + name = "amd64_linux", + constraint_values = [ + "@platforms//os:linux", + "@platforms//cpu:x86_64", + ], + exec_properties = { + "OSFamily": "Linux", + "Arch": "amd64", + }, + flags = [ + "--@aspect_rules_py//uv/private/constraints/platform:platform_libc=glibc", + "--@aspect_rules_py//uv/private/constraints/platform:platform_version=2.39", + "--@rules_rust//:extra_rustc_flag=-Cstrip=debuginfo", + "--@rules_rust//rust/settings:lto=fat", + "--stripopt=--strip-all", + ], +) + +py_venv_binary( + name = "app_bin", + srcs = ["__main__.py"], + main = "__main__.py", + python_version = "3.12", + venv = "source-build", + deps = [ + "@pypi//cowsay", + ], +) + +py_image_layer( + name = "app_layers", + binary = ":app_bin", +) + +platform_transition_filegroup( + name = "amd64_layers", + srcs = [":app_layers"], + target_platform = ":amd64_linux", +) + +assert_tar_listing( + name = "app_amd64_layers", + actual = [":amd64_layers"], + expected = ":app_amd64_layers_listing.yaml", +) + +platform_transition_filegroup( + name = "arm64_layers", + srcs = [":app_layers"], + target_platform = ":arm64_linux", +) + +assert_tar_listing( + name = "app_arm64_layers", + actual = [":arm64_layers"], + expected = ":app_arm64_layers_listing.yaml", +) + +oci_image( + name = "image", + # This is defined by an oci.pull() call in /MODULE.bazel + base = "@ubuntu", + entrypoint = ["/{}/app_bin".format(package_name())], + tars = [":app_layers"], +) + +platform_transition_filegroup( + name = "amd64_image", + srcs = [":image"], + target_platform = ":amd64_linux", +) + +platform_transition_filegroup( + name = "arm64_image", + srcs = [":image"], + target_platform = ":arm64_linux", +) + +oci_image_index( + name = "image_index", + images = [ + ":arm64_image", + ":amd64_image", + ], +) diff --git a/e2e/cases/uv-deps-650/source_crossbuild/__main__.py b/e2e/cases/uv-deps-650/source_crossbuild/__main__.py new file mode 100644 index 000000000..cae82ebdd --- /dev/null +++ b/e2e/cases/uv-deps-650/source_crossbuild/__main__.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import cowsay + +if __name__ == "__main__": + print(cowsay.cow("Hello, world!")) diff --git a/e2e/cases/uv-deps-650/source_crossbuild/annotations.toml b/e2e/cases/uv-deps-650/source_crossbuild/annotations.toml new file mode 100644 index 000000000..477493768 --- /dev/null +++ b/e2e/cases/uv-deps-650/source_crossbuild/annotations.toml @@ -0,0 +1,5 @@ +version = "0.0.0" + +[[package]] +name = "cowsay" +native = true diff --git a/e2e/cases/uv-deps-650/source_crossbuild/app_amd64_layers_listing.yaml b/e2e/cases/uv-deps-650/source_crossbuild/app_amd64_layers_listing.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/e2e/cases/uv-deps-650/source_crossbuild/app_arm64_layers_listing.yaml b/e2e/cases/uv-deps-650/source_crossbuild/app_arm64_layers_listing.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/e2e/cases/uv-deps-650/source_crossbuild/uv.lock b/e2e/cases/uv-deps-650/source_crossbuild/uv.lock new file mode 100644 index 000000000..46feddbc7 --- /dev/null +++ b/e2e/cases/uv-deps-650/source_crossbuild/uv.lock @@ -0,0 +1,76 @@ +version = 1 +revision = 3 +requires-python = ">=3.11" + +[[package]] +name = "build" +version = "1.3.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "os_name == 'nt'" }, + { name = "packaging" }, + { name = "pyproject-hooks" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/25/1c/23e33405a7c9eac261dff640926b8b5adaed6a6eb3e1767d441ed611d0c0/build-1.3.0.tar.gz", hash = "sha256:698edd0ea270bde950f53aed21f3a0135672206f3911e0176261a31e0e07b397", size = 48544, upload-time = "2025-08-01T21:27:09.268Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/cb/8c/2b30c12155ad8de0cf641d76a8b396a16d2c36bc6d50b621a62b7c4567c1/build-1.3.0-py3-none-any.whl", hash = "sha256:7145f0b5061ba90a1500d60bd1b13ca0a8a4cebdd0cc16ed8adf1c0e739f43b4", size = 23382, upload-time = "2025-08-01T21:27:07.844Z" }, +] + +[[package]] +name = "colorama" +version = "0.4.6" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697, upload-time = "2022-10-25T02:36:22.414Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335, upload-time = "2022-10-25T02:36:20.889Z" }, +] + +[[package]] +name = "cowsay" +version = "6.0" +source = { url = "https://files.pythonhosted.org/packages/7e/b5/e8e802ddc7f5219417dc7d7953eec81ffe48ad129b793f3040361e4aff89/cowsay-6.0.tar.gz" } +sdist = { hash = "sha256:47445cb273684618a1786db8e8d05ec9258455f7eb74893e5d0933daafeb44ba" } + +[[package]] +name = "dummy" +version = "0.0.0" +source = { virtual = "." } +dependencies = [ + { name = "build" }, + { name = "cowsay" }, + { name = "setuptools" }, +] + +[package.metadata] +requires-dist = [ + { name = "build", specifier = ">=1.3.0" }, + { name = "cowsay", url = "https://files.pythonhosted.org/packages/7e/b5/e8e802ddc7f5219417dc7d7953eec81ffe48ad129b793f3040361e4aff89/cowsay-6.0.tar.gz" }, + { name = "setuptools", specifier = ">=80.9.0" }, +] + +[[package]] +name = "packaging" +version = "25.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727, upload-time = "2025-04-19T11:48:59.673Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" }, +] + +[[package]] +name = "pyproject-hooks" +version = "1.2.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/e7/82/28175b2414effca1cdac8dc99f76d660e7a4fb0ceefa4b4ab8f5f6742925/pyproject_hooks-1.2.0.tar.gz", hash = "sha256:1e859bd5c40fae9448642dd871adf459e5e2084186e8d2c2a79a824c970da1f8", size = 19228, upload-time = "2024-09-29T09:24:13.293Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/bd/24/12818598c362d7f300f18e74db45963dbcb85150324092410c8b49405e42/pyproject_hooks-1.2.0-py3-none-any.whl", hash = "sha256:9e5c6bfa8dcc30091c74b0cf803c81fdd29d94f01992a7707bc97babb1141913", size = 10216, upload-time = "2024-09-29T09:24:11.978Z" }, +] + +[[package]] +name = "setuptools" +version = "80.9.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/18/5d/3bf57dcd21979b887f014ea83c24ae194cfcd12b9e0fda66b957c69d1fca/setuptools-80.9.0.tar.gz", hash = "sha256:f36b47402ecde768dbfafc46e8e4207b4360c654f1f3bb84475f0a28628fb19c", size = 1319958, upload-time = "2025-05-27T00:56:51.443Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a3/dc/17031897dae0efacfea57dfd3a82fdd2a2aeb58e0ff71b77b87e44edc772/setuptools-80.9.0-py3-none-any.whl", hash = "sha256:062d34222ad13e0cc312a4c02d73f059e86a4acbfbdea8f8f76b28c99f306922", size = 1201486, upload-time = "2025-05-27T00:56:49.664Z" }, +]