From aa87efaa0e4f973ab37bd56b9fa690eabde27d92 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Fri, 18 Sep 2009 11:40:44 -0700 Subject: ftpdir-cleanup: get rid of local getpkgname This is in the db-functions file, and does a better job. In order to do this, we had to change some path related code Signed-off-by: Aaron Griffin --- misc-scripts/ftpdir-cleanup | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/misc-scripts/ftpdir-cleanup b/misc-scripts/ftpdir-cleanup index 68af271..cc01363 100755 --- a/misc-scripts/ftpdir-cleanup +++ b/misc-scripts/ftpdir-cleanup @@ -13,19 +13,6 @@ dest=$2 . "$(dirname $0)/../db-functions" . "$(dirname $0)/../config" -getpkgname() { - local tmp - - tmp=${1##*/} - tmp=${tmp%$PKGEXT} - for arch in ${ARCHES[@]}; do - tmp=${tmp%-$arch} - done - tmp=${tmp%-any} - echo ${tmp%-*-*} -} - - ftppath_base="$FTP_BASE/$reponame/$FTP_OS_SUFFIX" for arch in ${ARCHES[@]}; do @@ -60,16 +47,17 @@ for arch in ${ARCHES[@]}; do exit 1 fi - for pkg in *; do + cd "$ftppath" + + for pkg in $TMPDIR/*; do filename=$(grep -A1 '^%FILENAME%$' "${pkg}/desc" | tail -n1) [ -z "${filename}" ] && filename="${pkg}${PKGEXT}" - if [ ! -e "${ftppath}/${filename}" ]; then + if [ ! -e "${filename}" ]; then MISSINGFILES="${MISSINGFILES} ${filename}" else pkgname="$(getpkgname ${filename})" - for otherfile in ${ftppath}/${pkgname}-*; do - otherfile="$(basename ${otherfile})" + for otherfile in ${pkgname}-*; do if [ "${otherfile}" != "${filename}" -a "${pkgname}" = "$(getpkgname ${otherfile})" ]; then if [ -h "${otherfile}" ]; then DELETESYMLINKS="${DELETESYMLINKS} ${otherfile}" @@ -81,7 +69,6 @@ for arch in ${ARCHES[@]}; do fi done - cd "$ftppath" for pkg in *$PKGEXT; do if [ ! -e "$pkg" ]; then continue @@ -95,7 +82,6 @@ for arch in ${ARCHES[@]}; do EXTRAFILES="$EXTRAFILES $pkg" done - cd "$ftppath" rm -rf ${TMPDIR} # Do a quick check to see if a missing ARCHINDEPFILE is in the any dir -- cgit v1.2.3-2-g168b