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.

137 lines
3.9 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. . ./scripts/functions
  47. # from ../scripts/parse-config
  48. base=$(pwd -P)
  49. for package ; do
  50. pkg=${package%=*} ; xpkg=${package#*=}
  51. lastpdir=""
  52. for pdir in package/*/$pkg ; do
  53. [ -f $pdir/$pkg.desc ] || continue
  54. [ "$lastpdir" ] && echo "$package: Found dup: $pdir $lastpdir"
  55. lastpdir="$pdir"
  56. done
  57. if [ -z "$lastpdir" ] ; then
  58. pdir="..."
  59. else
  60. pdir="$lastpdir"
  61. fi
  62. if [ -f $pdir/$pkg.conf ] ; then
  63. if egrep -q '^[^#]*\bflistdel' $pdir/$pkg.conf ; then
  64. echo "$package: Use of \$flistdel is evil!"
  65. fi
  66. fi
  67. if [ -f $pdir/$pkg.desc ] ; then
  68. grep '[^ ]' $pdir/$pkg.desc | \
  69. egrep -v '^(\[[A-Z0-9-]+\]( |$)|#)' | \
  70. sed "s,^,$package: Syntax error in $pkg.desc: ,"
  71. egrep '^\[[A-Z0-9-]+\]( |$)' $pdir/$pkg.desc | \
  72. tr '[]' '||' | cut -f2 -d'|' | \
  73. while read tag ; do
  74. grep -q "\\[$tag\\]" Documentation/Developers/$(
  75. )PKG-DESC-FORMAT && continue
  76. [ "${tag#X-}" != "$tag" ] && continue
  77. echo "$package: Unknown tag in $pkg.desc: [$tag]"
  78. done
  79. for x in `egrep '^\[(C|CATEGORY)\]' $pdir/$pkg.desc | \
  80. cut -f2- -d']'` ; do
  81. egrep -q "^$x( |$)" Documentation/Developers/$(
  82. )PKG-CATEGORIES && continue
  83. echo "$package: Unknown package category: $x"
  84. done
  85. for x in `egrep '^\[(F|FLAG)\]' $pdir/$pkg.desc | \
  86. cut -f2- -d']'` ; do
  87. egrep -q "^$x " Documentation/Developers/$(
  88. )PKG-FLAGS && continue
  89. echo "$package: Unknown package flag: $x"
  90. done
  91. for x in `egrep '^\[(S|STATUS)\]' $pdir/$pkg.desc | \
  92. cut -f2- -d']'` ; do
  93. case $x in
  94. Alpha|Beta|Gamma|Stable) ;;
  95. *) echo "$package: Unknown package" \
  96. "status: $x" ;;
  97. esac
  98. done
  99. for x in `egrep '^\[(L|LICENSE)\]' $pdir/$pkg.desc | \
  100. cut -f2- -d']'` ; do
  101. case $x in
  102. Unknown|GPL|LGPL|MPL|FDL|MIT|BSD) ;;
  103. OpenSource|Free-to-use|Commercial) ;;
  104. IBM-Public-License|DLJ) ;;
  105. *) echo "$package: Unknown package" \
  106. "license: $x" ;;
  107. esac
  108. done
  109. grep '^\[.*(\*)$' Documentation/Developers/PKG-DESC-FORMAT |
  110. sed 's/. ./|/g; s/|\*)//; s/^\[//;' | \
  111. while read line ; do
  112. parse_desc $pdir/$pkg.desc "${line%%\|*}"
  113. eval tag="desc_${line%%\|*}"
  114. eval [ -z "$tag" ] && echo "$package: No [$line] tag found."
  115. done
  116. else
  117. echo "$package: File not found: $pdir/$pkg.desc"
  118. fi
  119. if [ -f $pdir/$pkg.conf ] ; then
  120. bash -n $pdir/$pkg.conf 2>&1 | sed "s,^,$package: ,"
  121. fi
  122. done