rootfs accepts output param
This commit is contained in:
parent
64f6c53d60
commit
2fd9227654
29
rules.bzl
29
rules.bzl
@ -14,6 +14,8 @@ _input_container = attr.label(
|
||||
)
|
||||
|
||||
def _rootfs_impl(ctx):
|
||||
out = ctx.outputs.out
|
||||
if out == None:
|
||||
out = ctx.actions.declare_file(ctx.attr.name + ".tar")
|
||||
ctx.actions.run(
|
||||
outputs = [out],
|
||||
@ -37,6 +39,7 @@ rootfs = rule(
|
||||
attrs = {
|
||||
"src": _input_container,
|
||||
"_undocker": _undocker_cli,
|
||||
"out": attr.output(),
|
||||
},
|
||||
)
|
||||
|
||||
@ -58,6 +61,19 @@ def _lxcconfig_impl(ctx):
|
||||
runfiles = ctx.runfiles(files = ctx.files.src),
|
||||
)
|
||||
|
||||
|
||||
def lxcbundle(name, src):
|
||||
rootfsname = name+"-rootfs"
|
||||
rootfsnametar = rootfsname+"-tar"
|
||||
rootfs(name = rootfsnametar, src = src, out = rootfsname+".tar")
|
||||
lxcconfig(name, src = src)
|
||||
native.genrule(
|
||||
name = rootfsnametar + "-xz",
|
||||
srcs = [rootfsnametar],
|
||||
outs = [rootfsname + ".tar.xz"],
|
||||
cmd = "xz -cf $< > $@",
|
||||
)
|
||||
|
||||
_lxcconfig = rule(
|
||||
_lxcconfig_impl,
|
||||
doc = "Generate lxc config from a docker container image",
|
||||
@ -67,6 +83,7 @@ _lxcconfig = rule(
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def lxcconfig(name, src):
|
||||
_lxcconfig(name = name+"/config", src = src)
|
||||
pkg_tar(
|
||||
@ -77,15 +94,3 @@ def lxcconfig(name, src):
|
||||
name: "",
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def lxcbundle(name, src):
|
||||
rootfsname = name+"-rootfs"
|
||||
rootfs(name = rootfsname, src = src)
|
||||
lxcconfig(name, src = src)
|
||||
native.genrule(
|
||||
name = rootfsname + ".xz",
|
||||
srcs = [rootfsname],
|
||||
outs = [rootfsname + ".xz"],
|
||||
cmd = "xz -cf $< > $@",
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user