summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2009-01-16 22:22:04 +1000
committerAllan McRae <allan@archlinux.org>2009-01-16 22:22:04 +1000
commit9804911c5fbe7363d22f2384953bbcc3e57c1959 (patch)
tree3cf2721a79edb697644b1a24c129f9c8df53a229 /scripts
parent08034ceb1767f4bcbb7b440bcbfed1bc76881d16 (diff)
downloadpacman-9804911c5fbe7363d22f2384953bbcc3e57c1959.tar.xz
makepkg: add functions for backup and restore of package fields
Adds functions for the backup and restoration of package variables that can be over-ridden during package splitting. Variables which can be overridden are given in the splitpkg_overrides variable. Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in23
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index b21c2af8..4d33a9c0 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -42,9 +42,12 @@ BUILDSCRIPT='@BUILDSCRIPT@'
startdir="$PWD"
srcdir="$startdir/src"
pkgdir="$startdir/pkg"
+
packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge')
other_options=('ccache' 'distcc' 'makeflags' 'force')
-readonly -a packaging_options other_options
+splitpkg_overrides=('pkgdesc' 'license' 'groups' 'depends' 'optdepends' 'provides' \
+ 'conflicts' 'replaces' 'backup' 'options' 'install')
+readonly -a packaging_options other_options splitpkg_overrides
# Options
ASROOT=0
@@ -1179,6 +1182,24 @@ devel_update() {
fi
}
+backup_package_variables() {
+ for var in ${splitpkg_overrides[@]}; do
+ indirect="${var}_backup"
+ eval "${indirect}=\"${!var}\""
+ done
+}
+
+restore_package_variables() {
+ for var in ${splitpkg_overrides[@]}; do
+ indirect="${var}_backup"
+ if [ -n "${!indirect}" ]; then
+ eval "${var}=\"${!indirect}\""
+ else
+ unset ${var}
+ fi
+ done
+}
+
# getopt like parser
parse_options() {
local short_options=$1; shift;