merge.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # FIXME: do we need a license (or whatever else) header here?
  3. # This script merges libffi sources from upstream.
  4. # Default to the tip of master branch.
  5. commit=${1-master}
  6. fatal() {
  7. echo "$1"
  8. exit 1;
  9. }
  10. get_upstream() {
  11. rm -rf upstream
  12. git clone https://github.com/libffi/libffi.git upstream
  13. pushd upstream
  14. git checkout $commit || fatal "Failed to checkout $commit"
  15. popd
  16. }
  17. get_current_rev() {
  18. cd upstream
  19. git rev-parse HEAD
  20. }
  21. pwd | grep 'libffi$' || \
  22. fatal "Run this script from the libffi directory"
  23. get_upstream
  24. CUR_REV=$(get_current_rev)
  25. echo Current upstream revision: $CUR_REV
  26. # Remove the unused files.
  27. pushd upstream
  28. rm -rf ChangeLog.old .appveyor* .ci .github .gitignore .travis* \
  29. config.guess config.sub libtool-ldflags m4 make_sunver.pl \
  30. msvc_build
  31. rm -rf .git autogen.sh
  32. cp -a . ..
  33. popd
  34. rm -rf upstream
  35. # Update the MERGE file.
  36. cat << EOF > MERGE
  37. $CUR_REV
  38. The first line of this file holds the git revision number of the
  39. last merge done from the master library sources.
  40. EOF