build_deb.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/usr/bin/env bash
  2. ### Bash Environment Setup
  3. # http://redsymbol.net/articles/unofficial-bash-strict-mode/
  4. # https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
  5. # set -o xtrace
  6. set -o errexit
  7. set -o errtrace
  8. set -o nounset
  9. set -o pipefail
  10. IFS=$'\n'
  11. REPO_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd .. && pwd )"
  12. if [[ -f "$REPO_DIR/.venv/bin/activate" ]]; then
  13. source "$REPO_DIR/.venv/bin/activate"
  14. else
  15. echo "[!] Warning: No virtualenv presesnt in $REPO_DIR.venv"
  16. fi
  17. cd "$REPO_DIR"
  18. CURRENT_PLAFORM="$(uname)"
  19. REQUIRED_PLATFORM="Linux"
  20. if [[ "$CURRENT_PLAFORM" != "$REQUIRED_PLATFORM" ]]; then
  21. echo "[!] Skipping the Debian package build on $CURRENT_PLAFORM (it can only be run on $REQUIRED_PLATFORM)."
  22. exit 0
  23. fi
  24. VERSION="$(jq -r '.version' < "$REPO_DIR/package.json")"
  25. DEBIAN_VERSION="1"
  26. PGP_KEY_ID="7D5695D3B618872647861D51C38137A7C1675988"
  27. # make sure you have this in ~/.dput.cf:
  28. # [archivebox-ppa]
  29. # fqdn: ppa.launchpad.net
  30. # method: ftp
  31. # incoming: ~archivebox/ubuntu/archivebox/
  32. # login: anonymous
  33. # allow_unsigned_uploads: 0
  34. # cleanup build artifacts
  35. rm -Rf build deb_dist dist archivebox-*.tar.gz
  36. # make sure the stdeb.cfg file is up-to-date with all the dependencies
  37. # build source and binary packages
  38. python3 setup.py --command-packages=stdeb.command \
  39. sdist_dsc --debian-version=$DEBIAN_VERSION \
  40. bdist_deb
  41. # sign the build with your PGP key ID
  42. debsign -k "$PGP_KEY_ID" "deb_dist/archivebox_${VERSION}-${DEBIAN_VERSION}_source.changes"
  43. # push the build to launchpad ppa
  44. # dput archivebox "deb_dist/archivebox_${VERSION}-${DEBIAN_VERSION}_source.changes"