summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/conf.sh.in34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/lib/conf.sh.in b/src/lib/conf.sh.in
index 3ddef0b..4f86f12 100644
--- a/src/lib/conf.sh.in
+++ b/src/lib/conf.sh.in
@@ -188,15 +188,37 @@ set_var() {
unset_PKGBUILD() {
# This routine is based primarily off of the PKGBUILD(5) man-page,
- # version 4.1.2, dated 2013-06-18.
+ # version 4.2.0, dated 2014-12-31
+
+ # This is kinda weird, but everything is more readable with
+ # this as a utility function, but I didn't want to introduce a
+ # new global function, so I just introduced it with the name
+ # of a function that we get to unset anyway. So it can't
+ # clash with anything!
+ mksource() {
+ local v
+ for v in "$@"; do
+ unset -v "$v" $(declare -p|sed -rn "s/^declare -\S+ ($v_[a-zA-Z0-9_]*)=.*/\1/p")
+ done
+ }
+
+ # This line is taken from the makepkg source
+ local known_hash_algos=('md5' 'sha1' 'sha224' 'sha256' 'sha384' 'sha512')
# From the "OPTIONS AND DIRECTIVES" section (in order of mention)
unset -v pkgname pkgver
unset -f pkgver
- unset -v pkgrel pkgdesc epoch url license install changelog source
- unset -v noextract md5sums sha{1,256,384,512}sums groups arch backup
- unset -v depends makedepends checkdepends optdepends conflicts provides
- unset -v replaces options
+ unset -v pkgrel pkgdesc epoch url license install changelog
+
+ mksource source
+ unset -v noextract
+ local sums=("${known_hash_algos[@]/%/sums}")
+ mksource "${sums[@]}"
+
+ unset -v groups arch backup
+ mksource depends makedepends checkdepends optdepends
+ mksource conflicts provides replaces
+ unset -v options
# From the "PACKAGING FUNCTIONS" section (in order of mention)
unset -f package prepare build check
@@ -206,7 +228,7 @@ unset_PKGBUILD() {
unset -v pkgbase
# These are used by the `librefetch` program
- unset -v mksource mknoextract mkmd5sums mksha{1,256,384,512}sums
+ unset -v mksource mknoextract "${sums[@]/#/mk}"
unset -v mkdepends
unset -f mksource
}