summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-13 09:47:31 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-13 09:47:31 +0200
commita422060414670bb49d2422a38467b73ae01e7ecb (patch)
treef67c7216398ea6bf0aced46828235ca07fdbcf90
parente2c005b490df6762e23da3223944151c17d1de80 (diff)
downloaddbscripts-a422060414670bb49d2422a38467b73ae01e7ecb.tar.gz
dbscripts-a422060414670bb49d2422a38467b73ae01e7ecb.tar.xz
Use common functions to print messages, warnings and errors
These functions are copied from makepkg
-rwxr-xr-xcron-jobs/create-filelists4
-rwxr-xr-xcron-jobs/ftpdir-cleanup8
-rwxr-xr-xcron-jobs/sourceballs2
-rw-r--r--db-functions70
-rwxr-xr-xdb-move10
-rwxr-xr-xdb-remove10
-rwxr-xr-xdb-update48
-rwxr-xr-xmisc-scripts/ftpdir-cleanup-repo78
-rwxr-xr-xmisc-scripts/make-sourceball14
-rw-r--r--test/lib/common.inc10
-rwxr-xr-xtesting2x6
11 files changed, 134 insertions, 126 deletions
diff --git a/cron-jobs/create-filelists b/cron-jobs/create-filelists
index 8c354fc..9249408 100755
--- a/cron-jobs/create-filelists
+++ b/cron-jobs/create-filelists
@@ -23,7 +23,7 @@ case "${DBEXT}" in
*.gz) TAR_OPT="z" ;;
*.bz2) TAR_OPT="j" ;;
*.xz) TAR_OPT="J" ;;
- *) echo "Unknown compression type for DBEXT=${DBEXT}" && exit 1 ;;
+ *) die "Unknown compression type for DBEXT=${DBEXT}" ;;
esac
FILESEXT="${DBEXT//db/files}"
@@ -42,7 +42,7 @@ for repo in ${repos[@]}; do
mkdir -p "${DBDIR}/${repodir}"
bsdtar -xf "${targetdir}/${repodir}/${REPO_DB_FILE}" -C "${DBDIR}/${repodir}"
else
- echo "Fail! Does the repo $repo with arch $arch even exist?"
+ error "Fail! Does the repo $repo with arch $arch even exist?"
continue
fi
diff --git a/cron-jobs/ftpdir-cleanup b/cron-jobs/ftpdir-cleanup
index 7668ab5..3456e9c 100755
--- a/cron-jobs/ftpdir-cleanup
+++ b/cron-jobs/ftpdir-cleanup
@@ -29,13 +29,11 @@ done
popd >/dev/null
if [ -n "$to_cleanup" ]; then
- echo " The following packages are no longer in any repo"
- echo " They will be moved to $CLEANUP_DESTDIR"
+ msg "The following packages are no longer in any repo"
for f in $to_cleanup; do
- echo " $(basename "$f")"
+ msg2 "$(basename "$f")"
done
- echo ""
- mv $to_cleanup "$CLEANUP_DESTDIR"
+ ${CLEANUP_DRYRUN} || mv $to_cleanup "$CLEANUP_DESTDIR"
fi
script_unlock
diff --git a/cron-jobs/sourceballs b/cron-jobs/sourceballs
index 78c3959..b82e375 100755
--- a/cron-jobs/sourceballs
+++ b/cron-jobs/sourceballs
@@ -22,7 +22,7 @@ for repo in ${repos[@]}; do
for arch in ${ARCHES[@]} any; do
ftppath="$ftpbase/$repo/os/$arch"
if [ ! -d "$ftppath" ]; then
- echo "FTP path does not exist: $ftppath" >2
+ error "FTP path does not exist: $ftppath"
continue
fi
cd $ftppath
diff --git a/db-functions b/db-functions
index f22567b..0c96913 100644
--- a/db-functions
+++ b/db-functions
@@ -16,11 +16,48 @@ restore_umask () {
WORKDIR=$(mktemp -d /tmp/$(basename $0).XXXXXXXXXX)
LOCKS=()
+# check if messages are to be printed using color
+unset ALL_OFF BOLD BLUE GREEN RED YELLOW
+if [[ -t 2 ]]; then
+ ALL_OFF="$(tput sgr0)"
+ BOLD="$(tput bold)"
+ BLUE="${BOLD}$(tput setaf 4)"
+ GREEN="${BOLD}$(tput setaf 2)"
+ RED="${BOLD}$(tput setaf 1)"
+ YELLOW="${BOLD}$(tput setaf 3)"
+fi
+readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
+
+plain() {
+ local mesg=$1; shift
+ printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@"
+}
+
+msg() {
+ local mesg=$1; shift
+ printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
+}
+
+msg2() {
+ local mesg=$1; shift
+ printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@"
+}
+
+warning() {
+ local mesg=$1; shift
+ printf "${YELLOW}==> WARNING:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
+error() {
+ local mesg=$1; shift
+ printf "${RED}==> ERROR${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
+}
+
script_lock() {
local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)"
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
local _owner="$(/usr/bin/stat -c %U $LOCKDIR)"
- echo "Error: Script $(basename $0) is already locked by $_owner." >&2
+ error "Script $(basename $0) is already locked by $_owner."
exit 1
else
set_umask
@@ -31,7 +68,7 @@ script_lock() {
script_unlock() {
local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)"
if [ ! -d "$LOCKDIR" ]; then
- echo "Warning: Script $(basename $0) was not locked!" >&2
+ warning "Script $(basename $0) was not locked!"
restore_umask
return 1
else
@@ -51,12 +88,12 @@ cleanup() {
repo=${l%.*}
arch=${l#*.}
if [ -d "$TMPDIR/.repolock.$repo.$arch" ]; then
- echo "Removing left over lock from $repo/$arch" >&2
+ msg "Removing left over lock from $repo/$arch"
repo_unlock $repo $arch
fi
done
if [ -d "$TMPDIR/.scriptlock.$(basename $0)" ]; then
- echo "Removing left over lock from $(basename $0)" >&2
+ msg "Removing left over lock from $(basename $0)"
script_unlock
fi
rm -rf "$WORKDIR"
@@ -64,12 +101,12 @@ cleanup() {
}
abort() {
- echo 'Aborting...' >&2
+ msg 'Aborting...'
cleanup 0
}
die() {
- echo "$*" >&2
+ error "$*"
cleanup 1
}
@@ -99,7 +136,8 @@ repo_lock () {
while [ $_count -le $_trial ] || $_lockblock ; do
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
_owner="$(/usr/bin/stat -c %U $LOCKDIR)"
- echo "Warning: Repo $1-$2 is already locked by $_owner. Retrying in $LOCK_DELAY seconds..." >&2
+ warning "Repo $1-$2 is already locked by $_owner. " \
+ "Retrying in $LOCK_DELAY seconds..."
else
LOCKS[${#LOCKS[*]}]="$1.$2"
set_umask
@@ -109,14 +147,14 @@ repo_lock () {
let _count=$_count+1
done
- echo "Error: Repo $1-$2 is already locked by $_owner. Giving up!" >&2
+ error "Repo $1-$2 is already locked by $_owner. Giving up!"
return 1
}
repo_unlock () { #repo_unlock <repo-name> <arch>
local LOCKDIR="$TMPDIR/.repolock.$1.$2"
if [ ! -d "$LOCKDIR" ]; then
- echo "Warning: Repo lock $1-$2 was not locked!" >&2
+ warning "Repo lock $1-$2 was not locked!"
restore_umask
return 1
else
@@ -153,7 +191,7 @@ getpkgname() {
_name="$(_grep_pkginfo "$1" "^pkgname")"
if [ -z "$_name" ]; then
- echo "Error: Package '$1' has no pkgname in the PKGINFO. Fail!" >&2
+ error "Package '$1' has no pkgname in the PKGINFO. Fail!"
exit 1
fi
@@ -166,7 +204,7 @@ getpkgver() {
_ver="$(_grep_pkginfo "$1" "^pkgver")"
if [ -z "$_ver" ]; then
- echo "Error: Package '$1' has no pkgver in the PKGINFO. Fail!" >&2
+ error "Package '$1' has no pkgver in the PKGINFO. Fail!"
exit 1
fi
@@ -175,10 +213,10 @@ getpkgver() {
getpkgfile() {
if [[ ${#} -ne 1 ]]; then
- echo 'Error: No canonical package found!' >&2
+ error 'No canonical package found!'
exit 1
elif [ ! -f "${1}" ]; then
- echo "Error: Package ${1} not found!" >&2
+ error "Package ${1} not found!"
exit 1
fi
@@ -188,13 +226,13 @@ getpkgfile() {
getpkgfiles() {
local f
if [ ! -z "$(echo ${@%\.*} | sed "s/ /\n/g" | sort | uniq -D)" ]; then
- echo 'Error: Duplicate packages found!'>&2
+ error 'Duplicate packages found!'
exit 1
fi
for f in ${@}; do
if [ ! -f "${f}" ]; then
- echo "Error: Package ${f} not found!" >&2
+ error "Package ${f} not found!"
exit 1
fi
done
@@ -208,7 +246,7 @@ check_pkg_arch () {
_arch="$(_grep_pkginfo "$1" "^arch")"
if [ -z "$_arch" ]; then
- echo "Error: Package '$1' has no arch in the PKGINFO. Fail!" >&2
+ error "Package '$1' has no arch in the PKGINFO. Fail!"
return 1
fi
if [ "$_arch" = "$2" ]; then
diff --git a/db-move b/db-move
index 41b360d..207baec 100755
--- a/db-move
+++ b/db-move
@@ -1,7 +1,7 @@
#!/bin/bash
if [ $# -ne 4 ]; then
- echo "usage: $(basename $0) <pkgname|pkgbase> <repo-from> <repo-to> <arch>"
+ msg "usage: $(basename $0) <pkgname|pkgbase> <repo-from> <repo-to> <arch>"
exit 1
fi
@@ -24,7 +24,7 @@ svnrepo_from="$repofrom-$arch"
svnrepo_to="$repoto-$arch"
if ! check_repo_permission $repoto || ! check_repo_permission $repofrom; then
- echo "Error: You don't have permission to move packages from ${repofrom} to ${repoto}"
+ error "You don't have permission to move packages from ${repofrom} to ${repoto}"
exit 1
fi
@@ -41,7 +41,7 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then
pkgver=$(. "$packagebase/repos/$svnrepo_from/PKGBUILD"; echo ${pkgver})
pkgrel=$(. "$packagebase/repos/$svnrepo_from/PKGBUILD"; echo ${pkgrel})
- echo -n "Moving $packagebase from $repofrom to $repoto..."
+ msg "Moving $packagebase from $repofrom to $repoto..."
if [ -d "$packagebase/repos/$svnrepo_to" ]; then
/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"
@@ -71,10 +71,8 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then
/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"
+ die "$packagebase is not in repo $repofrom"
fi
repo_unlock $repoto $arch || exit 1
diff --git a/db-remove b/db-remove
index 1492d18..2f05c16 100755
--- a/db-remove
+++ b/db-remove
@@ -1,7 +1,7 @@
#!/bin/bash
if [ $# -ne 3 ]; then
- echo "usage: $(basename $0) <pkgname|packagebase> <reponame> <arch>"
+ msg "usage: $(basename $0) <pkgname|packagebase> <reponame> <arch>"
exit 1
fi
@@ -16,13 +16,13 @@ ftppath="$FTP_BASE/$reponame/os"
svnrepo="$reponame-$arch"
if ! check_repo_permission $reponame; then
- echo "Error: You don't have permission to remove packages from ${reponam}"
+ error "You don't have permission to remove packages from ${reponam}"
exit 1
fi
repo_lock $reponame $arch || exit 1
-echo -n "Removing $packagebase from $reponame..."
+msg "Removing $packagebase from $reponame..."
cd "$WORKDIR"
/usr/bin/svn checkout -q -N $SVNREPO checkout >/dev/null
cd checkout
@@ -33,7 +33,7 @@ if [ -d "$packagebase/repos/$svnrepo" ]; then
/usr/bin/svn rm --force -q "$packagebase/repos/$svnrepo"
/usr/bin/svn commit -q -m "$(basename $0): $packagebase removed by $(id -un)"
else
- die "Error: $packagebase not found in $svnrepo"
+ die "$packagebase not found in $svnrepo"
fi
cd "$WORKDIR"
@@ -53,8 +53,6 @@ for tarch in $arches; do
/usr/bin/repo-remove -q "$ftppath/$tarch/$reponame$DBEXT" ${pkgname[@]} >/dev/null
done
-echo 'done'
-
repo_unlock $reponame $arch || exit 1
# vim: set ts=4 sw=4 noet ft=sh:
diff --git a/db-update b/db-update
index c049714..b56a70f 100755
--- a/db-update
+++ b/db-update
@@ -1,7 +1,7 @@
#!/bin/bash
if [ $# -ne 1 ]; then
- echo "usage: $(basename $0) <reponame>"
+ msg "usage: $(basename $0) <reponame>"
exit 1
fi
@@ -12,7 +12,7 @@ reponame="$1"
current_arch=""
if ! check_repo_permission "$reponame"; then
- echo "error: you shouldn't be updating $reponame on this server!"
+ error "you shouldn't be updating $reponame on this server!"
exit 1
fi
@@ -21,11 +21,11 @@ ANYPKGS=""
stagedir="$STAGING/$reponame"
if [ ! -d $stagedir ]; then
- echo "error: staging directory missing: $stagedir" >&2
+ error "staging directory missing: $stagedir"
exit 1
fi
-echo -n "Updating $reponame..."
+msg "Updating $reponame..."
# Remove any package from $stagedir that is already in the FTP repository
for current_arch in ${ARCHES[@]} any; do
@@ -33,8 +33,8 @@ for current_arch in ${ARCHES[@]} any; do
for f in $stagedir/*-$current_arch$PKGEXT; do
bf=$(basename $f)
if [[ -f $ftppath/$bf ]]; then
- echo " WARNING: Package file $bf already exists in FTP repo"
- echo " Removing from $stagedir"
+ warning " Package file $bf already exists in FTP repo" \
+ " Removing from $stagedir"
/bin/rm $f
fi
done
@@ -59,7 +59,7 @@ if [ -n "$ANYPKGS" ]; then
pkgbase="$(getpkgbase $pkg)"
svnrepo="$reponame-any"
if ! check_pkg_arch "$pkg" "any"; then
- echo " ERROR: $pkgfile is not architecture independent!"
+ error "$pkgfile is not architecture independent!"
else
/usr/bin/svn up -q $pkgbase
if [ -d "$pkgbase/repos/$svnrepo" ]; then
@@ -68,10 +68,10 @@ if [ -n "$ANYPKGS" ]; then
if echo "$pkgfile" | grep -q "$pkgname-$pkgver-$pkgrel-any"; then
to_add_any="$to_add_any $pkg"
else
- echo " WARNING: $pkgfile does not match PKGBUILD in $svnrepo"
+ warning "$pkgfile does not match PKGBUILD in $svnrepo"
fi
else
- echo " WARNING: Package $pkgbase not found in $svnrepo"
+ warning "Package $pkgbase not found in $svnrepo"
fi
fi
done
@@ -86,9 +86,9 @@ for current_arch in ${ARCHES[@]}; do
poolrel="../../../$(get_pkgpool_for_host)"
if [ ! -d "$ftppath" ]; then
- echo "FTP path for this repo ($reponame) is missing"
- echo " -> $ftppath"
- echo "Please contact a system administrator"
+ error "FTP path for this repo ($reponame) is missing" \
+ " -> $ftppath" \
+ "Please contact a system administrator"
exit 1
fi
@@ -120,7 +120,7 @@ for current_arch in ${ARCHES[@]}; do
cd "$WORKDIR"
/usr/bin/svn checkout -N $SVNREPO checkout >/dev/null
cd checkout
-
+
if [ -n "$ADDPKGS" ]; then
for pkg in $ADDPKGS; do
pkgfile=$(basename $pkg)
@@ -128,7 +128,7 @@ for current_arch in ${ARCHES[@]}; do
pkgbase="$(getpkgbase $pkg)"
if ! check_pkg_arch "$pkg" "$current_arch"; then
- echo " ERROR: $pkgfile was built for the wrong architecture"
+ error "$pkgfile was built for the wrong architecture"
else
/usr/bin/svn up -q $pkgbase
if [ -d "$pkgbase/repos/$svnrepo" ]; then
@@ -137,10 +137,10 @@ for current_arch in ${ARCHES[@]}; do
if echo "$pkgfile" | grep -q "$pkgname-$pkgver-$pkgrel-$current_arch"; then
to_add="$to_add $pkg"
else
- echo " WARNING: $pkgfile does not match PKGBUILD in $svnrepo"
+ warning "$pkgfile does not match PKGBUILD in $svnrepo"
fi
else
- echo " WARNING: Package $pkgbase not found in $svnrepo"
+ warning "Package $pkgbase not found in $svnrepo"
fi
fi
done
@@ -156,10 +156,10 @@ for current_arch in ${ARCHES[@]}; do
/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"
+ error "Errors found when adding packages"
fi
else
- echo "No packages to add"
+ warning "No packages to add"
fi
# if non empty, move all build dirs
@@ -168,11 +168,11 @@ for current_arch in ${ARCHES[@]}; do
for f in "$WORKDIR/build/"*-$current_arch$PKGEXT; do
/bin/chmod 664 "$f" &>/dev/null
if ! /bin/cp "$f" "$poolpath/"; then
- die "error: failure while copying files to $poolpath"
+ die "failure while copying files to $poolpath"
fi
fname="$(basename $f)"
if ! ln -s "$poolrel/$fname" "$ftppath/$fname"; then
- die "error: failure symlinking $fname to $ftppath"
+ die "failure symlinking $fname to $ftppath"
fi
done
fi
@@ -181,11 +181,11 @@ for current_arch in ${ARCHES[@]}; do
/bin/chmod 664 "$f" &>/dev/null
fname="$(basename $f)"
if ! /bin/cp "$f" "$poolpath/"; then
- die "error: failure while copying files to $poolpath"
+ die "failure while copying files to $poolpath"
fi
if ! ln -s "$poolrel/$fname" "$ftppath/$fname"; then
- die "error: failure symlinking $fname to $ftppath"
+ die "failure symlinking $fname to $ftppath"
fi
done
fi
@@ -194,7 +194,7 @@ for current_arch in ${ARCHES[@]}; do
fi
ln -sf "$reponame$DBEXT" "$ftppath/$reponame${DBEXT%.tar.*}"
else
- echo "Nothing to copy, no work done"
+ warning "Nothing to copy, no work done"
fi
if [ -n "$to_add" ]; then
@@ -208,6 +208,4 @@ if [ -n "$to_add_any" ]; then
/bin/rm $to_add_any
fi
-echo 'done'
-
# vim: set ts=4 sw=4 noet ft=sh:
diff --git a/misc-scripts/ftpdir-cleanup-repo b/misc-scripts/ftpdir-cleanup-repo
index 12f726c..20f297b 100755
--- a/misc-scripts/ftpdir-cleanup-repo
+++ b/misc-scripts/ftpdir-cleanup-repo
@@ -1,7 +1,7 @@
#!/bin/bash
if [ $# -ne 1 ]; then
- echo "usage: $(basename $0) <reponame>"
+ msg "usage: $(basename $0) <reponame>"
exit 1
fi
@@ -13,6 +13,7 @@ reponame=$1
. "$(dirname $0)/../config"
clean_pkgs () {
+ if ! ${CLEANUP_DRYRUN}; then
for pkg in "$@"; do
if [ -h "$pkg" ]; then
rm -f "$pkg"
@@ -20,9 +21,10 @@ clean_pkgs () {
mv "$pkg" "$CLEANUP_DESTDIR"
fi
done
+ fi
}
-${CLEANUP_DRYRUN} && echo 'dry run mode is active'
+${CLEANUP_DRYRUN} && warning 'dry run mode is active'
ftppath_base="$FTP_BASE/$reponame/os"
@@ -38,26 +40,23 @@ for arch in ${ARCHES[@]}; do
EXTRAFILES=""
if [ ! -d "$ftppath" ]; then
- echo "FTP path '$ftppath' does not exist"
+ error "FTP path '$ftppath' does not exist"
exit 1
fi
if ! cd "${CLEANUP_TMPDIR}" ; then
- echo "Failed to cd to ${CLEANUP_TMPDIR}"
+ error "Failed to cd to ${CLEANUP_TMPDIR}"
exit 1
fi
if [ ! -f "$ftppath/$reponame$DBEXT" ]; then
- echo ""
- echo "WARNING: The file \"$ftppath/$reponame$DBEXT\" could not be found, skipping."
- echo ""
+ msg "The file \"$ftppath/$reponame$DBEXT\" could not be found, skipping."
repo_unlock $reponame $arch
continue
fi
if ! bsdtar xf "$ftppath/$reponame$DBEXT"; then
- echo ""
- echo "ERROR: Command failed: bsdtar xf \"$ftppath/$reponame$DBEXT\""
+ error "Command failed: bsdtar xf \"$ftppath/$reponame$DBEXT\""
exit 1
fi
@@ -106,7 +105,7 @@ for arch in ${ARCHES[@]}; do
MISSINGFILES=""
for mf in $missfiles; do
if [ -e "${ftppath_base}/any/${mf}" ]; then
- echo "Restoring missing 'any' symlink: ${mf}"
+ msg "Restoring missing 'any' symlink: ${mf}"
${CLEANUP_DRYRUN} || ln -s "../any/${mf}" "${ftppath}"
else
MISSINGFILES="${MISSINGFILES} ${mf}"
@@ -120,53 +119,36 @@ for arch in ${ARCHES[@]}; do
continue
fi
- echo "Scan complete for $reponame ($arch) at ${ftppath}"
-
- if [ -n "$DELETEFILES" ]; then
- echo " The following files are out of date"
- for f in $DELETEFILES; do
- echo " $f"
- done
- echo ""
- fi
-
- if [ -n "$DELETESYMLINKS" ]; then
- echo " The following symlinks are out of date"
- echo " They will be deleted"
- for f in $DELETESYMLINKS; do
- echo " $f"
- done
- echo ""
- fi
+ msg "Scan complete for $reponame ($arch) at ${ftppath}"
if [ -n "$MISSINGFILES" ]; then
- echo " The following files are missing in the repo"
for f in $MISSINGFILES; do
- echo " $f"
- done
- echo ""
- fi
-
- if [ -n "$EXTRAFILES" ]; then
- echo " The following files are in the repo but not the db"
- for f in $EXTRAFILES; do
- echo " $f"
+ error "$f is missing"
done
fi
if [ -n "${DELETEFILES}" ]; then
- ${CLEANUP_DRYRUN} || clean_pkgs ${DELETEFILES}
- echo ""
+ msg "The following files are out of date"
+ for f in $DELETEFILES; do
+ msg2 "$f"
+ done
+ clean_pkgs ${DELETEFILES}
fi
if [ -n "${DELETESYMLINKS}" ]; then
- ${CLEANUP_DRYRUN} || clean_pkgs ${DELETESYMLINKS}
- echo ""
+ msg "The following symlinks are out of date"
+ for f in $DELETESYMLINKS; do
+ msg2 "$f"
+ done
+ clean_pkgs ${DELETESYMLINKS}
fi
if [ -n "${EXTRAFILES}" ]; then
- ${CLEANUP_DRYRUN} || clean_pkgs ${EXTRAFILES}
- echo ""
+ msg "The following files are in the repo but not the db"
+ for f in $EXTRAFILES; do
+ msg2 "$f"
+ done
+ clean_pkgs ${EXTRAFILES}
fi
done
@@ -193,15 +175,13 @@ if [ -d "$ftppath_base/any" ]; then
fi
if [ -n "$ARCHINDEPFILES" ]; then
- echo " The following architecture independent packages"
- echo " are not symlinked in the architecture repositories."
+ msg "The following architecture independent packages are not symlinked in the architecture repositories."
for f in $ARCHINDEPFILES; do
- echo " $f"
+ msg2 "$f"
done
fi
if [ -d "$ftppath_base/any" -a -n "${ARCHINDEPFILES}" ]; then
cd "$ftppath_base/any"
- ${CLEANUP_DRYRUN} || clean_pkgs ${ARCHINDEPFILES}
- echo ""
+ clean_pkgs ${ARCHINDEPFILES}
fi
diff --git a/misc-scripts/make-sourceball b/misc-scripts/make-sourceball
index 8e26eec..5bd155f 100755
--- a/misc-scripts/make-sourceball
+++ b/misc-scripts/make-sourceball
@@ -1,8 +1,8 @@
#!/bin/bash
if [ $# -ne 3 -a $# -ne 4 ]; then
- echo "usage: $(basename $0) [-f] <packagename> <repo> <arch>"
- echo " -f Force building. Skip license checks"
+ msg "usage: $(basename $0) [-f] <packagename> <repo> <arch>"
+ msg " -f Force building. Skip license checks"
exit 1
fi
@@ -31,17 +31,17 @@ create_srcpackage() {
pkgrel=$(. PKGBUILD; echo ${pkgrel})
if ! [ $FORCE == 1 ] && ! chk_license ${license[@]} ; then
#Removed so as not to clutter failed.txt
- #echo -e "\t$packagename license (${license[@]}) does not require source tarballs" >&2
+ #warning "$packagename license (${license[@]}) does not require source tarballs"
cleanup 0
else
- echo "Creating source tarball for $packagename-$pkgver-$pkgrel"
+ msg "Creating source tarball for $packagename-$pkgver-$pkgrel"
fi
local logfile="$logpath/$packagename"
if ! /usr/bin/makepkg --allsource --ignorearch >"$logfile" 2>&1; then
popd >/dev/null
/bin/gzip -f -9 "$logfile"
- die "\tFailed to download source for $packagename-$pkgver-$pkgrel ($reponame-$arch)"
+ die "Failed to download source for $packagename-$pkgver-$pkgrel ($reponame-$arch)"
fi
/bin/rm -f "$logfile"{,.gz}
@@ -66,13 +66,13 @@ if [[ "$reponame" = "community" || "$reponame" = "community-testing" ]]; then
if /usr/bin/svn export -q "$SVNREPOCOMMUNITY/$packagename" $packagename; then
create_srcpackage "$packagename/repos/$reponame-$arch"
else
- die "\tPackage '$packagename' does not exist in repo '$reponame-$arch'"
+ die "Package '$packagename' does not exist in repo '$reponame-$arch'"
fi
else
if /usr/bin/svn export -q "$SVNREPO/$packagename" $packagename; then
create_srcpackage "$packagename/repos/$reponame-$arch"
else
- die "\tPackage '$packagename' does not exist in repo '$reponame-$arch'"
+ die "Package '$packagename' does not exist in repo '$reponame-$arch'"
fi
fi
diff --git a/test/lib/common.inc b/test/lib/common.inc
index 795d01a..5c76eb5 100644
--- a/test/lib/common.inc
+++ b/test/lib/common.inc
@@ -6,7 +6,7 @@ oneTimeSetUp() {
local p
pkgdir="$(mktemp -d /dev/shm/$(basename $0).XXXXXXXXXX)"
cp -r ${curdir}/packages/* "${pkgdir}"
- echo -n 'Building packages...'
+ msg 'Building packages...'
for p in "${pkgdir}"/*; do
pushd $p >/dev/null
linux32 makepkg -cf --config ${curdir}/lib/makepkg-i686.conf >/dev/null 2>&1 || die 'makepkg failed'
@@ -15,7 +15,6 @@ oneTimeSetUp() {
|| die 'makepkg failed'
popd >/dev/null
done
- echo 'done'
echo
}
@@ -29,14 +28,14 @@ setUp() {
#[ -f "${curdir}/../config.local" ] && die "${curdir}/../config.local exists"
TMP="$(mktemp -d /dev/shm/$(basename $0).XXXXXXXXXX)"
- #echo "Using ${TMP}"
+ #msg "Using ${TMP}"
mkdir -p "${TMP}/"{ftp,tmp,staging,{package,source}-cleanup,svn-{packages,community}-{copy,repo}}
mkdir -p "${TMP}/ftp/"{core,extra,community,testing,community-testing}/os/{i686,any,x86_64}
mkdir -p "${TMP}/ftp/pool/"{packages,community}
mkdir -p "${TMP}/staging/"{core,extra,community,testing,community-testing}
- echo -n 'Creating svn repository...'
+ msg 'Creating svn repository...'
svnadmin create "${TMP}/svn-packages-repo"
svnadmin create "${TMP}/svn-community-repo"
svn checkout -q "file://${TMP}/svn-packages-repo" "${TMP}/svn-packages-copy"
@@ -49,7 +48,6 @@ setUp() {
svn add -q "${TMP}/svn-packages-copy"/${pkg}
svn commit -q -m"initial commit of ${pkg}" "${TMP}/svn-packages-copy"
done
- echo 'done'
cat <<eot > "${curdir}/../config.local"
FTP_BASE="${TMP}/ftp"
@@ -152,4 +150,4 @@ checkRemovedAnyPackage() {
svn up -q "${TMP}/svn-packages-copy/${pkgbase}"
[ -d "${TMP}/svn-packages-copy/${pkgbase}/repos/${repo}-any" ] \
&& fail "svn-packages-copy/${pkgbase}/repos/${repo}-any should not exist"
-} \ No newline at end of file
+}
diff --git a/testing2x b/testing2x
index bf48be6..3626432 100755
--- a/testing2x
+++ b/testing2x
@@ -22,16 +22,16 @@ for pkg in $*; do
if [ -f "${pkg}/repos/testing-${_arch}/PKGBUILD" ]; then
for repo in core extra; do
if [ -f "${pkg}/repos/${repo}-${_arch}/PKGBUILD" ]; then
- echo "===> Moving package '${pkg}': testing-${_arch} -> ${repo}-${_arch}"
+ msg "Moving package '${pkg}': testing-${_arch} -> ${repo}-${_arch}"
$(dirname $0)/db-move "${pkg}" "testing" "${repo}" "${_arch}"
moved=1
break
fi
done
if [ ${moved} -eq 0 ]; then
- echo "===> Warning: ${pkg} is only in testing-${_arch}, cannot determine where to move it"
+ warning "${pkg} is only in testing-${_arch}, cannot determine where to move it"
fi
else
- echo "===> Warning: ${pkg} is not in testing-${_arch}"
+ warning "${pkg} is not in testing-${_arch}"
fi
done