diff --git a/scripts/ci/common.sh b/scripts/ci/common.sh index 75236302d0..a570cd8008 100755 --- a/scripts/ci/common.sh +++ b/scripts/ci/common.sh @@ -50,6 +50,29 @@ parse_version () { echo "crev='$crev'" } +set_fs_ver () { + local ver="$1" major="$2" minor="$3" micro="$4" rev="$5" + sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \ + -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \ + -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$ver\2|" \ + -i configure.in + if [ -n "$rev" ]; then + sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \ + -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \ + -i configure.in + fi +} + +gnuize () { + ./bootstrap.sh -j + mv bootstrap.sh rebootstrap.sh + rm -f docs/AUTHORS + rm -f docs/COPYING + rm -f docs/ChangeLog + rm -rf .git +} + if [ ! -d .git ]; then echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2 exit 1; diff --git a/scripts/ci/debsrcbuilder.sh b/scripts/ci/debsrcbuilder.sh index 2941543f4c..647efa834e 100755 --- a/scripts/ci/debsrcbuilder.sh +++ b/scripts/ci/debsrcbuilder.sh @@ -9,49 +9,42 @@ eval $(parse_version "$1") datestamp="$(date +%Y%m%dT%H%M%SZ)" nightly="n${datestamp}" build="b$2" -input_distro=$3 -distro=${input_distro:="unstable"} +distro=${3:="unstable"} -dst_version="$ver" -dst_name="freeswitch-${dst_version}" -dst_parent="/tmp/" -dst_dir="/tmp/${dst_name}" -dst_full_version="${dst_version}~${nightly}~${build}" -dst_full_name="freeswitch-${dst_full_version}" +fver="${ver}~${nightly}~${build}" +fname="freeswitch-$fver" +orig="freeswitch_$fver.orig" +ddir=$src_repo/debbuild +bdir=$src_repo/debbuild/$fname -mkdir -p $src_repo/debbuild/ +mkdir -p $ddir +git clone . $bdir +cd $bdir +set_fs_ver "$ver" "$major" "$minor" "$micro" "$rev" +gnuize +sleep 2 +cd $ddir +tar -c --exclude=.git -vf $orig.tar $fname +bzip2 -z -k $orig.tar +rm $orig.tar -tar xjf src_dist/${dst_name}.tar.bz2 -C ${src_repo}/debbuild/ -mv ${src_repo}/debbuild/${dst_name} ${src_repo}/debbuild/${dst_full_name} -cp -al src_dist/${dst_name}.tar.bz2 \ - ${src_repo}/debbuild/freeswitch_${dst_full_version}.orig.tar.bz2 - -# Build the debian source package first, from the source tar file. -echo "changing directory to ${src_repo}/debbuild/${dst_full_name}" - -cd ${src_repo}/debbuild/${dst_full_name} +cd $bdir (cd debian && ./bootstrap.sh) # dch can't handle comments in control file (cd debian; \ mv control control.orig; \ grep -e '^#' -v control.orig > control) # dependency: libparse-debcontrol-perl -dch -b -v "${dst_full_version}-1" \ +dch -b -v "${fver}-1" \ -M --force-distribution -D "$distro" \ "Nightly build at ${datestamp}." # dependency: fakeroot -dpkg-buildpackage -rfakeroot -S -us -uc +dpkg-buildpackage -rfakeroot -S -us -uc || exit $? -status=$? - -if [ $status -gt 0 ]; then - exit $status -else - cat 1>&2 <&2 < $dst_name.tar.gz || echo "gzip not available" bzip2 -z -k ${dst_name}.tar || echo "bzip2 not available" -[ "$dst_name" = "$dst_cname" ] || cp -al ${dst_name}.tar.bz2 ${dst_cname}.tar.bz2 # xz -z -9 -k ${dst_name}.tar || echo "xz / xz-utils not available" rm -rf ${dst_name}.tar $dst_dir mkdir -p ${src_repo}/src_dist mv -f ${dst_name}.tar.* ${src_repo}/src_dist -[ "$dst_name" = "$dst_cname" ] || mv -f ${dst_cname}.tar.* ${src_repo}/src_dist cat 1>&2 <