mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

222 lines
6.0 KiB

  1. #!/bin/bash
  2. #
  3. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  4. #
  5. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  6. # Please add additional copyright information _after_ the line containing
  7. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  8. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  9. #
  10. # ROCK Linux: rock-src/scripts/Internal
  11. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  12. #
  13. # This program is free software; you can redistribute it and/or modify
  14. # it under the terms of the GNU General Public License as published by
  15. # the Free Software Foundation; either version 2 of the License, or
  16. # (at your option) any later version. A copy of the GNU General Public
  17. # License can be found at Documentation/COPYING.
  18. #
  19. # Many people helped and are helping developing ROCK Linux. Please
  20. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  21. # file for details.
  22. #
  23. # --- ROCK-COPYRIGHT-NOTE-END ---
  24. #
  25. # Internal contains functionality for maintaining ROCK Linux sources
  26. # and development.
  27. #
  28. #
  29. # Helper scripts for core developers
  30. #
  31. if [ "$1" = "svn-add-remove" ] ; then
  32. rm -f files_svn.txt files_local.txt
  33. for dir in \
  34. architecture misc scripts \
  35. Documentation package target
  36. do
  37. tmp1=`mktemp` tmp2=`mktemp`
  38. echo $dir > $tmp1
  39. while ! cmp -s $tmp1 $tmp2
  40. do
  41. cat $tmp1 > $tmp2
  42. find $( cat $tmp2 ) -maxdepth 1 -type d | \
  43. egrep -v '/(\.svn|CVS)$' 2> /dev/null | sort -u > $tmp1
  44. done
  45. find $( cat $tmp2 ) -mindepth 1 -maxdepth 1 -type d -name .svn | \
  46. while read dirname ; do
  47. grep ' name="' $dirname/entries | cut -f2 -d'"' | \
  48. grep -v ^svn: | sed "s,^,${dirname%/*}/,"
  49. done | grep "/" | sort >> files_svn.txt
  50. find $( cat $tmp2 ) -mindepth 1 -maxdepth 1 | \
  51. egrep -v '/(\.svn|CVS)' | grep -v '/\.$' | \
  52. sort >> files_local.txt
  53. rm -f $tmp1 $tmp2
  54. done
  55. if [ "$DO_SVN_REVERT" = 1 ]
  56. then
  57. diff -u0 files_svn.txt files_local.txt | \
  58. grep '^[+][A-Za-z]' | \
  59. egrep -xv '\+Documentation/(FAQ|LSM)' | \
  60. sed 's,^+,rm -vf ,'
  61. elif egrep -q '#|/\.|~' files_local.txt
  62. then
  63. echo '#'
  64. echo '# Found dangerous files which must not go to SVN:'
  65. echo '#'
  66. egrep '#|/\.|~' files_local.txt | sed 's,^,rm -vf ,'
  67. else
  68. diff -u0 files_svn.txt files_local.txt | \
  69. grep '^[-+][A-Za-z]' | \
  70. egrep -xv '\+Documentation/(FAQ|LSM)' | \
  71. sed 's,^-,svn remove ,; s,^+,svn add ,'
  72. fi
  73. rm -f files_svn.txt files_local.txt
  74. elif [ "$1" = "svn-commit" ] ; then
  75. ./scripts/Internal svn-add-remove | tee svn_add_remove.sh
  76. if [ -s svn_add_remove.sh ]
  77. then
  78. echo "Run 'sh svn_add_remove.sh' to execute these commands."
  79. else
  80. rm -f svn_add_remove.sh
  81. svn commit
  82. fi
  83. elif [ "$1" = "svn-revert" ] ; then
  84. svn revert -R .
  85. DO_SVN_REVERT=1 ./scripts/Internal svn-add-remove | tee svn_revert.sh
  86. if [ -s svn_revert.sh ]
  87. then
  88. echo "Run 'sh svn_revert.sh' to execute these commands."
  89. else
  90. rm -f svn_revert.sh
  91. fi
  92. elif [ "$1" = "cvs-add-remove" ] ; then
  93. rm -f files_cvs.txt files_local.txt
  94. for dir in \
  95. architecture misc scripts \
  96. Documentation package target
  97. do
  98. find $dir/. -type d -name CVS | \
  99. while read dirname ; do
  100. dirname=${dirname/\/./} ; echo ${dirname%/*}
  101. awk -F "/" '$1 == "" && $3 !~ /^-/ {
  102. print "'"${dirname%/*}"'/" $2; }' < $dirname/Entries
  103. done | grep "/" | sort >> files_cvs.txt
  104. find $dir/. | grep -v '/CVS' | grep -v '/\.$' | \
  105. sed 's,/./,/,' | sort >> files_local.txt
  106. done
  107. if egrep -q '#|/\.|~' files_local.txt
  108. then
  109. echo '#'
  110. echo '# Found dangerous files which must not go to CVS:'
  111. echo '#'
  112. egrep '#|/\.|~' files_local.txt | sed 's,^,rm -vf ,'
  113. else
  114. diff -u0 files_cvs.txt files_local.txt | \
  115. grep '^[-+][A-Za-z]' | \
  116. egrep -xv '\+Documentation/(FAQ|LSM)' | \
  117. sed 's,^-,cvs remove ,; s,^+,cvs add ,'
  118. fi
  119. rm -f files_cvs.txt files_local.txt
  120. elif [ "$1" = "cvs-commit" ] ; then
  121. ./scripts/Internal cvs-add-remove | tee cvs_add_remove.sh
  122. if [ -s cvs_add_remove.sh ]
  123. then
  124. echo "Run 'sh cvs_add_remove.sh' to execute these commands."
  125. else
  126. rm -f cvs_add_remove.sh
  127. cvs commit
  128. fi
  129. elif [ "$1" = "cvs-update" ] ; then
  130. cvs -q update -d -P
  131. elif [ "$1" = "cvs-setroot" -a -n "$2" -a -n "$3" ] ; then
  132. find ./CVS ./architecture ./misc ./scripts ./target ./Documentation \
  133. ./package -name Root | grep '/CVS/Root$' | while read fn
  134. do
  135. fn="${fn%/CVS/Root}"; fn="${fn#./}"
  136. echo "Writing $fn/CVS/{Root,Repository}.."
  137. echo "$2" > $fn/CVS/Root
  138. echo "$3/$fn" > $fn/CVS/Repository
  139. done
  140. elif [ "$1" = "ftp-cleanup" ] ; then
  141. echo "Writing to cleanups.sh ..."
  142. lastsnap=`mktemp`; echo -n > cleanups.sh
  143. wget -nv -O $lastsnap http://www.rocklinux.org/sources/download/INDEX
  144. while read filename; do
  145. if ! egrep -q " ${filename//bz2/(gz|bz2)} " $lastsnap; then
  146. echo "rm -vf $filename" >> cleanups.sh
  147. echo "rm -vf $filename"
  148. fi
  149. done < <( ./scripts/Download -list-unknown | cut -f3 -d' ' )
  150. rm -f $lastsnap
  151. else
  152. cat << "EOT"
  153. This is an internal Script. It is only used by the core developers.
  154. ./scripts/Internal {mode}
  155. Where the following modes are availalbe:
  156. svn-add-remove .... print suggested 'svn add' and 'svn remove' calls
  157. svn-commit ........ make a svn-add-remove and and automatically run a
  158. 'svn commit' if svn-add-remove doesn't find
  159. anything to add or remove.
  160. svn-revert ........ run a 'svn revert' and then remove all files which
  161. are not known to svn. Useful before doing an 'svn
  162. up' to ver version containing a patch which is
  163. applied in the working directory.
  164. cvs-add-remove .... print suggested 'cvs add' and 'cvs remove' calls
  165. cvs-commit ........ make a cvs-add-remove and and automatically run a
  166. 'cvs commit' if cvs-add-remove doesn't find
  167. anything to add or remove.
  168. cvs-update ........ run 'cvs update -d -P'
  169. cvs-setroot x y ... write 'x' to all CVS/Root files and 'y' to all
  170. CVS/Repository files.
  171. ftp-cleanup ....... remove old files on ftp master
  172. EOT
  173. fi