diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2009-02-13 21:09:46 +0100 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2009-02-13 21:09:46 +0100 |
commit | 277c01e56e42977c01a1fe709cfe2130bf177ac2 (patch) | |
tree | 7412093be67e7e91553cd33f8bdc37029bb32b83 /misc-scripts/make-sourceball | |
parent | 767257f9802709ef7c5f516b29bb1f498bdcea78 (diff) | |
download | dbscripts-277c01e56e42977c01a1fe709cfe2130bf177ac2.tar.gz dbscripts-277c01e56e42977c01a1fe709cfe2130bf177ac2.tar.xz |
Correct the sourceball removal step
Only remove sourceballs that do NOT exist in any repo
This code is experimental
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'misc-scripts/make-sourceball')
-rwxr-xr-x | misc-scripts/make-sourceball | 38 |
1 files changed, 32 insertions, 6 deletions
diff --git a/misc-scripts/make-sourceball b/misc-scripts/make-sourceball index 72f4a1f..b882de8 100755 --- a/misc-scripts/make-sourceball +++ b/misc-scripts/make-sourceball @@ -78,16 +78,41 @@ create_srcpackage() { if [ ! -d "$srcpath" ]; then mkdir -p "$srcpath" fi - #Remove old sourceballs + cp "$pkgname/$pkg_file" "$srcpath" + + return 0 + fi +} + +remove_old() { + if [ -d "$1" ]; then + pushd "$1" >/dev/null + PKGVERS="" + for repo in *; do + cd "$repo" + . "$BUILDSCRIPT" + PKGVERS="$PKGVERS $pkgver-$pkgrel" + cd .. + done + for pkg in "$srcpath/$pkgname-"*; do pkg="$(basename $pkg)" if [ "$(getpkgname $pkg)" == "$pkgname" ]; then - rm -f "$srcpath/$pkg" + skip=0 + pver="$(getpkgver $pkg)" + for v in $PKGVERS; do + if [ "$v" = "$pver" ]; then + skip=1 + break + fi + done + if [ $skip -ne 1 ]; then + rm -f "$srcpath/$pkg" + fi fi done - cp "$pkgname/$pkg_file" "$srcpath" - return 0 + popd >/dev/null fi } @@ -99,8 +124,9 @@ set_umask /bin/mkdir -p "$logpath" cd "$WORKDIR" -if /usr/bin/svn export -q "$SVN_PATH/$packagename/repos/$reponame-$_arch" $packagename; then - create_srcpackage "$packagename" +if /usr/bin/svn export -q "$SVN_PATH/$packagename" $packagename; then + create_srcpackage "$packagename/repos/$reponame-$_arch" + remove_old "$pkgname/repos/" else die "\tPackage '$packagename' does not exist in repo '$reponame-$_arch'" fi |