Subject: [alpine-devel] [PATCH] main/freeswitch: add snapshot to APKBUILD

From: Cameron Banta <[email-masked]>
Date: Mon, 12 Mar 2012 15:50:12 +0000

---
 main/freeswitch/APKBUILD |   28 ++++++++++++++++++++++------
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/main/freeswitch/APKBUILD b/main/freeswitch/APKBUILD
index bf39232..2d426c7 100644
--- a/main/freeswitch/APKBUILD
+++ b/main/freeswitch/APKBUILD
@@ -1,11 +1,10 @@
 # Contributor: Michael Mason <[email-masked]>
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=freeswitch
-pkgver=1.0.7_p20120309
-_ver=${pkgver%_p*}
-_snapshot=${pkgver#*_p}
-_commit=ca60afaa1900abdeeb3a105de6cd53f098a3dd01
-pkgrel=1
+_snapshot=20120312
+pkgver=1.0.7_p${_snapshot}
+_commit=5e4a514531de2a1d8040c3d306a9e8de426de566
+pkgrel=0
 pkgdesc="A communications platform written in C from the ground up"
 url="http://www.freeswitch.org"
 arch="all"
@@ -27,6 +26,23 @@ source="http://git.freeswitch.org/git/freeswitch/snapshot/$pkgname-$_commit.tar.
 	freeswitch.initd
 	"
 
+snapshot() {
+	current_head=$(curl http://git.freeswitch.org/git/freeswitch/patch/ | head -n1 | cut -d" " -f2)
+	current_snapshot=$(grep -e "^_snapshot=.*$" APKBUILD | cut -d"=" -f2)
+	new_snapshot=$(date +"%Y%m%d")
+	if [ "$current_snapshot" = "$new_snapshot" ]; then
+		old_pkgrel=$(grep -e "^pkgrel=.*$" APKBUILD | cut -d"=" -f2)
+		new_pkgrel=$(expr $old_pkgrel + 1 )
+	else
+		new_pkgrel=0
+	fi
+	sed -i "s/^_commit=.*$/_commit=$current_head/" APKBUILD
+	sed -i "s/^pkgrel=.*$/pkgrel=$new_pkgrel/" APKBUILD
+	sed -i "s/^_snapshot=.*$/_snapshot=$new_snapshot/" APKBUILD
+	abuild fetch
+	abuild checksum
+}
+
 _builddir="$srcdir/$pkgname-$_commit"
 
 prepare() {
@@ -153,7 +169,7 @@ conf() {
 	mkdir -p "$pkgdir"/etc/freeswitch/scripts
 }
 
-md5sums="9d539a3cbbc56cef870946506839603c  freeswitch-ca60afaa1900abdeeb3a105de6cd53f098a3dd01.tar.bz2
+md5sums="8c0609c00039513a1a81eda685845b37  freeswitch-5e4a514531de2a1d8040c3d306a9e8de426de566.tar.bz2
 11883affe0839a8e15fe680aeb11b86e  freeswitch-mod_shout-textrels.patch
 769eaa127d4dbae687dc4aa961a8cc70  0002-mod_lua-alpine-module-search-path.patch
 94516a9473e2283ab201f38cb2756741  modules.conf
-- 
1.7.9.3

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---