From 33aaaf109c0eda001bdc061486fd5427e143937a Mon Sep 17 00:00:00 2001 From: Lars Michelsen Date: Mon, 9 Dec 2024 17:38:43 +0100 Subject: [PATCH] Make mknotifyd package more self contained Some static files were still in the generic enterprise skel directory, which can now be handled by bazel in the package itself. Introduce a bazel way to deal with the monolithic skel.permissions file. This file is needed by OMD to later set file permissions when creating the sites etc directory and files based on the skel hierarchy. This piece will be needed once we move more packages towards bazel. Change-Id: Iba31ceae1e27fccc58b88df35e4c020c27185a60 --- bazel_variables.bzl | 15 +++++++++++++++ omd/BUILD | 22 +++++++++++++++++++++- omd/Makefile | 2 ++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/bazel_variables.bzl b/bazel_variables.bzl index fd9bce8bf80..c21c59770ae 100644 --- a/bazel_variables.bzl +++ b/bazel_variables.bzl @@ -22,3 +22,18 @@ edition_deps = { "//non-free/packages/cmk-otel-collector:pkg_tar", ], } + +edition_skel_permissions = { + "cce": [ + "//non-free/packages/cmk-mknotifyd:skel.permissions", + ], + "cee": [ + "//non-free/packages/cmk-mknotifyd:skel.permissions", + ], + "cme": [ + "//non-free/packages/cmk-mknotifyd:skel.permissions", + ], + "cse": [ + "//non-free/packages/cmk-mknotifyd:skel.permissions", + ], +} diff --git a/omd/BUILD b/omd/BUILD index fd1e82f94fb..59f4422641f 100644 --- a/omd/BUILD +++ b/omd/BUILD @@ -1,5 +1,6 @@ +load("@bazel_skylib//rules:write_file.bzl", "write_file") load("@rules_pkg//pkg:tar.bzl", "pkg_tar") -load("//:bazel_variables.bzl", "edition_deps") +load("//:bazel_variables.bzl", "edition_deps", "edition_skel_permissions") pkg_tar( name = "intermediate_install", @@ -52,3 +53,22 @@ pkg_tar( "cme", "cse", ]] + +[genrule( + name = "skel_permissions_" + edition, + srcs = edition_skel_permissions[edition], + outs = ["skel.permissions_" + edition], + cmd = "cat $< > $@", +) for edition in [ + "cce", + "cee", + "cme", + "cse", +]] + +# Placeholder since we have no cre specfic skel.permissions so far (will come soon) +write_file( + name = "skel_permissions_cre", + out = "skel.permissions_cre", + content = [], +) diff --git a/omd/Makefile b/omd/Makefile index 4755bc65b30..22a5c3ad49e 100644 --- a/omd/Makefile +++ b/omd/Makefile @@ -191,6 +191,8 @@ $(SKEL_PERMISSIONS): $(INSTALL) OUTPUT="$${OUTPUT}# $$p\n$$(cat $$p/skel.permissions)\n"; \ fi ; \ done ; \ + bazel build //omd:skel_permissions_$(EDITION_SHORT) ; \ + OUTPUT="$${OUTPUT}# Bazel\n$$(cat $(REPO_PATH)/bazel-bin/omd/skel.permissions_cee)\n" ; \ echo -e "$$OUTPUT" > $(SKEL_PERMISSIONS) $(INSTALL_GLOBAL): $(SKEL_PERMISSIONS) $(BOM)