split upt packages to dedicated directories

This commit is contained in:
Motiejus Jakštys 2021-05-24 00:11:58 +03:00
parent 8fe547a0ca
commit e1555f31a8

View File

@ -64,8 +64,9 @@ def _lxcconfig_impl(ctx):
def lxcbundle(name, src, version, overlay_tars = []): def lxcbundle(name, src, version, overlay_tars = []):
if type(version) != "int": if type(version) != "int":
fail("version must be an int, got {}".format(type(version))) fail("version must be an int, got {}".format(type(version)))
stage0 = name + "/_stage0/rootfs" nameversion = "{}.{}".format(name, version)
stage1 = name + "/_stage1/rootfs" stage0 = nameversion + "/_stage0/rootfs"
stage1 = nameversion + "/_stage1/rootfs"
rootfs( rootfs(
name = stage0, name = stage0,
src = src, src = src,
@ -77,16 +78,15 @@ def lxcbundle(name, src, version, overlay_tars = []):
extension = "tar.xz", extension = "tar.xz",
out = stage1 + ".tar.xz", out = stage1 + ".tar.xz",
) )
lxcconfig(name, src = src, out = name + "/_stage1/meta.tar.xz") lxcconfig(name, version, src = src, out = name + "/_stage1/meta.tar.xz")
outname = "{}.{}.tar".format(name, version)
pkg_tar( pkg_tar(
name = name, name = nameversion,
srcs = [ srcs = [
name + "/_stage1/rootfs", nameversion + "/_stage1/rootfs",
name + "/_stage1/meta", nameversion + "/_stage1/meta",
], ],
out = outname, out = "{}.tar".format(nameversion),
) )
_lxcconfig = rule( _lxcconfig = rule(
@ -98,12 +98,13 @@ _lxcconfig = rule(
}, },
) )
def lxcconfig(name, src, out = None): def lxcconfig(name, version, src, out = None):
_lxcconfig(name = name + "/_stage0/config", src = src) nameversion = "{}.{}".format(name, version)
_lxcconfig(name = nameversion + "/_stage0/config", src = src)
pkg_tar( pkg_tar(
name = name + "/_stage1/meta", name = nameversion + "/_stage1/meta",
extension = "tar.xz", extension = "tar.xz",
srcs = [name + "/_stage0/config"], srcs = [nameversion + "/_stage0/config"],
remap_paths = { remap_paths = {
name: "", name: "",
}, },