--- sisyphus-0.9.1/etc/functions.fix 2005-07-01 19:02:47 +0400 +++ sisyphus-0.9.1/etc/functions 2005-09-06 17:35:00 +0400 @@ -114,17 +114,18 @@ cleanup_incoming() local f for f in "$@"; do if [ ! -r "$f" ]; then FileError "unavailable" "$f" continue fi local type rpm_arch component type="$(file -b "$f")" || { rc=1; continue; } - rpm_arch="$(printf %s "$f" | sed -ne 's,^.*\.\([^.]\+\)\.rpm$,\1,p')" || + rpm_arch="$f"; rpm_arch="${rpm_arch%.rpm}"; rpm_arch="${rpm_arch##*.}" + [ -n "$rpm_arch" ] || { rc=1; continue; } valid_architecture "$rpm_arch" || { FileError "invalid architecture: $rpm_arch" "$f"; rc=1; continue; } if [ -z "${type##RPM v3 src *}" ]; then target_cleanup "$f" "$NEW_FILE_PREFIX/SRPMS" || rc=1 elif [ -z "${type##RPM v3 bin *}" ]; then target_cleanup "$f" "$NEW_FILE_PREFIX/$rpm_arch/RPMS" || rc=1 else @@ -164,17 +165,18 @@ upload_bin_new() local f rpm_arch for f in *.rpm; do if [ ! -f "$f" ]; then [ "$f" != '*.rpm' ] || continue FileError "not a regular file" "$f" rc=1 continue fi - rpm_arch="$(printf %s "$f" | sed -ne 's,^.*\.\([^\.]\+\)\.rpm$,\1,p')" || + rpm_arch="$f"; rpm_arch="${rpm_arch%.rpm}"; rpm_arch="${rpm_arch##*.}" + [ -n "$rpm_arch" ] || { rc=1; continue; } valid_architecture "$rpm_arch" || { FileError "invalid architecture: $rpm_arch" "$f"; rc=1; continue; } $test cp -pv -- "$f" "$PREFIX/$NEW_FILE_PREFIX/$rpm_arch/RPMS" done cleanup_incoming *.rpm @@ -186,45 +188,50 @@ check_missing_srpms() { local rpms_dir="$1" shift || return local srpms_dir="$1" shift || return local rc=0 local f n + local repo_src="$PREFIX/$NEW_SRC_REPOSITORIES" for f in "$rpms_dir"/*.rpm; do if [ ! -f "$f" ]; then [ "$f" != "$rpms_dir/*.rpm" ] || continue FileError "not a regular file" "$f" rc=1 continue fi n=`LANG=C LANGUAGE=C LC_ALL=C rpmquery -p --qf '%{SOURCERPM}' -- "$f"` || { rc=1; continue; } n="${n%.src.rpm}" n="${n%.nosrc.rpm}" - if ! [ -f "$srpms_dir/$n.src.rpm" -o -f "$srpms_dir/$n.nosrc.rpm" ]; then + if ! [ -f "$srpms_dir/$n.src.rpm" -o -f "$srpms_dir/$n.nosrc.rpm" ] && + ! [ -f "$repo_src/$n.src.rpm" -o -f "$repo_src/$n.nosrc.rpm" ]; then FileError "$n" "$f" rc=1 fi done return $rc } # find orphaned SRPMS check_obsolete_srpms() { local rpms_dir="$1" shift || return local srpms_dir="$1" shift || return + [ -n "$(find "$rpms_dir" -mindepth 1 -maxdepth 1 -type f -name '*src\.rpm' -print -quit)" ] || + return 0 + local rc=0 local list= local f n pushd "$rpms_dir" >/dev/null #RPMS for f in *.rpm; do if [ ! -f "$f" ]; then [ "$f" != '*.rpm' ] || continue @@ -246,17 +253,17 @@ $n" if [ ! -f "$f" ]; then [ "$f" != '*.rpm' ] || continue FileError "not a regular file" "$f" rc=1 continue fi n="${f%.src.rpm}" n="${n%.nosrc.rpm}" - if ! printf %s "$list" |grep -qs "^$n\$"; then + if ! printf %s "$list" |grep -m1 -qsxF "$n"; then FileError "$f" rc=1 fi done popd >/dev/null return $rc }