fix rootfs rules

This commit is contained in:
Motiejus Jakštys 2021-05-24 00:11:58 +03:00
parent aacea22c0f
commit 8a5d9b636c
2 changed files with 2 additions and 42 deletions

25
BUILD
View File

@ -1,6 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar") load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
load("//src/undocker:rules.bzl", "rootfs", "temp")
load("@io_bazel_rules_docker//container:container.bzl", "container_bundle") load("@io_bazel_rules_docker//container:container.bzl", "container_bundle")
go_library( go_library(
@ -28,27 +27,3 @@ genrule(
cmd = "$(location :undocker) rootfs $< $@", cmd = "$(location :undocker) rootfs $< $@",
tools = [":undocker"], tools = [":undocker"],
) )
# later debugging
pkg_tar(
name = "alpine-container-plus",
deps = ["@alpine//image"],
)
rootfs(
name = "alpine-rootfs2",
#src = "@alpine//image:image",
src = ":alpine-container-plus",
)
filegroup(
name = "maingo",
srcs = ["main.go"],
visibility = ["//visibility:public"],
)
temp(
name = "temp",
out = "maingo.txt",
data = ":maingo",
)

View File

@ -3,10 +3,11 @@ def _rootfs_impl(ctx):
out = ctx.actions.declare_file(outf) out = ctx.actions.declare_file(outf)
ctx.actions.run( ctx.actions.run(
outputs = [out], outputs = [out],
inputs = ctx.files.src,
executable = ctx.files._undocker[0], executable = ctx.files._undocker[0],
arguments = [ arguments = [
"rootfs", "rootfs",
ctx.attr.src.files.to_list()[0].path, ctx.files.src.to_list()[0].path,
outf, outf,
], ],
) )
@ -33,19 +34,3 @@ rootfs = rule(
), ),
}, },
) )
def _temp_impl(ctx):
for f in ctx.files.data:
print(f.path)
ctx.actions.run_shell(
outputs = [ctx.outputs.out],
command = "find $@",
)
temp = rule(
implementation = _temp_impl,
attrs = {
"data": attr.label(mandatory = True, allow_single_file = True),
"out": attr.output(mandatory = True),
},
)