From e53abaf4fda49503c51ec15b3d024f8ddc044c40 Mon Sep 17 00:00:00 2001 From: betaboon Date: Sun, 10 Dec 2023 18:17:24 +0100 Subject: [PATCH] wip --- README.md | 1 + debian_packages/extensions.bzl | 25 ++ debian_packages/private/bzlmod/BUILD.bazel | 0 .../private/bzlmod/repository.build.tmpl | 21 + debian_packages/private/bzlmod/repository.bzl | 85 ++++ .../private/bzlmod/repository.packages.tmpl | 21 + .../private/repository.workspace.tmpl | 8 + examples/bzlmod/.bazelrc | 1 + examples/bzlmod/.bazelversion | 1 + examples/bzlmod/BUILD.bazel | 76 ++++ examples/bzlmod/MODULE.bazel | 26 ++ examples/bzlmod/README.md | 9 + examples/bzlmod/WORKSPACE.bazel | 2 + examples/bzlmod/packages.lock | 377 ++++++++++++++++++ examples/bzlmod/packages.yaml | 36 ++ examples/bzlmod/snapshots.yaml | 2 + 16 files changed, 691 insertions(+) create mode 100644 debian_packages/extensions.bzl create mode 100644 debian_packages/private/bzlmod/BUILD.bazel create mode 100644 debian_packages/private/bzlmod/repository.build.tmpl create mode 100644 debian_packages/private/bzlmod/repository.bzl create mode 100644 debian_packages/private/bzlmod/repository.packages.tmpl create mode 100644 debian_packages/private/repository.workspace.tmpl create mode 100644 examples/bzlmod/.bazelrc create mode 100644 examples/bzlmod/.bazelversion create mode 100644 examples/bzlmod/BUILD.bazel create mode 100644 examples/bzlmod/MODULE.bazel create mode 100644 examples/bzlmod/README.md create mode 100644 examples/bzlmod/WORKSPACE.bazel create mode 100644 examples/bzlmod/packages.lock create mode 100644 examples/bzlmod/packages.yaml create mode 100644 examples/bzlmod/snapshots.yaml diff --git a/README.md b/README.md index 3427455..cbb2032 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ Usage of this ruleset involves three main steps: - [rules_docker](examples/rules_docker/) - [rules_oci](examples/rules_oci) +- [bzlmod](examples/bzlmod) ## Public API Docs diff --git a/debian_packages/extensions.bzl b/debian_packages/extensions.bzl new file mode 100644 index 0000000..6cdb4e3 --- /dev/null +++ b/debian_packages/extensions.bzl @@ -0,0 +1,25 @@ +load(":defs.bzl", "debian_packages_repository") + +_repository_attrs = { + "name": attr.string(doc = "TODO"), + "lock_file": attr.label(), + "default_distro": attr.string(), + "default_arch": attr.string(), +} + +def _impl(mctx): + for mod in mctx.modules: + for repository in mod.tags.repository: + debian_packages_repository( + name = repository.name, + lock_file = repository.lock_file, + default_distro = repository.default_distro, + default_arch = repository.default_arch, + ) + +debian_packages = module_extension( + implementation = _impl, + tag_classes = { + "repository": tag_class(attrs = _repository_attrs), + }, +) diff --git a/debian_packages/private/bzlmod/BUILD.bazel b/debian_packages/private/bzlmod/BUILD.bazel new file mode 100644 index 0000000..e69de29 diff --git a/debian_packages/private/bzlmod/repository.build.tmpl b/debian_packages/private/bzlmod/repository.build.tmpl new file mode 100644 index 0000000..3231ace --- /dev/null +++ b/debian_packages/private/bzlmod/repository.build.tmpl @@ -0,0 +1,21 @@ +# AUTO GENERATED. DO NOT EDIT! + +load("@rules_debian_packages//debian_packages/private:utils.bzl", "package_rule", "package_layer_rule") + +package(default_visibility = ["//visibility:public"]) + +_REPOSITORY = "{REPOSITORY}" + +_PACKAGES = {PACKAGES} + +[ + package_rule(_REPOSITORY, name, distro, arch, deps) + for name, distro, arch, deps in _PACKAGES +] + +[ + package_layer_rule(_REPOSITORY, name, distro, arch, deps) + for name, distro, arch, deps in _PACKAGES +] + +exports_files(["packages.bzl"]) diff --git a/debian_packages/private/bzlmod/repository.bzl b/debian_packages/private/bzlmod/repository.bzl new file mode 100644 index 0000000..16a7993 --- /dev/null +++ b/debian_packages/private/bzlmod/repository.bzl @@ -0,0 +1,85 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file") +load("@rules_debian_packages//debian_packages/private:utils.bzl", "debfile_name", "package_name") + +_ARCHIVE_BUILD_FILE_CONTENT = """\ +load("@rules_debian_packages//debian_packages/private:utils.bzl", "debfile_layer_rule") +debfile_layer_rule() +""" + +def _debian_packages_repository_impl(rctx): + print("IN BZLMOD REPO:", rctx.attr.name) + lock_file_path = rctx.path(rctx.attr.lock_file) + lock_file_content = json.decode(rctx.read(lock_file_path)) + lock_file_files = lock_file_content.get("files") + lock_file_packages = lock_file_content.get("packages") + + for distro, archs in lock_file_files.items(): + for arch, arch_files in archs.items(): + for file in arch_files: + http_file( + name = rctx.attr.name + "_" + debfile_name(file["name"], distro, arch), + urls = [file["url"]], + sha256 = file["sha256"], + downloaded_file_path = file["url"].split("/")[-1], + ) + http_archive( + name = rctx.attr.name + "_" + package_name(file["name"], distro, arch), + urls = [file["url"]], + sha256 = file["sha256"], + build_file_content = _ARCHIVE_BUILD_FILE_CONTENT, + ) + + packages = [] + for distro, archs in lock_file_packages.items(): + for arch, arch_packages in archs.items(): + for package in arch_packages: + packages.append( + ( + package["name"], + distro, + arch, + tuple(package["dependencies"]), + ), + ) + + print("writing BZLMOD BUILD") + rctx.template( + "BUILD.bazel", + Label("@rules_debian_packages//debian_packages/private/bzlmod:repository.build.tmpl"), + substitutions = { + "{REPOSITORY}": rctx.attr.name, + "{PACKAGES}": str(tuple(packages)), + }, + ) + + print("writing BZLMOD packages") + rctx.template( + "packages.bzl", + Label("@rules_debian_packages//debian_packages/private/bzlmod:repository.packages.tmpl"), + substitutions = { + "{REPOSITORY}": rctx.attr.name, + "{DEFAULT_DISTRO}": rctx.attr.default_distro, + "{DEFAULT_ARCH}": rctx.attr.default_arch, + }, + ) + +_debian_packages_repository_attrs = { + "lock_file": attr.label( + doc = "The lockfile to generate a repository from.", + allow_single_file = True, + mandatory = True, + ), + "default_distro": attr.string( + doc = "The debian-distro to assume as default.", + mandatory = True, + ), + "default_arch": attr.string( + doc = "The architecture to assume as default.", + mandatory = True, + ), +} + +debian_packages_repository = repository_rule( + implementation = _debian_packages_repository_impl, + attrs = _debian_packages_repository_attrs, +) diff --git a/debian_packages/private/bzlmod/repository.packages.tmpl b/debian_packages/private/bzlmod/repository.packages.tmpl new file mode 100644 index 0000000..b63ca5f --- /dev/null +++ b/debian_packages/private/bzlmod/repository.packages.tmpl @@ -0,0 +1,21 @@ +# AUTO GENERATED. DO NOT EDIT! + +load("@rules_debian_packages//debian_packages/private:utils.bzl", "debfile_target", "debfile_layer_target", "package_target", "package_layer_target") + +_REPOSITORY = "{REPOSITORY}" + +_DEFAULT_DISTRO = "{DEFAULT_DISTRO}" + +_DEFAULT_ARCH = "{DEFAULT_ARCH}" + +def debfile(name, distro = _DEFAULT_DISTRO, arch = _DEFAULT_ARCH): + return debfile_target(_REPOSITORY, name, distro, arch) + +def debfile_layer(name, distro = _DEFAULT_DISTRO, arch = _DEFAULT_ARCH): + return debfile_layer_target(_REPOSITORY, name, distro, arch) + +def debian_package(name, distro = _DEFAULT_DISTRO, arch = _DEFAULT_ARCH): + return package_target(_REPOSITORY, name, distro, arch) + +def debian_package_layer(name, distro = _DEFAULT_DISTRO, arch = _DEFAULT_ARCH): + return package_layer_target(_REPOSITORY, name, distro, arch) diff --git a/debian_packages/private/repository.workspace.tmpl b/debian_packages/private/repository.workspace.tmpl new file mode 100644 index 0000000..f09c6b8 --- /dev/null +++ b/debian_packages/private/repository.workspace.tmpl @@ -0,0 +1,8 @@ +# AUTO GENERATED. DO NOT EDIT! + +_REPOSITORY = "{REPOSITORY}" + +workspace(name = _REPOSITORY) + +load(":packages.bzl", "install_deps") +install_deps() diff --git a/examples/bzlmod/.bazelrc b/examples/bzlmod/.bazelrc new file mode 100644 index 0000000..3ce91d2 --- /dev/null +++ b/examples/bzlmod/.bazelrc @@ -0,0 +1 @@ +common --enable_bzlmod diff --git a/examples/bzlmod/.bazelversion b/examples/bzlmod/.bazelversion new file mode 100644 index 0000000..19b860c --- /dev/null +++ b/examples/bzlmod/.bazelversion @@ -0,0 +1 @@ +6.4.0 diff --git a/examples/bzlmod/BUILD.bazel b/examples/bzlmod/BUILD.bazel new file mode 100644 index 0000000..6c630f8 --- /dev/null +++ b/examples/bzlmod/BUILD.bazel @@ -0,0 +1,76 @@ +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball") +load("@debian_packages//:packages.bzl", "debian_package_layer") +load("@rules_pkg//pkg:mappings.bzl", "pkg_mklink") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +# load("@rules_debian_packages//debian_packages:defs.bzl", "debian_packages_lockfile") + +package(default_visibility = ["//visibility:public"]) + +pkg_mklink( + name = "usr_bin_python_symlink", + link_name = "/usr/bin/python", + target = "/bin/bin/python3.11", +) + +pkg_mklink( + name = "usr_bin_python3_symlink", + link_name = "/usr/bin/python3", + target = "/bin/bin/python3.11", +) + +pkg_tar( + name = "symlinks_layer", + srcs = [ + ":usr_bin_python3_symlink", + ":usr_bin_python_symlink", + ], +) + +oci_image( + name = "image", + architecture = "amd64", + entrypoint = ["/usr/bin/python3.11"], + env = {"LANG": "C.UTF-8"}, + os = "linux", + tars = [ + # required to replicate distroless/static + debian_package_layer("base-files"), + debian_package_layer("netbase"), + debian_package_layer("tzdata"), + debian_package_layer("ca-certificates"), + # required to replicate distroless/base + debian_package_layer("libc6"), + debian_package_layer("libssl3"), + debian_package_layer("openssl"), + # required to replicate distroless/cc + debian_package_layer("libgcc-s1"), + debian_package_layer("libgomp1"), + debian_package_layer("libstdc++6"), + # required to replicate distroless/python + debian_package_layer("dash"), + debian_package_layer("libc-bin"), + debian_package_layer("python3.11-minimal"), + debian_package_layer("libpython3.11-stdlib"), + debian_package_layer("python3-distutils"), + # symlinks + ":symlinks_layer", + ], + visibility = ["//visibility:private"], +) + +oci_tarball( + name = "image.tar", + image = ":image", + repo_tags = ["image:latest"], +) + +# Generate lockfile with: +# bazel run :debian_packages.generate +# Update snapshots with: +# bazel run :debian_packages.update +# debian_packages_lockfile( +# name = "debian_packages", +# lock_file = "packages.lock", +# packages_file = "packages.yaml", +# snapshots_file = "snapshots.yaml", +# ) diff --git a/examples/bzlmod/MODULE.bazel b/examples/bzlmod/MODULE.bazel new file mode 100644 index 0000000..5cf22b2 --- /dev/null +++ b/examples/bzlmod/MODULE.bazel @@ -0,0 +1,26 @@ +module( + name = "rules_debian_packages_bzlmod_example", + version = "0.0.0", + compatibility_level = 1, +) + +bazel_dep(name = "rules_oci", version = "1.4.0") +bazel_dep(name = "rules_pkg", version = "0.9.1") +bazel_dep(name = "rules_python", version = "0.26.0") +bazel_dep(name = "rules_debian_packages", version = "0.0.0") +local_path_override( + module_name = "rules_debian_packages", + path = "../..", +) + +python = use_extension("@rules_python//python/extensions:python.bzl", "python") +python.toolchain(python_version = "3.11") + +debian_packages = use_extension("@rules_debian_packages//debian_packages:extensions.bzl", "debian_packages") +debian_packages.repository( + name = "debian_packages", + default_arch = "amd64", + default_distro = "debian12", + lock_file = "//:packages.lock", +) +use_repo(debian_packages, "debian_packages") diff --git a/examples/bzlmod/README.md b/examples/bzlmod/README.md new file mode 100644 index 0000000..f311ad9 --- /dev/null +++ b/examples/bzlmod/README.md @@ -0,0 +1,9 @@ +# Example + +This workspace provides an example of using `rules_debian_packages` with `rules_oci`. + +It demonstrates how to build a container-image that is almost equivalent to `distroless/python3-debian12`. + +To build the image run: `bazel build :image` + +To update the debian-snapshots run: `bazel run :debian_packages.update` diff --git a/examples/bzlmod/WORKSPACE.bazel b/examples/bzlmod/WORKSPACE.bazel new file mode 100644 index 0000000..78cc252 --- /dev/null +++ b/examples/bzlmod/WORKSPACE.bazel @@ -0,0 +1,2 @@ +# Empty file indicating the root of a Bazel workspace. +# Dependencies and setup are in MODULE.bazel. diff --git a/examples/bzlmod/packages.lock b/examples/bzlmod/packages.lock new file mode 100644 index 0000000..0d2bda1 --- /dev/null +++ b/examples/bzlmod/packages.lock @@ -0,0 +1,377 @@ +{ + "files": { + "debian12": { + "amd64": [ + { + "name": "awk", + "sha256": "9cd63c1b35ff082092c221a23dcb167f72c4d1c3de3a42e11f16181f42ab3b55", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/g/gawk/gawk_5.2.1-2_amd64.deb", + "version": null + }, + { + "name": "base_files", + "sha256": "cde7e5f9cf398bc9d82d119e8ed2697c94e2e59b8d20b0e05c6b4c29dd65573b", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/b/base-files/base-files_12.4+deb12u2_amd64.deb", + "version": "12.4+deb12u2" + }, + { + "name": "ca_certificates", + "sha256": "5308b9bd88eebe2a48be3168cb3d87677aaec5da9c63ad0cf561a29b8219115c", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/c/ca-certificates/ca-certificates_20230311_all.deb", + "version": "20230311" + }, + { + "name": "dash", + "sha256": "33ea40061da2f1a861ec46212b2b6a34f0776a049b1a3f0abce2fb8cb994258f", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/d/dash/dash_0.5.12-2_amd64.deb", + "version": "0.5.12-2" + }, + { + "name": "gcc_12_base", + "sha256": "1a03df5a57833d65b5bb08cfa19d50e76f29088dc9e64fb934af42d9023a0807", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/g/gcc-12/gcc-12-base_12.2.0-14_amd64.deb", + "version": "12.2.0-14" + }, + { + "name": "libbz2_1_0", + "sha256": "54149da3f44b22d523b26b692033b84503d822cc5122fed606ea69cc83ca5aeb", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/b/bzip2/libbz2-1.0_1.0.8-5+b1_amd64.deb", + "version": "1.0.8-5+b1" + }, + { + "name": "libc6", + "sha256": "96c2d796a21fdc92b4d272a550841c208e89c91ab0d54514ac28ae92da64c2c7", + "url": "https://snapshot.debian.org/archive/debian-security/20231110T215743Z/pool/updates/main/g/glibc/libc6_2.36-9+deb12u3_amd64.deb", + "version": "2.36-9+deb12u3" + }, + { + "name": "libc_bin", + "sha256": "9840ce93b42b66c784852df07ee9131b7acab886177794a5c9ba761da9463887", + "url": "https://snapshot.debian.org/archive/debian-security/20231110T215743Z/pool/updates/main/g/glibc/libc-bin_2.36-9+deb12u3_amd64.deb", + "version": "2.36-9+deb12u3" + }, + { + "name": "libcom_err2", + "sha256": "8010e4285276bb344c05ae780deae2fffb45e237116c3a78481365c5954125ec", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/e/e2fsprogs/libcom-err2_1.47.0-2_amd64.deb", + "version": "1.47.0-2" + }, + { + "name": "libcrypt1", + "sha256": "f5f60a5cdfd4e4eaa9438ade5078a57741a7a78d659fcb0c701204f523e8bd29", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/libx/libxcrypt/libcrypt1_4.4.33-2_amd64.deb", + "version": "1:4.4.33-2" + }, + { + "name": "libdb5_3", + "sha256": "7dc5127b8dd0da80e992ba594954c005ae4359d839a24eb65d0d8129b5235c84", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/d/db5.3/libdb5.3_5.3.28+dfsg2-1_amd64.deb", + "version": "5.3.28+dfsg2-1" + }, + { + "name": "libexpat1", + "sha256": "fe36a7f35361fc40d0057ef447a7302fd41d51740d51c98fb3870bbed5b96e56", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/e/expat/libexpat1_2.5.0-1_amd64.deb", + "version": "2.5.0-1" + }, + { + "name": "libffi8", + "sha256": "6d9f6c25c30efccce6d4bceaa48ea86c329a3432abb360a141f76ac223a4c34a", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/libf/libffi/libffi8_3.4.4-1_amd64.deb", + "version": "3.4.4-1" + }, + { + "name": "libgcc_s1", + "sha256": "f3d1d48c0599aea85b7f2077a01d285badc42998c1a1e7473935d5cf995c8141", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/g/gcc-12/libgcc-s1_12.2.0-14_amd64.deb", + "version": "12.2.0-14" + }, + { + "name": "libgomp1", + "sha256": "1dbc499d2055cb128fa4ed678a7adbcced3d882b3509e26d5aa3742a4b9e5b2f", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/g/gcc-12/libgomp1_12.2.0-14_amd64.deb", + "version": "12.2.0-14" + }, + { + "name": "libgssapi_krb5_2", + "sha256": "6631304ce4b5b9ba0af3fdebf088a734aed2d28ffad2a03ba79e4fcb2e226dd6", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/k/krb5/libgssapi-krb5-2_1.20.1-2+deb12u1_amd64.deb", + "version": "1.20.1-2+deb12u1" + }, + { + "name": "libk5crypto3", + "sha256": "6a91eee690e6ad2207df3a355fc329a58d8e31bf5ca9a9dd4de8f7a1c812ddc5", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/k/krb5/libk5crypto3_1.20.1-2+deb12u1_amd64.deb", + "version": "1.20.1-2+deb12u1" + }, + { + "name": "libkeyutils1", + "sha256": "cfac89e6a7a54ff3c6a4f843310e25efeddaa771baeae470bd98bd588c373563", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/k/keyutils/libkeyutils1_1.6.3-2_amd64.deb", + "version": "1.6.3-2" + }, + { + "name": "libkrb5_3", + "sha256": "03ebdf235600f4a8a6d4fbc7080de0a776b1a701f43c4e9697944757591d7809", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/k/krb5/libkrb5-3_1.20.1-2+deb12u1_amd64.deb", + "version": "1.20.1-2+deb12u1" + }, + { + "name": "libkrb5support0", + "sha256": "e489a9282c4b765c29d9eda7c4747e1cb58be71161012c3a57e2a8bc63dc0f5a", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/k/krb5/libkrb5support0_1.20.1-2+deb12u1_amd64.deb", + "version": "1.20.1-2+deb12u1" + }, + { + "name": "liblzma5", + "sha256": "d4b7736e58512a2b047f9cb91b71db5a3cf9d3451192fc6da044c77bf51fe869", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/x/xz-utils/liblzma5_5.4.1-0.2_amd64.deb", + "version": "5.4.1-0.2" + }, + { + "name": "libncursesw6", + "sha256": "98fa7a53dc565a38b65fb70422ad08001bf5361d8fbc74255280c329996a6bec", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/n/ncurses/libncursesw6_6.4-4_amd64.deb", + "version": "6.4-4" + }, + { + "name": "libnsl2", + "sha256": "c0d83437fdb016cb289436f49f28a36be44b3e8f1f2498c7e3a095f709c0d6f8", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/libn/libnsl/libnsl2_1.3.0-2_amd64.deb", + "version": "1.3.0-2" + }, + { + "name": "libpython3_11_minimal", + "sha256": "6fc5ab5858781ab90c68b4deea09f21871fd7b55dc1a0764ad7116ac4c86574d", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/p/python3.11/libpython3.11-minimal_3.11.2-6_amd64.deb", + "version": "3.11.2-6" + }, + { + "name": "libpython3_11_stdlib", + "sha256": "67eec0eb4df58b93e1bf97c402c2cbeb361bf9c5af44fa3a02ff1c723c791ca2", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/p/python3.11/libpython3.11-stdlib_3.11.2-6_amd64.deb", + "version": "3.11.2-6" + }, + { + "name": "libreadline8", + "sha256": "e02ebbd3701cf468dbf98d6d917fbe0325e881f07fe8b316150c8d2a64486e66", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/r/readline/libreadline8_8.2-1.3_amd64.deb", + "version": "8.2-1.3" + }, + { + "name": "libsqlite3_0", + "sha256": "a8b11a1664a998cc2499fb04327d1f6c4e8f77b78ea8b6f8418d96fc54e3731f", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/s/sqlite3/libsqlite3-0_3.40.1-2_amd64.deb", + "version": "3.40.1-2" + }, + { + "name": "libssl3", + "sha256": "6e129c5814812b3516a656ae5b664b9970e2f8823250cd5b98190f21c0de2bca", + "url": "https://snapshot.debian.org/archive/debian-security/20231110T215743Z/pool/updates/main/o/openssl/libssl3_3.0.11-1~deb12u2_amd64.deb", + "version": "3.0.11-1~deb12u2" + }, + { + "name": "libstdcpp6", + "sha256": "9b1b269020cec6aced3b39f096f7b67edd1f0d4ab24f412cb6506d0800e19cbf", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/g/gcc-12/libstdc++6_12.2.0-14_amd64.deb", + "version": "12.2.0-14" + }, + { + "name": "libtinfo6", + "sha256": "072d908f38f51090ca28ca5afa3b46b2957dc61fe35094c0b851426859a49a51", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/n/ncurses/libtinfo6_6.4-4_amd64.deb", + "version": "6.4-4" + }, + { + "name": "libtirpc3", + "sha256": "2a46d5a5e9486da11ffeff5740931740d6deae4f92cd6098df060dc5dff1e1c7", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/libt/libtirpc/libtirpc3_1.3.3+ds-1_amd64.deb", + "version": "1.3.3+ds-1" + }, + { + "name": "libuuid1", + "sha256": "c2b3ccade855de14c6ece893a0d2bec63b0a007cbc2970af8152cf06699ccd2a", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/u/util-linux/libuuid1_2.38.1-5+b1_amd64.deb", + "version": "2.38.1-5+b1" + }, + { + "name": "netbase", + "sha256": "29b23c48c0fe6f878e56c5ddc9f65d1c05d729360f3690a593a8c795031cd867", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/n/netbase/netbase_6.4_all.deb", + "version": "6.4" + }, + { + "name": "openssl", + "sha256": "ea063646d4f70d15be5ed52b67b5ac95d68dda823c60d808c7c25439c6d14e4d", + "url": "https://snapshot.debian.org/archive/debian-security/20231110T215743Z/pool/updates/main/o/openssl/openssl_3.0.11-1~deb12u2_amd64.deb", + "version": "3.0.11-1~deb12u2" + }, + { + "name": "python3_11_minimal", + "sha256": "a72247ba64bcd1d0ace2ea8eefd7bcfaca84204def9495269526c25dd9fddc0c", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/p/python3.11/python3.11-minimal_3.11.2-6_amd64.deb", + "version": "3.11.2-6" + }, + { + "name": "python3_distutils", + "sha256": "a620b555f301860a08e30534c7e6f7d79818e5e1977bfec39a612e7003074318", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/p/python3-stdlib-extensions/python3-distutils_3.11.2-3_all.deb", + "version": "3.11.2-3" + }, + { + "name": "tzdata", + "sha256": "825efb56b6b9f7ca816074d7c2f6118894f455e64839d85eb1de53f4a610991e", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/t/tzdata/tzdata_2023c-5_all.deb", + "version": "2023c-5" + }, + { + "name": "zlib1g", + "sha256": "d7dd1d1411fedf27f5e27650a6eff20ef294077b568f4c8c5e51466dc7c08ce4", + "url": "https://snapshot.debian.org/archive/debian/20231111T025358Z/pool/main/z/zlib/zlib1g_1.2.13.dfsg-1_amd64.deb", + "version": "1:1.2.13.dfsg-1" + } + ] + } + }, + "packages": { + "debian12": { + "amd64": [ + { + "dependencies": [ + "awk" + ], + "name": "base_files" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6", + "libgcc_s1", + "libssl3", + "openssl" + ], + "name": "ca_certificates" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6", + "libgcc_s1" + ], + "name": "dash" + }, + { + "dependencies": [ + "gcc_12_base", + "libgcc_s1" + ], + "name": "libc6" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6", + "libgcc_s1" + ], + "name": "libc_bin" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6" + ], + "name": "libgcc_s1" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6", + "libgcc_s1" + ], + "name": "libgomp1" + }, + { + "dependencies": [ + "gcc_12_base", + "libbz2_1_0", + "libc6", + "libcom_err2", + "libcrypt1", + "libdb5_3", + "libffi8", + "libgcc_s1", + "libgssapi_krb5_2", + "libk5crypto3", + "libkeyutils1", + "libkrb5_3", + "libkrb5support0", + "liblzma5", + "libncursesw6", + "libnsl2", + "libpython3_11_minimal", + "libreadline8", + "libsqlite3_0", + "libssl3", + "libtinfo6", + "libtirpc3", + "libuuid1" + ], + "name": "libpython3_11_stdlib" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6", + "libgcc_s1" + ], + "name": "libssl3" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6", + "libgcc_s1" + ], + "name": "libstdcpp6" + }, + { + "dependencies": [], + "name": "netbase" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6", + "libgcc_s1", + "libssl3" + ], + "name": "openssl" + }, + { + "dependencies": [ + "gcc_12_base", + "libc6", + "libexpat1", + "libgcc_s1", + "libpython3_11_minimal", + "libssl3", + "zlib1g" + ], + "name": "python3_11_minimal" + }, + { + "dependencies": [], + "name": "python3_distutils" + }, + { + "dependencies": [], + "name": "tzdata" + } + ] + } + }, + "snapshots": { + "main": "20231111T025358Z", + "security": "20231110T215743Z" + } +} \ No newline at end of file diff --git a/examples/bzlmod/packages.yaml b/examples/bzlmod/packages.yaml new file mode 100644 index 0000000..540782c --- /dev/null +++ b/examples/bzlmod/packages.yaml @@ -0,0 +1,36 @@ +- distros: ["debian12"] + archs: ["amd64"] + packages: + # required to replicate distroless/static + - base-files + - netbase + - tzdata + - ca-certificates + # required to replicate distroless/base + - libc6 + - libssl3 + - openssl + # required to replicate distroless/cc + - libgcc-s1 + - libgomp1 + - libstdc++6 + # required to replicate distroless/python + - dash + - libc-bin + - python3-distutils + - python3.11-minimal + - libpython3.11-stdlib + exclude_packages: + # generally excluded from distroless + - debconf + - debconf-2.0 + - dpkg + - install-info + - debianutils + - media-types + - mime-support + # excluded from distroless/python + - readline-common + - libtirpc-common + - python3 + - python3-lib2to3 diff --git a/examples/bzlmod/snapshots.yaml b/examples/bzlmod/snapshots.yaml new file mode 100644 index 0000000..94716bd --- /dev/null +++ b/examples/bzlmod/snapshots.yaml @@ -0,0 +1,2 @@ +main: 20231111T025358Z +security: 20231110T215743Z