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 cba51683649..04439a5726e 100644 --- a/omd/BUILD +++ b/omd/BUILD @@ -4,7 +4,7 @@ load("@bazel_skylib//rules:write_file.bzl", "write_file") load("@rules_pkg//pkg:tar.bzl", "pkg_tar") load("@rules_uv//uv:pip.bzl", "pip_compile") load("@rules_uv//uv:venv.bzl", "create_venv") -load("//:bazel_variables.bzl", "edition_deps") +load("//:bazel_variables.bzl", "edition_deps", "edition_skel_permissions") exports_files([ "requirements.txt", @@ -28,7 +28,6 @@ create_venv( "//omd/packages/freetds:freetds_pkg", "//omd/packages/protobuf", "//packages/site/check-http:check_http_pkg", - "//omd/packages:skel_permissions_pkg_" + edition, ], extension = "tar.gz", deps = [ @@ -64,6 +63,25 @@ create_venv( "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 = [], +) + write_file( name = "werks_utils", out = "werks_utils.py", diff --git a/omd/Makefile b/omd/Makefile index 07c25a357bc..c468312f10a 100644 --- a/omd/Makefile +++ b/omd/Makefile @@ -175,7 +175,26 @@ $(INSTALL): $(INSTALL_LOG_TARGETS) chmod -R o+Xr $(DESTDIR)$(OMD_ROOT) $(TOUCH) $@ -$(INSTALL_GLOBAL): $(INSTALL) $(BOM) +$(SKEL_PERMISSIONS): $(INSTALL) +# Create permissions file for skel + mkdir -p $(DESTDIR)$(OMD_ROOT)/share/omd + set -e ; \ + OUTPUT=""; \ + cd packages ; for p in $(PACKAGES) rrdtool; do \ + if [ -d $$p ] && [ -e $$p/skel.permissions ] ; then \ + OUTPUT="$${OUTPUT}# $$p\n$$(cat $$p/skel.permissions)\n"; \ + fi ; \ + done ; \ + cd ../../non-free/packages ; for p in $(PACKAGES) ; do \ + if [ -d $$p ] && [ -e $$p/skel.permissions ] ; then \ + 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_$(EDITION_SHORT))\n" ; \ + echo -e "$$OUTPUT" > $(SKEL_PERMISSIONS) + +$(INSTALL_GLOBAL): $(SKEL_PERMISSIONS) $(BOM) # Create link to default version ln -sf $(OMD_VERSION) $(DESTDIR)$(OMD_BASE)/versions/default diff --git a/omd/packages/BUILD b/omd/packages/BUILD index 97ff591d401..e69de29bb2d 100644 --- a/omd/packages/BUILD +++ b/omd/packages/BUILD @@ -1,69 +0,0 @@ -load("@rules_pkg//pkg:mappings.bzl", "pkg_files") - -SKEL_PERM = [ - "//omd/packages/stunnel:skel.permissions", - "//omd/packages/rrdtool:skel.permissions", - "//omd/packages/nagvis:skel.permissions", - "//omd/packages/apache-omd:skel.permissions", - "//omd/packages/jaeger:skel.permissions", - "//omd/packages/enterprise:skel.permissions", - "//omd/packages/check_mk:skel.permissions", - "//omd/packages/perl-modules:skel.permissions", - "//omd/packages/nagios:skel.permissions", - "//omd/packages/redis:skel.permissions", - "//omd/packages/openssl:skel.permissions", - "//omd/packages/pnp4nagios:skel.permissions", - "//omd/packages/omd:skel.permissions", - "//omd/packages/rabbitmq:skel.permissions", - "//omd/packages/maintenance:skel.permissions", -] - -[genrule( - name = "skel_permissions_" + edition, - srcs = SKEL_PERM + { - "cre": [], - "cce": [ - "//non-free/packages/cmk-mknotifyd:skel.permissions", - "//non-free/packages/otel-collector:skel.permissions", - ], - "cee": [ - "//non-free/packages/cmk-mknotifyd:skel.permissions", - ], - "cme": [ - "//non-free/packages/cmk-mknotifyd:skel.permissions", - "//non-free/packages/otel-collector:skel.permissions", - ], - "cse": [ - "//non-free/packages/cmk-mknotifyd:skel.permissions", - "//non-free/packages/otel-collector:skel.permissions", - ], - }[edition], - outs = ["skel.permissions_" + edition], - cmd = "cat $(SRCS) > $@", -) for edition in [ - "cre", - "cce", - "cee", - "cme", - "cse", -]] - -[pkg_files( - name = "skel_permissions_pkg_" + edition, - srcs = [ - ":skel.permissions_" + edition, - ], - prefix = "share/omd", - renames = { - "skel.permissions_" + edition: "skel.permissions", - }, - visibility = [ - "//omd:__pkg__", - ], -) for edition in [ - "cre", - "cce", - "cee", - "cme", - "cse", -]] diff --git a/omd/packages/apache-omd/BUILD b/omd/packages/apache-omd/BUILD index 60072ec0a44..63e2eb528eb 100644 --- a/omd/packages/apache-omd/BUILD +++ b/omd/packages/apache-omd/BUILD @@ -1,8 +1,6 @@ load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "pkg_mklink", "strip_prefix") load("@rules_pkg//pkg:tar.bzl", "pkg_tar") -exports_files(["skel.permissions"]) - genrule( name = "apache-omd", srcs = [ diff --git a/omd/packages/check_mk/BUILD b/omd/packages/check_mk/BUILD deleted file mode 100644 index 3f8b34598e3..00000000000 --- a/omd/packages/check_mk/BUILD +++ /dev/null @@ -1 +0,0 @@ -exports_files(["skel.permissions"]) diff --git a/omd/packages/jaeger/BUILD b/omd/packages/jaeger/BUILD index 1413d593447..b73906aa198 100644 --- a/omd/packages/jaeger/BUILD +++ b/omd/packages/jaeger/BUILD @@ -1,7 +1,5 @@ JAEGER_VERSION = "2.0.0" -exports_files(["skel.permissions"]) - genrule( name = "fetch_package", srcs = ["@jaeger//file"], diff --git a/omd/packages/maintenance/BUILD b/omd/packages/maintenance/BUILD deleted file mode 100644 index 3f8b34598e3..00000000000 --- a/omd/packages/maintenance/BUILD +++ /dev/null @@ -1 +0,0 @@ -exports_files(["skel.permissions"]) diff --git a/omd/packages/nagios/BUILD b/omd/packages/nagios/BUILD index 489b9c2c9f4..7af49e79a39 100644 --- a/omd/packages/nagios/BUILD +++ b/omd/packages/nagios/BUILD @@ -1,5 +1,4 @@ exports_files([ "merge-nagios-config", "diskspace", - "skel.permissions", ]) diff --git a/omd/packages/nagvis/BUILD b/omd/packages/nagvis/BUILD deleted file mode 100644 index 3f8b34598e3..00000000000 --- a/omd/packages/nagvis/BUILD +++ /dev/null @@ -1 +0,0 @@ -exports_files(["skel.permissions"]) diff --git a/omd/packages/omd/BUILD b/omd/packages/omd/BUILD index 528a343d639..9bdd97feb5f 100644 --- a/omd/packages/omd/BUILD +++ b/omd/packages/omd/BUILD @@ -1,4 +1 @@ -exports_files([ - "skel.permissions", - "use_system_openssl", -]) +exports_files(["use_system_openssl"]) diff --git a/omd/packages/openssl/BUILD b/omd/packages/openssl/BUILD index c48652eb204..02bd8661cab 100644 --- a/omd/packages/openssl/BUILD +++ b/omd/packages/openssl/BUILD @@ -5,8 +5,6 @@ load("@rules_pkg//pkg:mappings.bzl", "filter_directory", "pkg_attributes", "pkg_ load("@rules_pkg//pkg:tar.bzl", "pkg_tar") load("//bazel/rules:binreplace_version_from_flag.bzl", "binreplace_version_from_flag") -exports_files(["skel.permissions"]) - bin_paths = [ "bin/c_rehash", "bin/openssl", diff --git a/omd/packages/perl-modules/BUILD b/omd/packages/perl-modules/BUILD index e381115bdd4..0b20c3a2ce7 100644 --- a/omd/packages/perl-modules/BUILD +++ b/omd/packages/perl-modules/BUILD @@ -1,8 +1,6 @@ load("perl-modules_http.bzl", "PERL_MODULES_LIST_1", "PERL_MODULES_LIST_2") load(":rename_perl_packages.bzl", "rename_perl_package") -exports_files(["skel.permissions"]) - [rename_perl_package( name = module.removesuffix("tar.gz").removesuffix("tgz"), srcs = [ diff --git a/omd/packages/pnp4nagios/BUILD b/omd/packages/pnp4nagios/BUILD index 1f62ff9837a..6d0fe6de4b8 100644 --- a/omd/packages/pnp4nagios/BUILD +++ b/omd/packages/pnp4nagios/BUILD @@ -4,7 +4,6 @@ exports_files( "diskspace", "PNP4NAGIOS", "skel", - "skel.permissions", ], visibility = ["//visibility:public"], ) diff --git a/omd/packages/rabbitmq/BUILD b/omd/packages/rabbitmq/BUILD index 2c0fd60c994..5bbfbcdd197 100644 --- a/omd/packages/rabbitmq/BUILD +++ b/omd/packages/rabbitmq/BUILD @@ -3,8 +3,6 @@ filegroup( srcs = glob(["**"]), ) -exports_files(["skel.permissions"]) - genrule( name = "build", srcs = [ diff --git a/omd/packages/redis/BUILD b/omd/packages/redis/BUILD index 3f8b34598e3..e69de29bb2d 100644 --- a/omd/packages/redis/BUILD +++ b/omd/packages/redis/BUILD @@ -1 +0,0 @@ -exports_files(["skel.permissions"]) diff --git a/omd/packages/rrdtool/BUILD b/omd/packages/rrdtool/BUILD index ba2f656cf91..7df707d088f 100644 --- a/omd/packages/rrdtool/BUILD +++ b/omd/packages/rrdtool/BUILD @@ -3,8 +3,6 @@ load("@rules_pkg//pkg:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_fil load("@rules_pkg//pkg:tar.bzl", "pkg_tar") load("//bazel/rules:package_wheel.bzl", "package_wheel") -exports_files(["skel.permissions"]) - [genrule( name = "%s_deployable" % binary, srcs = ["@rrdtool_native//:%s" % binary], diff --git a/omd/packages/stunnel/BUILD b/omd/packages/stunnel/BUILD index 3c3e0cad0b1..8841a34a838 100644 --- a/omd/packages/stunnel/BUILD +++ b/omd/packages/stunnel/BUILD @@ -1,4 +1 @@ -exports_files([ - "skel", - "skel.permissions", -]) +exports_files(["skel"])