treewide: format repo with buildifier
Change-Id: Ia7aebeb7bba5b119c9157d1ad805cc477bcbb68a
Reviewed-on: https://review.monogon.dev/c/monogon/+/3774
Tested-by: Jenkins CI
Reviewed-by: Leopold Schabel <leo@monogon.tech>
diff --git a/third_party/linux/def.bzl b/third_party/linux/def.bzl
index 0efbb64..4c6798c 100644
--- a/third_party/linux/def.bzl
+++ b/third_party/linux/def.bzl
@@ -25,7 +25,6 @@
load("//build/utils:detect_root.bzl", "detect_root")
-
_new_settings = {
# This list should be expanded with any configuration options that end
# up reaching this rule with different values across different build
@@ -40,8 +39,7 @@
"//command_line_option:platforms": "//build/platforms:linux_amd64_static",
}
-
-def _ignore_unused_configuration_impl(settings, attr):
+def _ignore_unused_configuration_impl(_settings, _attr):
return _new_settings
# Transition to flip all known-unimportant but varying configuration options to
@@ -66,15 +64,17 @@
See `resource_set` documentation in builtins.actions Bazel docs.
"""
+
# 16 threads seems about right - this fits well in both our build machines and
# development machines.
cpu = 16
+
# In MB. Picked based on observing build in htop.
mb_per_cpu = 256
return {
- 'cpu': cpu,
- 'memory': cpu * mb_per_cpu,
- 'local_test': 0,
+ "cpu": cpu,
+ "memory": cpu * mb_per_cpu,
+ "local_test": 0,
}
def _linux_image_impl(ctx):
@@ -89,8 +89,8 @@
# (image_name) is the name of the image that will be generated by this
# rule.
(target, image_source, image_name) = {
- 'vmlinux': ('vmlinux modules', 'vmlinux', 'vmlinux'),
- 'bzImage': ('all modules', 'arch/x86/boot/bzImage', 'bzImage'),
+ "vmlinux": ("vmlinux modules", "vmlinux", "vmlinux"),
+ "bzImage": ("all modules", "arch/x86/boot/bzImage", "bzImage"),
}[image_format]
# Root of the given Linux sources.
@@ -100,8 +100,8 @@
modinfo = ctx.actions.declare_file("modules.builtin.modinfo")
modules = ctx.actions.declare_directory("modules")
ctx.actions.run_shell(
- outputs = [ image, modinfo, modules ],
- inputs = [ kernel_config ] + kernel_src,
+ outputs = [image, modinfo, modules],
+ inputs = [kernel_config] + kernel_src,
resource_set = _linux_image_impl_resources,
command = '''
kconfig=$1
@@ -138,47 +138,48 @@
)
return [
- DefaultInfo(
- files=depset([image]),
- runfiles=ctx.runfiles(files=[image])
- ),
- OutputGroupInfo(
- modinfo = depset([modinfo]),
- modules = depset([modules])
- )
+ DefaultInfo(
+ files = depset([image]),
+ runfiles = ctx.runfiles(files = [image]),
+ ),
+ OutputGroupInfo(
+ modinfo = depset([modinfo]),
+ modules = depset([modules]),
+ ),
]
linux_image = rule(
- doc = '''
+ doc = """
Build Linux kernel image unhermetically in a given format.
- ''',
+ """,
implementation = _linux_image_impl,
cfg = ignore_unused_configuration,
attrs = {
"kernel_config": attr.label(
- doc = '''
+ doc = """
Linux kernel configuration file to build this kernel image with.
- ''',
+ """,
allow_single_file = True,
default = ":linux-metropolis.config",
),
"kernel_src": attr.label(
- doc = '''
+ doc = """
Filegroup containing Linux kernel sources.
- ''',
+ """,
default = "@linux//:all",
),
"image_format": attr.string(
- doc = '''
+ doc = """
Format of generated Linux image, one of 'vmlinux' or 'bzImage',
- ''',
+ """,
values = [
- 'vmlinux', 'bzImage',
+ "vmlinux",
+ "bzImage",
],
- default = 'bzImage',
+ default = "bzImage",
),
"_allowlist_function_transition": attr.label(
- default = "@bazel_tools//tools/allowlists/function_transition_allowlist"
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
},
)