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.

131 lines
3.8 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 - 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. 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. echo
  41. echo " Do a few very simple tests to auto-detect errors in the package *.desc and"
  42. echo " *.conf files."
  43. echo " Run tests on single packages, repositories, or all packages."
  44. exit 1
  45. fi
  46. for package ; do
  47. lastpdir=""
  48. for pdir in package/*/$package ; do
  49. [ -f $pdir/$package.desc ] || continue
  50. [ "$lastpdir" ] && echo "$package: Found dup: $pdir $lastpdir"
  51. lastpdir="$pdir"
  52. done
  53. if [ -z "$lastpdir" ] ; then
  54. pdir="..."
  55. else
  56. pdir="$lastpdir"
  57. fi
  58. if [ -f $pdir/$package.conf ] ; then
  59. if egrep -q '^[^#]*\bflistdel' $pdir/$package.conf ; then
  60. echo "$package: Use of \$flistdel is evil!"
  61. fi
  62. fi
  63. if [ -f $pdir/$package.desc ] ; then
  64. grep '[^ ]' $pdir/$package.desc | \
  65. egrep -v '^(\[[A-Z0-9-]+\]( |$)|#)' | \
  66. sed "s,^,$package: Syntax error in $package.desc: ,"
  67. egrep '^\[[A-Z0-9-]+\]( |$)' $pdir/$package.desc | \
  68. tr '[]' '||' | cut -f2 -d'|' | \
  69. while read tag ; do
  70. grep -q "\\[$tag\\]" Documentation/Developers/$(
  71. )PKG-DESC-FORMAT && continue
  72. [ "${tag#X-}" != "$tag" ] && continue
  73. echo "$package: Unknown tag in $package.desc: [$tag]"
  74. done
  75. for x in `egrep '^\[(C|CATEGORY)\]' $pdir/$package.desc | \
  76. cut -f2- -d']'` ; do
  77. egrep -q "^$x( |$)" Documentation/Developers/$(
  78. )PKG-CATEGORIES && continue
  79. echo "$package: Unknown package category: $x"
  80. done
  81. for x in `egrep '^\[(F|FLAG)\]' $pdir/$package.desc | \
  82. cut -f2- -d']'` ; do
  83. egrep -q "^$x " Documentation/Developers/$(
  84. )PKG-FLAGS && continue
  85. echo "$package: Unknown package flag: $x"
  86. done
  87. for x in `egrep '^\[(S|STATUS)\]' $pdir/$package.desc | \
  88. cut -f2- -d']'` ; do
  89. case $x in
  90. Alpha|Beta|Gamma|Stable) ;;
  91. *) echo "$package: Unknown package" \
  92. "status: $x" ;;
  93. esac
  94. done
  95. for x in `egrep '^\[(L|LICENSE)\]' $pdir/$package.desc | \
  96. cut -f2- -d']'` ; do
  97. case $x in
  98. Unknown|GPL|LGPL|MPL|FDL|MIT|BSD) ;;
  99. OpenSource|Free-to-use|Commercial) ;;
  100. IBM-Public-License) ;;
  101. *) echo "$package: Unknown package" \
  102. "license: $x" ;;
  103. esac
  104. done
  105. grep '^\[.*(\*)$' Documentation/Developers/PKG-DESC-FORMAT |
  106. sed 's/. ./|/g; s/|\*)//; s/^\[//;' | \
  107. while read line ; do
  108. egrep -q "^\[($line)\]" $pdir/$package.desc ||
  109. echo "$package: No [$line] tag found."
  110. done
  111. else
  112. echo "$package: File not found: $pdir/$package.desc"
  113. fi
  114. if [ -f $pdir/$package.conf ] ; then
  115. bash -n $pdir/$package.conf 2>&1 | sed "s,^,$package: ,"
  116. fi
  117. done