lxcconfigxz

This commit is contained in:
Motiejus Jakštys 2021-05-24 00:11:58 +03:00
parent 7b4c7ba04f
commit 64b5eaa954
2 changed files with 15 additions and 10 deletions

8
BUILD
View File

@ -19,11 +19,3 @@ go_binary(
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
genrule(
name = "alpine-rootfs",
srcs = ["@alpine//image"],
outs = ["alpine-rootfs.tar"],
cmd = "$(location :undocker) rootfs $< $@",
tools = [":undocker"],
)

View File

@ -1,3 +1,5 @@
load("@rules_pkg//:pkg.bzl", "pkg_tar")
_undocker_cli = attr.label(
doc = "undocker cli; private and may not be overridden",
cfg = "host",
@ -39,7 +41,7 @@ rootfs = rule(
)
def _lxcconfig_impl(ctx):
out = ctx.actions.declare_file(ctx.attr.name + ".conf")
out = ctx.actions.declare_file(ctx.attr.name)
ctx.actions.run(
outputs = [out],
inputs = ctx.files.src,
@ -56,7 +58,7 @@ def _lxcconfig_impl(ctx):
runfiles = ctx.runfiles(files = ctx.files.src),
)
lxcconfig = rule(
_lxcconfig = rule(
_lxcconfig_impl,
doc = "Generate lxc config from a docker container image",
attrs = {
@ -64,3 +66,14 @@ lxcconfig = rule(
"_undocker": _undocker_cli,
},
)
def lxcconfig(name, src):
_lxcconfig(name = name+"/config", src = src)
pkg_tar(
name = name + "txz",
extension = "tar.xz",
srcs = [name+"/config"],
remap_paths = {
name: "",
},
)