X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=blobdiff_plain;f=id-deb-build%2Fid-pbuild.sh;h=0f3441e5c82607e3f76b13761cd299289fa577d2;hb=7af2cd4eeeea3ee9b373457fd45f363f77073db8;hp=8e131a606dddf3e66508f97c45b5f2c231363c6c;hpb=863c4277ac9212d165ad5fbde7a9c7bbbaa3c996;p=git-tools-moved-to-github.git diff --git a/id-deb-build/id-pbuild.sh b/id-deb-build/id-pbuild.sh index 8e131a6..0f3441e 100755 --- a/id-deb-build/id-pbuild.sh +++ b/id-deb-build/id-pbuild.sh @@ -13,7 +13,6 @@ Options: [--centos=distros] [--upload] [--concurrency=N] - [--product=X] EOF exit $1 } @@ -48,9 +47,6 @@ while test $# -gt 0; do --concurrency=*) concurrency=$optarg ;; - --product=*) - PRODUCT=$optarg - ;; -*) do_help=yes ;; @@ -82,16 +78,38 @@ if test ! -x $PBUILDROOT; then exit 1 fi -MKDEBSRC=${ID_DEB_BUILD}/id-mk-deb-src.sh -if test ! -x $MKDEBSRC; then - echo "$MKDEBSRC not found" - exit 1 +if test "$CENTOS_DIST"; then + RNAME=`rpm -q --specfile *.spec --queryformat "%{NAME};" | cut -d ";" -f1` + echo "RNAME=$RNAME" + if test "$NAME" -a "$NAME" != "$RNAME"; then + echo "NAME in IDMETA ($NAME) does not match RPM spec NAME ($RNAME)" + exit 1 + fi + PRODUCT=$RNAME fi - -if $upload; then - : -else - if $debian; then +if $debian; then + DNAME=`awk '/Source:/ {print $2}' debian/control` + if test "$NAME" -a "$NAME" != "$DNAME"; then + echo "NAME in IDMETA ($NAME) does not match debian/control ($DNAME)" + exit 1 + fi + PRODUCT=$DNAME + if ! $upload; then + MKDEBSRC=${ID_DEB_BUILD}/id-mk-deb-src.sh + if test ! -x $MKDEBSRC; then + echo "$MKDEBSRC not found" + exit 1 + fi + DCH=debian/changelog + if ! git ls-files $DCH --error-unmatch >/dev/null 2>&1; then + rm -f $DCH + echo "${DNAME} (${VERSION}-1.indexdata) unstable; urgency=medium" >$DCH + echo '' >>$DCH + echo ' * Upstream.' >>$DCH + echo '' >>$DCH + echo " -- `git config --get user.name` <`git config --get user.email`> `date -R`" >>$DCH + echo '' >>$DCH + fi if test "${SUDO_USER}"; then if test ! -d deb-src; then $MKDEBSRC @@ -106,9 +124,9 @@ else fi $MKDEBSRC fi - else - mkdir -p deb-src fi +else + mkdir -p deb-src fi cd deb-src @@ -134,17 +152,7 @@ if $debian; then fi fi -if test -z "$PRODUCT"; then - PRODUCT=$NAME -fi -if test -z "$PRODUCT"; then - if $debian; then - PRODUCT=`echo *.dsc|sed 's/_.*//g'` - else - PRODUCT=`cd ..;rpm -q --specfile *.spec --queryformat "%{NAME};" | cut -d ";" -f1` - fi -fi -echo "Dsc $PKG . Product $PRODUCT" +echo "Product: $PRODUCT" echo "Ubuntu distros: $UBUNTU_DIST" echo "Debian distros: $DEBIAN_DIST" echo "Centos distros: $CENTOS_DIST" @@ -169,9 +177,7 @@ if $upload; then for dist in ${CENTOS_DIST}; do arch=amd64 prodver=${PRODUCT}-${VERSION} - if scp ${ID_DEB_BUILD}/../id-rpm-build/upload-rpms.sh ${dist}:rpmbuild/SOURCES/${prodver}/; then - : - else + if ! scp ${ID_DEB_BUILD}/../id-rpm-build/upload-rpms.sh ${dist}:rpmbuild/SOURCES/${prodver}/; then echo "Copy of upload-rpms.sh to $dist failed" exit 1 fi @@ -183,17 +189,32 @@ if $upload; then fi done for dist in ${UBUNTU_DIST}; do - scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/ubuntu/${dist} + ssh ftp.indexdata.dk "mkdir -p /home/ftp/pub/${PRODUCT}/ubuntu/${dist}" + if ! scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/ubuntu/${dist}; then + echo "Upload failed for $dist" + exit 1 + fi done for dist in ${DEBIAN_DIST}; do - scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/debian/${dist} + ssh ftp.indexdata.dk "mkdir -p /home/ftp/pub/${PRODUCT}/debian/${dist}" + if ! scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/debian/${dist}; then + echo "Upload failed for $dist" + exit 1 + fi done - echo "" - echo "====================================================" - echo "APT/YUM should be updated via cron every 15 minutes " - echo " from July 11 2013 and later." - echo "No need to call update archive on kebab" - echo "====================================================" + if test "${CENTOS_DIST}"; then + if ! ssh ftp.indexdata.dk "sudo -n /home/indexdata/proj/git-tools/update-archive/update-yum-archive.sh"; then + echo "update-yum-archive.sh failed" + exit 1 + fi + fi + if test "${UBUNTU_DIST}" -o "${DEBIAN_DIST}"; then + if ! ssh ftp.indexdata.dk "sudo -n /home/indexdata/proj/git-tools/update-archive/update-archive.sh --ubuntu=\"${UBUNTU_DIST}\" --debian=\"${DEBIAN_DIST}\""; then + echo "update-archive.sh failed" + exit 1 + fi + fi + echo "Upload successful - we hope" exit 0 fi