From b198392e4cab8d1e37a781a09e0e5bf23dea7cf9 Mon Sep 17 00:00:00 2001 From: Javier Maestro Date: Tue, 3 Dec 2024 18:41:16 +0000 Subject: [PATCH] chore: remove select() from the examples With the changes in #115 and the previous commit, we can now remove a bunch of select from the examples and use the new target aliases. --- .../debian_shared_dependencies/BUILD.bazel | 36 +---------------- examples/ubuntu_snapshot/BUILD.bazel | 40 +------------------ 2 files changed, 4 insertions(+), 72 deletions(-) diff --git a/examples/debian_shared_dependencies/BUILD.bazel b/examples/debian_shared_dependencies/BUILD.bazel index 5e259f5..2710d72 100644 --- a/examples/debian_shared_dependencies/BUILD.bazel +++ b/examples/debian_shared_dependencies/BUILD.bazel @@ -1,6 +1,5 @@ load("@aspect_bazel_lib//lib:tar.bzl", "tar") load("@container_structure_test//:defs.bzl", "container_structure_test") -load("@rules_distroless//apt:defs.bzl", "dpkg_status") load("@rules_distroless//distroless:defs.bzl", "group", "passwd") load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load") @@ -46,28 +45,6 @@ tar( ], ) -PACKAGES = [ - "@shared_dependencies//tzdata", - "@shared_dependencies//bash", - "@shared_dependencies//coreutils", - "@shared_dependencies//nginx-core", -] - -# Creates /var/lib/dpkg/status with installed package information. -dpkg_status( - name = "dpkg_status", - controls = select({ - "@platforms//cpu:arm64": [ - "%s/arm64:control" % package - for package in PACKAGES - ], - "@platforms//cpu:x86_64": [ - "%s/amd64:control" % package - for package in PACKAGES - ], - }), -) - oci_image( name = "apt", architecture = select({ @@ -79,17 +56,8 @@ oci_image( ":sh", ":passwd", ":group", - ":dpkg_status", - ] + select({ - "@platforms//cpu:arm64": [ - "%s/arm64" % package - for package in PACKAGES - ], - "@platforms//cpu:x86_64": [ - "%s/amd64" % package - for package in PACKAGES - ], - }), + "@shared_dependencies//:shared_dependencies", + ], ) oci_load( diff --git a/examples/ubuntu_snapshot/BUILD.bazel b/examples/ubuntu_snapshot/BUILD.bazel index 4441b91..2cb6a91 100644 --- a/examples/ubuntu_snapshot/BUILD.bazel +++ b/examples/ubuntu_snapshot/BUILD.bazel @@ -1,6 +1,5 @@ load("@aspect_bazel_lib//lib:tar.bzl", "tar") load("@container_structure_test//:defs.bzl", "container_structure_test") -load("@rules_distroless//apt:defs.bzl", "dpkg_status") load("@rules_distroless//distroless:defs.bzl", "group", "passwd") load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load") @@ -46,32 +45,6 @@ tar( ], ) -PACKAGES = [ - "@noble//ncurses-base", - "@noble//libncurses6", - "@noble//tzdata", - "@noble//bash", - "@noble//coreutils", - "@noble//dpkg", - "@noble//apt", - "@noble//perl", -] - -# Creates /var/lib/dpkg/status with installed package information. -dpkg_status( - name = "dpkg_status", - controls = select({ - "@platforms//cpu:arm64": [ - "%s/arm64:control" % package - for package in PACKAGES - ], - "@platforms//cpu:x86_64": [ - "%s/amd64:control" % package - for package in PACKAGES - ], - }), -) - oci_image( name = "noble", architecture = select({ @@ -83,17 +56,8 @@ oci_image( ":sh", ":passwd", ":group", - ":dpkg_status", - ] + select({ - "@platforms//cpu:arm64": [ - "%s/arm64" % package - for package in PACKAGES - ], - "@platforms//cpu:x86_64": [ - "%s/amd64" % package - for package in PACKAGES - ], - }), + "@noble//:noble", + ], ) oci_load(