Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Pacman Development (http://www.linux-archive.org/archlinux-pacman-development/)
-   -   makepkg: always build when pkgver function used (http://www.linux-archive.org/archlinux-pacman-development/684136-makepkg-always-build-when-pkgver-function-used.html)

Allan McRae 07-16-2012 12:30 PM

makepkg: always build when pkgver function used
 
If a pkgver() function is specified, always build the package even
if a package with the current pkgver is found as this pkgver may
change.

The only exception is when installing with -i. If a new build is
required then, -f must be used.

Signed-off-by: Allan McRae <allan@archlinux.org>
---

I thought this was a reasonable compromise in terms of complexity
and what I would expect makepkg to do. Having makepkg download
all the sources, update pkgver, then check if a package with the same
pkgver is already built did not seem the right approach to me.

scripts/makepkg.sh.in | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index ed14577..d7d40de 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -74,6 +74,7 @@ IGNOREARCH=0
BUILDFUNC=0
CHECKFUNC=0
PKGFUNC=0
+PKGVERFUNC=0
SPLITPKG=0
PKGLIST=()
SIGNPKG='
@@ -545,7 +546,7 @@ download_sources() {
esac
done

- if declare -f pkgver >/dev/null && (( GET_VCS )); then
+ if (( PKGVERFUNC && GET_VCS )); then
update_pkgver
check_pkgver || exit 1
fi
@@ -1807,7 +1808,7 @@ check_sanity() {
ret=1
fi

- if ! declare -f pkgver >/dev/null; then
+ if (( ! PKGVERFUNC )) ; then
check_pkgver || ret=1
fi

@@ -2406,6 +2407,10 @@ if (( GENINTEG )); then
exit 0 # $E_OK
fi

+if declare -f pkgver >/dev/null; then
+ PKGVERFUNC=1
+fi
+
# check the PKGBUILD for some basic requirements
check_sanity || exit 1

@@ -2482,12 +2487,12 @@ else
warning "$(gettext "The package group has already been built, installing existing packages...")"
install_package
exit $?
- else
+ elif (( ! PKGVERFUNC )); then
error "$(gettext "The package group has already been built. (use %s to overwrite)")" "-f"
exit 1
fi
fi
- if (( somepkgbuilt )); then
+ if (( somepkgbuilt && ! PKGVERFUNC )); then
error "$(gettext "Part of the package group has already been built. (use %s to overwrite)")" "-f"
exit 1
fi
--
1.7.11.2


All times are GMT. The time now is 11:43 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.