Compare commits

...
Author SHA1 Message Date
f33f47c2b3
make: Fix CONFIG_SUBDIR
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m50s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m17s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m49s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m7s
CI / Packaging test (push) Successful in 0s
The existence of CONFIG_SUBDIR hijacks INSTALL_CFGDIR to a subdirectory (by
default /etc/opt/<package>/$(CONFIG_SUBDIR)). Then std_install_rules apply,
and (the bent) INSTALL_CFGDIR is installed, but its parent directory, the
original $(INSTALL_CFGDIR), is not a prerequisite of install anylonger, and
has no rule anymore, hence log-install is never run for it. Instead it's
implicitly created by log-install -D $(INSTALL_CFGDIR).

This commit gives /etc/opt/<package> std-install rule and variables back as
CFGTOPDIR variants, and inserts it early into the install target's
prerequisite list.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-07 09:23:17 +02:00
ddf310d3ad
make: Support INSTALL_PREFIXDIR
During "make install", the packaging machinery should run "$(LOG_INSTALL)
-D /opt/<pkg>" but runs "mkdir -p /opt/<pkg>" instead. As a consequence,
the created directory is not owned by any of the created packages. This
commit fixes that by introducing INSTALL_PREFIXDIR and installing it like
all other directories.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-07 09:23:16 +02:00
281a8f383e
lib.Types: Restrict LoadTypes to ABC-derived classes
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m18s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m18s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m50s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m5s
CI / Packaging test (push) Successful in 0s
The previous commit reads __abstractmethods__ via a getattr() with an empty
frozenset fallback, because in mypy 2.3.1 the scanned classes are typed as
type[object], which does not declare the attribute.

Add is_abc_class() as a TypeGuard, and skip the classes it rejects with a
debug line: LoadTypes now yields only ABC-derived classes. The guard
narrows to the classes that carry the attribute, so that the debug line can
now read __abstractmethods__ directly.

The command loaders are unaffected: every class they load is derived from
AbstractCmd, and hence from ABC. For loads that rely on the name filter
alone, plain classes are now skipped instead of being yielded.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: Jan Lindemann <jan@janware.com>
2026-09-07 09:12:42 +02:00
ff6e13e09f
lib.Types: Read __abstractmethods__ via getattr()
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m19s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m19s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m8s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m6s
CI / Packaging test (push) Successful in 0s
LoadTypes._classes() reads the __abstractmethods__ attribute of each class
that inspect.getmembers() returns for its debug output. mypy 2.2.0 allows
this, mypy 2.3.1 doesn't: It now types those classes as type[object]
instead of Any. The attribute itself is only declared on the ABCMeta
metaclass, so the direct access fails the type check.

Read the attribute through getattr() with an 'unknown' fallback string, and
annotate the variable explicitly. The runtime behavior is unchanged, since
the attribute exists whenever inspect.isabstract() is true, and the call
satisfies the checker.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
Signed-off-by: user.email <jan@janware.com>
2026-09-07 07:07:02 +02:00
10 changed files with 38 additions and 10 deletions

View file

@ -4,15 +4,26 @@ include $(JWBDIR)/make/dev-utils.mk
all:
clean: clean.conf
install: install_CFG install_files_SYSCFG install_files_LOGROT install_files_CRONTAB install_files_RSYSLOG \
install_files_APACHE_CONF install_files_SYSTEMD install_files_INIT install_files_TMPFILES $(CONF_D)
install: \
$(INSTALL_CFGTOPDIR) \
install_CFG \
install_files_SYSCFG \
install_files_LOGROT \
install_files_CRONTAB \
install_files_RSYSLOG \
install_files_APACHE_CONF \
install_files_SYSTEMD \
install_files_INIT \
install_files_TMPFILES \
$(CONF_D)
test: all
clean.conf:
$(RM) -rf *~ .*.swp *.done
ifneq ($(CONFIG_SUBDIR),)
$(INSTALLED_CFG): $(INSTALL_CFGDIR)
ifneq ($(INSTALL_CFGTOPDIR),)
$(INSTALL_CFGTOPDIR):
$(INSTALL) -D -d -m $(CFGTOPDIRMODE) -o $(CFGTOPDIROWNER) -g $(CFGTOPDIRGROUP) $@
endif
ifneq ($(CONF_D),)

View file

@ -31,6 +31,7 @@ LOG_PREFIX ?= $(PREFIX)/log
JAVA_PREFIX ?= $(PREFIX)
HDR_SCOPE_PREFIX ?=
INSTALL_PREFIXDIR ?= $(PREFIX)
DATA_DIR ?= $(FLAVOUR_PATH_PREFIX)$(PREFIX)/data
IMAGEDIR ?= $(DATA_DIR)/images
JSON_DIR ?= $(DATA_DIR)/json
@ -71,6 +72,9 @@ CFGMODE ?= 660
CFGDIROWNER ?= $(EXEDIROWNER)
CFGDIRGROUP ?= $(EXEDIRGROUP)
CFGDIRMODE ?= $(EXEDIRMODE)
CFGTOPDIROWNER ?= $(CFGDIROWNER)
CFGTOPDIRGROUP ?= $(CFGDIRGROUP)
CFGTOPDIRMODE ?= $(CFGDIRMODE)
SYSCFGOWNER ?= $(CFGOWNER)
SYSCFGGROUP ?= $(CFGGROUP)
SYSCFGMODE ?= $(CFGMODE)

View file

@ -31,6 +31,7 @@ LOG_PREFIX ?= $(ENV_PREFIX)/var/log
JAVA_PREFIX ?= $(PREFIX)
HDR_SCOPE_PREFIX ?=
INSTALL_PREFIXDIR ?= $(PREFIX)
DATA_DIR ?= $(FLAVOUR_PATH_PREFIX)$(PREFIX)/data
IMAGEDIR ?= $(DATA_DIR)/images
JSON_DIR ?= $(DATA_DIR)/json
@ -71,6 +72,9 @@ CFGMODE ?= 664
CFGDIROWNER ?= $(EXEDIROWNER)
CFGDIRGROUP ?= $(EXEDIRGROUP)
CFGDIRMODE ?= $(EXEDIRMODE)
CFGTOPDIROWNER ?= $(CFGDIROWNER)
CFGTOPDIRGROUP ?= $(CFGDIRGROUP)
CFGTOPDIRMODE ?= $(CFGDIRMODE)
SYSCFGOWNER ?= $(CFGOWNER)
SYSCFGGROUP ?= $(CFGGROUP)
SYSCFGMODE ?= $(CFGMODE)

View file

@ -307,6 +307,8 @@ LOCAL_MKFILES ?= $(wildcard GNUmakefile makefile Makefile *.mk)
LOG_QUAL_PREFIX ?= $(LOGID):
# -- standard dirs and files for build and install
INSTALLATION_FILE_TYPES += PREFIX
# -- CFG
INSTALLATION_FILE_TYPES += CFG
CONFIG_FILE ?= $(CONFIG_DIR)/$(PROJECT).conf
@ -314,6 +316,7 @@ BUILD_CFGDIR = $(TOPDIR)/conf
ifeq ($(CONFIG_SUBDIR),)
INSTALL_CFGDIR ?= $(CONFIG_DIR)
else
INSTALL_CFGTOPDIR ?= $(CONFIG_DIR)
INSTALL_CFGDIR ?= $(CONFIG_DIR)/$(CONFIG_SUBDIR)
endif
LOCAL_CFG ?= $(filter-out %.site.conf, $(filter-out rsyslog-%, $(wildcard *.conf *.xml *.bprof *.jw-tmpl *.ini *.yaml *.toml))) $(LOCAL_EXTRA_CFG)

View file

@ -8,7 +8,7 @@ SRC_H += $(PROJ_H) $(wildcard $(HDRDIR_SCOPE_SUFFIX)/*.h)
# mandatory targets
all: $(PROJ_H)
clean: clean.include
install: install_HDR
install: install_dir_PREFIX install_HDR
# not wäry naaice
ifneq ($(HDRDIR_SCOPE_SUFFIX),)

View file

@ -31,7 +31,7 @@ endif
ifeq ($(CREATE_PKG_CONFIG),true)
all: build_PKG_CONFIG
endif
install: $(DEVEL_TARGETS)
install: install_dir_PREFIX $(DEVEL_TARGETS)
clean: textclean localclean doneclean clean.pkg-config
test: all

View file

@ -1,5 +1,5 @@
all: build_EXE build_CGI
install: install_files_INIT install_EXE install_files_CGI install_files_SYSCFG
install: install_dir_PREFIX install_files_INIT install_EXE install_files_CGI install_files_SYSCFG
clean:allclean localclean doneclean textclean clean.init
test: all

View file

@ -18,7 +18,7 @@ include $(JWBDIR)/make/rules.mk
all: $(SHOBJS) $(BUILD_SHOBJS)
clean: objclean textclean localclean profclean
install: $(ALL) install_dir_LIB installso
install: $(ALL) install_dir_PREFIX install_dir_LIB installso
$(BUILD_LIBDIR)/%.so: %.so
install -m 755 $< $@

View file

@ -13,7 +13,7 @@ endif
include $(JWBDIR)/make/exe.mk
all: build_EXE
install: install_EXE
install: install_dir_PREFIX install_EXE
clean: clean.yapp
distclean:

View file

@ -5,7 +5,7 @@ import os
import re
import sys
from typing import TYPE_CHECKING, Any, Generic, Iterable, TypeVar, override
from typing import TYPE_CHECKING, Any, Generic, Iterable, TypeGuard, TypeVar, override
from .log import ERR, OFF, log, parse_log_level
@ -15,6 +15,9 @@ if TYPE_CHECKING:
T = TypeVar('T')
def is_abc_class(c: type[object]) -> TypeGuard[abc.ABCMeta]:
return isinstance(c, abc.ABCMeta)
class Types(abc.ABC, Iterable[type[T]], Generic[T]): # export
@override
@ -101,6 +104,9 @@ class LoadTypes(Types[T]): # export
if rx is not None and not re.match(rx, member_name):
self._debug(f'o "{name}" has wrong name')
continue
if not is_abc_class(c):
self._debug(f'o "{name}" is not derived from ABCMeta')
continue
if inspect.isabstract(c):
self._debug(f'o "{name}" is abstract: {c.__abstractmethods__}')
continue