+++ /dev/null
-#!/bin/sh
-usage()
-{
- cat <<EOF
-Usage: id-pbuild-root.sh [OPTIONS]
-Options:
- [--arch=architecture]
- [--dist=distribution]
- [--dsc=dscfile]
- [--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= ;;
- esac
- case $1 in
- --dist=*)
- DIST=$optarg
- ;;
- --arch=*)
- ARCH=$optarg
- ;;
- --dsc=*)
- DSC=$optarg
- ;;
- --update=*)
- update=$optarg
- ;;
- -*)
- do_help=yes
- ;;
- esac
- shift
-done
-if test "$do_help" = "yes"; then
- usage 1 1>&2
-fi
-if test -z "$DIST"; then
- echo "id-pbuild-root.sh: missing --dist"
- exit 1
-fi
-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: 4
-# sh-basic-offset: 4
-# End:
-
+++ /dev/null
-#!/bin/sh
-usage()
-{
- cat <<EOF
-Usage: id-pbuild.sh [OPTIONS]
-Options:
- [--debian=distros]
- [--ubuntu=distros]
- [--centos=distros]
- [--concurrency=level]
- [--update=true|false]
- [--upload]
-EOF
- exit $1
-}
-D0=`dirname $0`
-ID_DEB_BUILD=`cd $D0; pwd`
-update=true
-do_help=false
-upload=false
-concurrency=8
-ARCHS="i386 amd64"
-while test $# -gt 0; do
- case "$1" in
- -*=*) 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
- ;;
- --concurrency=*)
- 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 "$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
-if test "$CENTOS_DIST"; then
- centos=true
- RNAME=`awk '/Name:/ {print $2}' *.spec`
- if test "$NAME" -a "$NAME" != "$RNAME"; then
- echo "NAME in IDMETA ($NAME) does not match RPM spec NAME ($RNAME)"
- exit 1
- fi
- PRODUCT=$RNAME
- 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
- 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
- centos=false
-fi
-TAR=${PRODUCT}-${VERSION}.tar.gz
-
-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
- fi
-
- 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 $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
- 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 " failed. Inspect ~/rpmbuild/$r/build.log"
- exit 1
- fi
- done
-fi
-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 ! ${ID_DEB_BUILD}/id-mk-deb-changelog.sh; then
- echo "id-mk-deb-changelog.sh failed"
- fi
- 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 grep "Architecture: all" $DSC >/dev/null; then
- USE_ARCHS=i386
- else
- USE_ARCHS=$ARCHS
- 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
- 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
- done
- done
-fi
-
-# Local Variables:
-# mode:shell-script
-# sh-indentation: 4
-# sh-basic-offset: 4
-# End:
-
+++ /dev/null
-# The distribution should be correct in your changelog file.
-# Uncomment this line to use the one listed there:
-# https://wiki.ubuntu.com/PbuilderHowto
-#DIST=`dpkg-parsechangelog | awk '/^Distribution: / {print $2}'`
-
-# : ${DIST:=$(lsb_release --short --codename)}
-# : ${ARCH:=$(dpkg --print-architecture)}
-NAME="$DIST-$ARCH"
-DISTRIBUTION="$DIST"
-# We avoid keyring in assignment below. bug 4122
-DEBOOTSTRAPOPTS=("--arch" "$ARCH" --variant=buildd)
-BASETGZ="`dirname $BASETGZ`/$NAME-base.tgz"
-#BUILDRESULT="/var/cache/pbuilder/$NAME/result/"
-BUILDRESULT="$NAME"
-APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
-ALLOWUNTRUSTED=yes
-CCACHEDIR=
-
-# See https://www.mail-archive.com/debian-bugs-closed@lists.debian.org/msg445261.html --malc
-USENETWORK=yes
-
-# http://releases.ubuntu.com/releases/
-case "$DIST" in
- xenial|wily|vivid|utopic|trusty|saucy|raring|quantal|precise|oneiric|natty|maverick|lucid|karmic) # ubuntu specific
- # MIRRORSITE="http://ftp.df.lth.se/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"
- ;;
- jessie|wheezy|squeeze|lenny|etch) # debian specific
- MIRRORSITE="http://ftp.se.debian.org/debian/"
- COMPONENTS="main contrib non-free"
- OTHERMIRROR="deb http://ftp.indexdata.dk/debian $DIST main"
- ;;
- *)
- echo "Unknown distribution: $DIST"
- exit 1
- ;;
-esac