lxcbundle target

This commit is contained in:
Motiejus Jakštys 2021-05-24 00:11:58 +03:00
parent 2fd9227654
commit 503fff5820

View File

@ -63,16 +63,22 @@ def _lxcconfig_impl(ctx):
def lxcbundle(name, src): def lxcbundle(name, src):
rootfsname = name+"-rootfs" rootfsname = name+"/_/rootfs"
rootfsnametar = rootfsname+"-tar" rootfs(name = rootfsname, src = src, out = rootfsname+".tar")
rootfs(name = rootfsnametar, src = src, out = rootfsname+".tar")
lxcconfig(name, src = src) lxcconfig(name, src = src)
native.genrule( native.genrule(
name = rootfsnametar + "-xz", name = name+"-rootfs",
srcs = [rootfsnametar], srcs = [rootfsname],
outs = [rootfsname + ".tar.xz"], outs = [rootfsname + ".tar.xz"],
cmd = "xz -cf $< > $@", cmd = "xz -cf $< > $@",
) )
pkg_tar(
name = name,
srcs = [
name+"-rootfs",
name+"-meta",
],
)
_lxcconfig = rule( _lxcconfig = rule(
_lxcconfig_impl, _lxcconfig_impl,
@ -85,12 +91,13 @@ _lxcconfig = rule(
def lxcconfig(name, src): def lxcconfig(name, src):
_lxcconfig(name = name+"/config", src = src) _lxcconfig(name = name+"/_/config", src = src)
pkg_tar( pkg_tar(
name = name + ".config", name = name + "-meta",
extension = "tar.xz", extension = "tar.xz",
srcs = [name+"/config"], srcs = [name+"/_/config"],
remap_paths = { remap_paths = {
name: "", name: "",
}, },
out = "meta.tar.xz",
) )