echo "Building Debian"
cd "$WORKSPACE"
-sudo $bindir/build_debs.sh ./release /srv/debian-base $vers
+# Before, at this point, this script called the below contents that
+# was part of /srv/ceph-buid/build_debs.sh. Now everything is in here, in one
+# place, no need to checkout/clone anything. WYSIWYG::
+#
+# sudo $bindir/build_debs.sh ./release /srv/debian-base $vers
+
+
+releasedir="./release"
+pbuilddir="/srv/debian-base"
+cephver=$vers
+
+start_time=`date`
+echo version $cephver
+
+whoami=`whoami`
+[ "$whoami" != "root" ] && echo "must run as root not $whoami" && usage && exit 1
+
+[ -z "$dists" ] && dists=`cat $releasedir/$cephver/debian_dists`
+dvers=`cat $releasedir/$cephver/debian_version`
+echo deb vers $dvers
+echo dists $dists
+
+for dist in $dists
+do
+ pbuilder --clean
+
+ bpvers=`$bindir/gen_debian_version.sh $dvers $dist`
+ echo deb vers $bpvers
+
+ echo building debs for $dist
+ if [ `dpkg-architecture -qDEB_BUILD_ARCH` = "i386" ] ; then
+ # Architecture dependent, independent and source
+ pbuilder build \
+ --distribution $dist \
+ --basetgz $pbuilddir/$dist.tgz \
+ --buildresult $releasedir/$cephver \
+ --debbuildopts "-j`grep -c processor /proc/cpuinfo`" \
+ $releasedir/$cephver/ceph_$bpvers.dsc
+ else
+ # Binary only architecture dependent
+ pbuilder build \
+ --binary-arch \
+ --distribution $dist \
+ --basetgz $pbuilddir/$dist.tgz \
+ --buildresult $releasedir/$cephver \
+ --debbuildopts "-j`grep -c processor /proc/cpuinfo`" \
+ $releasedir/$cephver/ceph_$bpvers.dsc
+ fi
+
+done
+
+# do lintian checks
+for dist in $dists
+do
+ bpvers=`$bindir/gen_debian_version.sh $dvers $dist`
+ echo lintian checks for $bpvers
+ echo lintian --allow-root $releasedir/$cephver/*$bpvers*.deb
+done
+
+echo "Start Time = $start_time"
+echo " End Time = $(date)"
+
#Collect Artifacts
mkdir -p dist/debian