--- /dev/null
+#!/bin/sh
+if test ! -f debian/control; then
+ echo "No debian/control"
+ exit 1
+fi
+if test ! -f IDMETA; then
+ echo "No IDMETA"
+ exit 1
+fi
+. ./IDMETA
+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
+
+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
l=`head -1 $DEBCHANGELOG`
PROD=`echo $l|sed 's/ .*//g'`
VERSION=`echo $l|sed 's/.*(//g'|sed 's/).*//g'`
-echo "VERSION=$VERSION"
MAJOR=`echo $VERSION|sed 's/-.*//g'`
-echo "MAJOR=$MAJOR"
MINOR=`echo $VERSION|sed 's/.*-//g'`
-echo "MINOR=$MINOR"
TAR=${PROD}-${MAJOR}.tar.gz
if test ! -f ${TAR}; then
echo "$0: ${TAR} missing"
set -e
mkdir -p deb-src
ORIG=${PROD}_${MAJOR}.orig.tar.gz
-echo "TAR=$TAR"
-echo "ORIG=$ORIG"
cp ${TAR} deb-src/${ORIG}
cd deb-src
tar xf ${ORIG}
+++ /dev/null
-echo "id-mk-dist.sh is deprecated -- use mkdist.sh instead"
-exit 1
-
-#!/bin/sh
-if test ! -f debian/changelog; then
- echo "debian/changelog not found"
- exit 1
-fi
-PRODUCT=`head -1 debian/changelog |awk '{print $1}'`
-if test ! -f IDMETA; then
- echo "IDMETA not found in current directory"
- exit 1
-fi
-. ./IDMETA
-for f in debian/*; do
- if test -d $f; then
- echo "Removing $f"
- rm -r $f
- fi
-done
-git log >ChangeLog
-rm -f dist.tar ${PRODUCT}-*.tar.gz ${PRODUCT}-${VERSION}
-tar cv --exclude='*~' --exclude='.*' -f dist.tar *
-mkdir $PRODUCT-$VERSION
-(cd $PRODUCT-$VERSION; tar xf ../dist.tar)
-for f in .gitignore debian; do
- (cd $PRODUCT-$VERSION; rm -fr $f)
-done
-tar zcvf $PRODUCT-$VERSION.tar.gz $PRODUCT-$VERSION
-rm -fr $PRODUCT-$VERSION dist.tar
-
#!/bin/sh
-
usage()
{
cat <<EOF
Usage: id-pbuild-root.sh [OPTIONS]
Options:
+ [--arch=architecture]
+ [--dist=distribution]
[--dsc=dscfile]
- [--dist=distribution]
- [--arch=architecture]
- [--home=home]
-
-This script is should be called with root privilege. It is meant to be
-called by id-pbuild.sh.
+ [--update=true|false]
EOF
exit $1
}
+D0=`dirname $0`
+do_help=false
+update=true
while test $# -gt 0; do
case "$1" in
- -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
esac
-
case $1 in
- --dist=*)
- dist=$optarg
- ;;
- --arch=*)
- arch=$optarg
- ;;
- --dsc=*)
- dsc=$optarg
- ;;
- --home=*)
- HOME=$optarg
- ;;
- -*)
- usage 1
- ;;
+ --dist=*)
+ DIST=$optarg
+ ;;
+ --arch=*)
+ ARCH=$optarg
+ ;;
+ --dsc=*)
+ DSC=$optarg
+ ;;
+ --update=*)
+ update=$optarg
+ ;;
+ -*)
+ do_help=yes
+ ;;
esac
shift
done
-
-PBUILDER=/usr/sbin/pbuilder
-
-if test -z "$dist" -o -z "$arch"; then
- echo "dist and arch must be given"
- usage 1
+if test "$do_help" = "yes"; then
+ usage 1 1>&2
fi
-rm -fr ${dist}-${arch}
-
-if test ! -f $HOME/.pbuilderrc; then
- echo "$HOME/.pbuilderrc missing"
+if test -z "$DIST"; then
+ echo "id-pbuild-root.sh: missing --dist"
exit 1
fi
-if test "$dsc"; then
- if test ! -f /var/cache/pbuilder/${dist}-${arch}-base.tgz; then
- DIST=$dist ARCH=$arch $PBUILDER --create
- fi
- DIST=$dist ARCH=$arch $PBUILDER --update --override-config
- DIST=$dist ARCH=$arch $PBUILDER --build $dsc
+if test -z "$ARCH"; then
+ echo "id-pbuild-root.sh: missing --arch"
+ exit 1
fi
+if test -z "$DSC"; then
+ echo "id-pbuild-root.sh: missing --dsc"
+ exit 1
+fi
+if test ! -x /usr/bin/lxc-attach; then
+ echo "No lxc-attach. Probably not running on mochi!!"
+ exit 1
+fi
+export DIST ARCH # export for pbuilder to see
+echo "$DIST-$ARCH begin"
+if $update; then
+ if ! lxc-attach -n pbuilder -- pbuilder --update --override-config >update-${DIST}-${ARCH}.log 2>&1; then
+ if ! lxc-attach -n pbuilder -- pbuilder --create >create-${DIST}-${ARCH}.log 2>&1; then
+ echo "$DIST-$ARCH failed. Inspect deb-src/create-${DIST}-${ARCH}.log"
+ exit 2
+ fi
+ if ! lxc-attach -n pbuilder -- pbuilder --update --override-config >update-${DIST}-${ARCH}.log 2>&1; then
+ echo "$DIST-$ARCH failed. Inspect deb-src/update-${DIST}-${ARCH}.log"
+ exit 2
+ fi
+ fi
+fi
+if ! lxc-attach -n pbuilder -- pbuilder --build $DSC >build-${DIST}-${ARCH}.log 2>&1; then
+ echo "$DIST-$ARCH failed. Inspect deb-src/build-${DIST}-${ARCH}.log"
+ exit 3
+fi
+echo "$DIST-$ARCH done"
+exit 0
# Local Variables:
# mode:shell-script
-# sh-indentation: 2
+# sh-indentation: 4
# sh-basic-offset: 4
# End:
+
#!/bin/sh
-# This script builds Debian packages for one or more distributions
-# in i386/amd64 architectures. It uses pbuilder. pbuilder requires root
-# privilege and so this script should be invoked with sudo.
-
usage()
{
cat <<EOF
Usage: id-pbuild.sh [OPTIONS]
Options:
- [--debian=distros]
- [--ubuntu=distros]
- [--centos=distros]
- [--upload]
- [--concurrency=N]
+ [--debian=distros]
+ [--ubuntu=distros]
+ [--centos=distros]
+ [--concurrency=level]
+ [--update=true|false]
+ [--upload]
EOF
exit $1
}
-
-# things that might be set by options
-upload=false
+D0=`dirname $0`
+ID_DEB_BUILD=`cd $D0; pwd`
+update=true
do_help=false
-concurrency=4
+upload=false
+concurrency=8
ARCHS="i386 amd64"
-
-if test -f IDMETA; then
- . ./IDMETA
-fi
while test $# -gt 0; do
case "$1" in
- -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
esac
case $1 in
- --debian=*)
- DEBIAN_DIST_A=$optarg
- ;;
- --ubuntu=*)
- UBUNTU_DIST_A=$optarg
- ;;
- --centos=*)
- CENTOS_DIST_A=$optarg
- ;;
- --upload)
- upload=true
- ;;
+ --debian=*)
+ DEBIAN_DIST_A=$optarg
+ ;;
+ --ubuntu=*)
+ UBUNTU_DIST_A=$optarg
+ ;;
+ --centos=*)
+ CENTOS_DIST_A=$optarg
+ ;;
--concurrency=*)
- concurrency=$optarg
- ;;
- -*)
- do_help=yes
- ;;
+ concurrency=$optarg
+ ;;
+ --upload)
+ upload=true
+ ;;
+ --update=*)
+ update=$optarg
+ ;;
+ -*)
+ do_help=yes
+ ;;
esac
shift
done
+if test "$do_help" = "yes"; then
+ usage 1 1>&2
+fi
+if test ! -x /usr/bin/lxc-attach; then
+ echo "No lxc-attach. Probably not running on mochi!!"
+ exit 1
+fi
+if test -f IDMETA; then
+ . ./IDMETA
+else
+ echo "IDMETA missing"
+ exit 1
+fi
+UPLOAD_HOST=${UPLOAD_HOST:=ftp.indexdata.dk}
+UPLOAD_PATH=${UPLOAD_PATH:=/home/ftp/pub}
if test "$DEBIAN_DIST_A" -o "$UBUNTU_DIST_A" -o "$CENTOS_DIST_A"; then
DEBIAN_DIST=$DEBIAN_DIST_A
UBUNTU_DIST=$UBUNTU_DIST_A
CENTOS_DIST=$CENTOS_DIST_A
fi
-
-if test "$do_help" = "yes"; then
- usage 1 1>&2
-fi
-
if test "$DEBIAN_DIST" -o "$UBUNTU_DIST"; then
debian=true
+ 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
else
debian=false
fi
-
-D0=`dirname $0`
-ID_DEB_BUILD=`cd $D0; pwd`
-PBUILDROOT=${ID_DEB_BUILD}/id-pbuild-root.sh
-if test ! -x $PBUILDROOT; then
- echo "$PBUILDROOT not found"
- exit 1
-fi
-
if test "$CENTOS_DIST"; then
+ centos=true
RNAME=`awk '/Name:/ {print $2}' *.spec`
- 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 $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
+ if test ! -d ~/rpmbuild; then
+ echo "Creating ~/rpmbuild"
+ mkdir -p ~/pmbuild/BUILD
+ mkdir -p ~/rpmbuild/RPMS/noarch
+ mkdir -p ~/rpmbuild/RPMS/x86_64
+ mkdir -p ~/rpmbuild/SOURCES
+ mkdir -p ~/rpmbuild/SPECS
+ mkdir -p ~/rpmbuild/SRPMS
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
- fi
- else
- if test -d deb-src; then
- rm -f deb-src/*.gz
- if test $? -ne 0; then
- echo "deb-src could not be removed. Remove deb-src manually"
- exit 1
- fi
- rm -f deb-src/*.dsc
- fi
- $MKDEBSRC
- fi
+ if test ! -f ~/.rpmmacros; then
+ echo "Creating ~/.rpmmacros"
+ echo "%_topdir $HOME/rpmbuild" >~/.rpmmacros
+ echo "%_source_filedigest_algorithm 0" >>~/.rpmmacros
+ echo "%_binary_filedigest_algorithm 0" >>~/.rpmmacros
fi
else
- mkdir -p deb-src
+ centos=false
fi
+TAR=${PRODUCT}-${VERSION}.tar.gz
-cd deb-src
-
-if $debian; then
- for f in *.dsc; do
- if test -f "$f"; then
- PKG=$f
+if $upload; then
+ UPLOAD_URI=${UPLOAD_HOST}:${UPLOAD_PATH}/${PRODUCT}
+ echo "Uploading to ${UPLOAD_URI}"
+ if $centos; then
+ pkg_names=`sudo lxc-attach -n mockbuild -- rpm -q --specfile ~/rpmbuild/SPECS/${PRODUCT}.spec --queryformat "%{NAME}-%{VERSION}-%{RELEASE}\n"`
+ for dist in ${CENTOS_DIST}; do
+ case $dist in
+ centos5)
+ ftpdir=centos/5.5
+ r=id-epel-5-x86_64 ;;
+ centos6)
+ ftpdir=centos/6
+ r=id-epel-6-x86_64 ;;
+ centos7)
+ ftpdir=centos/7
+ r=id-epel-7-x86_64 ;;
+ *)
+ ftpdir=centos/$dist
+ r=$dist ;;
+ esac
+ echo "$r"
+ for pkg in ${pkg_names}; do
+ ssh ${UPLOAD_HOST} "mkdir -p ${UPLOAD_PATH}/${PRODUCT}/redhat/${ftpdir}/SRPMS"
+ if test -f ~/rpmbuild/SRPMS/${pkg}.src.rpm; then
+ scp ~/rpmbuild/SRPMS/${pkg}.src.rpm ${UPLOAD_URI}/redhat/${ftpdir}/SRPMS
+ fi
+ for arch in x86_64 noarch; do
+ if test -f ~/rpmbuild/$r/${pkg}.${arch}.rpm; then
+ ssh ${UPLOAD_HOST} "mkdir -p ${UPLOAD_PATH}/${PRODUCT}/redhat/${ftpdir}/RPMS/${arch}"
+ scp ~/rpmbuild/$r/${pkg}.${arch}.rpm ${UPLOAD_URI}/redhat/${ftpdir}/RPMS/${arch}
+ fi
+ done
+ done
+ done
+ if ! ssh ${UPLOAD_HOST} "sudo -n /home/indexdata/proj/git-tools/update-archive/update-yum-archive.sh" >~/rpmbuild/yum-update.log 2>&1; then
+ echo "update-yum-archive.sh failed. Inspect ~/rpmbuild/yum-update.log"
+ exit 1
fi
- done
- if test -z "$PKG"; then
- echo "Specify .dsc file"
- exit 1
- fi
- if test ! -e "$PKG"; then
- echo "${PKG} does not exist"
- exit 1
fi
- if grep "Architecture: all" $PKG >/dev/null; then
- USE_ARCHS=i386
- else
- USE_ARCHS=$ARCHS
- fi
-fi
-
-echo "Product: $PRODUCT"
-echo "Ubuntu distros: $UBUNTU_DIST"
-echo "Debian distros: $DEBIAN_DIST"
-echo "Centos distros: $CENTOS_DIST"
-if $debian; then
- if test "${SUDO_USER}"; then
- echo "Running as sudo."
- echo "Tip: You can avoid it by adding the following in /etc/sudoers"
- echo "${SUDO_USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh"
- HOME_EXPORT=/home/${SUDO_USER}
- else
- sudo -k
- HOME_EXPORT=$HOME
- fi
- if test ! -f ${HOME_EXPORT}/.pbuilderrc; then
- echo "${HOME_EXPORT}/.pbuilderrc missing"
- echo "You may need to run: ln -s ~/proj/git-tools/id-deb-build/pbuilderrc ~/.pbuilderrc"
- exit 1
+ if $debian; then
+ cd deb-src
+ if test -n "${UBUNTU_DIST}"; then
+ for dist in ${UBUNTU_DIST}; do
+ ssh ${UPLOAD_HOST} "mkdir -p ${UPLOAD_PATH}/${PRODUCT}/ubuntu/${dist}"
+ if ! scp ${dist}-*/* ${UPLOAD_URI}/ubuntu/${dist}; then
+ echo "Upload failed for $dist"
+ exit 1
+ fi
+ done
+ fi
+ if test -n "${DEBIAN_DIST}"; then
+ for dist in ${DEBIAN_DIST}; do
+ ssh ${UPLOAD_HOST} "mkdir -p ${UPLOAD_PATH}/${PRODUCT}/debian/${dist}"
+ if ! scp ${dist}-*/* ${UPLOAD_URI}/debian/${dist}; then
+ echo "Upload failed for $dist"
+ exit 1
+ fi
+ done
+ fi
+ if ! ssh ${UPLOAD_HOST} "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
-if $upload; then
+if $centos; then
+ SPEC=${PRODUCT}.spec
+ cp ${TAR} ~/rpmbuild/SOURCES
+ cat ${SPEC}|sed "s/%define idmetaversion.*/%define idmetaversion ${VERSION}/" >~/rpmbuild/SPECS/${SPEC}
+ sudo lxc-attach -n mockbuild -- rpmbuild -bs ~/rpmbuild/SPECS/${SPEC}
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
- echo "Copy of upload-rpms.sh to $dist failed"
- exit 1
- fi
- if ssh $dist "cd rpmbuild/SOURCES/${prodver} && chmod +x upload-rpms.sh && ./upload-rpms.sh ${PRODUCT}.spec"; then
- :
+ case $dist in
+ centos5)
+ r=id-epel-5-x86_64 ;;
+ centos6)
+ r=id-epel-6-x86_64 ;;
+ centos7)
+ r=id-epel-7-x86_64 ;;
+ *)
+ r=$dist ;;
+ esac
+ echo -n "$r"
+ mkdir -p ~/rpmbuild/$r
+ if sudo lxc-attach -n mockbuild -- mock -q --resultdir=~/rpmbuild/$r -r $r ~/rpmbuild/SRPMS/${PRODUCT}-${VERSION}*src.rpm; then
+ echo " done"
else
- echo "Upload failed for $dist"
+ echo " failed. Inspect ~/rpmbuild/$r/build.log"
exit 1
fi
done
- for dist in ${UBUNTU_DIST}; do
- 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
- 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
- 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
-
-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"
+if $debian; then
+ sudo rm -fr deb-src
+ MKDEBSRC=${ID_DEB_BUILD}/id-mk-deb-src.sh
+ if test ! -x $MKDEBSRC; then
+ echo "$MKDEBSRC not found"
exit 1
fi
-
- if ssh $dist "test -f .rpmmacros && test -d rpmbuild/SOURCES && test -d rpmbuild/RPMS && test -d rpmbuild/SRPMS"; then
- :
- else
- echo "Host $dist does not seem to be prepared with rpmbuild directories"
- exit 1
+ if ! ${ID_DEB_BUILD}/id-mk-deb-changelog.sh; then
+ echo "id-mk-deb-changelog.sh failed"
fi
-
- if scp ../${tarname} $dist:rpmbuild/SOURCES/ ; then
- :
- else
- echo "Could not copy $tarname to $dist"
+ if ! ${MKDEBSRC}; then
+ echo "id-mk-deb-src.sh failed"
+ fi
+ cd deb-src
+ for f in *.dsc; do
+ if test -f "$f"; then
+ DSC=$f
+ fi
+ done
+ if test -z "$DSC"; then
+ echo "${DSC}does not exist"
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
- :
+ if grep "Architecture: all" $DSC >/dev/null; then
+ USE_ARCHS=i386
else
- echo "FAILED: See ${dist}-${arch}.log"
- exit 1
+ USE_ARCHS=$ARCHS
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
- sudo -n $PBUILDROOT --home=${HOME_EXPORT} --dist=$dist --arch=$arch
- if test $? -ne 0; then
- echo "FAILED"
- echo "Run id-pbuild.sh using sudo or add yourself to /etc/sudoers:"
- echo "${USER} ALL=NOPASSWD: ${ID_DEB_BUILD}/id-pbuild-root.sh"
- exit 1
- fi
+ rm -f ~/.pbuilderrc
+ i=0
+ cat ${ID_DEB_BUILD}/pbuilderrc > ~/.pbuilderrc
+ for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
+ for arch in ${USE_ARCHS}; do
+ sudo ${ID_DEB_BUILD}/id-pbuild-root.sh --update=$update --dsc=$DSC --arch=$arch --dist=$dist &
+ i=`expr $i + 1`
+ if test $i -ge $concurrency; then
+ i=0
+ wait
+ if ! test -f ${dist}-${arch}/*.dsc; then
+ echo "FAILED: No .dsc file for ${dist}-${arch}"
+ exit 1
+ fi
+ fi
+ done
done
-done
-
-# call our privileged wrapper to do the real work, with --dsc option
-i=0
-date
-for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
- for arch in ${USE_ARCHS}; do
- sudo -n $PBUILDROOT --home=${HOME_EXPORT} \
- --dist=$dist --arch=$arch --dsc=$PKG >${dist}-${arch}.log 2>&1 &
- i=`expr $i + 1`
- if test $i -eq $concurrency; then
- i=0
- wait
- if test -f ${dist}-${arch}/*.dsc; then
- :
- else
+ wait
+ for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
+ for arch in ${USE_ARCHS}; do
+ if ! test -f ${dist}-${arch}/*.dsc; then
echo "FAILED: No .dsc file for ${dist}-${arch}"
exit 1
fi
- fi
+ done
done
-done
-wait
-for dist in ${DEBIAN_DIST} ${UBUNTU_DIST}; do
- for arch in ${USE_ARCHS}; do
- if test -f ${dist}-${arch}/*.dsc; then
- :
- else
- echo "FAILED: No .dsc file for ${dist}-${arch}"
- exit 1
- fi
- done
-done
+fi
-date
-echo "Done"
# Local Variables:
# mode:shell-script
-# sh-indentation: 2
+# sh-indentation: 4
# sh-basic-offset: 4
# End:
+
# https://wiki.ubuntu.com/PbuilderHowto
#DIST=`dpkg-parsechangelog | awk '/^Distribution: / {print $2}'`
-: ${DIST:=$(lsb_release --short --codename)}
-: ${ARCH:=$(dpkg --print-architecture)}
+# : ${DIST:=$(lsb_release --short --codename)}
+# : ${ARCH:=$(dpkg --print-architecture)}
NAME="$DIST-$ARCH"
DISTRIBUTION="$DIST"
# We avoid keyring in assignment below. bug 4122
case "$DIST" in
vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick|lucid|karmic) # ubuntu specific
# MIRRORSITE="http://ftp.df.lth.se/ubuntu/"
- MIRRORSITE="http://mirrors.dotsrc.org/ubuntu/"
+ MIRRORSITE="http://mirror.one.com/ubuntu/"
# MIRRORSITE="http://mirrors.kernel.org/ubuntu/"
COMPONENTS="main restricted universe multiverse"
OTHERMIRROR="deb http://ftp.indexdata.dk/ubuntu $DIST main"
#!/bin/sh
-# Copyright (c) 2011 IndexData ApS. http://indexdata.com
+# Copyright (c) 2011-2015 IndexData ApS. http://indexdata.com
# Author: Wolfram Schneider
#
# id-release - a helper script to build a release & packaging for debian + redhat
#
# see http://twiki.indexdata.dk/cgi-bin/twiki/view/ID/IDSoftwareRelease
+# https://twiki.indexdata.com/twiki/bin/view/ID/AdamsReleaseProcedure
# die early
set -e
exit 1
}
+branch_check () {
+ if ! git branch | egrep -q '^\* master$'; then
+ ( echo ">>> Warning: you are not running on the master branch <<<"
+ git branch; echo ) 1>&2
+ fi
+}
+
######################################################################
+branch_check
+
case $1 in
[0-9]* ) version=$1 ;;
* ) usage ;;
esac
-echo "Did you updated the news log file?"
+
+
+cat <<EOF
+#!/bin/sh
+#
+# See also https://twiki.indexdata.com/twiki/bin/view/ID/AdamsReleaseProcedure
+#
+
+set -e
+
+EOF
+
+echo "# Did you updated the news log file?"
for file in Changes News NEWS
do
if [ -e $file ]; then
- ls -l $file
+ echo "# $(ls -l $file)"
fi
done
echo ""
perl=false
fi
-if [ `ls |egrep '\.spec$' | wc -l` -eq 0 ]; then
+if [ `ls | egrep '\.spec$' | wc -l` -eq 0 ]; then
usage "No *.spec file found"
else
spec=`ls |egrep '\.spec$' | head -1`
perl -i.bak -npe "s,VERSION=.*,VERSION=$version," IDMETA
if $java; then
- echo "set maven version to $version"
+ echo "# set maven version to $version"
mvn versions:set -DnewVersion=$version > mvn-versions.log
fi
if $perl; then
- echo "check perl version numbers"
- find . -name '*.pm' -print0 | xargs -0 egrep -H '\$VERSION.*=.*[0-9]' | egrep -v '^\./deb-src/'
+ echo "# check perl version numbers"
+ find . -name '*.pm' -print0 | xargs -0 egrep -H '\$VERSION.*=.*[0-9]' |
+ egrep -v '^\./deb-src/' | perl -npe 's,^,# ,'
fi
# update debian version file
perl -i.bak -npe "s,^Version: \d+.*,Version: $version," $spec
-
######################################################################
-echo ""
echo "# Please commit the version updates now"
echo "git commit -a -m'new release v$version'"
echo ""
-echo "# Please run now"
-echo "git push"
+echo "# Please tag now (we will push later to origin)"
echo "git tag v$version"
-echo "git push origin tag v$version"
if $java; then
echo "mvn versions:set -DnewVersion=$version-SNAPSHOT"
######################################################################
echo ""
-echo "# On RedHat or centos, please run the commands"
-echo "sudo date # ask for password early"
-echo "git pull"
-echo "\$HOME/proj/git-tools/id-deb-build/mkdist.sh"
-echo "sudo cp $package-$version.tar.gz /usr/src/redhat/SOURCES/"
-echo "sudo rpmbuild -ba $spec"
-echo "# if successfully, scp the package to ftp.indexdata.dk (kebab)"
-echo "\$HOME/proj/git-tools/id-rpm-build/upload-rpms.sh $spec"
-echo ""
-echo "# on kebab run: sudo su"
-echo "# cd $HOME/proj/git-tools/update-archive && ./update-yum-archive.sh"
-
-
-######################################################################
-echo ""
-echo "# On debian or ubuntu, please run the commands"
-echo "sudo rm -rf deb-src"
-echo "git pull"
+echo "# On mochi, please run the commands"
echo "\$HOME/proj/git-tools/id-deb-build/mkdist.sh"
-echo "\$HOME/proj/git-tools/id-deb-build/id-mk-deb-src.sh"
-echo "sudo \$HOME/proj/git-tools/id-deb-build/id-pbuild.sh"
-echo "# if successfully, scp the package to ftp.indexdata.dk (kebab)"
+echo "\$HOME/proj/git-tools/id-deb-build/id-pbuild.sh"
echo "\$HOME/proj/git-tools/id-deb-build/id-pbuild.sh --upload"
echo ""
-echo "# on kebab run: sudo su"
-echo "# cd $HOME/proj/git-tools/update-archive && ./update-archive.sh"
-echo ""
+echo "# if successfully, don't forget to push to origin"
+echo "git push origin master"
+echo "git push origin tag v$version"
+
+# EOF
+++ /dev/null
-#!/bin/sh
-# Thie script will create an .rpmmacros file that will allow rpmbuild
-# as non-root. Results will be put in in rpmbuild of your home directory
-cd $HOME
-if test -f .rpmmacros; then
- echo ".rpmmacros already exist"
-else
- echo "creating .rpmmacros"
- echo "%_topdir $HOME/rpmbuild" >.rpmmacros
-fi
-if test ! -d rpmbuild; then
- mkdir -p rpmbuild/BUILD
- mkdir -p rpmbuild/RPMS/noarch
- mkdir -p rpmbuild/RPMS/x86_64
- mkdir -p rpmbuild/SOURCES
- mkdir -p rpmbuild/SPECS
- mkdir -p rpmbuild/SRPMS
-fi
+++ /dev/null
-#!/bin/sh
-PWD=`pwd`
-UPLOAD_PATH=${UPLOAD_PATH:=/home/ftp/pub}
-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
-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}"
- inc_src=false
-fi
-inc_bin=true
-if test ! -d ${BUILD_DIR}/RPMS; then
- echo "No RPMS dir under ${BUILD_DIR}"
- inc_bin=false
-fi
-
-for pkg in ${pkg_names}; do
- copy=false
- if $inc_src; then
- if test -f ${BUILD_DIR}/SRPMS/${pkg}.src.rpm; then
- scp ${BUILD_DIR}/SRPMS/${pkg}.src.rpm ${UPLOAD_URI}/redhat/${DISTRO}/SRPMS/
- copy=true
- fi
- fi
- if $inc_bin; then
- 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}/
- fi
- done
- if ! $copy; then
- echo "FAILED: No RPM copied for: ${pkg}"
- exit 1
- fi
- fi
-done
confdir=`pwd`
architectures="i386 x86_64"
dirs_to_upd=""
-for vdist in centos/5.5 rhel/5.5 centos/6; do
+for vdist in centos/5.5 rhel/5.5 centos/6 centos/7; do
dist=`basename $vdist`
vendor=`dirname $vdist`
ftpdir=/home/ftp/pub/yum/$vendor/$dist