From c33d72f4d4ca3494dd59b5ca8f328d4b102eb581 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 22 Sep 2026 17:34:02 +0200 Subject: [PATCH 1/3] pkg-dist.mk, pkg.sh: Build RPMs in dist/build pkg.sh hardcodes $HOME/rpmbuild as the rpmbuild topdir while make computes the same location separately as PKG_DIR_BUILD, and a sandboxed shell cannot build at all: rpmbuild writes its scratch trees and results under the topdir, outside the project. - Default PKG_DIR_BUILD to $(TOPDIR)/dist/build for non-root builds and pass it to pkg.sh as the new -T option (root keeps /usr/src/packages; local.mk can still override) - Build with --define _topdir pointing at that directory, resolved to an absolute path, so the scratch tree, RPMS and SRPMS stay in the project tree where make clean drops them Signed-off-by: Jan Lindemann Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.87.0 --- make/pkg-dist.mk | 5 +++-- scripts/pkg.sh | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/make/pkg-dist.mk b/make/pkg-dist.mk index 6e3584ac..29b11eb7 100644 --- a/make/pkg-dist.mk +++ b/make/pkg-dist.mk @@ -67,9 +67,10 @@ else ifeq ($(BUILD_USER),root) PKG_DIR_BUILD = /usr/src/packages else - PKG_DIR_BUILD = $(HOME)/rpmbuild + PKG_DIR_BUILD ?= $(TOPDIR)/dist/build endif PKG_DIR_BINARY = $(PKG_DIR_BUILD)/RPMS/$(PKG_ARCH) + PKG_SH_EXTRA_ARGS += -T $(PKG_DIR_BUILD) endif DIST_DIRS = $(DIST_SRC_DIR) $(DIST_PCKG_DIR) @@ -106,7 +107,7 @@ PKG_SH = $(PKG_SH_EXE) \ -X "$(PKG_CONFLICTS_RUN)" -Y "$(PKG_CONFLICTS_DEVEL)" \ --provides-run "$(PKG_PROVIDES_RUN)" --provides-devel "$(PKG_PROVIDES_DEVEL)" \ -m $(JWB_SCRIPT_DIR) -a $(PKG_ARCH) -p $(DIST_PCKG_DIR) -F $(PKG_FORMAT) \ - -B $(PKG_UPLOAD_URLPREFIX) -A $(PKG_UPLOAD_FILE_ATTRIB) + -B $(PKG_UPLOAD_URLPREFIX) -A $(PKG_UPLOAD_FILE_ATTRIB) $(PKG_SH_EXTRA_ARGS) all: install: diff --git a/scripts/pkg.sh b/scripts/pkg.sh index ac8484a5..22e4738b 100644 --- a/scripts/pkg.sh +++ b/scripts/pkg.sh @@ -524,11 +524,12 @@ build_pkg() case "$PKG_FORMAT" in rpm) # --- build RPMs and copy them to source directory - local rpmbuild_root=$HOME/rpmbuild - [ `id -u` = 0 ] && rpmbuild_root=/usr/src/packages + local rpmbuild_root=${RPMBUILD_ROOT:-$HOME/rpmbuild} + mkdir -p $rpmbuild_root + rpmbuild_root=$(readlink -f $rpmbuild_root) local rpmbuild_srpms=$rpmbuild_root/SRPMS local rpmbuild_rpms=$rpmbuild_root/RPMS/$PKG_ARCH - rpmbuild -ta $DIST_PCKG_DIR/$tar_archive + rpmbuild --define "_topdir $rpmbuild_root" -ta $DIST_PCKG_DIR/$tar_archive cp $rpmbuild_srpms/$src_base.src.rpm $DIST_PCKG_DIR/ cp $rpmbuild_rpms/$PKG_PROJECT-*-$version.$PKG_ARCH.rpm $DIST_PCKG_DIR/ ;; @@ -1138,6 +1139,7 @@ PROJECT_DESCR_FILE=$TOPDIR/make/project.conf DIST_SRC_DIR=dist/src DIST_INST_DIR=dist/src DIST_PCKG_DIR=dist/pckg +RPMBUILD_ROOT="" PKG_PROJECT="$PROJECT" PKG_REQUIRES_RUN="" PKG_RECOMMENDS_RUN="" @@ -1160,6 +1162,10 @@ while [ ${1:0:1} = - ]; do eval DIST_SRC_DIR=\"$2\" shift ;; + -T) + eval RPMBUILD_ROOT=\"$2\" + shift + ;; -p) eval DIST_PCKG_DIR=\"$2\" shift -- 2.56.0 From 29dffb9767d6b973c2fa9d6447783e168d7e8073 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 22 Sep 2026 17:41:32 +0200 Subject: [PATCH 2/3] pkg-dist.mk, pkg.sh: Rename dist/pckg to dist/pkg The directory holding the built packages uses the pckg abbreviation while every other package-related name in the build system uses pkg (PKG_PROJECT, PKG_FORMAT, PKG_ARCH). Rename dist/pckg to dist/pkg, in the DIST_PCKG_DIR variable and in the recipes that hardcode the path. Signed-off-by: Jan Lindemann Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.87.0 --- make/pkg-dist.mk | 8 ++++---- scripts/pkg.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/make/pkg-dist.mk b/make/pkg-dist.mk index 29b11eb7..48e9d960 100644 --- a/make/pkg-dist.mk +++ b/make/pkg-dist.mk @@ -39,7 +39,7 @@ include $(JWBDIR)/make/tag-defs.mk DIST_DIR = dist DIST_SRC_DIR = $(DIST_DIR)/src/$(PKG_PROJECT)-$(PKG_VERSION) -DIST_PCKG_DIR = $(DIST_DIR)/pckg +DIST_PCKG_DIR = $(DIST_DIR)/pkg UPLOAD_SRC_DIR = $(DIST_PCKG_DIR) PCKG_TAR ?= $(PKG_PROJECT)-$(PKG_VERSION).tar.gz @@ -140,7 +140,7 @@ pkg-build.dist: $(VERSION_FILE) pkg-update-local-repo: for a in src i386 i586 i686 x86_64; do \ if ls dist/*/*.$$a.rpm >/dev/null 2>&1; then \ - sudo install -m 644 dist/pckg/*.$$a.rpm $(LOCAL_REPO)/rpm/$$a/ ;\ + sudo install -m 644 dist/pkg/*.$$a.rpm $(LOCAL_REPO)/rpm/$$a/ ;\ fi ;\ done sudo sh $(LOCAL_REPO)/update.sh @@ -288,10 +288,10 @@ pkg-release-reinstall: get-maintainer get-official get-pub pkg-release-update-ve $(PKG_SH) release $(PKG_SH_BUILD_OPTS) ifneq ($(TARGET_HOST),) pkg-remote-install: - scp $(addprefix dist/pckg/,$(PKG_RUN_X86) $(PKG_DEVEL_X86)) root@$(TARGET_HOST):/tmp/ + scp $(addprefix dist/pkg/,$(PKG_RUN_X86) $(PKG_DEVEL_X86)) root@$(TARGET_HOST):/tmp/ ssh -l root $(TARGET_HOST) rpm -U --force $(addprefix /tmp/,$(PKG_RUN_X86) $(PKG_DEVEL_X86)) pkg-remote-install-run: - scp $(addprefix dist/pckg/,$(PKG_RUN_X86)) root@$(TARGET_HOST):/tmp/ + scp $(addprefix dist/pkg/,$(PKG_RUN_X86)) root@$(TARGET_HOST):/tmp/ ssh -l root $(TARGET_HOST) rpm -U --force $(addprefix /tmp/,$(PKG_RUN_X86)) ssh-remote: ssh -l root $(TARGET_HOST) diff --git a/scripts/pkg.sh b/scripts/pkg.sh index 22e4738b..e1773bde 100644 --- a/scripts/pkg.sh +++ b/scripts/pkg.sh @@ -1138,7 +1138,7 @@ tmp_mkdef_sh="" PROJECT_DESCR_FILE=$TOPDIR/make/project.conf DIST_SRC_DIR=dist/src DIST_INST_DIR=dist/src -DIST_PCKG_DIR=dist/pckg +DIST_PCKG_DIR=dist/pkg RPMBUILD_ROOT="" PKG_PROJECT="$PROJECT" PKG_REQUIRES_RUN="" -- 2.56.0 From f92de9f3ffb441976ab6030baddbfb10315e4df1 Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Thu, 24 Sep 2026 10:16:33 +0200 Subject: [PATCH 3/3] pkg-dist.mk, pkg.sh: Rename PCKG variables to PKG The previous commit renamed the dist/pckg directory to dist/pkg but kept the pckg spelling in the variables that reference it. Rename the variables to PKG: - DIST_PCKG_DIR to DIST_PKG_DIR (make/pkg-dist.mk, pkg.sh) - PCKG_TAR to PKG_TAR, PCKG_ROOT to PKG_ROOT and DIST_PCKG_RPM to DIST_PKG_RPM (make/pkg-dist.mk) None of the other 320 janware projects use these variables. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.87.0 Signed-off-by: Jan Lindemann --- make/pkg-dist.mk | 20 ++++++++++---------- make/rules.mk | 4 ++-- scripts/pkg.sh | 32 ++++++++++++++++---------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/make/pkg-dist.mk b/make/pkg-dist.mk index 48e9d960..eaa749db 100644 --- a/make/pkg-dist.mk +++ b/make/pkg-dist.mk @@ -39,10 +39,10 @@ include $(JWBDIR)/make/tag-defs.mk DIST_DIR = dist DIST_SRC_DIR = $(DIST_DIR)/src/$(PKG_PROJECT)-$(PKG_VERSION) -DIST_PCKG_DIR = $(DIST_DIR)/pkg +DIST_PKG_DIR = $(DIST_DIR)/pkg -UPLOAD_SRC_DIR = $(DIST_PCKG_DIR) -PCKG_TAR ?= $(PKG_PROJECT)-$(PKG_VERSION).tar.gz +UPLOAD_SRC_DIR = $(DIST_PKG_DIR) +PKG_TAR ?= $(PKG_PROJECT)-$(PKG_VERSION).tar.gz ifeq ($(PKG_FORMAT),debian) # too bad: debian Requires: somepkg = 1.2.3 isn't satisfied by somepkg-1.2.3-5 @@ -73,10 +73,10 @@ else PKG_SH_EXTRA_ARGS += -T $(PKG_DIR_BUILD) endif -DIST_DIRS = $(DIST_SRC_DIR) $(DIST_PCKG_DIR) -BINARY_PKG = $(DIST_PCKG_DIR)/$(PKG_RUN_X86) +DIST_DIRS = $(DIST_SRC_DIR) $(DIST_PKG_DIR) +BINARY_PKG = $(DIST_PKG_DIR)/$(PKG_RUN_X86) ifeq ($(CREATE_DEVEL),true) -BINARY_PKG += $(DIST_PCKG_DIR)/$(PKG_DEVEL_X86) +BINARY_PKG += $(DIST_PKG_DIR)/$(PKG_DEVEL_X86) endif PKG_REQUIRES_BUILD += $(call proj_query, pkg-requires $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) build $(PROJECT)) @@ -106,7 +106,7 @@ PKG_SH = $(PKG_SH_EXE) \ -E "$(PKG_RECOMMENDS_RUN)" \ -X "$(PKG_CONFLICTS_RUN)" -Y "$(PKG_CONFLICTS_DEVEL)" \ --provides-run "$(PKG_PROVIDES_RUN)" --provides-devel "$(PKG_PROVIDES_DEVEL)" \ - -m $(JWB_SCRIPT_DIR) -a $(PKG_ARCH) -p $(DIST_PCKG_DIR) -F $(PKG_FORMAT) \ + -m $(JWB_SCRIPT_DIR) -a $(PKG_ARCH) -p $(DIST_PKG_DIR) -F $(PKG_FORMAT) \ -B $(PKG_UPLOAD_URLPREFIX) -A $(PKG_UPLOAD_FILE_ATTRIB) $(PKG_SH_EXTRA_ARGS) all: @@ -114,7 +114,7 @@ install: clean: pkg-clean distclean: pkg-clean -pkg-tgz: $(DIST_PCKG_DIR)/$(PCKG_TAR) +pkg-tgz: $(DIST_PKG_DIR)/$(PKG_TAR) ftag: ftag.dist pkg-upload-stable: pkg-upload-STABLE.dist @@ -169,7 +169,7 @@ pkguninstall.dist: upload-%.dist: %_$(PROJECT_CAPNAME)_RPM_RUN_I386 cvs commit $< - $(UPLOAD_SH) $< $(REMOTE_TARGET_PREFIX)$(PCKG_ROOT)/$<:640:750:$(FTP_RUN_USER).$(FTP_RUN_GROUP) + $(UPLOAD_SH) $< $(REMOTE_TARGET_PREFIX)$(PKG_ROOT)/$<:640:750:$(FTP_RUN_USER).$(FTP_RUN_GROUP) touch $@ update-repo.dist: upload.dist @@ -250,7 +250,7 @@ define increase_build_number endef define check_reinstall_old - (true $(addprefix && test -f ,$(DIST_PCKG_RPM)) && make pkg-uninstall && make pkg-install) + (true $(addprefix && test -f ,$(DIST_PKG_RPM)) && make pkg-uninstall && make pkg-install) endef md5: diff --git a/make/rules.mk b/make/rules.mk index e64fca06..1a1eea40 100644 --- a/make/rules.mk +++ b/make/rules.mk @@ -33,7 +33,7 @@ distclean: clean love \ mocclean \ objclean \ - pckgclean \ + pkgclean \ depsclean \ profclean \ push \ @@ -60,7 +60,7 @@ installexe: all checkroot $(INSTALLED_EXE) installso: all checkroot install_dir_LIB $(INSTALLED_SHOBJS) -pckgclean: +pkgclean: $(RM) -rf *.zip *.tar.gz *.rpm *.deb tmpclean: diff --git a/scripts/pkg.sh b/scripts/pkg.sh index e1773bde..77536a9d 100644 --- a/scripts/pkg.sh +++ b/scripts/pkg.sh @@ -253,8 +253,8 @@ check_pkg_reinstall() ;; esac - check_pkg_install $TOPDIR/$DIST_PCKG_DIR/$PKG_PROJECT-run$suffix || return 1 - check_pkg_install -c $TOPDIR/$DIST_PCKG_DIR/$PKG_PROJECT-devel$suffix || return 1; + check_pkg_install $TOPDIR/$DIST_PKG_DIR/$PKG_PROJECT-run$suffix || return 1 + check_pkg_install -c $TOPDIR/$DIST_PKG_DIR/$PKG_PROJECT-devel$suffix || return 1; } check_release_is_current() @@ -517,9 +517,9 @@ build_pkg() done # --- tar up source directory tree - create_empty_dir $DIST_PCKG_DIR "Package directory" + create_empty_dir $DIST_PKG_DIR "Package directory" - tar --anchored -czvf $DIST_PCKG_DIR/$tar_archive -C $DIST_SRC_DIR `basename $src_tree` + tar --anchored -czvf $DIST_PKG_DIR/$tar_archive -C $DIST_SRC_DIR `basename $src_tree` case "$PKG_FORMAT" in rpm) @@ -529,13 +529,13 @@ build_pkg() rpmbuild_root=$(readlink -f $rpmbuild_root) local rpmbuild_srpms=$rpmbuild_root/SRPMS local rpmbuild_rpms=$rpmbuild_root/RPMS/$PKG_ARCH - rpmbuild --define "_topdir $rpmbuild_root" -ta $DIST_PCKG_DIR/$tar_archive - cp $rpmbuild_srpms/$src_base.src.rpm $DIST_PCKG_DIR/ - cp $rpmbuild_rpms/$PKG_PROJECT-*-$version.$PKG_ARCH.rpm $DIST_PCKG_DIR/ + rpmbuild --define "_topdir $rpmbuild_root" -ta $DIST_PKG_DIR/$tar_archive + cp $rpmbuild_srpms/$src_base.src.rpm $DIST_PKG_DIR/ + cp $rpmbuild_rpms/$PKG_PROJECT-*-$version.$PKG_ARCH.rpm $DIST_PKG_DIR/ ;; *) #exit - #cp $DIST_PCKG_DIR/$tar_archive $src_tree/../$tar_archive_orig + #cp $DIST_PKG_DIR/$tar_archive $src_tree/../$tar_archive_orig ( local mod_script_dir=`readlink -f $JWB_SCRIPT_DIR` cd $src_tree @@ -544,7 +544,7 @@ build_pkg() #strace -f -s 128 -o /tmp/strace.out debuild --no-tgz-check --prepend-path=$mod_script_dir -us -uc debuild --no-tgz-check --prepend-path=$mod_script_dir -us -uc ) - cp $DIST_SRC_DIR/*.deb $DIST_PCKG_DIR/ + cp $DIST_SRC_DIR/*.deb $DIST_PKG_DIR/ ;; esac } @@ -558,9 +558,9 @@ upload_file() fi local f="$1" local t="$2" - [ -f $DIST_PCKG_DIR/$f ] || { + [ -f $DIST_PKG_DIR/$f ] || { if [ "$quiet" = true ]; then return 0; fi - "+ $DIST_PCKG_DIR/$f doesn't exist, can't upload" + "+ $DIST_PKG_DIR/$f doesn't exist, can't upload" return 1 } local os_name=`get_os | sed 's/-.*//'` @@ -600,7 +600,7 @@ upload_file() esac esac echo "+ uploading $target" - RSYNC_RSH=$SSH /bin/bash $JWB_SCRIPT_DIR/upload.sh $DIST_PCKG_DIR/$f $target + RSYNC_RSH=$SSH /bin/bash $JWB_SCRIPT_DIR/upload.sh $DIST_PKG_DIR/$f $target } upload_pkg() @@ -1138,7 +1138,7 @@ tmp_mkdef_sh="" PROJECT_DESCR_FILE=$TOPDIR/make/project.conf DIST_SRC_DIR=dist/src DIST_INST_DIR=dist/src -DIST_PCKG_DIR=dist/pkg +DIST_PKG_DIR=dist/pkg RPMBUILD_ROOT="" PKG_PROJECT="$PROJECT" PKG_REQUIRES_RUN="" @@ -1167,7 +1167,7 @@ while [ ${1:0:1} = - ]; do shift ;; -p) - eval DIST_PCKG_DIR=\"$2\" + eval DIST_PKG_DIR=\"$2\" shift ;; -m) @@ -1287,7 +1287,7 @@ version) ;; build) check_cwd - rm -rf ./$DIST_SRC_DIR ./$DIST_PCKG_DIR + rm -rf ./$DIST_SRC_DIR ./$DIST_PKG_DIR cmd_build "$@" ;; release-reinstall) @@ -1301,7 +1301,7 @@ release) check_release_is_current -r || { set -e check_cwd - rm -rf ./$DIST_SRC_DIR ./$DIST_PCKG_DIR + rm -rf ./$DIST_SRC_DIR ./$DIST_PKG_DIR check_update_version || true cmd_build "$@" check_pkg_reinstall -- 2.56.0