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.

73 lines
2.3 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/Create-DescPatch
  11. # ROCK Linux is Copyright (C) 1998 - 2003 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. if [ "$1" = "-repository" ] ; then
  25. shift ; for y ; do
  26. for x in package/$y/[a-z0-9]* ; do $0 ${x##*/} ; done
  27. done
  28. exit 0
  29. fi
  30. if [ "$1" != "${1#-}" -o $# -eq 0 ] ; then
  31. echo
  32. echo "Usage: $0 <package(s)>"
  33. echo "or $0 -repository <repositories>"
  34. echo
  35. echo " \"Normalize\" package .desc files for single packages or repositories:"
  36. echo " group tags as described in Documentation/Developers/PKG-DESC-FORMAT,"
  37. echo " and remove extra empty lines and commented out tags."
  38. echo " The files are not modified directly, instead a patch is ouput that"
  39. echo " can be used to apply changes."
  40. echo
  41. exit 1
  42. fi
  43. for package ; do
  44. lastpdir=""
  45. for pdir in package/*/$package ; do
  46. [ "$lastpdir" ] && echo "$package: Found dup: $pdir $lastpdir"
  47. lastpdir="$pdir"
  48. done
  49. if [ -f $pdir/$package.desc ] && ! grep -q '^#if' $pdir/$package.desc; then
  50. tempfn=`mktemp`
  51. { echo ; nl=0
  52. while read line ; do
  53. if [ "$line" = "--" -a "$nl" = 0 ] ; then
  54. echo ; nl=1
  55. fi
  56. if [ "${line#\[}" != "$line" ] ; then
  57. for x in $line ; do
  58. x="`echo $x | tr -d '[]'`"
  59. grep "^\[$x\]" $pdir/$package.desc && nl=0
  60. done
  61. fi
  62. done < Documentation/Developers/PKG-DESC-FORMAT
  63. if [ "$nl" = 0 ] ; then echo ; fi
  64. grep "^\[X" $pdir/$package.desc && echo
  65. } > $tempfn
  66. diff -u ./$pdir/$package.desc $tempfn
  67. rm -f $tempfn
  68. fi
  69. done