diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2009-02-13 12:09:46 -0800 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2009-02-13 12:09:46 -0800 |
commit | 277c01e56e42977c01a1fe709cfe2130bf177ac2 (patch) | |
tree | 7412093be67e7e91553cd33f8bdc37029bb32b83 | |
parent | 767257f9802709ef7c5f516b29bb1f498bdcea78 (diff) |
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>
-rw-r--r-- | db-functions | 11 | ||||
-rwxr-xr-x | misc-scripts/make-sourceball | 38 |
2 files changed, 43 insertions, 6 deletions
diff --git a/db-functions b/db-functions index a2e2f72..c105dab 100644 --- a/db-functions +++ b/db-functions @@ -66,6 +66,17 @@ getpkgname() { echo ${tmp%-*-*} } +# Get the pkgver-pkgrel of this package +getpkgver() { + local tmp + + tmp=${1##*/} + tmp=${tmp%$PKGEXT} + tmp=${tmp%$SRCEXT} + tmp=${tmp%-$CARCH} + echo $tmp | sed 's|.*-\(.*-.*\)$|\1|g' +} + check_pkg_arch () { #check_pkg_arch pkgfile arch local arch _arch="$(/usr/bin/bsdtar -xOf "$1" .PKGINFO | /bin/grep "^arch" | /bin/sed 's|\w*\s*=\s*\(.*\)|\1|')" 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 |