From 277c01e56e42977c01a1fe709cfe2130bf177ac2 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Fri, 13 Feb 2009 12:09:46 -0800 Subject: Correct the sourceball removal step Only remove sourceballs that do NOT exist in any repo This code is experimental Signed-off-by: Aaron Griffin --- misc-scripts/make-sourceball | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) (limited to 'misc-scripts/make-sourceball') 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 -- cgit v1.2.3-54-g00ecf