Skip to content

Commit

Permalink
Revert "Create skel.permissions via Bazel"
Browse files Browse the repository at this point in the history
Revert submission 93790

Reason for revert: no such package 'omd/packages/enterprise'

Reverted changes: /q/submissionid:93790

Change-Id: I7cf2e66d556f0818f6b8565bc3bf1c7c6fa3e224
  • Loading branch information
JonasScharpf committed Jan 24, 2025
1 parent dc74bde commit 928c34c
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 98 deletions.
15 changes: 15 additions & 0 deletions bazel_variables.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
}
22 changes: 20 additions & 2 deletions omd/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 = [
Expand Down Expand Up @@ -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",
Expand Down
21 changes: 20 additions & 1 deletion omd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
69 changes: 0 additions & 69 deletions omd/packages/BUILD
Original file line number Diff line number Diff line change
@@ -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",
]]
2 changes: 0 additions & 2 deletions omd/packages/apache-omd/BUILD
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
1 change: 0 additions & 1 deletion omd/packages/check_mk/BUILD

This file was deleted.

2 changes: 0 additions & 2 deletions omd/packages/jaeger/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
JAEGER_VERSION = "2.0.0"

exports_files(["skel.permissions"])

genrule(
name = "fetch_package",
srcs = ["@jaeger//file"],
Expand Down
1 change: 0 additions & 1 deletion omd/packages/maintenance/BUILD

This file was deleted.

1 change: 0 additions & 1 deletion omd/packages/nagios/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
exports_files([
"merge-nagios-config",
"diskspace",
"skel.permissions",
])
1 change: 0 additions & 1 deletion omd/packages/nagvis/BUILD

This file was deleted.

5 changes: 1 addition & 4 deletions omd/packages/omd/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
exports_files([
"skel.permissions",
"use_system_openssl",
])
exports_files(["use_system_openssl"])
2 changes: 0 additions & 2 deletions omd/packages/openssl/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 0 additions & 2 deletions omd/packages/perl-modules/BUILD
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down
1 change: 0 additions & 1 deletion omd/packages/pnp4nagios/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ exports_files(
"diskspace",
"PNP4NAGIOS",
"skel",
"skel.permissions",
],
visibility = ["//visibility:public"],
)
2 changes: 0 additions & 2 deletions omd/packages/rabbitmq/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ filegroup(
srcs = glob(["**"]),
)

exports_files(["skel.permissions"])

genrule(
name = "build",
srcs = [
Expand Down
1 change: 0 additions & 1 deletion omd/packages/redis/BUILD
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
exports_files(["skel.permissions"])
2 changes: 0 additions & 2 deletions omd/packages/rrdtool/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
5 changes: 1 addition & 4 deletions omd/packages/stunnel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
exports_files([
"skel",
"skel.permissions",
])
exports_files(["skel"])

0 comments on commit 928c34c

Please sign in to comment.