Allow it to be a variable in the PKGBUILD as well as propagating it through
to the built package and the package database. We leave some backward
compatibility in place by placing the '%FORCE%' option in the database if
the package contains an epoch; this will be used by older versions of pacman
and more or less ignored by versions that use epoch.

Signed-off-by: Dan McGee <[email protected]>
---
 scripts/makepkg.sh.in  |    6 ++----
 scripts/repo-add.sh.in |    7 ++++++-
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 3a7a4d1..c4b2dfc 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -45,7 +45,7 @@ srcdir="$startdir/src"
 pkgdir="$startdir/pkg"
 
 packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge')
-other_options=('ccache' 'distcc' 'makeflags' 'force')
+other_options=('ccache' 'distcc' 'makeflags')
 splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \
                     'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \
                     'backup' 'options' 'install' 'changelog')
@@ -923,14 +923,12 @@ write_pkginfo() {
        (( SPLITPKG )) && echo pkgbase = $pkgbase
        echo "pkgver = $pkgver-$pkgrel"
        echo "pkgdesc = $pkgdesc"
+       [[ $epoch ]] && echo "epoch = $epoch"
        echo "url = $url"
        echo "builddate = $builddate"
        echo "packager = $packager"
        echo "size = $size"
        echo "arch = $PKGARCH"
-       if [[ $(check_option force) = "y" ]]; then
-               echo "force = true"
-       fi
 
        [[ $license ]]    && printf "license = %s\n"   "${licen...@]}"
        [[ $replaces ]]   && printf "replaces = %s\n"  "${replac...@]}"
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 8ef940d..626de23 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -185,7 +185,7 @@ db_write_entry()
 {
        # blank out all variables
        local pkgfile="$1"
-       local pkgname pkgver pkgdesc csize size md5sum url arch builddate 
packager force \
+       local pkgname pkgver pkgdesc epoch csize size md5sum url arch builddate 
packager force \
                _groups _licenses _replaces _depends _conflicts _provides 
_optdepends
 
        local OLDIFS="$IFS"
@@ -262,6 +262,11 @@ db_write_entry()
        [[ -n $builddate ]] && echo -e "%BUILDDATE%\n$builddate\n" >>desc
        [[ -n $packager ]] && echo -e "%PACKAGER%\n$packager\n" >>desc
        write_list_entry "REPLACES" "$_replaces" "desc"
+       # remain backward-compatible for now; put a force entry in the database
+       if [[ -n $epoch ]]; then
+               echo -e "%EPOCH%\n#epoch\n" >>desc
+               echo -e "%FORCE%\n" >>desc
+       fi
        [[ -n $force ]] && echo -e "%FORCE%\n" >>desc
 
        # create depends entry
-- 
1.7.3.1


Reply via email to