linux.debian-sid.script.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/sh
  2. set -e
  3. : ${TARGET_ARCH:=amd64}
  4. BASETGZ="$HOME/pbuilder-bases/debian-sid-$TARGET_ARCH.tgz"
  5. MIRROR=http://cdn-fastly.deb.debian.org/debian
  6. KEYRING=/usr/share/keyrings/debian-archive-keyring.gpg
  7. if [ -z "$TRAVIS_TAG" ]
  8. then
  9. sudo \
  10. sh -c "echo CCACHEDIR=$HOME/.ccache >> /etc/pbuilderrc"
  11. fi
  12. if [ "$CC" = clang ]
  13. then
  14. sudo sh -c "echo EXTRAPACKAGES=clang >> /etc/pbuilderrc"
  15. fi
  16. if [ ! -e "$BASETGZ.stamp" ]
  17. then
  18. mkdir -p "$HOME/pbuilder-bases"
  19. sudo pbuilder --create --basetgz "$BASETGZ" --mirror $MIRROR \
  20. --distribution sid --architecture $TARGET_ARCH \
  21. --debootstrapopts --variant=buildd \
  22. --debootstrapopts --keyring=$KEYRING \
  23. --debootstrapopts --include=perl
  24. touch "$BASETGZ.stamp"
  25. else
  26. sudo pbuilder --update --basetgz "$BASETGZ"
  27. fi
  28. sync_version() {
  29. local VERSION
  30. local MMR
  31. local STAGE
  32. local EXTRA
  33. VERSION=$(git describe --tags --match v[0-9].[0-9].[0-9]*)
  34. VERSION=${VERSION#v}
  35. MMR=${VERSION%%-*}
  36. case $VERSION in
  37. *-*-*-*)
  38. VERSION=${VERSION%-*}
  39. STAGE=${VERSION#*-}
  40. STAGE=${STAGE%-*}
  41. EXTRA=${VERSION##*-}
  42. VERSION=$MMR~$STAGE.$EXTRA
  43. ;;
  44. *-*-*)
  45. VERSION=${VERSION%-*}
  46. EXTRA=${VERSION##*-}
  47. VERSION=$MMR.$EXTRA
  48. ;;
  49. *-*)
  50. STAGE=${VERSION#*-}
  51. VERSION=$MMR~$STAGE
  52. ;;
  53. esac
  54. sed "1 s/@VERSION@/$VERSION/" -i debian/changelog
  55. echo Set Debian version to $VERSION
  56. }
  57. sync_version
  58. DIR="$PWD"
  59. cd ..
  60. dpkg-source -b "$DIR"
  61. env -i CC="$CC" CXX="$CXX" sudo pbuilder --build --debbuildopts "--jobs=auto" \
  62. --basetgz "$BASETGZ" ./*.dsc