mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 00:08:50 -05:00
makepkg: deal with overriden package arch properly
This fixes a lot of checks done by makepkg (e.g. to see if a package is already built and choosing which package to install). Previously, if a package had both "i686" and "any" versions, the "i686" one always took precidence regardless of the value of "arch" in the PKGBUILD for that package. Fixes FS#27204. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
b2a2a98297
commit
d38a1c02db
@ -168,7 +168,7 @@ clean_up() {
|
|||||||
|
|
||||||
# clean up dangling symlinks to packages
|
# clean up dangling symlinks to packages
|
||||||
for pkg in ${pkgname[@]}; do
|
for pkg in ${pkgname[@]}; do
|
||||||
for file in ${pkg}-*-*-${CARCH}{${PKGEXT},${SRCEXT}}; do
|
for file in ${pkg}-*-*-*{${PKGEXT},${SRCEXT}}; do
|
||||||
if [[ -h $file && ! -e $file ]]; then
|
if [[ -h $file && ! -e $file ]]; then
|
||||||
rm -f "$file"
|
rm -f "$file"
|
||||||
fi
|
fi
|
||||||
@ -260,6 +260,28 @@ get_full_version() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##
|
||||||
|
# usage : get_pkg_arch( [$pkgname] )
|
||||||
|
# return : architecture of the package
|
||||||
|
##
|
||||||
|
get_pkg_arch() {
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
if [[ $arch = "any" ]]; then
|
||||||
|
printf "%s\n" "any"
|
||||||
|
else
|
||||||
|
printf "%s\n" "$CARCH"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
local arch_override
|
||||||
|
eval $(declare -f package_$1 | sed -n 's/\(^[[:space:]]*arch=\)/arch_override=/p')
|
||||||
|
if [[ $arch_override = "any" ]]; then
|
||||||
|
printf "%s\n" "any"
|
||||||
|
else
|
||||||
|
printf "%s\n" "$CARCH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
# Checks to see if options are present in makepkg.conf or PKGBUILD;
|
# Checks to see if options are present in makepkg.conf or PKGBUILD;
|
||||||
# PKGBUILD options always take precedence.
|
# PKGBUILD options always take precedence.
|
||||||
@ -1201,7 +1223,7 @@ write_pkginfo() {
|
|||||||
printf "builddate = %s\n" "$builddate"
|
printf "builddate = %s\n" "$builddate"
|
||||||
printf "packager = %s\n" "$packager"
|
printf "packager = %s\n" "$packager"
|
||||||
printf "size = %s\n" "$size"
|
printf "size = %s\n" "$size"
|
||||||
printf "arch = %s\n" "$PKGARCH"
|
printf "arch = %s\n" "$pkgarch"
|
||||||
|
|
||||||
[[ $license ]] && printf "license = %s\n" "${license[@]}"
|
[[ $license ]] && printf "license = %s\n" "${license[@]}"
|
||||||
[[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}"
|
[[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}"
|
||||||
@ -1287,11 +1309,7 @@ create_package() {
|
|||||||
nameofpkg="$1"
|
nameofpkg="$1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $arch = "any" ]]; then
|
pkgarch=$(get_pkg_arch)
|
||||||
PKGARCH="any"
|
|
||||||
else
|
|
||||||
PKGARCH=$CARCH
|
|
||||||
fi
|
|
||||||
|
|
||||||
write_pkginfo $nameofpkg > .PKGINFO
|
write_pkginfo $nameofpkg > .PKGINFO
|
||||||
|
|
||||||
@ -1313,7 +1331,7 @@ create_package() {
|
|||||||
msg2 "$(gettext "Compressing package...")"
|
msg2 "$(gettext "Compressing package...")"
|
||||||
|
|
||||||
local fullver=$(get_full_version)
|
local fullver=$(get_full_version)
|
||||||
local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${PKGARCH}${PKGEXT}"
|
local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${pkgarch}${PKGEXT}"
|
||||||
local ret=0
|
local ret=0
|
||||||
|
|
||||||
[[ -f $pkg_file ]] && rm -f "$pkg_file"
|
[[ -f $pkg_file ]] && rm -f "$pkg_file"
|
||||||
@ -1465,14 +1483,11 @@ install_package() {
|
|||||||
msg "$(gettext "Installing %s package group with %s...")" "$pkgbase" "$PACMAN -U"
|
msg "$(gettext "Installing %s package group with %s...")" "$pkgbase" "$PACMAN -U"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local fullver pkg pkglist
|
local fullver pkgarch pkg pkglist
|
||||||
for pkg in ${pkgname[@]}; do
|
for pkg in ${pkgname[@]}; do
|
||||||
fullver=$(get_full_version $pkg)
|
fullver=$(get_full_version $pkg)
|
||||||
if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} ]]; then
|
pkgarch=$(get_pkg_arch $pkg)
|
||||||
pkglist+=" $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT}"
|
pkglist+=" $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
|
||||||
else
|
|
||||||
pkglist+=" $PKGDEST/${pkg}-${fullver}-any${PKGEXT}"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! run_pacman -U $pkglist; then
|
if ! run_pacman -U $pkglist; then
|
||||||
@ -2261,8 +2276,8 @@ fi
|
|||||||
|
|
||||||
if (( ! SPLITPKG )); then
|
if (( ! SPLITPKG )); then
|
||||||
fullver=$(get_full_version)
|
fullver=$(get_full_version)
|
||||||
if [[ -f $PKGDEST/${pkgname}-${fullver}-${CARCH}${PKGEXT} \
|
pkgarch=$(get_pkg_arch)
|
||||||
|| -f $PKGDEST/${pkgname}-${fullver}-any${PKGEXT} ]] \
|
if [[ -f $PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT} ]] \
|
||||||
&& ! (( FORCE || SOURCEONLY || NOBUILD )); then
|
&& ! (( FORCE || SOURCEONLY || NOBUILD )); then
|
||||||
if (( INSTALL )); then
|
if (( INSTALL )); then
|
||||||
warning "$(gettext "A package has already been built, installing existing package...")"
|
warning "$(gettext "A package has already been built, installing existing package...")"
|
||||||
@ -2278,8 +2293,8 @@ else
|
|||||||
somepkgbuilt=0
|
somepkgbuilt=0
|
||||||
for pkg in ${pkgname[@]}; do
|
for pkg in ${pkgname[@]}; do
|
||||||
fullver=$(get_full_version $pkg)
|
fullver=$(get_full_version $pkg)
|
||||||
if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} \
|
pkgarch=$(get_pkg_arch $pkg)
|
||||||
|| -f $PKGDEST/${pkg}-${fullver}-any${PKGEXT} ]]; then
|
if [[ -f $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT} ]]; then
|
||||||
somepkgbuilt=1
|
somepkgbuilt=1
|
||||||
else
|
else
|
||||||
allpkgbuilt=0
|
allpkgbuilt=0
|
||||||
|
Loading…
Reference in New Issue
Block a user