FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 03-09-2012, 10:26 AM
Allan McRae
 
Default 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>
---
scripts/makepkg.sh.in | 51 ++++++++++++++++++++++++++++++++-----------------
1 file changed, 33 insertions(+), 18 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f21c638..8abd69c 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -168,7 +168,7 @@ clean_up() {

# clean up dangling symlinks to packages
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
rm -f "$file"
fi
@@ -261,6 +261,28 @@ get_full_version() {
}

##
+# usage : get_pkg_arch( [$pkgname] )
+# return : architecture of the package
+##
+get_pkg_arch() {
+ if [[ -z $1 ]]; then
+ if [[ $arch = "any" ]]; then
+ printf "%s
" "any"
+ else
+ printf "%s
" "$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
" "any"
+ else
+ printf "%s
" "$CARCH"
+ fi
+ fi
+}
+
+##
# Checks to see if options are present in makepkg.conf or PKGBUILD;
# PKGBUILD options always take precedence.
#
@@ -1180,7 +1202,7 @@ write_pkginfo() {
printf "builddate = %s
" "$builddate"
printf "packager = %s
" "$packager"
printf "size = %s
" "$size"
- printf "arch = %s
" "$PKGARCH"
+ printf "arch = %s
" "$pkgarch"

[[ $license ]] && printf "license = %s
" "${license[@]}"
[[ $replaces ]] && printf "replaces = %s
" "${replaces[@]}"
@@ -1266,11 +1288,7 @@ create_package() {
nameofpkg="$1"
fi

- if [[ $arch = "any" ]]; then
- PKGARCH="any"
- else
- PKGARCH=$CARCH
- fi
+ pkgarch=$(get_pkg_arch)

write_pkginfo $nameofpkg > .PKGINFO

@@ -1292,7 +1310,7 @@ create_package() {
msg2 "$(gettext "Compressing package...")"

local fullver=$(get_full_version)
- local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${PKGARCH}${PKGEXT}"
+ local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${pkgarch}${PKGEXT}"
local ret=0

[[ -f $pkg_file ]] && rm -f "$pkg_file"
@@ -1446,12 +1464,9 @@ install_package() {

local fullver pkg pkglist
for pkg in ${pkgname[@]}; do
- fullver=$(get_full_version $pkg)
- if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT} ]]; then
- pkglist+=" $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT}"
- else
- pkglist+=" $PKGDEST/${pkg}-${fullver}-any${PKGEXT}"
- fi
+ local fullver=$(get_full_version $pkg)
+ local pkgarch=$(get_pkg_arch $pkg)
+ pkglist+=" $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT}"
done

if ! run_pacman -U $pkglist; then
@@ -2239,8 +2254,8 @@ fi

if (( ! SPLITPKG )); then
fullver=$(get_full_version)
- if [[ -f $PKGDEST/${pkgname}-${fullver}-${CARCH}${PKGEXT}
- || -f $PKGDEST/${pkgname}-${fullver}-any${PKGEXT} ]]
+ pkgarch=$(get_pkg_arch)
+ if [[ -f $PKGDEST/${pkgname}-${fullver}-${pkgarch}${PKGEXT} ]]
&& ! (( FORCE || SOURCEONLY || NOBUILD )); then
if (( INSTALL )); then
warning "$(gettext "A package has already been built, installing existing package...")"
@@ -2256,8 +2271,8 @@ else
somepkgbuilt=0
for pkg in ${pkgname[@]}; do
fullver=$(get_full_version $pkg)
- if [[ -f $PKGDEST/${pkg}-${fullver}-${CARCH}${PKGEXT}
- || -f $PKGDEST/${pkg}-${fullver}-any${PKGEXT} ]]; then
+ pkgarch=$(get_pkg_arch $pkg)
+ if [[ -f $PKGDEST/${pkg}-${fullver}-${pkgarch}${PKGEXT} ]]; then
somepkgbuilt=1
else
allpkgbuilt=0
--
1.7.9.3
 

Thread Tools




All times are GMT. The time now is 10:10 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org