lxcconfigxz
This commit is contained in:
parent
7b4c7ba04f
commit
64b5eaa954
8
BUILD
8
BUILD
@ -19,11 +19,3 @@ go_binary(
|
|||||||
embed = [":go_default_library"],
|
embed = [":go_default_library"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
genrule(
|
|
||||||
name = "alpine-rootfs",
|
|
||||||
srcs = ["@alpine//image"],
|
|
||||||
outs = ["alpine-rootfs.tar"],
|
|
||||||
cmd = "$(location :undocker) rootfs $< $@",
|
|
||||||
tools = [":undocker"],
|
|
||||||
)
|
|
||||||
|
17
rules.bzl
17
rules.bzl
@ -1,3 +1,5 @@
|
|||||||
|
load("@rules_pkg//:pkg.bzl", "pkg_tar")
|
||||||
|
|
||||||
_undocker_cli = attr.label(
|
_undocker_cli = attr.label(
|
||||||
doc = "undocker cli; private and may not be overridden",
|
doc = "undocker cli; private and may not be overridden",
|
||||||
cfg = "host",
|
cfg = "host",
|
||||||
@ -39,7 +41,7 @@ rootfs = rule(
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _lxcconfig_impl(ctx):
|
def _lxcconfig_impl(ctx):
|
||||||
out = ctx.actions.declare_file(ctx.attr.name + ".conf")
|
out = ctx.actions.declare_file(ctx.attr.name)
|
||||||
ctx.actions.run(
|
ctx.actions.run(
|
||||||
outputs = [out],
|
outputs = [out],
|
||||||
inputs = ctx.files.src,
|
inputs = ctx.files.src,
|
||||||
@ -56,7 +58,7 @@ def _lxcconfig_impl(ctx):
|
|||||||
runfiles = ctx.runfiles(files = ctx.files.src),
|
runfiles = ctx.runfiles(files = ctx.files.src),
|
||||||
)
|
)
|
||||||
|
|
||||||
lxcconfig = rule(
|
_lxcconfig = rule(
|
||||||
_lxcconfig_impl,
|
_lxcconfig_impl,
|
||||||
doc = "Generate lxc config from a docker container image",
|
doc = "Generate lxc config from a docker container image",
|
||||||
attrs = {
|
attrs = {
|
||||||
@ -64,3 +66,14 @@ lxcconfig = rule(
|
|||||||
"_undocker": _undocker_cli,
|
"_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: "",
|
||||||
|
},
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user