pkg.sh: Fix broken version macro expansion #92

Merged
Jan Lindemann merged 1 commit from jan/feature/20260909-pkg-sh-fix-broken-version-macro-expansion into master 2026-09-09 15:55:39 +02:00 AGit
2 changed files with 13 additions and 17 deletions
Showing only changes of commit af31e80678 - Show all commits

pkg.sh: Fix broken version macro expansion
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m52s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m12s
CI / Packaging test (pull_request) Successful in 0s

pkg-dist.mk queries the package relations with
--dont-expand-version-macros, and build_pkg() expanded the remaining
VERSION and VERSION-REVISION macros with a local sed-based
expand_version_macros(). That substitutes the version of the project being
built for every macro, instead of the version of the dependency the macro
refers to.

Drop --dont-expand-version-macros from the proj_query calls so the macros
resolve to the dependency's own version, and remove expand_version_macros()
from build_pkg(), which passes the PKG_* variables to rpmbuild as they are
queried.

Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann 2026-09-09 06:29:40 +02:00
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -78,13 +78,13 @@ ifeq ($(CREATE_DEVEL),true)
BINARY_PKG += $(DIST_PCKG_DIR)/$(PKG_DEVEL_X86) BINARY_PKG += $(DIST_PCKG_DIR)/$(PKG_DEVEL_X86)
endif endif
PKG_REQUIRES_BUILD += $(call proj_query, pkg-requires --dont-expand-version-macros $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) build $(PROJECT)) PKG_REQUIRES_BUILD += $(call proj_query, pkg-requires $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) build $(PROJECT))
PKG_REQUIRES_RUN += $(call proj_query, pkg-requires --dont-expand-version-macros $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) run $(PROJECT)) PKG_REQUIRES_RUN += $(call proj_query, pkg-requires $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) run $(PROJECT))
PKG_REQUIRES_DEVEL += $(call proj_query, pkg-requires --dont-expand-version-macros $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) devel $(PROJECT)) PKG_REQUIRES_DEVEL += $(call proj_query, pkg-requires $(PROJ_QUERY_PKG_REQUIRES_EXTRA_ARGS) devel $(PROJECT))
PKG_CONFLICTS_RUN += $(call proj_query, pkg-conflicts --dont-expand-version-macros $(PROJ_QUERY_PKG_CONFLICTS_EXTRA_ARGS) run $(PROJECT)) PKG_CONFLICTS_RUN += $(call proj_query, pkg-conflicts $(PROJ_QUERY_PKG_CONFLICTS_EXTRA_ARGS) run $(PROJECT))
PKG_CONFLICTS_DEVEL += $(call proj_query, pkg-conflicts --dont-expand-version-macros $(PROJ_QUERY_PKG_CONFLICTS_EXTRA_ARGS) devel $(PROJECT)) PKG_CONFLICTS_DEVEL += $(call proj_query, pkg-conflicts $(PROJ_QUERY_PKG_CONFLICTS_EXTRA_ARGS) devel $(PROJECT))
PKG_PROVIDES_RUN += $(call proj_query, pkg-provides --dont-expand-version-macros $(PROJ_QUERY_PKG_PROVIDES_EXTRA_ARGS) run $(PROJECT)) PKG_PROVIDES_RUN += $(call proj_query, pkg-provides $(PROJ_QUERY_PKG_PROVIDES_EXTRA_ARGS) run $(PROJECT))
PKG_PROVIDES_DEVEL += $(call proj_query, pkg-provides --dont-expand-version-macros $(PROJ_QUERY_PKG_PROVIDES_EXTRA_ARGS) devel $(PROJECT)) PKG_PROVIDES_DEVEL += $(call proj_query, pkg-provides $(PROJ_QUERY_PKG_PROVIDES_EXTRA_ARGS) devel $(PROJECT))
PKG_UPLOAD_OS_NAME = $(shell echo $(OS_NAME_VERSION) | sed 's/-.*//') PKG_UPLOAD_OS_NAME = $(shell echo $(OS_NAME_VERSION) | sed 's/-.*//')
PKG_UPLOAD_OS_VERSION = $(shell echo $(OS_NAME_VERSION) | sed 's/[^-]\+-//') PKG_UPLOAD_OS_VERSION = $(shell echo $(OS_NAME_VERSION) | sed 's/[^-]\+-//')

View file

@ -438,16 +438,12 @@ build_pkg()
local tar_archive_orig=$src_base.orig.tar.bz2 local tar_archive_orig=$src_base.orig.tar.bz2
local distribution=`get_os` local distribution=`get_os`
expand_version_macros() { local rpm_requires_run="$PKG_REQUIRES_RUN"
echo "$@" | sed "s/__NEXT_VERSION__/$version/g; s/VERSION-REVISION/$version/g; s/VERSION/$version/g" local rpm_requires_devel="$PKG_REQUIRES_DEVEL"
} local rpm_conflicts_run="$PKG_CONFLICTS_RUN"
local rpm_conflicts_devel="$PKG_CONFLICTS_DEVEL"
local rpm_requires_run=`expand_version_macros $PKG_REQUIRES_RUN` local rpm_provides_run="$PKG_PROVIDES_RUN"
local rpm_requires_devel=`expand_version_macros $PKG_REQUIRES_DEVEL` local rpm_provides_devel="$PKG_PROVIDES_DEVEL"
local rpm_conflicts_run=`expand_version_macros $PKG_CONFLICTS_RUN`
local rpm_conflicts_devel=`expand_version_macros $PKG_CONFLICTS_DEVEL`
local rpm_provides_run=`expand_version_macros $PKG_PROVIDES_RUN`
local rpm_provides_devel=`expand_version_macros $PKG_PROVIDES_DEVEL`
# --- create source directory tree # --- create source directory tree
create_empty_dir $src_tree "Source files compilation directory" create_empty_dir $src_tree "Source files compilation directory"