Source files of fsfe.org, pdfreaders.org, freeyourandroid.org, ilovefs.org, drm.info, and test.fsfe.org. Contribute: https://fsfe.org/contribute/web/
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.

stirrups.sh 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/bin/sh
  2. inc_stirrups=true
  3. [ -z "$inc_misc" ] && . "$basedir/build/misc.sh"
  4. # [ -z "$inc_sources" ] && . "$basedir/build/sources.sh"
  5. validate_caches(){
  6. # outdate / remove cache files if necessary
  7. # hook functions here as required
  8. # validate_tagmap # hook from sources.sh
  9. true
  10. }
  11. dir_maker(){
  12. # set up directory tree for output
  13. # optimise by only issuing mkdir commands
  14. # for leaf directories
  15. input="${1%/}"
  16. output="${2%/}"
  17. curpath="$output"
  18. find "$input" -depth -type d \
  19. \! -path '*/.svn' \! -path '*/.svn/*' \
  20. \! -path '*/.git' \! -path '*/.git/*' \
  21. -printf '%P\n' \
  22. | while read filepath; do
  23. oldpath="$curpath"
  24. curpath="$output/$filepath/"
  25. srcdir="$output/source/$filepath/"
  26. match "$oldpath" "^$curpath" || mkdir -p "$curpath" "$srcdir"
  27. done
  28. }
  29. build_manifest(){
  30. # read a Makefile from stdin and generate
  31. # list of all make tagets
  32. sed -nr 's;\\ ; ;g;
  33. s;\\#;#;g;
  34. s;\$\{OUTPUTDIR\}/([^:]+):.*;\1;p'
  35. }
  36. remove_orphans(){
  37. # read list of files which should be in a directory tree
  38. # and remove everything else
  39. dtree="${1%/}"
  40. # Idea behind the algorithm:
  41. # `find` will list every existing file once.
  42. # The manifest of all make targets will list all wanted files once.
  43. # Concatenate all lines from manifest and `find`.
  44. # Every file which is listed twice is wanted and exists.
  45. # We use 'uniq -u' to drop those from the list.
  46. # Remaining single files exist only in the tree and are to be
  47. # removed (or were just added to the manifest and cannot be removed
  48. # from the tree)
  49. (find "$dtree" \( -type f -o -type l \) -printf '%P\n' ; cat) \
  50. | sort \
  51. | uniq -u \
  52. | while read file; do
  53. rm -v "$dtree/$file"
  54. done
  55. }
  56. wakeup_news(){
  57. # Performs a `touch` on all files which are to be released at the
  58. # presented date.
  59. today="$1"
  60. find "$basedir" -name '*.xml' \
  61. | xargs egrep -l "<[^>]+ date=[\"']${today}[\"'][^>]*>" \
  62. | xargs touch -c 2>&- || true
  63. }