diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2020-01-16 18:27:34 +0100 |
---|---|---|
committer | Andrew Gregory <andrew@archlinux.org> | 2020-06-18 10:43:04 +0200 |
commit | 0bf4779cda35cfb8dc049ec5f27017c65c8ce716 (patch) | |
tree | a00cb3213239467e770fc9354870951daaba66fc /scripts/libmakepkg | |
parent | d61c398b2cb3ec41e62a6e258b5791d0ce9de720 (diff) | |
download | pacman-0bf4779cda35cfb8dc049ec5f27017c65c8ce716.tar.gz pacman-0bf4779cda35cfb8dc049ec5f27017c65c8ce716.tar.xz |
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 d626a17ef94d79975ff17d04250152ea46aaade3)
Diffstat (limited to 'scripts/libmakepkg')
-rw-r--r-- | scripts/libmakepkg/lint_pkgbuild/changelog.sh.in | 10 | ||||
-rw-r--r-- | scripts/libmakepkg/lint_pkgbuild/install.sh.in | 10 |
2 files changed, 14 insertions, 6 deletions
diff --git a/scripts/libmakepkg/lint_pkgbuild/changelog.sh.in b/scripts/libmakepkg/lint_pkgbuild/changelog.sh.in index 114298f9..be6501ef 100644 --- a/scripts/libmakepkg/lint_pkgbuild/changelog.sh.in +++ b/scripts/libmakepkg/lint_pkgbuild/changelog.sh.in @@ -32,11 +32,15 @@ lint_pkgbuild_functions+=('lint_changelog') lint_changelog() { - local name file changelog_list + local file changelog_list changelog_list=("${changelog[@]}") - for name in "${pkgname[@]}"; do - if extract_function_variable "package_$name" changelog 0 file; then + # 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 pkgname + for pkgname in "${pkgname_backup[@]}"; do + if extract_function_variable "package_$pkgname" changelog 0 file; then changelog_list+=("$file") fi done diff --git a/scripts/libmakepkg/lint_pkgbuild/install.sh.in b/scripts/libmakepkg/lint_pkgbuild/install.sh.in index 95076692..1bf5681d 100644 --- a/scripts/libmakepkg/lint_pkgbuild/install.sh.in +++ b/scripts/libmakepkg/lint_pkgbuild/install.sh.in @@ -32,11 +32,15 @@ lint_pkgbuild_functions+=('lint_install') lint_install() { - local list file name install_list ret=0 + local list file install_list ret=0 install_list=("${install[@]}") - for name in "${pkgname[@]}"; do - extract_function_variable "package_$name" install 0 file + # 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 pkgname + for pkgname in "${pkgname_backup[@]}"; do + extract_function_variable "package_$pkgname" install 0 file install_list+=("$file") done |