xul2xhtml.sh 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/bash
  2. GIT_REPO=https://gitlab.com/frg/seamonkey-central-patches.git
  3. # Uncomment the following line to ignore the GIT patch queue when
  4. # creating the patches.
  5. #GIT_REPO=
  6. ERROR=0
  7. rm -rf /tmp/comm-xul$$ /tmp/git-xul$$
  8. pushd /tmp
  9. hg clone https://hg.mozilla.org/comm-central/ /tmp/comm-xul$$ || ERROR=1
  10. if [ $ERROR -eq 1 ]
  11. then
  12. rm -rf /tmp/*-xul$$
  13. echo "failed to clone comm-central"
  14. exit 1
  15. fi
  16. if [ "$GIT_REPO" != "" ]
  17. then
  18. mkdir /tmp/git-xul$$
  19. cd /tmp/git-xul$$
  20. git clone $GIT_REPO || ERROR=1
  21. if [ $ERROR -eq 1 ]
  22. then
  23. rm -rf /tmp/*-xul$$
  24. echo "failed to clone git patch queue"
  25. exit 1
  26. fi
  27. cd /tmp/comm-xul$$
  28. if [ -s /tmp/git-xul$$/seamonkey-central-patches/comm-central/patches/series ]
  29. then
  30. for i in `cat /tmp/git-xul$$/seamonkey-central-patches/comm-central/patches/series`
  31. do
  32. if [ "${i:0:12}" = "TOP-1611647-" ]
  33. then
  34. break
  35. fi
  36. hg import /tmp/git-xul$$/seamonkey-central-patches/comm-central/patches/$i || ERROR=1
  37. if [ $ERROR -eq 1 ]
  38. then
  39. rm -rf /tmp/*xul$$
  40. echo "failure applying $i"
  41. exit 1
  42. fi
  43. done
  44. fi
  45. fi
  46. cd /tmp/comm-xul$$
  47. find suite -name '*.xul' -print > /tmp/filelist$$
  48. for i in `sed -e 's@\.xul$@@' /tmp/filelist$$`
  49. do
  50. hg mv $i.xul $i.xhtml
  51. done
  52. hg commit -q -m "Bug 1611647 - Port bug 1579952 - Mass rename .xul files to .xhtml in suite."
  53. CHANGESET_1=`hg history -l 1 | grep changeset | sed -e 's@changeset:[ ]*@@'`
  54. find suite -type f -exec grep '\.xul\b' {} \; -a -print > /tmp/filelist$$
  55. for i in `grep '^suite' /tmp/filelist$$`
  56. do
  57. sed -e 's@\.xul @.xhtml @g' -e 's@\.xul\. @.xhtml. @g' -e 's@\.xul\b@.xhtml@g' < $i > $i.$$
  58. sed -e 's@there\.is\.only\.xhtml@there.is.only.xul@' -e 's@vnd\.mozilla\.xhtml+xml@vnd.mozilla.xul+xml@' < $i.$$ > $i
  59. rm $i.$$
  60. done
  61. rm /tmp/filelist$$
  62. hg commit -q -m "Bug 1611647 - Port bug 1579952 - Fix references to xul files in suite."
  63. CHANGESET_2=`hg history -l 1 | grep changeset | sed -e 's@changeset:[ ]*@@'`
  64. popd
  65. hg export -R /tmp/comm-xul$$ $CHANGESET_1 > TOP-1611647-1-rename-xul-suite.patch
  66. hg export -R /tmp/comm-xul$$ $CHANGESET_2 > TOP-1611647-2-fix-xul-references-suite.patch
  67. rm -rf /tmp/comm-xul$$ /tmp/git-xul$$