Getting svn sources for use with slkbuild

From Salix OS
Revision as of 22:52, 21 September 2009 by Thenktor (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This script gets latest svn sources, creates a source tarball and updates the $pkgver variable in the SLKBUILD file. It also can retrieve a svn revision specified on command line:

#!/bin/bash
pkgname=taglib

# retrieve revision given on command line - else latest revision
svn_rev=${1:-""}
# svn url
svn_dir=${pkgname}
svn_url=svn://anonsvn.kde.org/home/kde/trunk/kdesupport/${svn_dir}

# let's rock!
svn_cmd=" co"
# if revision is set by command line, then get this revision
[ ! -z $svn_rev ] && svn_cmd="$svn_cmd -r $svn_rev"
# set pkgver to the downloaded revision
cur_rev=$(svn $svn_cmd $svn_url $svn_dir 2>svn_err.log | tail -1 |tr -c -d "[:digit:]")
pkgver="r${cur_rev}"

# create the source archive
tar czf $pkgname-$pkgver.src.tar.gz $svn_dir

# change the SLKBUILD
sed -i 's#^pkgver=.*#pkgver='$pkgver'#' SLKBUILD