From b82a2ec63574c5fe0a0dd49b242d8c365155b828 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Mon, 17 Aug 2009 15:12:33 -0700 Subject: Replace DB_COMPRESSION with DBEXT in the config DBEXT contains the full extension for the db files (.db.tar.gz) and is recorded in the config file Signed-off-by: Aaron Griffin --- config | 1 + db-move | 17 ++++++++--------- db-remove | 9 ++++----- db-update | 13 ++++++------- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/config b/config index a8748c7..873c2f3 100644 --- a/config +++ b/config @@ -11,3 +11,4 @@ TMPDIR="/srv/tmp" ARCHES=(i686 x86_64) # To be used if $BUILDSCRIPT is removed from makepkg.conf #BUILDSCRIPT="PKGBUILD" +DBEXT=".db.tar.gz" diff --git a/db-move b/db-move index 1b07091..e1a50bd 100755 --- a/db-move +++ b/db-move @@ -13,7 +13,6 @@ packagebase="$1" repofrom="$2" repoto="$3" _arch="$4" -DB_COMPRESSION='gz' export CARCH="$_arch" @@ -91,25 +90,25 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then for architecture in $arches; do # copy the db file into our working area - if [ -f "$ftppath_from/$architecture/$repofrom.db.tar.$DB_COMPRESSION" ]; then - /bin/cp "$ftppath_from/$architecture/$repofrom.db.tar.$DB_COMPRESSION" . - /usr/bin/repo-remove -q "$repofrom.db.tar.$DB_COMPRESSION" ${pkgname[@]} || die "Error in repo-remove" + if [ -f "$ftppath_from/$architecture/$repofrom$DBEXT" ]; then + /bin/cp "$ftppath_from/$architecture/$repofrom$DBEXT" . + /usr/bin/repo-remove -q "$repofrom$DBEXT" ${pkgname[@]} || die "Error in repo-remove" #use '*' to move the old DB too - mv $repofrom.db.tar.$DB_COMPRESSION* "$ftppath_from/$architecture" + mv $repofrom$DBEXT"$ftppath_from/$architecture" echo " Package files will be cleaned up automatically" fi - if [ -f "$ftppath_to/$architecture/$repoto.db.tar.$DB_COMPRESSION" ]; then - /bin/cp "$ftppath_to/$architecture/$repoto.db.tar.$DB_COMPRESSION" . + if [ -f "$ftppath_to/$architecture/$repoto$DBEXT" ]; then + /bin/cp "$ftppath_to/$architecture/$repoto$DBEXT" . fi for i in ${pkgname[@]}; do _pkgfile="$i-$pkgver-$pkgrel-$_arch$PKGEXT" /bin/cp "$ftppath_from/$architecture/$_pkgfile" . - /usr/bin/repo-add -q "$repoto.db.tar.$DB_COMPRESSION" $_pkgfile || die "Error in repo-add $_pkgfile" + /usr/bin/repo-add -q "$repoto$DBEXT" $_pkgfile || die "Error in repo-add $_pkgfile" done #use '*' to move the old DB too - mv $repoto.db.tar.$DB_COMPRESSION* $ftppath_to/$architecture + mv $repoto$DBEXT* $ftppath_to/$architecture for i in ${pkgname[@]}; do _pkgfile="$i-$pkgver-$pkgrel-$_arch$PKGEXT" if [ "${_arch}" == "any" ]; then diff --git a/db-remove b/db-remove index b246a8f..b4151c7 100755 --- a/db-remove +++ b/db-remove @@ -12,7 +12,6 @@ source_makepkg packagebase="$1" reponame="$2" arch="$3" -DB_COMPRESSION='gz' export CARCH="$arch" @@ -79,8 +78,8 @@ fi # copy the db file into our working area for architecture in $arches; do - if [ -f "$ftppath/$architecture/$reponame.db.tar.$DB_COMPRESSION" ]; then - /bin/cp "$ftppath/$architecture/$reponame.db.tar.$DB_COMPRESSION" build/ + if [ -f "$ftppath/$architecture/$reponame$DBEXT" ]; then + /bin/cp "$ftppath/$architecture/$reponame$DBEXT" build/ else echo "No database found at '$ftppath/$architecture', nothing more to do" exit 0 @@ -88,9 +87,9 @@ for architecture in $arches; do echo " Removing from $reponame DB file ($architecture)" cd build/ - /usr/bin/repo-remove -q "$reponame.db.tar.$DB_COMPRESSION" ${pkgname[@]} + /usr/bin/repo-remove -q "$reponame$DBEXT" ${pkgname[@]} - /bin/mv "$reponame.db.tar.$DB_COMPRESSION" "$ftppath/$architecture" + /bin/mv "$reponame$DBEXT" "$ftppath/$architecture" echo "Package files will be cleaned up automatically" cd .. diff --git a/db-update b/db-update index 8e7a0c7..05236fe 100755 --- a/db-update +++ b/db-update @@ -11,7 +11,6 @@ source_makepkg reponame="$1" current_arch="" -DB_COMPRESSION='gz' [ "$UID" = "" ] && UID=$(uid) @@ -125,8 +124,8 @@ for current_arch in ${ARCHES[@]}; do cd "$WORKDIR" # copy the db file into our working area - if [ -f "$ftppath/$reponame.db.tar.$DB_COMPRESSION" ]; then - /bin/cp "$ftppath/$reponame.db.tar.$DB_COMPRESSION" build/ + if [ -f "$ftppath/$reponame$DBEXT" ]; then + /bin/cp "$ftppath/$reponame$DBEXT" build/ fi echo "Updating DB for $svnrepo" @@ -139,8 +138,8 @@ for current_arch in ${ARCHES[@]}; do if [ -n "$ADDPKGS" -o -n "$ANYPKGS" ]; then echo "==> Copying DB file from '$reponame'..." >&2 - if [ -f "$ftppath/$reponame.db.tar.$DB_COMPRESSION" ]; then - /bin/cp "$ftppath/$reponame.db.tar.$DB_COMPRESSION" build/ + if [ -f "$ftppath/$reponame$DBEXT" ]; then + /bin/cp "$ftppath/$reponame$DBEXT" build/ fi pkgtotal=$(echo "$ADDPKGS $ANYPKGS" | wc -w) @@ -183,9 +182,9 @@ for current_arch in ${ARCHES[@]}; do pkgs="" for pkg in $to_add $to_add_any; do pkgs="$pkgs $(basename $pkg)"; done - /usr/bin/repo-add -q "$reponame.db.tar.$DB_COMPRESSION" $pkgs + /usr/bin/repo-add -q "$reponame$DBEXT" $pkgs else - rm -f "build/$reponame.db.tar.$DB_COMPRESSION" + rm -f "build/$reponame$DBEXT" echo "Errors found when adding packages" fi else -- cgit v1.2.3