makepkg: make per-package files containing '$pkgname' consistently work
Extracting function variables containing arbitrarily scoped variables of
arbitrary nature is a disaster, but let's at least cover the common case
of using the actual '$pkgname' in an install/changelog file. It's the
odd case of actually being basically justified use of disambiguating
between the same variable used in multiple different split packages...
and also, --printsrcinfo already uses and overwrites the variable
'pkgname' in pkgbuild_extract_to_srcinfo, so this "works" in .SRCINFO
but doesn't work in .src.tar.gz
It doesn't work in lint_pkgbuild either, but in that case the problem is
being too permissive, not too restrictive -- we might end up checking
the same file twice, and printing that it is missing twice.
Fixes FS#64932
Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
(cherry picked from commit d626a17ef9
)
This commit is contained in:
parent
d61c398b2c
commit
0bf4779cda
3 changed files with 21 additions and 9 deletions
|
@ -32,11 +32,15 @@ lint_pkgbuild_functions+=('lint_changelog')
|
||||||
|
|
||||||
|
|
||||||
lint_changelog() {
|
lint_changelog() {
|
||||||
local name file changelog_list
|
local file changelog_list
|
||||||
|
|
||||||
changelog_list=("${changelog[@]}")
|
changelog_list=("${changelog[@]}")
|
||||||
for name in "${pkgname[@]}"; do
|
# set pkgname the same way we do for running package(), this way we get
|
||||||
if extract_function_variable "package_$name" changelog 0 file; then
|
# the right value in extract_function_variable
|
||||||
|
local pkgname_backup=(${pkgname[@]})
|
||||||
|
local pkgname
|
||||||
|
for pkgname in "${pkgname_backup[@]}"; do
|
||||||
|
if extract_function_variable "package_$pkgname" changelog 0 file; then
|
||||||
changelog_list+=("$file")
|
changelog_list+=("$file")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -32,11 +32,15 @@ lint_pkgbuild_functions+=('lint_install')
|
||||||
|
|
||||||
|
|
||||||
lint_install() {
|
lint_install() {
|
||||||
local list file name install_list ret=0
|
local list file install_list ret=0
|
||||||
|
|
||||||
install_list=("${install[@]}")
|
install_list=("${install[@]}")
|
||||||
for name in "${pkgname[@]}"; do
|
# set pkgname the same way we do for running package(), this way we get
|
||||||
extract_function_variable "package_$name" install 0 file
|
# the right value in extract_function_variable
|
||||||
|
local pkgname_backup=(${pkgname[@]})
|
||||||
|
local pkgname
|
||||||
|
for pkgname in "${pkgname_backup[@]}"; do
|
||||||
|
extract_function_variable "package_$pkgname" install 0 file
|
||||||
install_list+=("$file")
|
install_list+=("$file")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
@ -782,13 +782,16 @@ create_srcpackage() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
local i
|
# set pkgname the same way we do for running package(), this way we get
|
||||||
|
# the right value in extract_function_variable
|
||||||
|
local pkgname_backup=(${pkgname[@]})
|
||||||
|
local i pkgname
|
||||||
for i in 'changelog' 'install'; do
|
for i in 'changelog' 'install'; do
|
||||||
local file files
|
local file files
|
||||||
|
|
||||||
[[ ${!i} ]] && files+=("${!i}")
|
[[ ${!i} ]] && files+=("${!i}")
|
||||||
for name in "${pkgname[@]}"; do
|
for pkgname in "${pkgname_backup[@]}"; do
|
||||||
if extract_function_variable "package_$name" "$i" 0 file; then
|
if extract_function_variable "package_$pkgname" "$i" 0 file; then
|
||||||
files+=("$file")
|
files+=("$file")
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
@ -800,6 +803,7 @@ create_srcpackage() {
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
pkgname=(${pkgname_backup[@]})
|
||||||
|
|
||||||
local fullver=$(get_full_version)
|
local fullver=$(get_full_version)
|
||||||
local pkg_file="$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
|
local pkg_file="$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue