pkg-manager.sh: Replace by jw-pkg.py distro

Retire pkg-manager.sh and replace it by the cleaner "jw-pkg.sh
distro" command, essentially providing the same functionality and
nearly the same command-line interface.

Not-so-fun-fact:

  jw-pkg > git diff --stat jw-devops/master
  ...
  71 files changed, 732 insertions(+), 340 deletions(-)

400 LOC more. That's what the move from a shell script to the more
maintainable Python versions costs. Still a good idea, and the
enhanced extensibility might pay off in terms of LOC with other shell
scripts in the future.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-01-28 08:10:09 +01:00
commit b8e8ecf2f1
3 changed files with 11 additions and 181 deletions

View file

@ -101,10 +101,7 @@ ifneq ($(EXCLUDE_FROM_BUILD),)
endif
# non-interactive mode
INTERACTIVE ?= true
ifneq ($(INTERACTIVE),true)
DASH_Y := -y
endif
INTERACTIVE ?= auto
# ------------ external programs II
@ -119,6 +116,7 @@ endif
JW_PKG_PY = $(TIME) python3 $(JWB_SCRIPT_DIR)/jw-pkg.py --prefix $(shell pwd) $(JW_PKG_PY_EXTRA_OPTS)
JW_PKG_PY_PROJECTS = $(JW_PKG_PY) projects
JW_PKG_PY_BUILD = $(JW_PKG_PY_PRJECTS) build $(JW_PKG_PY_EXTRA_BUILD_OPTS)
PKG_MANAGER ?= $(JW_PKG_PY) distro --interactive=$(INTERACTIVE)
PGIT_SH := /bin/bash $(JWB_SCRIPT_DIR)/pgit.sh
ifneq ($(origin PROJECTS_DIR_REMOTE_BASE),undefined)
@ -140,7 +138,6 @@ ifneq ($(JANWARE_USER),)
endif
PURGE_SH = /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/purge-stale-projects.sh $(JW_PKG_BINDIR)/purge-stale-projects.sh) purge-not-found)
PKG_MANAGER_SH ?= /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/pkg-manager.sh $(JW_PKG_BINDIR)/pkg-manager.sh) pkg-manager-not-found)
CREATE_PROJECT_SH ?= /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/jw-pkg-create-project.sh $(JW_PKG_BINDIR)/jw-pkg-create-project.sh) jw-pkg-create-project-not-found)
LIST_VCS_FILES_SH = /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/scm.sh $(JW_PKG_BINDIR)/scm.sh) scm-sh-not-found) ls-files
GIT_SRV_ADMIN_SH = JW_PKG_SSH_EXTRA_OPTS="$(JW_PKG_SSH_EXTRA_OPTS)" $(GIT_SSH) $(JANWARE_USER)@git.janware.com $(JW_PKG_REMOTE_BINDIR)/git-srv-admin.sh
@ -241,13 +238,13 @@ cloc:
# --- package-related targets
pkg-manager-refresh:
$(PKG_MANAGER_SH) refresh $(DASH_Y)
$(PKG_MANAGER) refresh
pkg-install-build-deps:
$(PKG_MANAGER_SH) install $(DASH_Y) "$(BASE_PKGS) $(shell $(JW_PKG_PY_PROJECTS) required-os-pkg --skip-excluded --flavours build $(TARGET_PROJECTS))"
$(PKG_MANAGER) install $(BASE_PKGS) $(shell $(JW_PKG_PY_PROJECTS) required-os-pkg --skip-excluded --flavours build $(TARGET_PROJECTS))
pkg-install-release-deps:
$(PKG_MANAGER_SH) install $(DASH_Y) "$(BASE_PKGS) $(shell $(JW_PKG_PY_PROJECTS) required-os-pkg --skip-excluded --flavours 'build run release' $(TARGET_PROJECTS))"
$(PKG_MANAGER) install $(BASE_PKGS) $(shell $(JW_PKG_PY_PROJECTS) required-os-pkg --skip-excluded --flavours 'build run release' $(TARGET_PROJECTS))
pkg-release-reinstall: $(PREREQ_RELEASE)

View file

@ -21,7 +21,8 @@ GIT_DESCR = $(TOPDIR)/.git/description
GIT_MAIN_BRANCH ?= master
OPT_JANWARE_PROJECT ?= -j
PKG_MANAGER_SH ?= /bin/bash $(firstword $(wildcard $(JWB_SCRIPT_DIR)/pkg-manager.sh /opt/jw-pkg/bin/pkg-manager.sh) pkg-manager-not-found)
INTERACTIVE ?= auto
PKG_MANAGER ?= $(JW_PKG_PY) distro --interactive=$(INTERACTIVE)
ifeq ($(OPT_JANWARE_PROJECT),-j)
REMOTE_GIT_FLAVOUR ?= proj
@ -209,16 +210,16 @@ git-pull-%:
fi
pkg-manager-refresh:
$(PKG_MANAGER_SH) refresh $(DASH_Y)
$(PKG_MANAGER) refresh
pkg-install-build-deps:
$(PKG_MANAGER_SH) install $(DASH_Y) $(BASE_PKGS) $(shell $(proj_query_cmd) required-os-pkg --skip-excluded --flavours "build" $(PROJECT))
$(PKG_MANAGER) install $(BASE_PKGS) $(shell $(proj_query_cmd) required-os-pkg --skip-excluded --flavours "build" $(PROJECT))
pkg-install-release-deps:
$(PKG_MANAGER_SH) install $(DASH_Y) $(BASE_PKGS) $(shell $(proj_query_cmd) required-os-pkg --skip-excluded --flavours "build run release" $(PROJECT))
$(PKG_MANAGER) install $(BASE_PKGS) $(shell $(proj_query_cmd) required-os-pkg --skip-excluded --flavours "build run release" $(PROJECT))
pkg-install-testbuild-deps:
$(PKG_MANAGER_SH) install $(DASH_Y) $(BASE_PKGS) $(shell $(proj_query_cmd) pkg-requires --delimiter=' ' --no-version build,run,release $(PROJECT))
$(PKG_MANAGER) install $(BASE_PKGS) $(shell $(proj_query_cmd) pkg-requires --delimiter=' ' --no-version build,run,release $(PROJECT))
echo-hash:
$(Q)/bin/bash $(PKG_SH_EXE) hash