support multiple files for the same output

This commit is contained in:
Motiejus Jakštys 2021-05-24 00:11:58 +03:00
parent 6c3943a3cc
commit 7114396590

View File

@ -65,12 +65,13 @@ def _lxcconfig_impl(ctx):
def lxcbundle(name, src): def lxcbundle(name, src):
rootfsname = name+"/_/rootfs" rootfsname = name+"/_/rootfs"
rootfs(name = rootfsname, src = src, out = rootfsname+".tar") rootfs(name = rootfsname, src = src, out = rootfsname+".tar")
lxcconfig(name, src = src) lxcconfig(name, src = src, out = name+"/_/meta.tar.xz")
native.genrule( native.genrule(
name = name+"-rootfs", name = name+"-rootfs",
srcs = [rootfsname], srcs = [rootfsname],
outs = [rootfsname + ".tar.xz"], outs = [rootfsname + ".tar.xz"],
cmd = "xz -cf $< > $@", cmd = "xz -f $< > $@",
message = "xz",
) )
pkg_tar( pkg_tar(
name = name, name = name,
@ -90,7 +91,7 @@ _lxcconfig = rule(
) )
def lxcconfig(name, src): def lxcconfig(name, src, out = None):
_lxcconfig(name = name+"/_/config", src = src) _lxcconfig(name = name+"/_/config", src = src)
pkg_tar( pkg_tar(
name = name + "-meta", name = name + "-meta",
@ -99,5 +100,5 @@ def lxcconfig(name, src):
remap_paths = { remap_paths = {
name: "", name: "",
}, },
out = "meta.tar.xz", out = out or "meta.tar.xz",
) )