third_party: rename build_files to $reponame.bzl

This enables IDEs to correctly identify the filetype

Change-Id: I9e2644514f001f94abe7da92c332f95889a34380
Reviewed-on: https://review.monogon.dev/c/monogon/+/3823
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
Tested-by: Jenkins CI
diff --git a/build/bazel/third_party.MODULE.bazel b/build/bazel/third_party.MODULE.bazel
index fbb7901..4efc0b5 100644
--- a/build/bazel/third_party.MODULE.bazel
+++ b/build/bazel/third_party.MODULE.bazel
@@ -40,7 +40,7 @@
 
 http_archive(
     name = "cockroach",
-    build_file = "//third_party/cockroach:BUILD.repo",
+    build_file = "//third_party/cockroach:cockroach.bzl",
     integrity = "sha256-CCHP9XcEAPuUyLbCqzONlvQRT78rMga8im3PYvnA9Oo=",
     strip_prefix = "cockroach-v%s.linux-amd64" % COCKROACH_VERSION,
     urls = [
@@ -88,15 +88,15 @@
 
 http_archive(
     name = "linux",
-    build_file = "//third_party/linux/external:BUILD.repo",
+    build_file = "//third_party/linux:linux.bzl",
     integrity = "sha256-IZcVui3PplOfugmtP5ISdy81Bxietg13+OibBsMuck4=",
     patch_args = ["-p1"],
     patches = [
-        "//third_party/linux/external:0001-block-partition-expose-PARTUUID-through-uevent.patch",
-        "//third_party/linux/external:disable-static-ifs.patch",
-        "//third_party/linux/external:enable-pmsg.patch",
-        "//third_party/linux/external:lacp_fix.patch",
-        "//third_party/linux/external:fb-devs-knob.patch",
+        "//third_party/linux/patches:0001-block-partition-expose-PARTUUID-through-uevent.patch",
+        "//third_party/linux/patches:disable-static-ifs.patch",
+        "//third_party/linux/patches:enable-pmsg.patch",
+        "//third_party/linux/patches:lacp_fix.patch",
+        "//third_party/linux/patches:fb-devs-knob.patch",
     ],
     strip_prefix = "linux-" + LINUX_VERSION,
     urls = ["https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-%s.tar.xz" % LINUX_VERSION],
@@ -106,7 +106,7 @@
 
 http_archive(
     name = "linux-firmware",
-    build_file = "//third_party/linux-firmware:BUILD.repo",
+    build_file = "//third_party/linux-firmware:linux-firmware.bzl",
     integrity = "sha256-k+m2riJAZhY5yHT1/Dj2d9GK/jZbF6E/7mtPxPukLBA=",
     strip_prefix = "linux-firmware-" + LINUX_FIRMWARE_VERSION,
     urls = ["https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-%s.tar.gz" % LINUX_FIRMWARE_VERSION],
@@ -116,7 +116,7 @@
 
 http_archive(
     name = "intel_ucode",
-    build_file = "//third_party/intel_ucode:BUILD.repo",
+    build_file = "//third_party/intel_ucode:intel_ucode.bzl",
     integrity = "sha256-i3WC6sfpppE1bhizvcvHstsJSU4EDsmApKX7bQ2iYb8=",
     strip_prefix = "Intel-Linux-Processor-Microcode-Data-Files-microcode-" + INTEL_UCODE_VERSION,
     urls = ["https://github.com/intel/Intel-Linux-Processor-Microcode-Data-Files/archive/refs/tags/microcode-%s.tar.gz" % INTEL_UCODE_VERSION],
@@ -124,7 +124,7 @@
 
 git_repository(
     name = "edk2",
-    build_file = "//third_party/edk2/external:BUILD.repo",
+    build_file = "//third_party/edk2:edk2.bzl",
     commit = "b24306f15daa2ff8510b06702114724b33895d3c",  # stable202202
     patch_args = ["-p1"],
     patches = [
@@ -140,7 +140,7 @@
 
 http_archive(
     name = "musl",
-    build_file = "//third_party/musl:BUILD.repo",
+    build_file = "//third_party/musl:musl.bzl",
     integrity = "sha256-E3DJqBKyzyp9koAlEMygBYzDfmanvt1wBR8KNAFQIqM=",
     strip_prefix = "musl-" + MUSL_VERSION,
     urls = ["https://www.musl-libc.org/releases/musl-%s.tar.gz" % MUSL_VERSION],
@@ -280,7 +280,7 @@
 
 http_archive(
     name = "libpg_query",
-    build_file = "//third_party/libpg_query/external:BUILD.repo",
+    build_file = "//third_party/libpg_query:libpg_query.bzl",
     integrity = "sha256-i4INY0QrFnfOTw3yqVs/r9vFIKgpAd74EhdVnsTfnms=",
     strip_prefix = "libpg_query-" + LIBPG_QUERY_VERSION,
     urls = ["https://github.com/pganalyze/libpg_query/archive/refs/tags/%s.tar.gz" % LIBPG_QUERY_VERSION],
diff --git a/third_party/cockroach/BUILD.repo b/third_party/cockroach/BUILD.repo
deleted file mode 100644
index e9ec3f7..0000000
--- a/third_party/cockroach/BUILD.repo
+++ /dev/null
@@ -1,3 +0,0 @@
-exports_files([
-    "cockroach"
-])
\ No newline at end of file
diff --git a/third_party/cockroach/cockroach.bzl b/third_party/cockroach/cockroach.bzl
new file mode 100644
index 0000000..503292f
--- /dev/null
+++ b/third_party/cockroach/cockroach.bzl
@@ -0,0 +1,3 @@
+exports_files([
+    "cockroach",
+])
diff --git a/third_party/edk2/external/BUILD.repo b/third_party/edk2/edk2.bzl
similarity index 100%
rename from third_party/edk2/external/BUILD.repo
rename to third_party/edk2/edk2.bzl
diff --git a/third_party/edk2/external/BUILD.bazel b/third_party/edk2/external/BUILD.bazel
deleted file mode 100644
index e69de29..0000000
--- a/third_party/edk2/external/BUILD.bazel
+++ /dev/null
diff --git a/third_party/intel_ucode/BUILD.repo b/third_party/intel_ucode/intel_ucode.bzl
similarity index 98%
rename from third_party/intel_ucode/BUILD.repo
rename to third_party/intel_ucode/intel_ucode.bzl
index 351b565..64a4618 100644
--- a/third_party/intel_ucode/BUILD.repo
+++ b/third_party/intel_ucode/intel_ucode.bzl
@@ -1,2 +1,2 @@
 # Anything other than family 6 is not interesting to us
-filegroup(name = "fam6h", srcs = glob(["intel-ucode/06-*"]), visibility = ["//visibility:public"])
\ No newline at end of file
+filegroup(name = "fam6h", srcs = glob(["intel-ucode/06-*"]), visibility = ["//visibility:public"])
diff --git a/third_party/libpg_query/external/BUILD.bazel b/third_party/libpg_query/external/BUILD.bazel
deleted file mode 100644
index e69de29..0000000
--- a/third_party/libpg_query/external/BUILD.bazel
+++ /dev/null
diff --git a/third_party/libpg_query/external/BUILD.repo b/third_party/libpg_query/libpg_query.bzl
similarity index 98%
rename from third_party/libpg_query/external/BUILD.repo
rename to third_party/libpg_query/libpg_query.bzl
index b362e34..1a2486b 100644
--- a/third_party/libpg_query/external/BUILD.repo
+++ b/third_party/libpg_query/libpg_query.bzl
@@ -9,15 +9,6 @@
     srcs = glob([
         "src/*.c",
         "src/*.h",
-
-        "vendor/protobuf-c/protobuf-c.h",
-        "vendor/protobuf-c/protobuf-c.c",
-
-        "vendor/xxhash/xxhash.c",
-
-        "protobuf/pg_query.pb-c.c",
-        "protobuf/pg_query.pb-c.h",
-
         "src/postgres/include/*.h",
         "src/postgres/include/**/*.h",
     ], [
@@ -29,7 +20,13 @@
         "src/pg_query_readfuncs_defs.c",
         "src/pg_query_readfuncs_conds.c",
         "src/pg_query_json_helper.c",
-    ]),
+    ]) + [
+        "vendor/protobuf-c/protobuf-c.h",
+        "vendor/protobuf-c/protobuf-c.c",
+        "vendor/xxhash/xxhash.c",
+        "protobuf/pg_query.pb-c.c",
+        "protobuf/pg_query.pb-c.h",
+    ],
     textual_hdrs = [
         "src/pg_query_enum_defs.c",
         "src/pg_query_fingerprint_defs.c",
diff --git a/third_party/linux-firmware/BUILD.repo b/third_party/linux-firmware/linux-firmware.bzl
similarity index 99%
rename from third_party/linux-firmware/BUILD.repo
rename to third_party/linux-firmware/linux-firmware.bzl
index a6ba223..dd23722 100644
--- a/third_party/linux-firmware/BUILD.repo
+++ b/third_party/linux-firmware/linux-firmware.bzl
@@ -1,3 +1,3 @@
 filegroup(name = "all_files", srcs = glob(["**"]), visibility = ["//visibility:public"])
 filegroup(name = "metadata", srcs = ["WHENCE"], visibility = ["//visibility:public"])
-filegroup(name = "amd_ucode", srcs = glob(["amd-ucode/*.bin"]), visibility = ["//visibility:public"])
\ No newline at end of file
+filegroup(name = "amd_ucode", srcs = glob(["amd-ucode/*.bin"]), visibility = ["//visibility:public"])
diff --git a/third_party/linux/external/BUILD.repo b/third_party/linux/linux.bzl
similarity index 99%
rename from third_party/linux/external/BUILD.repo
rename to third_party/linux/linux.bzl
index ed035ee..1b57c03 100644
--- a/third_party/linux/external/BUILD.repo
+++ b/third_party/linux/linux.bzl
@@ -1,11 +1,11 @@
+load("@rules_cc//cc:defs.bzl", "cc_binary")
+
 filegroup(
     name = "all",
     srcs = glob(["**"]),
     visibility = ["//visibility:public"],
 )
 
-load("@rules_cc//cc:defs.bzl", "cc_binary")
-
 # Build gen_init_cpio separately for the initramfs generation stage
 cc_binary(
     name = "gen_init_cpio",
diff --git a/third_party/linux/external/0001-block-partition-expose-PARTUUID-through-uevent.patch b/third_party/linux/patches/0001-block-partition-expose-PARTUUID-through-uevent.patch
similarity index 100%
rename from third_party/linux/external/0001-block-partition-expose-PARTUUID-through-uevent.patch
rename to third_party/linux/patches/0001-block-partition-expose-PARTUUID-through-uevent.patch
diff --git a/third_party/linux/external/BUILD.bazel b/third_party/linux/patches/BUILD.bazel
similarity index 100%
rename from third_party/linux/external/BUILD.bazel
rename to third_party/linux/patches/BUILD.bazel
diff --git a/third_party/linux/external/disable-static-ifs.patch b/third_party/linux/patches/disable-static-ifs.patch
similarity index 100%
rename from third_party/linux/external/disable-static-ifs.patch
rename to third_party/linux/patches/disable-static-ifs.patch
diff --git a/third_party/linux/external/enable-pmsg.patch b/third_party/linux/patches/enable-pmsg.patch
similarity index 100%
rename from third_party/linux/external/enable-pmsg.patch
rename to third_party/linux/patches/enable-pmsg.patch
diff --git a/third_party/linux/external/fb-devs-knob.patch b/third_party/linux/patches/fb-devs-knob.patch
similarity index 100%
rename from third_party/linux/external/fb-devs-knob.patch
rename to third_party/linux/patches/fb-devs-knob.patch
diff --git a/third_party/linux/external/lacp_fix.patch b/third_party/linux/patches/lacp_fix.patch
similarity index 100%
rename from third_party/linux/external/lacp_fix.patch
rename to third_party/linux/patches/lacp_fix.patch
diff --git a/third_party/musl/BUILD.repo b/third_party/musl/musl.bzl
similarity index 98%
rename from third_party/musl/BUILD.repo
rename to third_party/musl/musl.bzl
index 0f930c5..9fbdeaf 100644
--- a/third_party/musl/BUILD.repo
+++ b/third_party/musl/musl.bzl
@@ -1 +1 @@
-filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])
\ No newline at end of file
+filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])