[pacman-dev] [PATCH] makepkg: allow epoch to be overridden

Dave Reisner d at falconindy.com
Fri Jul 22 10:13:01 EDT 2011


On Sat, Jul 23, 2011 at 12:10:32AM +1000, Allan McRae wrote:
> On 22/07/11 23:55, Dave Reisner wrote:
> >On Fri, Jul 22, 2011 at 10:04:31PM +1000, Allan McRae wrote:
> >>We can override pkgver and pkgrel so it is only logical to add epoch
> >>to that list
> >>
> >>Signed-off-by: Allan McRae<allan at archlinux.org>
> >>---
> >>  scripts/makepkg.sh.in |   17 ++++++++++-------
> >>  1 files changed, 10 insertions(+), 7 deletions(-)
> >>
> >>diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> >>index 4b8f167..88afe7b 100644
> >>--- a/scripts/makepkg.sh.in
> >>+++ b/scripts/makepkg.sh.in
> >>@@ -44,9 +44,9 @@ startdir="$PWD"
> >>
> >>  packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge' 'upx')
> >>  other_options=('ccache' 'distcc' 'buildflags' 'makeflags')
> >>-splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \
> >>-                    'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \
> >>-                    'backup' 'options' 'install' 'changelog')
> >>+splitpkg_overrides=('pkgver' 'pkgrel' 'epoch' 'pkgdesc' 'arch' 'license' \
> >>+                    'groups' 'depends' 'optdepends' 'provides' 'conflicts' \
> >>+                    'replaces' 'backup' 'options' 'install' 'changelog')
> >>  readonly -a packaging_options other_options splitpkg_overrides
> >>
> >>  # Options
> >>@@ -1455,10 +1455,13 @@ check_sanity() {
> >>  		fi
> >>  	done || ret=1
> >>
> >>-	if [[ ! $epoch =~ ^[0-9]*$ ]]; then
> >>-		error "$(gettext "%s must be an integer.")" "epoch"
> >>-		ret=1
> >>-	fi
> >>+	awk -F'=' '/^[[:space:]]*epoch=/ { $1=""; print $0 }' "$BUILDFILE" |
> >>+	while read i; do
> >>+		if [[ ! $i =~ ^[0-9]*$ ]]; then
> >>+			error "$(gettext "%s must be an integer.")" "epoch"
> >>+			return 1
> >>+		fi
> >>+	done || ret=1
> >>
> >>  	if [[ $arch != 'any' ]]; then
> >>  		if ! in_array $CARCH ${arch[@]}; then
> >>--
> >>1.7.6
> >>
> >>
> >
> >I see 2 issues:
> >1) s/return/exit/ or remove the '|| ret=1'. Both are not needed. return,
> >even from inside a subshell will work as expected.
> 
> Does either of those options work?  We want only ret=1 set on
> failure and not exiting from the function so the rest of the checks
> are performed.
> 

Then you want to 'exit 1' from the subshell so that the '|| ret=1' is
triggered.

> >2) This doesn't handle comments after the epoch value.
> >
> >   awk -F'=' '/^[[:space:]]*epoch=/ { $1=""; print $0 }' "$BUILDFILE" | {
> >     read i _
> >     if [[ $i != +([[:digit:]]) ]]; then
> >       error "$(gettext "%s must be an integer.")" "epoch"
> >       return 1
> >     fi
> >   }
> >
> >
> >
> >
> 
> 


More information about the pacman-dev mailing list