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

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