diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2010-08-08 03:44:17 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2010-08-08 03:44:17 +0200 |
commit | c117d9048ae591401a79037222da7bf7bda85705 (patch) | |
tree | c2d5dea1bebe6382f746f601845dc35ec9191545 | |
parent | 918eaba387411a2f447f1669f255bcd2fb681e94 (diff) | |
download | dbscripts-c117d9048ae591401a79037222da7bf7bda85705.tar.gz dbscripts-c117d9048ae591401a79037222da7bf7bda85705.tar.xz |
Reduce verbosity
Only inform of errors and processes that might take longer.
-rwxr-xr-x | db-move | 15 | ||||
-rwxr-xr-x | db-remove | 21 | ||||
-rwxr-xr-x | db-update | 23 | ||||
-rw-r--r-- | test/lib/common.inc | 4 | ||||
-rwxr-xr-x | test/runTest | 14 |
5 files changed, 32 insertions, 45 deletions
@@ -55,22 +55,21 @@ repo_lock $repofrom $_arch || exit 1 /bin/mkdir -p "$WORKDIR" cd "$WORKDIR" -/usr/bin/svn checkout -N $SVNREPO checkout +/usr/bin/svn checkout -q -N $SVNREPO checkout >/dev/null cd checkout /usr/bin/svn up -q $packagebase if [ -d "$packagebase/repos/$svnrepo_from" ]; then . "$packagebase/repos/$svnrepo_from/$BUILDSCRIPT" + echo -n "Moving $packagebase from $repofrom to $repoto..." if [ -d "$packagebase/repos/$svnrepo_to" ]; then - echo " Removing existing package from subversion" /usr/bin/svn rm --force -q "$packagebase/repos/$svnrepo_to" /usr/bin/svn commit -q -m "$(basename $0): $packagebase removed by $(id -un) for move to $repoto" fi - echo " Moving svn entries" - /usr/bin/svn mv -r HEAD "$packagebase/repos/$svnrepo_from" "$packagebase/repos/$svnrepo_to" - /usr/bin/svn commit -m "$(basename $0): moved $packagebase from [$repofrom] to [$repoto] ($_arch)" + /usr/bin/svn mv -q -r HEAD "$packagebase/repos/$svnrepo_from" "$packagebase/repos/$svnrepo_to" + /usr/bin/svn commit -q -m "$(basename $0): moved $packagebase from [$repofrom] to [$repoto] ($_arch)" _pkgfiles='' for i in ${pkgname[@]}; do @@ -90,9 +89,11 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then done for _tarch in ${_tarches[@]}; do - /usr/bin/repo-add -q "$ftppath_to/${_tarch}/$repoto$DBEXT" ${_pkgfiles} || die "Error in repo-add $_pkgfiles" - /usr/bin/repo-remove -q "$ftppath_from/${_tarch}/$repofrom$DBEXT" ${pkgname[@]} || die "Error in repo-remove ${pkgname[@]}" + /usr/bin/repo-add -q "$ftppath_to/${_tarch}/$repoto$DBEXT" ${_pkgfiles} >/dev/null || die "Error in repo-add $_pkgfiles" + /usr/bin/repo-remove -q "$ftppath_from/${_tarch}/$repofrom$DBEXT" ${pkgname[@]} >/dev/null || die "Error in repo-remove ${pkgname[@]}" done + + echo 'done' else die "Error: $packagebase is not in repo $repofrom" fi @@ -42,26 +42,21 @@ trap cleanup 0 repo_lock $reponame $_arch || exit 1 +echo -n "Removing $packagebase from $reponame..." /bin/mkdir -p "$WORKDIR" - - -echo "==> Removing package '$packagebase' from '$reponame'..." >&2 - cd "$WORKDIR" -/usr/bin/svn checkout -N $SVNREPO checkout +/usr/bin/svn checkout -q -N $SVNREPO checkout >/dev/null cd checkout /usr/bin/svn up -q $packagebase if [ -d "$packagebase/repos/$svnrepo" ]; then - echo " Removing from subversion" . "$packagebase/repos/$svnrepo/$BUILDSCRIPT" /usr/bin/svn rm --force -q "$packagebase/repos/$svnrepo" /usr/bin/svn commit -q -m "$(basename $0): $packagebase removed by $(id -un)" else echo " Warning: $packagebase not found in $svnrepo" - echo " Removing split packages is not supported" - echo " You need to specify each sub package instead" - pkgname=$packagebase + echo " Removing split packages is not yet supported" + exit 1 fi cd "$WORKDIR" @@ -82,14 +77,16 @@ for architecture in $arches; do exit 0 fi - echo " Removing from $reponame DB file ($architecture)" cd build/ - /usr/bin/repo-remove -q "$reponame$DBEXT" ${pkgname[@]} + /usr/bin/repo-remove -q "$reponame$DBEXT" ${pkgname[@]} >/dev/null /bin/mv "$reponame$DBEXT" "$ftppath/$architecture" - echo "Package files will be cleaned up automatically" cd .. done + +echo 'done' + cleanup + # vim: set ts=4 sw=4 noet ft=sh: @@ -74,6 +74,8 @@ die() { trap ctrl_c 2 trap cleanup 0 +echo -n "Updating $reponame..." + # Remove any package from $stagedir that is already in the FTP repository for current_arch in ${ARCHES[@]} any; do ftppath="$FTP_BASE/$reponame/os/$current_arch" @@ -97,9 +99,8 @@ cd "$WORKDIR" if [ -n "$ANYPKGS" ]; then pkgtotal=$(echo "$ANYPKGS" | wc -w) - echo "==> Processing $pkgtotal new/updated arch-independent packages for '$reponame'..." >&2 - /usr/bin/svn checkout -N $SVNREPO checkout + /usr/bin/svn checkout -q -N $SVNREPO checkout >/dev/null cd checkout to_add_any="" for pkg in $ANYPKGS; do @@ -107,11 +108,9 @@ if [ -n "$ANYPKGS" ]; then _pkgname="$(getpkgname $pkg)" _pkgbase="$(getpkgbase $pkg)" svnrepo="$reponame-any" - echo " Validating package arch (any) $_pkgname" if ! check_pkg_arch "$pkg" "any"; then echo " ERROR: $_pkgfile is not architecture independent!" else - echo " Checking SVN for $_pkgbase" /usr/bin/svn up -q $_pkgbase if [ -d "$_pkgbase/repos/$svnrepo" ]; then . "$_pkgbase/repos/$svnrepo/$BUILDSCRIPT" @@ -156,8 +155,6 @@ for current_arch in ${ARCHES[@]}; do /bin/cp "$ftppath/$reponame$DBEXT" build/$reponame-$current_arch$DBEXT fi - echo "Updating DB for $svnrepo" - to_add="" if [ -d "$stagedir" ]; then ADDPKGS="$(getpkgfiles $stagedir/*-${current_arch}$PKGEXT 2>/dev/null)" @@ -165,17 +162,14 @@ for current_arch in ${ARCHES[@]}; do if [ -n "$ADDPKGS" -o -n "$ANYPKGS" ]; then - echo "==> Copying DB file from '$reponame'..." >&2 - if [ -f "$ftppath/$reponame$DBEXT" ]; then /bin/cp "$ftppath/$reponame$DBEXT" build/$reponame-$current_arch$DBEXT fi pkgtotal=$(echo "$ADDPKGS $ANYPKGS" | wc -w) - echo "==> Processing $pkgtotal new/updated packages for repository '$reponame'..." >&2 cd "$WORKDIR" - /usr/bin/svn checkout -N $SVNREPO checkout + /usr/bin/svn checkout -N $SVNREPO checkout >/dev/null cd checkout if [ -n "$ADDPKGS" ]; then @@ -184,11 +178,9 @@ for current_arch in ${ARCHES[@]}; do _pkgname="$(getpkgname $pkg)" _pkgbase="$(getpkgbase $pkg)" - echo " Validating package arch ($current_arch) $_pkgname" if ! check_pkg_arch "$pkg" "$current_arch"; then echo " ERROR: $_pkgfile was built for the wrong architecture" else - echo " Checking SVN for $_pkgbase" /usr/bin/svn up -q $_pkgbase if [ -d "$_pkgbase/repos/$svnrepo" ]; then . "$_pkgbase/repos/$svnrepo/$BUILDSCRIPT" @@ -211,7 +203,7 @@ 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-$current_arch$DBEXT" $pkgs + /usr/bin/repo-add -q "$reponame-$current_arch$DBEXT" $pkgs >/dev/null else rm -f "build/$reponame-$current_arch$DBEXT" echo "Errors found when adding packages" @@ -223,7 +215,6 @@ for current_arch in ${ARCHES[@]}; do # if non empty, move all build dirs if [ $(/bin/ls "$WORKDIR/build/" 2>/dev/null | wc -l) != 0 ]; then if [ $(getpkgfiles "$WORKDIR/build/"*-$current_arch$PKGEXT 2>/dev/null | wc -l) != 0 ]; then - echo "Copying new files to '$poolpath' and symlinking" for f in "$WORKDIR/build/"*-$current_arch$PKGEXT; do /bin/chmod 664 "$f" &>/dev/null if ! /bin/cp "$f" "$poolpath/"; then @@ -236,7 +227,6 @@ for current_arch in ${ARCHES[@]}; do done fi if [ $(getpkgfiles "$WORKDIR/build/"*-any$PKGEXT 2>/dev/null | wc -l) != 0 ]; then - echo "Copying new files to '$poolpath_any' and symlinking" for f in "$WORKDIR/build/"*-any$PKGEXT; do /bin/chmod 664 "$f" &>/dev/null fname="$(basename $f)" @@ -257,7 +247,6 @@ for current_arch in ${ARCHES[@]}; do fi if [ -n "$to_add" ]; then - echo "Cleaning staging dir" /bin/rm $to_add fi @@ -268,6 +257,8 @@ if [ -n "$to_add_any" ]; then /bin/rm $to_add_any fi +echo 'done' + trap '' 0 2 rm -rf $WORKDIR # vim: set ts=4 sw=4 noet ft=sh: diff --git a/test/lib/common.inc b/test/lib/common.inc index dd3022e..2d2b612 100644 --- a/test/lib/common.inc +++ b/test/lib/common.inc @@ -60,10 +60,8 @@ eot } tearDown() { - echo -n 'Cleaning up...' rm -rf "${TMP}" rm -f "${curdir}/../config.local" - echo 'done' echo } @@ -73,7 +71,7 @@ releasePackage() { local arch=$3 pushd "${TMP}/svn-packages-copy"/${pkgbase}/trunk/ >/dev/null - archrelease ${repo}-${arch} >/dev/null + archrelease ${repo}-${arch} >/dev/null 2&>1 popd >/dev/null cp "${pkgdir}/${pkgbase}"/*.pkg.tar.* "${STAGING}"/${repo}/ } diff --git a/test/runTest b/test/runTest index d453493..b24b7ea 100755 --- a/test/runTest +++ b/test/runTest @@ -235,7 +235,7 @@ testCleanupSimplePackages() { ../db-remove pkg-simple-a extra ${arch} done - ../cron-jobs/ftpdir-cleanup + ../cron-jobs/ftpdir-cleanup >/dev/null for arch in ${arches[@]}; do local pkg1="pkg-simple-a-1-1-${arch}.pkg.tar.xz" @@ -258,7 +258,7 @@ testCleanupAnyPackages() { ../db-update extra ../db-remove pkg-any-a extra any - ../cron-jobs/ftpdir-cleanup + ../cron-jobs/ftpdir-cleanup >/dev/null local pkg1='pkg-any-a-1-1-any.pkg.tar.xz' [ -f "${FTP_BASE}/packages/arch/${arch}/${pkg1}" ] && fail "packages/arch/${arch}/${pkg1} found" @@ -289,7 +289,7 @@ testCleanupSplitPackages() { done done - ../cron-jobs/ftpdir-cleanup + ../cron-jobs/ftpdir-cleanup >/dev/null for arch in ${arches[@]}; do for pkg in "${pkgdir}/${pkgs[0]}"/*-${arch}.pkg.tar.*; do @@ -333,7 +333,7 @@ testMovePackagesWithoutPool() { done done - ../cron-jobs/ftpdir-cleanup + ../cron-jobs/ftpdir-cleanup >/dev/null for pkgbase in ${pkgs[@]}; do for arch in ${arches[@]}; do @@ -341,7 +341,7 @@ testMovePackagesWithoutPool() { done done - ../cron-jobs/ftpdir-cleanup + ../cron-jobs/ftpdir-cleanup >/dev/null for pkgbase in ${pkgs[@]}; do for arch in ${arches[@]}; do @@ -374,13 +374,13 @@ testMoveAnyPackagesWithoutPool() { done done - ../cron-jobs/ftpdir-cleanup + ../cron-jobs/ftpdir-cleanup >/dev/null for pkgbase in ${pkgs[@]}; do ../db-move ${pkgbase} testing extra any done - ../cron-jobs/ftpdir-cleanup + ../cron-jobs/ftpdir-cleanup >/dev/null for pkgbase in ${pkgs[@]}; do for pkg in "${pkgdir}/${pkgbase}"/*-any.pkg.tar.*; do |