gbp-configure-unpatched-source 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. #
  3. #
  4. # Setup dpkg-source and git to unpatch the source after the build and ignore
  5. # the .pc directory.
  6. GIT_EXCLUDE=.git/info/exclude
  7. LOCAL_OPTIONS=debian/source/local-options
  8. help ()
  9. {
  10. cat << EOF >/dev/stdout
  11. Modifies "$LOCAL_OPTIONS" and "$GIT_EXCLUDE"
  12. to ignore .pc and unpatch the source after the build.
  13. EOF
  14. exit $1
  15. }
  16. case $1 in
  17. -h|--help)
  18. help 0
  19. ;;
  20. esac
  21. if [ ! -d .git ]; then
  22. echo "Not the top of a git repository - aborting."
  23. help 1
  24. fi
  25. if ! grep -qs '^3.*\(quilt\)' debian/source/format; then
  26. echo "Not a source format 3 (quilt) package - aborting."
  27. help 1
  28. fi
  29. if ! grep -qs '^unapply-patches' $LOCAL_OPTIONS; then
  30. echo "Setting unapply-patches in $LOCAL_OPTIONS"
  31. echo "unapply-patches" >> $LOCAL_OPTIONS
  32. git add $LOCAL_OPTIONS
  33. git commit -m "Unapply patches from source" $LOCAL_OPTIONS
  34. else
  35. echo "unapply-patches already configured"
  36. fi
  37. if ! grep -qs "^\.pc/" $GIT_EXCLUDE; then
  38. echo "Adding .pc/ to $GIT_EXCLUDE"
  39. echo ".pc/" >> $GIT_EXCLUDE
  40. else
  41. echo "$GIT_EXCLUDE already configured"
  42. fi