dailys.sh 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. ##### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
  3. src_repo="$(pwd)"
  4. if [ ! -d .git ]; then
  5. echo "error: must be run from within the top level of a FreeSWITCH git tree." 1>&2
  6. exit 1;
  7. fi
  8. if [ -z "$1" ]; then
  9. echo "usage: ./scripts/dailys.sh MAJOR.MINOR.MICRO[.REVISION] BUILD_NUMBER" 1>&2
  10. exit 1;
  11. fi
  12. ver="$1"
  13. major=$(echo "$ver" | cut -d. -f1)
  14. minor=$(echo "$ver" | cut -d. -f2)
  15. micro=$(echo "$ver" | cut -d. -f3)
  16. rev=$(echo "$ver" | cut -d. -f4)
  17. build="$2"
  18. dst_name="freeswitch-$major.$minor.$micro"
  19. dst_parent="/tmp/"
  20. dst_dir="/tmp/$dst_name"
  21. if [ -d "$dst_dir" ]; then
  22. echo "error: destination directory $dst_dir already exists." 1>&2
  23. exit 1;
  24. fi
  25. # save local changes
  26. #ret=$(git stash save "Save uncommitted changes before tagging.")
  27. #if echo $ret | grep "^Saved"; then
  28. #stash_saved=1
  29. #fi
  30. sed -e "s|\(AC_SUBST(SWITCH_VERSION_MAJOR, \[\).*\(\])\)|\1$major\2|" \
  31. -e "s|\(AC_SUBST(SWITCH_VERSION_MINOR, \[\).*\(\])\)|\1$minor\2|" \
  32. -e "s|\(AC_SUBST(SWITCH_VERSION_MICRO, \[\).*\(\])\)|\1$micro\2|" \
  33. -e "s|\(AC_INIT(\[freeswitch\], \[\).*\(\], BUG-REPORT-ADDRESS)\)|\1$major.$minor.$micro\2|" \
  34. -i configure.ac
  35. if [ -n "$rev" ]; then
  36. sed -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION, \[\).*\(\])\)|\1$rev\2|" \
  37. -e "s|\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, \[\).*\(\])\)|\1$rev\2|" \
  38. -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION\)|\1|" \
  39. -e "s|#\(AC_SUBST(SWITCH_VERSION_REVISION_HUMAN\)|\1|" \
  40. -i configure.ac
  41. fi
  42. #git add configure.ac
  43. #git commit -m "Release freeswitch-$ver"
  44. #git tag -a -m "freeswitch-$ver release" v$ver
  45. #git clone $src_repo $dst_dir
  46. #if [ -n "$stash_saved" ]; then
  47. # git stash pop
  48. #fi
  49. cp -r . $dst_dir
  50. cd $dst_dir
  51. ./bootstrap.sh
  52. mv bootstrap.sh rebootstrap.sh
  53. rm -f docs/AUTHORS
  54. rm -f docs/COPYING
  55. rm -f docs/ChangeLog
  56. rm -rf .git
  57. cd ..
  58. cd $dst_parent
  59. tar -cvf $dst_name.tar $dst_name
  60. # gzip -9 -c $dst_name.tar > $dst_name.tar.gz || echo "gzip not available"
  61. bzip2 -z -k $dst_name.tar || echo "bzip2 not available"
  62. # xz -z -9 -k $dst_name.tar || echo "xz / xz-utils not available"
  63. rm -rf $dst_name.tar $dst_dir
  64. mkdir -p $src_repo/rpmbuild/{SOURCES,BUILD,BUILDROOT,i386,x86_64,SOURCES,SPECS}
  65. mv -f $dst_name.tar.* $src_repo/rpmbuild/SOURCES/.
  66. cd $src_repo/rpmbuild/SOURCES
  67. for i in `grep 'Source..\?:' $src_repo/freeswitch.spec|grep -v Source0 |awk '{print $2}'`; do wget $i; done
  68. cd $src_repo
  69. rpmbuild --define "VERSION_NUMBER $ver" \
  70. --define "BUILD_NUMBER $build" \
  71. --define "_topdir %(pwd)/rpmbuild" \
  72. --define "_rpmdir %{_topdir}" \
  73. --define "_srcrpmdir %{_topdir}" \
  74. -ba freeswitch.spec
  75. # --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
  76. # --define "_sourcedir %{_topdir}" \
  77. # --define "_builddir %{_topdir}" \
  78. mkdir $src_repo/RPMS
  79. mv $src_repo/rpmbuild/*/*.rpm $src_repo/RPMS/.
  80. cat 1>&2 <<EOF
  81. ----------------------------------------------------------------------
  82. The v$ver-$build tarballs and RPMs have been rolled, now we
  83. just need to roll packages with them
  84. ----------------------------------------------------------------------
  85. EOF