Skip to content

Commit

Permalink
module: add option to choose between podman and docker
Browse files Browse the repository at this point in the history
Signed-off-by: Øyvind Harboe <[email protected]>
  • Loading branch information
oharboe committed Sep 1, 2024
1 parent 2bb24e8 commit 33106aa
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module(

orfs = use_extension("//:extension.bzl", "orfs_repositories")
orfs.default(
# docker_name = "podman",
image = "docker.io/openroad/orfs:v3.0-1266-ge623a237",
sha256 = "d9492e65906d5e459bdc9d033915bc8fc15c37ab7b6337196f2e95c0e00a287e",
)
Expand Down
5 changes: 3 additions & 2 deletions MODULE.bazel.lock

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

7 changes: 5 additions & 2 deletions docker.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ def _impl(repository_ctx):
python = repository_ctx.which(python_name)
if not python:
fail("Failed to find {}.".format(python_name))
docker_name = "docker"

docker_name = repository_ctx.attr.docker_name or "docker"
docker = repository_ctx.which(docker_name)
if not docker:
fail("Failed to find {}.".format(docker_name))
print("Using {} to extract files.".format(docker_name))

created = repository_ctx.execute(
[
Expand Down Expand Up @@ -70,6 +72,7 @@ docker_pkg = repository_rule(
"build_file": attr.label(mandatory = True),
"image": attr.string(mandatory = True),
"sha256": attr.string(mandatory = True),
"docker_name": attr.string(mandatory = False),
"patches": attr.label_list(default = []),
"patch_tool": attr.string(default = ""),
"patch_args": attr.string_list(default = ["-p0"]),
Expand All @@ -89,4 +92,4 @@ docker_pkg = repository_rule(
cfg = "exec",
),
},
)
)
4 changes: 4 additions & 0 deletions extension.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ _default_tag = tag_class(
"sha256": attr.string(
mandatory = True,
),
"docker_name": attr.string(
mandatory = False,
),
},
)

Expand Down Expand Up @@ -43,6 +46,7 @@ def _orfs_repositories_impl(module_ctx):
sha256 = default.sha256,
build_file = ":docker.BUILD.bazel",
timeout = 3600,
docker_name = default.docker_name,
)

orfs_repositories = module_extension(
Expand Down

0 comments on commit 33106aa

Please sign in to comment.