OpenSDE Framework (without history before r20070)
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.

115 lines
3.2 KiB

  1. #!/bin/bash
  2. #
  3. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  4. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  5. #
  6. # Filename: scripts/Check-PkgFormat
  7. # Copyright (C) 2006 - 2008 The OpenSDE Project
  8. # Copyright (C) 2004 - 2006 The T2 SDE Project
  9. # Copyright (C) 1998 - 2003 Clifford Wolf
  10. #
  11. # More information can be found in the files COPYING and README.
  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; version 2 of the License. A copy of the
  16. # GNU General Public License can be found in the file COPYING.
  17. # --- SDE-COPYRIGHT-NOTE-END ---
  18. if [ "$1" = "-all" ] ; then
  19. $0 -repository `ls package/. | egrep -v '(CVS|\.svn|\.git)'`
  20. exit 0
  21. fi
  22. if [ "$1" = "-repository" ] ; then
  23. shift ; for y ; do
  24. for x in package/$y/[a-z0-9]* ; do
  25. [ -f "$x/${x##*/}.desc" ] && $0 ${x##*/}
  26. done
  27. done
  28. exit 0
  29. fi
  30. if [ "$1" != "${1#-}" -o $# -eq 0 ] ; then
  31. echo "Usage: $0 <package-names>"
  32. echo "or $0 -repository <repository-names>"
  33. echo "or $0 -all"
  34. exit 1
  35. fi
  36. for package ; do
  37. lastpdir=
  38. for pdir in package/*/$package ; do
  39. [ -f $pdir/$package.desc ] || continue
  40. [ "$lastpdir" ] && echo "$package: Found dup: $pdir $lastpdir"
  41. lastpdir="$pdir"
  42. done
  43. if [ -z "$lastpdir" ] ; then
  44. pdir="..."
  45. else
  46. pdir="$lastpdir"
  47. fi
  48. if [ -f $pdir/$package.conf ] ; then
  49. if egrep -q '^[^#]*\bflistdel' $pdir/$package.conf ; then
  50. echo "$package: Use of \$flistdel is evil!"
  51. fi
  52. fi
  53. if [ -f $pdir/$package.desc ] ; then
  54. grep '[^ ]' $pdir/$package.desc |
  55. egrep -v '^(\[[A-Z0-9-]+\]( |$)|#)' |
  56. sed "s,^,$package: Syntax error in $package.desc: ,"
  57. egrep '^\[[A-Z0-9-]+\]( |$)' $pdir/$package.desc |
  58. tr '[]' '||' | cut -f2 -d'|' |
  59. while read tag ; do
  60. grep -q "\\[$tag\\]" etc/desc_format &&
  61. continue
  62. [ "${tag#X-}" != "$tag" ] && continue
  63. echo "$package: Unknown tag in $package.desc: [$tag]"
  64. done
  65. for x in `egrep '^\[(C|CATEGORY)\]' $pdir/$package.desc |
  66. cut -f2- -d']'` ; do
  67. egrep -q "^$x( |$)" etc/categories &&
  68. continue
  69. echo "$package: Unknown package category: $x"
  70. done
  71. for x in `egrep '^\[(F|FLAG)\]' $pdir/$package.desc |
  72. cut -f2- -d']'` ; do
  73. egrep -q "^$x " etc/flags &&
  74. continue
  75. echo "$package: Unknown package flag: $x"
  76. done
  77. for x in `egrep '^\[(S|STATUS)\]' $pdir/$package.desc |
  78. cut -f2- -d']'` ; do
  79. egrep -q "^$x" etc/status &&
  80. continue
  81. echo "$package: Unknown package status: $x"
  82. done
  83. for x in `egrep '^\[(L|LICENSE)\]' $pdir/$package.desc |
  84. cut -f2- -d']'` ; do
  85. egrep -q "^$x" etc/licenses &&
  86. continue
  87. echo "$package: Unknown package license: $x"
  88. done
  89. grep '^\[.*(\*)$' etc/desc_format |
  90. sed 's/. ./|/g; s/|\*)//; s/^\[//;' |
  91. while read line ; do
  92. egrep -q "^\[($line)\]" $pdir/$package.desc ||
  93. echo "$package: No [$line] tag found."
  94. done
  95. else
  96. echo "$package: File not found: $pdir/$package.desc"
  97. fi
  98. if [ -f $pdir/$package.conf ] ; then
  99. bash -n $pdir/$package.conf 2>&1 | sed "s,^,$package: ,"
  100. fi
  101. done