Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
thesayyn committed Mar 28, 2024
1 parent 239533e commit c0b2ad2
Show file tree
Hide file tree
Showing 9 changed files with 643 additions and 144 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ common:linux --sandbox_tmpfs_path=/tmp


# Allow external dependencies to be retried. debian snapshot is unreliable and needs retries.
common --experimental_repository_downloader_retries=200
common --experimental_repository_downloader_retries=10

# Load any settings specific to the current user.
# .bazelrc.user should appear in .gitignore so that settings are not shared with team members
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module(
)

bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.5.3")
bazel_dep(name = "aspect_bazel_lib", version = "2.6.0")
bazel_dep(name = "container_structure_test", version = "1.16.0")
bazel_dep(name = "rules_oci", version = "1.7.4")

Expand Down
16 changes: 8 additions & 8 deletions apt/private/index.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ load("@rules_distroless//distroless:defs.bzl", "flatten")
flatten(
name = "data",
tars = [{src}],
compression = "gzip"
compress = "gzip"
)
alias(
name = "control",
actual = "@{repo_name}//:control",
visibility = ["//visibility:public"],
)
filegroup(
Expand All @@ -41,12 +47,6 @@ filegroup(
{deps}
] + [":data"]
)
alias(
name = "control",
actual = "@{repo_name}//:control",
visibility = ["//visibility:public"],
)
'''

def _deb_package_index_impl(rctx):
Expand Down Expand Up @@ -85,7 +85,7 @@ def _deb_package_index_impl(rctx):
target_name = package["arch"],
src = '"@%s_%s//:data"' % (rctx.attr.name, name),
deps = ",\n ".join([
'"@%s_%s//:data"' % (rctx.attr.name, dep)
'"//%s/%s"' % (dep["name"], package["arch"])
for dep in package["dependencies"]
]),
urls = [package["url"]],
Expand Down
6 changes: 5 additions & 1 deletion apt/private/lockfile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def _add_package_dependency(lock, package, dependency, arch):
if k not in lock.fast_package_lookup:
fail("Broken state: %s is not in the lockfile." % package["Package"])
i = lock.fast_package_lookup[k]
lock.packages[i]["dependencies"].append(_package_key(dependency, arch))
lock.packages[i]["dependencies"].append(dict(
key = _package_key(dependency, arch),
name = dependency["Package"],
version = dependency["Version"],
))

def _has_package(lock, name, version, arch):
key = "%s_%s_%s" % (util.sanitize(name), util.sanitize(version), arch)
Expand Down
6 changes: 3 additions & 3 deletions distroless/dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def distroless_dependencies():

http_archive(
name = "aspect_bazel_lib",
sha256 = "6c25c59581041ede31e117693047f972cc4700c89acf913658dc89d04c338f8d",
strip_prefix = "bazel-lib-2.5.3",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.5.3/bazel-lib-v2.5.3.tar.gz",
sha256 = "3e0a430ada9b8f0f845767a267cf584bc94b8ec642d6093f31dca3938b18f6a1",
strip_prefix = "bazel-lib-2.6.0",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.6.0/bazel-lib-v2.6.0.tar.gz",
)
6 changes: 3 additions & 3 deletions distroless/private/flatten.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ _DOC = """Flatten multiple archives into single archive."""
def _flatten_impl(ctx):
bsdtar = ctx.toolchains[tar_lib.TOOLCHAIN_TYPE]

ext = tar_lib.common.compression_to_extension[ctx.attr.compression] if ctx.attr.compression else ".tar"
ext = tar_lib.common.compression_to_extension[ctx.attr.compress] if ctx.attr.compress else ".tar"
output = ctx.actions.declare_file(ctx.attr.name + ext)

args = ctx.actions.args()
args.add("--create")
tar_lib.common.add_compression_args(ctx.attr.compression, args)
tar_lib.common.add_compression_args(ctx.attr.compress, args)
args.add("--file", output)
args.add_all(ctx.files.tars, format_each = "@%s")

Expand All @@ -37,7 +37,7 @@ flatten = rule(
allow_empty = False,
doc = "List of tars to flatten",
),
"compression": attr.string(
"compress": attr.string(
doc = "Compress the archive file with a supported algorithm.",
values = tar_lib.common.accepted_compression_types,
),
Expand Down
4 changes: 2 additions & 2 deletions docs/rules.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/apt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ group(

tar(
name = "sh",
srcs = [],
mtree = [
# needed as dpkg assumes sh is installed in a typical debian installation.
"./bin/sh type=link link=/bin/bash",
Expand Down
Loading

0 comments on commit c0b2ad2

Please sign in to comment.