X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=id-rpm-build%2Fupload-rpms.sh;h=0562b70fa02ef6abb79f7436b44ee474056fdd03;hb=7d8c5ed8093a91ad072d3769d81b0dfb8ecb64ee;hp=4f952f1143fa2f0f120b7ab231eb31d8f158bc91;hpb=a719bb0adfe68ddad9a099dfaf6779e3a406085c;p=git-tools-moved-to-github.git diff --git a/id-rpm-build/upload-rpms.sh b/id-rpm-build/upload-rpms.sh index 4f952f1..0562b70 100755 --- a/id-rpm-build/upload-rpms.sh +++ b/id-rpm-build/upload-rpms.sh @@ -1,20 +1,35 @@ -BUILD_DIR=${BUILD_DIR:=/usr/src/redhat/} +#!/bin/sh PWD=`pwd` UPLOAD_PATH=${UPLOAD_PATH:=/home/ftp/pub} -UPLOAD_HOST=${UPLOAD_HOST:=flurry} -UPLOAD_DIR=${UPLOAD_DIR:=`basename $PWD`} -UPLOAD_URI=${UPLOAD_HOST}:${UPLOAD_PATH}/${UPLOAD_DIR} -DISTRO=${DISTRO:="centos/5.5"} -project=`basename $PWD` -if test ! -f ${project}.spec; then - echo "Missing ${project}.spec file. Are you in the project directory?" +UPLOAD_HOST=${UPLOAD_HOST:=ftp.indexdata.dk} +specfile=$1 +if test ! -f "${specfile}"; then + echo "Missing .spec file argument." exit 1 fi if test ! -x /bin/rpm; then echo "$0: /bin/rpm missing. Install rpm" exit 1 fi -pkg_names=`rpm -q --specfile ${project}.spec` +if test ! -f /etc/redhat-release; then + echo "/etc/redhat-release missing" + exit 1 +fi +if test -z "$DISTRO"; then + if grep 'release 6' /etc/redhat-release >/dev/null; then + DISTRO="centos/6" + else + DISTRO="centos/5.5" + fi +fi +topdir=`rpm --eval "%{_topdir}"` +BUILD_DIR=${BUILD_DIR:=${topdir}} +pkg_names=`rpm -q --specfile ${specfile} --queryformat "%{NAME}-%{VERSION}-%{RELEASE}\n"` +pkg_short=`rpm -q --specfile ${specfile} --queryformat "%{NAME};" | cut -d ";" -f1` + +UPLOAD_DIR=${UPLOAD_DIR:=${pkg_short}} +UPLOAD_URI=${UPLOAD_HOST}:${UPLOAD_PATH}/${UPLOAD_DIR} +echo "Uploading to ${UPLOAD_URI}..." inc_src=true if test ! -d ${BUILD_DIR}/SRPMS; then echo "No SRPMS dir under ${BUILD_DIR}" @@ -29,19 +44,23 @@ fi for pkg in ${pkg_names}; do if $inc_src; then if test ! -f ${BUILD_DIR}/SRPMS/${pkg}.src.rpm; then - echo "No SRPM for ${pkg}" - else - scp ${BUILD_DIR}/SRPMS/${pkg}.src.rpm ${UPLOAD_URI}/redhat/${DISTRO}/SRPMS/ - fi - fi + echo "FAILED: No SRPM for ${pkg}" + exit 1 + fi + scp ${BUILD_DIR}/SRPMS/${pkg}.src.rpm ${UPLOAD_URI}/redhat/${DISTRO}/SRPMS/ + fi if $inc_bin; then + copy=false for dir in ${BUILD_DIR}/RPMS/*; do arch=`basename ${dir}` if test -f ${dir}/${pkg}.${arch}.rpm; then + copy=true scp ${dir}/${pkg}.${arch}.rpm ${UPLOAD_URI}/redhat/${DISTRO}/RPMS/${arch}/ - else - echo "No ${pkg} in arch ${arch}" fi done + if ! $copy; then + echo "FAILED: No RPM copied for: ${pkg}" + exit 1 + fi fi done