Merge branch 'master' of ssh://git.indexdata.com:222/home/git/pub/git-tools
authorHeikki Levanto <heikki@indexdata.dk>
Mon, 21 May 2012 14:07:23 +0000 (16:07 +0200)
committerHeikki Levanto <heikki@indexdata.dk>
Mon, 21 May 2012 14:07:23 +0000 (16:07 +0200)
id-deb-build/id-mk-deb-src.sh
id-deb-build/id-pbuild.sh
id-deb-build/mkdist.sh
id-deb-build/pbuilderrc
update-archive/update-archive.sh

index 4e351bb..c63e772 100755 (executable)
@@ -11,10 +11,6 @@ fi
 if test -f debian/.gitignore; then
        cd debian; for i in `cat .gitignore`; do rm -fr $i; done; cd ..
 fi
-if test -d deb-src; then
-       echo "deb-src exist. You might remove it"
-       exit 1
-fi
 l=`head -1 $DEBCHANGELOG`
 PROD=`echo $l|sed 's/ .*//g'`
 VERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'`
@@ -29,7 +25,7 @@ if test ! -f ${TAR}; then
        exit 1
 fi
 set -e
-mkdir deb-src
+mkdir -p deb-src
 ORIG=${PROD}_${MAJOR}.orig.tar.gz
 echo "TAR=$TAR"
 echo "ORIG=$ORIG"
index c04e2d7..51cb8e0 100755 (executable)
@@ -10,6 +10,7 @@ Usage: id-pbuild.sh [OPTIONS]
 Options:
        [--debian=distros]
        [--ubuntu=distros]
+       [--centos=distros]
        [--upload]
        [--concurrency=N]
        [--product=X]
@@ -21,6 +22,7 @@ EOF
 upload=false
 do_help=false
 concurrency=4
+ARCHS="i386 amd64"
 
 if test -f IDMETA; then
     . ./IDMETA
@@ -38,6 +40,9 @@ while test $# -gt 0; do
        --ubuntu=*)
            UBUNTU_DIST=$optarg
            ;;
+       --centos=*)
+           CENTOS_DIST=$optarg
+           ;;
         --upload)
            upload=true
            ;;
@@ -73,7 +78,7 @@ if test ! -x $MKDEBSRC; then
 fi
 
 if $upload; then
-    cd deb-src
+    :
 else
     if test "${SUDO_USER}"; then
        if test ! -d deb-src; then
@@ -81,7 +86,7 @@ else
        fi
     else
        if test -d deb-src; then
-           rm -rf deb-src
+           rm -f deb-src/*.gz
            if test $? -ne 0; then
                echo "deb-src could not be removed. Remove deb-src manually"
                exit 1
@@ -89,8 +94,8 @@ else
        fi
        $MKDEBSRC
     fi
-    cd deb-src
 fi
+cd deb-src
 
 for f in *.dsc; do
     if test -f "$f"; then
@@ -108,7 +113,6 @@ fi
 if test -z "$PRODUCT"; then
     PRODUCT=`echo *.dsc|sed 's/_.*//g'`
 fi
-ARCHS="i386 amd64"
 if grep "Architecture: all" $PKG >/dev/null; then
     USE_ARCHS=i386
 else
@@ -117,6 +121,7 @@ fi
 echo "Dsc $PKG . Product $PRODUCT"
 echo "Ubuntu distros: $UBUNTU_DIST"
 echo "Debian distros: $DEBIAN_DIST"
+echo "Centos distros: $CENTOS_DIST"
 if test "${SUDO_USER}"; then
     echo "Running as sudo."
     echo "Tip: You can avoid it by adding the following in /etc/sudoers"
@@ -132,6 +137,16 @@ if test ! -f ${HOME_EXPORT}/.pbuilderrc; then
 fi
 
 if $upload; then
+    for dist in ${CENTOS_DIST}; do
+       arch=amd64
+       prodver=${PRODUCT}-${VERSION}
+       if ssh $dist "cd rpmbuild/SOURCES/${prodver} && ../../../proj/git-tools/id-rpm-build/upload-rpms.sh ${PRODUCT}.spec"; then
+           :
+           else
+           echo "Upload failed for $dist"
+           exit 1
+       fi
+    done
     for dist in ${UBUNTU_DIST}; do
        scp ${dist}-*/* ftp.indexdata.dk:/home/ftp/pub/${PRODUCT}/ubuntu/${dist}
     done
@@ -140,17 +155,52 @@ if $upload; then
     done
     echo ""
     echo "===================================================="
-    echo "Remember to update APT on ftp.indexdata.dk !!!"
+    echo "Remember to update APT/YUM on ftp.indexdata.dk !!!"
     echo ""
     echo "ssh ftp.indexdata.dk"
     echo "cd ~/proj/git-tools/update-archive"
     echo "sudo su"
     echo "./update-archive.sh"
+    if test ${CENTOS_DIST}; then
+       echo "./update-yum-archive.sh"
+    fi
     echo "===================================================="
     exit 0
 fi
+
 rm -f *.log
 
+# copy tars to centos build hosts
+for dist in ${CENTOS_DIST}; do
+    arch=amd64
+    prodver=${PRODUCT}-${VERSION}
+    tarname=${prodver}.tar.gz
+    if test ! -f ../${tarname}; then
+       echo "$tarname: missing"
+       exit 1
+    fi
+
+    if ssh $dist "test -f .rpmmacros && test -d rpmbuild/SOURCES && test -d rpmbuild/RPMS && test -d rpmbuild/SRPMS && test -x proj/git-tools/id-rpm-build/upload-rpms.sh"; then
+       :
+    else
+       echo "Host $dist does not seem to be prepared with git-tools and rpmbuild directories"
+       exit 1
+    fi
+
+    if scp ../${tarname} $dist:rpmbuild/SOURCES/ ; then
+       :
+    else
+       echo "Could not copy $tarname to $dist"
+       exit 1
+    fi
+    if ssh $dist "cd rpmbuild/SOURCES && rm -fr $prodver && tar zxf $tarname && cd ${prodver} && rpmbuild -ba ${PRODUCT}.spec" >${dist}-${arch}.log 2>&1; then
+       :
+    else
+       echo "FAILED: See ${dist}-${arch}.log"
+       exit 1
+    fi
+done
+
 # call our privileged wrapper to clean the directories, no --dsc option
 for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
     for arch in ${USE_ARCHS}; do
@@ -195,6 +245,7 @@ for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
        fi
     done
 done
+
 date
 echo "Done"
 # Local Variables:
index 925d249..473013e 100755 (executable)
@@ -11,13 +11,12 @@ fi
 
 #we will keep this to get the project name
 DEBCHANGELOG=debian/changelog
-l=`head -1 $DEBCHANGELOG`
 
 if [ "x$NAME" != x ]; then
   echo "Got name $NAME from IDMETA file"
 else
-  NAME=`echo $l|sed 's/ .*//g'`
-  echo "Warning: assuming name $NAME from debian/changelog"
+  NAME=`head -1 $DEBCHANGELOG|sed 's/ .*//g'`
+  echo "Warning: assuming name $NAME from $DEBCHANGELOG"
 fi
 
 if [ "x$2" != x ]; then
@@ -28,9 +27,9 @@ fi
 if [ "x$VERSION" != x ]; then
   echo "Got version $VERSION from IDMETA file"
 else
-  FULLVERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'`
+  FULLVERSION=`head -1 $DEBCHANGELOG|sed 's/.*(//g'|sed 's/).*//g'`
   VERSION=`echo $FULLVERSION|sed 's/-.*//g'`
-  echo "Warning: assuming version $VERSION from debian/changelog"
+  echo "Warning: assuming version $VERSION from $DEBCHANGELOG"
 fi
 
 if [ "x$1" != x ]; then
@@ -38,12 +37,15 @@ if [ "x$1" != x ]; then
   VERSION=$1
 fi
 
+trap 'rm -f tmp.tar' 0
 git archive --format=tar --prefix=$NAME-$VERSION/ v${VERSION} > tmp.tar || die "This version is not tagged in Git";
 tar xf tmp.tar
 rm tmp.tar
 for file in debian $OMIT_FROM_DIST; do
-  echo "Omitting $file from distribution"
-  rm -r $NAME-$VERSION/$file
+  if [ -e "$file" ]; then
+    echo "Omitting $file from distribution"
+    rm -r $NAME-$VERSION/$file
+  fi
 done
 tar cfz $NAME-$VERSION.tar.gz $NAME-$VERSION
 rm -r $NAME-$VERSION
index 169a190..4885ecb 100644 (file)
@@ -18,9 +18,9 @@ CCACHEDIR=
 
 # http://releases.ubuntu.com/releases/
 case "$DIST" in
-    oneiric|natty|maverick|lucid|karmic) # ubuntu specific
+    precise|oneiric|natty|maverick|lucid|karmic) # ubuntu specific
        # MIRRORSITE="http://ftp.df.lth.se/ubuntu/"
-       MIRRORSITE="http://mirrors.telianet.dk/ubuntu/"
+       MIRRORSITE="http://mirrors.dotsrc.org/ubuntu/"
         # MIRRORSITE="http://mirrors.kernel.org/ubuntu/"
         COMPONENTS="main restricted universe multiverse"
        OTHERMIRROR="deb http://ftp.indexdata.dk/ubuntu $DIST main"
index 7b74e8f..e7fbabd 100755 (executable)
@@ -15,7 +15,10 @@ confdir=`pwd`
 
 architectures="i386 amd64"
 
-for vdist in ubuntu/karmic ubuntu/lucid ubuntu/maverick ubuntu/natty ubuntu/oneiric debian/wheezy debian/squeeze debian/lenny debian/etch; do
+for vdist in ubuntu/karmic ubuntu/lucid ubuntu/maverick \
+       ubuntu/natty ubuntu/oneiric ubuntu/precise \
+       debian/wheezy debian/squeeze debian/lenny \
+       debian/etch; do
        dist=`basename $vdist`
        vendor=`dirname $vdist`
        ftpdir=/home/ftp/pub/$vendor