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 <jan@janware.com> Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.87.0
This commit is contained in:
parent
a03eb10868
commit
c33d72f4d4
2 changed files with 12 additions and 5 deletions
|
|
@ -67,9 +67,10 @@ else
|
||||||
ifeq ($(BUILD_USER),root)
|
ifeq ($(BUILD_USER),root)
|
||||||
PKG_DIR_BUILD = /usr/src/packages
|
PKG_DIR_BUILD = /usr/src/packages
|
||||||
else
|
else
|
||||||
PKG_DIR_BUILD = $(HOME)/rpmbuild
|
PKG_DIR_BUILD ?= $(TOPDIR)/dist/build
|
||||||
endif
|
endif
|
||||||
PKG_DIR_BINARY = $(PKG_DIR_BUILD)/RPMS/$(PKG_ARCH)
|
PKG_DIR_BINARY = $(PKG_DIR_BUILD)/RPMS/$(PKG_ARCH)
|
||||||
|
PKG_SH_EXTRA_ARGS += -T $(PKG_DIR_BUILD)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DIST_DIRS = $(DIST_SRC_DIR) $(DIST_PCKG_DIR)
|
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)" \
|
-X "$(PKG_CONFLICTS_RUN)" -Y "$(PKG_CONFLICTS_DEVEL)" \
|
||||||
--provides-run "$(PKG_PROVIDES_RUN)" --provides-devel "$(PKG_PROVIDES_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_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:
|
all:
|
||||||
install:
|
install:
|
||||||
|
|
|
||||||
|
|
@ -524,11 +524,12 @@ build_pkg()
|
||||||
case "$PKG_FORMAT" in
|
case "$PKG_FORMAT" in
|
||||||
rpm)
|
rpm)
|
||||||
# --- build RPMs and copy them to source directory
|
# --- build RPMs and copy them to source directory
|
||||||
local rpmbuild_root=$HOME/rpmbuild
|
local rpmbuild_root=${RPMBUILD_ROOT:-$HOME/rpmbuild}
|
||||||
[ `id -u` = 0 ] && rpmbuild_root=/usr/src/packages
|
mkdir -p $rpmbuild_root
|
||||||
|
rpmbuild_root=$(readlink -f $rpmbuild_root)
|
||||||
local rpmbuild_srpms=$rpmbuild_root/SRPMS
|
local rpmbuild_srpms=$rpmbuild_root/SRPMS
|
||||||
local rpmbuild_rpms=$rpmbuild_root/RPMS/$PKG_ARCH
|
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_srpms/$src_base.src.rpm $DIST_PCKG_DIR/
|
||||||
cp $rpmbuild_rpms/$PKG_PROJECT-*-$version.$PKG_ARCH.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_SRC_DIR=dist/src
|
||||||
DIST_INST_DIR=dist/src
|
DIST_INST_DIR=dist/src
|
||||||
DIST_PCKG_DIR=dist/pckg
|
DIST_PCKG_DIR=dist/pckg
|
||||||
|
RPMBUILD_ROOT=""
|
||||||
PKG_PROJECT="$PROJECT"
|
PKG_PROJECT="$PROJECT"
|
||||||
PKG_REQUIRES_RUN=""
|
PKG_REQUIRES_RUN=""
|
||||||
PKG_RECOMMENDS_RUN=""
|
PKG_RECOMMENDS_RUN=""
|
||||||
|
|
@ -1160,6 +1162,10 @@ while [ ${1:0:1} = - ]; do
|
||||||
eval DIST_SRC_DIR=\"$2\"
|
eval DIST_SRC_DIR=\"$2\"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
-T)
|
||||||
|
eval RPMBUILD_ROOT=\"$2\"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-p)
|
-p)
|
||||||
eval DIST_PCKG_DIR=\"$2\"
|
eval DIST_PCKG_DIR=\"$2\"
|
||||||
shift
|
shift
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue