osbase/build: replace label_keyed_string_dict with string_keyed_label_dict
Before bazel 7.4 the string_keyed_label_dict attribute type wasn't available. fsspec_core_impl was using a label_keyed_string_dict which is structurally wrong but there was no alternative for it. This replaces that usage.
Change-Id: I36c02c84e6aa2557cd2beb09c07d3ceca501553d
Reviewed-on: https://review.monogon.dev/c/monogon/+/3853
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/osbase/bringup/test/BUILD.bazel b/osbase/bringup/test/BUILD.bazel
index 1e9312a..a5f3768 100644
--- a/osbase/bringup/test/BUILD.bazel
+++ b/osbase/bringup/test/BUILD.bazel
@@ -28,6 +28,7 @@
],
)
+# TODO(tim): Replace instances with macro
go_library(
name = "succeeded_lib",
srcs = ["main_succeeded.go"],
@@ -53,7 +54,7 @@
node_initramfs(
name = "initramfs_succeeded",
files = {
- ":succeeded": "/init",
+ "/init": ":succeeded",
},
fsspecs = [
"//osbase/build:earlydev.fsspec",
@@ -94,7 +95,7 @@
node_initramfs(
name = "initramfs_panic",
files = {
- ":panic": "/init",
+ "/init": ":panic",
},
fsspecs = [
"//osbase/build:earlydev.fsspec",
@@ -135,7 +136,7 @@
node_initramfs(
name = "initramfs_error",
files = {
- ":error": "/init",
+ "/init": ":error",
},
fsspecs = [
"//osbase/build:earlydev.fsspec",
diff --git a/osbase/build/def.bzl b/osbase/build/def.bzl
index 73752f7..d4b497c 100644
--- a/osbase/build/def.bzl
+++ b/osbase/build/def.bzl
@@ -61,7 +61,7 @@
fs_files = []
inputs = []
- for label, p in ctx.attr.files.items() + ctx.attr.files_cc.items() + extra_files:
+ for p, label in ctx.attr.files.items() + ctx.attr.files_cc.items() + extra_files:
if not p.startswith("/"):
fail("file {} invalid: must begin with /".format(p))
@@ -134,7 +134,7 @@
their permissions set to 0444. All parent directories will be created with 0755 permissions.
""",
attrs = {
- "files": attr.label_keyed_string_dict(
+ "files": attr.string_keyed_label_dict(
mandatory = True,
allow_files = True,
doc = """
@@ -144,7 +144,7 @@
# Attach pure transition to ensure all binaries added to the initramfs are pure/static binaries.
cfg = build_pure_transition,
),
- "files_cc": attr.label_keyed_string_dict(
+ "files_cc": attr.string_keyed_label_dict(
allow_files = True,
doc = """
Special case of 'files' for compilation targets that need to be built with the musl toolchain like
@@ -196,7 +196,7 @@
their permissions set to 0444. All parent directories will be created with 0555 permissions.
""",
attrs = {
- "files": attr.label_keyed_string_dict(
+ "files": attr.string_keyed_label_dict(
mandatory = True,
allow_files = True,
doc = """
@@ -206,7 +206,7 @@
# Attach pure transition to ensure all binaries added to the initramfs are pure/static binaries.
cfg = build_pure_transition,
),
- "files_cc": attr.label_keyed_string_dict(
+ "files_cc": attr.string_keyed_label_dict(
allow_files = True,
doc = """
Special case of 'files' for compilation targets that need to be built with the musl toolchain like
diff --git a/osbase/fsquota/BUILD.bazel b/osbase/fsquota/BUILD.bazel
index 75a3133..0293e25 100644
--- a/osbase/fsquota/BUILD.bazel
+++ b/osbase/fsquota/BUILD.bazel
@@ -27,7 +27,7 @@
name = "ktest",
cmdline = "ramdisk_size=51200",
files_cc = {
- "@xfsprogs//:mkfs": "/mkfs.xfs",
+ "/mkfs.xfs": "@xfsprogs//:mkfs",
},
tester = ":fsquota_test",
)
diff --git a/osbase/test/ktest/ktest.bzl b/osbase/test/ktest/ktest.bzl
index 42e6b60..37efd30 100644
--- a/osbase/test/ktest/ktest.bzl
+++ b/osbase/test/ktest/ktest.bzl
@@ -30,7 +30,7 @@
initramfs_name = ctx.label.name + ".cpio.zst"
initramfs = ctx.actions.declare_file(initramfs_name)
- fsspec_core_impl(ctx, ctx.executable._mkcpio, initramfs, [(ctx.attr._ktest_init[0], "/init"), (ctx.attr.tester[0], "/tester")], [ctx.attr._earlydev])
+ fsspec_core_impl(ctx, ctx.executable._mkcpio, initramfs, [("/init", ctx.attr._ktest_init[0]), ("/tester", ctx.attr.tester[0])], [ctx.attr._earlydev])
script_file = ctx.actions.declare_file(ctx.label.name + ".sh")
@@ -65,7 +65,7 @@
# Runs inside the given kernel, needs to be build for Linux/static
cfg = build_static_transition,
),
- "files": attr.label_keyed_string_dict(
+ "files": attr.string_keyed_label_dict(
allow_files = True,
doc = """
Dictionary of Labels to String, placing a given Label's output file in the initramfs at the location
@@ -74,7 +74,7 @@
# Attach pure transition to ensure all binaries added to the initramfs are pure/static binaries.
cfg = build_pure_transition,
),
- "files_cc": attr.label_keyed_string_dict(
+ "files_cc": attr.string_keyed_label_dict(
allow_files = True,
doc = """
Special case of 'files' for compilation targets that need to be built with the musl toolchain like