prepare_ubuntu_pkgs_for_ppa.sh 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/bash
  2. # Creates a set of packages for each different Ubuntu distribution, with the
  3. # intention of uploading them to:
  4. # https://launchpad.net/~joseluisblancoc/+archive/nanoflann
  5. #
  6. # JLBC, 2010-2011
  7. # Checks
  8. # --------------------------------
  9. if [ -f version ];
  10. then
  11. NANOFLANN_VERSION_STR=`cat version`
  12. NANOFLANN_VERSION_MAJOR=${NANOFLANN_VERSION_STR:0:1}
  13. NANOFLANN_VERSION_MINOR=${NANOFLANN_VERSION_STR:2:1}
  14. NANOFLANN_VERSION_PATCH=${NANOFLANN_VERSION_STR:4:1}
  15. AUX_SVN=$(svnversion)
  16. #Remove the trailing "M":
  17. NANOFLANN_VERSION_SVN=${AUX_SVN%M}
  18. NANOFLANN_VER_MM="${NANOFLANN_VERSION_MAJOR}.${NANOFLANN_VERSION_MINOR}"
  19. NANOFLANN_VER_MMP="${NANOFLANN_VERSION_MAJOR}.${NANOFLANN_VERSION_MINOR}.${NANOFLANN_VERSION_PATCH}"
  20. echo "nanoflann version: ${NANOFLANN_VER_MMP} (SVN: ${NANOFLANN_VERSION_SVN})"
  21. else
  22. echo "ERROR: Run this script from the nanoflann root directory."
  23. exit 1
  24. fi
  25. NANOFLANN_UBUNTU_OUT_DIR="$HOME/nanoflann_ubuntu"
  26. NANOFLANNSRC=`pwd`
  27. NANOFLANN_DEB_DIR="$HOME/nanoflann_debian"
  28. NANOFLANN_EXTERN_DEBIAN_DIR="$NANOFLANNSRC/packaging/debian/"
  29. EMAIL4DEB="Jose Luis Blanco (University of Malaga) <joseluisblancoc@gmail.com>"
  30. # Clean out dirs:
  31. rm -fr $NANOFLANN_UBUNTU_OUT_DIR/
  32. # -------------------------------------------------------------------
  33. # And now create the custom packages for each Ubuntu distribution
  34. # -------------------------------------------------------------------
  35. LST_DISTROS=(bionic focal)
  36. count=${#LST_DISTROS[@]}
  37. IDXS=$(seq 0 $(expr $count - 1))
  38. cp ${NANOFLANN_EXTERN_DEBIAN_DIR}/changelog /tmp/my_changelog
  39. for IDX in ${IDXS};
  40. do
  41. DEBIAN_DIST=${LST_DISTROS[$IDX]}
  42. # -------------------------------------------------------------------
  43. # Call the standard "prepare_debian.sh" script:
  44. # -------------------------------------------------------------------
  45. cd ${NANOFLANNSRC}
  46. bash scripts/prepare_debian.sh -u -d ${DEBIAN_DIST} # -s
  47. echo
  48. echo "===== Distribution: ${DEBIAN_DIST} ========="
  49. cd ${NANOFLANN_DEB_DIR}/nanoflann-${NANOFLANN_VER_MMP}${DEBIAN_DIST}/debian
  50. cp /tmp/my_changelog changelog
  51. DEBCHANGE_CMD="--newversion ${NANOFLANN_VERSION_STR}${DEBIAN_DIST}-1~ppa1~${DEBIAN_DIST}"
  52. echo "Changing to a new Debian version: ${DEBCHANGE_CMD}"
  53. echo "Adding a new entry to debian/changelog for distribution ${DEBIAN_DIST}"
  54. DEBEMAIL=${EMAIL4DEB} debchange $DEBCHANGE_CMD -b --distribution ${DEBIAN_DIST} --force-distribution New version of upstream sources.
  55. cp changelog /tmp/my_changelog
  56. echo "Now, let's build the source Deb package with 'debuild -S -sa':"
  57. cd ..
  58. debuild -S -sa
  59. # Make a copy of all these packages:
  60. cd ..
  61. mkdir -p $NANOFLANN_UBUNTU_OUT_DIR/$DEBIAN_DIST
  62. cp nanoflann_* $NANOFLANN_UBUNTU_OUT_DIR/$DEBIAN_DIST/
  63. echo ">>>>>> Saving packages to: $NANOFLANN_UBUNTU_OUT_DIR/$DEBIAN_DIST/"
  64. done
  65. exit 0