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.

127 lines
3.6 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/Check-PkgFormat
  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" = "-all" ] ; then
  25. $0 -repository `ls package/. | egrep -v '(CVS|\.svn)'`
  26. exit 0
  27. fi
  28. if [ "$1" = "-repository" ] ; then
  29. shift ; for y ; do
  30. for x in package/$y/[a-z0-9]* ; do
  31. [ -f "$x/${x##*/}.desc" ] && $0 ${x##*/}
  32. done
  33. done
  34. exit 0
  35. fi
  36. if [ "$1" != "${1#-}" -o $# -eq 0 ] ; then
  37. echo "Usage: $0 <package-names>"
  38. echo "or $0 -repository <repository-names>"
  39. echo "or $0 -all"
  40. exit 1
  41. fi
  42. for package ; do
  43. lastpdir=""
  44. for pdir in package/*/$package ; do
  45. [ -f $pdir/$package.desc ] || continue
  46. [ "$lastpdir" ] && echo "$package: Found dup: $pdir $lastpdir"
  47. lastpdir="$pdir"
  48. done
  49. if [ -z "$lastpdir" ] ; then
  50. pdir="..."
  51. else
  52. pdir="$lastpdir"
  53. fi
  54. if [ -f $pdir/$package.conf ] ; then
  55. if egrep -q '^[^#]*\bflistdel' $pdir/$package.conf ; then
  56. echo "$package: Use of \$flistdel is evil!"
  57. fi
  58. fi
  59. if [ -f $pdir/$package.desc ] ; then
  60. grep '[^ ]' $pdir/$package.desc | \
  61. egrep -v '^(\[[A-Z0-9-]+\]( |$)|#)' | \
  62. sed "s,^,$package: Syntax error in $package.desc: ,"
  63. egrep '^\[[A-Z0-9-]+\]( |$)' $pdir/$package.desc | \
  64. tr '[]' '||' | cut -f2 -d'|' | \
  65. while read tag ; do
  66. grep -q "\\[$tag\\]" Documentation/Developers/$(
  67. )PKG-DESC-FORMAT && continue
  68. [ "${tag#X-}" != "$tag" ] && continue
  69. echo "$package: Unknown tag in $package.desc: [$tag]"
  70. done
  71. for x in `egrep '^\[(C|CATEGORY)\]' $pdir/$package.desc | \
  72. cut -f2- -d']'` ; do
  73. egrep -q "^$x( |$)" Documentation/Developers/$(
  74. )PKG-CATEGORIES && continue
  75. echo "$package: Unknown package category: $x"
  76. done
  77. for x in `egrep '^\[(F|FLAG)\]' $pdir/$package.desc | \
  78. cut -f2- -d']'` ; do
  79. egrep -q "^$x " Documentation/Developers/$(
  80. )PKG-FLAGS && continue
  81. echo "$package: Unknown package flag: $x"
  82. done
  83. for x in `egrep '^\[(S|STATUS)\]' $pdir/$package.desc | \
  84. cut -f2- -d']'` ; do
  85. case $x in
  86. Alpha|Beta|Gamma|Stable) ;;
  87. *) echo "$package: Unknown package" \
  88. "status: $x" ;;
  89. esac
  90. done
  91. for x in `egrep '^\[(L|LICENSE)\]' $pdir/$package.desc | \
  92. cut -f2- -d']'` ; do
  93. case $x in
  94. Unknown|GPL|LGPL|MPL|FDL|MIT|BSD) ;;
  95. OpenSource|Free-to-use|Commercial) ;;
  96. IBM-Public-License) ;;
  97. *) echo "$package: Unknown package" \
  98. "license: $x" ;;
  99. esac
  100. done
  101. grep '^\[.*(\*)$' Documentation/Developers/PKG-DESC-FORMAT |
  102. sed 's/. ./|/g; s/|\*)//; s/^\[//;' | \
  103. while read line ; do
  104. egrep -q "^\[($line)\]" $pdir/$package.desc ||
  105. echo "$package: No [$line] tag found."
  106. done
  107. else
  108. echo "$package: File not found: $pdir/$package.desc"
  109. fi
  110. if [ -f $pdir/$package.conf ] ; then
  111. bash -n $pdir/$package.conf 2>&1 | sed "s,^,$package: ,"
  112. fi
  113. done