1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08:50 -05:00

makepkg: disallow pkgver/pkgrel/epoch overrides in packages

This is a confusing feature, and no one uses it.
This commit is contained in:
Dave Reisner 2014-08-04 08:48:05 -04:00 committed by Allan McRae
parent b694d84554
commit 8a02abcf19

View File

@ -48,12 +48,12 @@ declare -r startdir="$PWD"
LIBRARY=${LIBRARY:-'@libmakepkgdir@'} LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
packaging_options=('strip' 'docs' 'libtool' 'staticlibs' 'emptydirs' 'zipman' \ packaging_options=('strip' 'docs' 'libtool' 'staticlibs' 'emptydirs' 'zipman'
'purge' 'upx' 'debug') 'purge' 'upx' 'debug')
other_options=('ccache' 'distcc' 'buildflags' 'makeflags') other_options=('ccache' 'distcc' 'buildflags' 'makeflags')
splitpkg_overrides=('pkgver' 'pkgrel' 'epoch' 'pkgdesc' 'arch' 'url' 'license' \ splitpkg_overrides=('pkgdesc' 'arch' 'url' 'license' 'groups' 'depends'
'groups' 'depends' 'optdepends' 'provides' 'conflicts' \ 'optdepends' 'provides' 'conflicts' 'replaces' 'backup'
'replaces' 'backup' 'options' 'install' 'changelog') 'options' 'install' 'changelog')
readonly -a packaging_options other_options splitpkg_overrides readonly -a packaging_options other_options splitpkg_overrides
known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512') known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512')
@ -842,28 +842,15 @@ missing_source_file() {
} }
## ##
# usage : get_full_version( [$pkgname] ) # usage : get_full_version()
# return : full version spec, including epoch (if necessary), pkgver, pkgrel # return : full version spec, including epoch (if necessary), pkgver, pkgrel
## ##
get_full_version() { get_full_version() {
if [[ -z $1 ]]; then if [[ $epoch ]] && (( epoch > 0 )); then
if [[ -n $epoch ]] && (( $epoch )); then
printf "%s\n" "$epoch:$pkgver-$pkgrel" printf "%s\n" "$epoch:$pkgver-$pkgrel"
else else
printf "%s\n" "$pkgver-$pkgrel" printf "%s\n" "$pkgver-$pkgrel"
fi fi
else
for i in pkgver pkgrel epoch; do
local indirect="${i}_override"
eval $(declare -f package_$1 | sed -n "s/\(^[[:space:]]*$i=\)/${i}_override=/p")
[[ -z ${!indirect} ]] && eval ${indirect}=\"${!i}\"
done
if [[ -n $epoch_override ]] && (( $epoch_override )); then
printf "%s\n" "$epoch_override:$pkgver_override-$pkgrel_override"
else
printf "%s\n" "$pkgver_override-$pkgrel_override"
fi
fi
} }
## ##
@ -2184,7 +2171,7 @@ install_package() {
(( NEEDED )) && pkglist+=('--needed') (( NEEDED )) && pkglist+=('--needed')
for pkg in ${pkgname[@]}; do for pkg in ${pkgname[@]}; do
fullver=$(get_full_version $pkg) fullver=$(get_full_version)
pkgarch=$(get_pkg_arch $pkg) pkgarch=$(get_pkg_arch $pkg)
pkglist+=("$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}") pkglist+=("$PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}")
@ -2386,20 +2373,12 @@ validate_pkgver() {
} }
check_pkgver() { check_pkgver() {
local ret=0
if [[ -z ${pkgver} ]]; then if [[ -z ${pkgver} ]]; then
error "$(gettext "%s is not allowed to be empty.")" "pkgver" error "$(gettext "%s is not allowed to be empty.")" "pkgver"
ret=1 return 1
fi fi
awk -F'=' '$1 ~ /^[[:space:]]*pkgver$/' "$BUILDFILE" | sed "s/[[:space:]]*#.*//" | validate_pkgver "$pkgver"
while IFS='=' read -r _ i; do
eval i=\"$(sed 's/^\(['\''"]\)\(.*\)\1$/\2/' <<< "${i%%+([[:space:]])}")\"
validate_pkgver "$i" || return 1
done || ret=1
return $ret
} }
get_vcsclient() { get_vcsclient() {
@ -2585,7 +2564,7 @@ check_build_status() {
allpkgbuilt=1 allpkgbuilt=1
somepkgbuilt=0 somepkgbuilt=0
for pkg in ${pkgname[@]}; do for pkg in ${pkgname[@]}; do
fullver=$(get_full_version $pkg) fullver=$(get_full_version)
pkgarch=$(get_pkg_arch $pkg) pkgarch=$(get_pkg_arch $pkg)
if [[ -f $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT} ]]; then if [[ -f $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT} ]]; then
somepkgbuilt=1 somepkgbuilt=1