3 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
4 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
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
11 # More information can be found in the files COPYING and README.
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 ---
19 if [ "$1" = "-all" ] ; then
20 $0 -repository `ls package/. | egrep -v '(CVS|\.svn|\.git)'`
24 if [ "$1" = "-repository" ] ; then
26 for x
in package
/$y/[a-z0-9
]* ; do
27 [ -f "$x/${x##*/}.desc" ] && $0 ${x##*/}
33 if [ "$1" != "${1#-}" -o $# -eq 0 ] ; then
34 echo "Usage: $0 <package-names>"
35 echo "or $0 -repository <repository-names>"
42 for pdir
in package
/*/$package ; do
43 [ -f $pdir/$package.desc
] ||
continue
44 [ "$lastpdir" ] && echo "$package: Found dup: $pdir $lastpdir"
47 if [ -z "$lastpdir" ] ; then
53 if [ -f $pdir/$package.conf
] ; then
54 if egrep -q '^[^#]*\bflistdel' $pdir/$package.conf
; then
55 echo "$package: Use of \$flistdel is evil!"
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: ,"
64 egrep '^\[[A-Z0-9-]+\]( |$)' $pdir/$package.desc |
65 tr '[]' '||' | cut
-f2 -d'|' |
67 grep -q "\\[$tag\\]" etc
/desc_format
&&
69 [ "${tag#X-}" != "$tag" ] && continue
70 echo "$package: Unknown tag in $package.desc: [$tag]"
73 for x
in `egrep '^\[(C|CATEGORY)\]' $pdir/$package.desc |
75 egrep -q "^$x( |$)" etc
/categories
&&
77 echo "$package: Unknown package category: $x"
80 for x
in `egrep '^\[(F|FLAG)\]' $pdir/$package.desc |
82 egrep -q "^$x " etc
/flags
&&
84 echo "$package: Unknown package flag: $x"
87 for x
in `egrep '^\[(S|STATUS)\]' $pdir/$package.desc |
89 egrep -q "^$x" etc
/status
&&
91 echo "$package: Unknown package status: $x"
94 for x
in `egrep '^\[(L|LICENSE)\]' $pdir/$package.desc |
96 egrep -q "^$x" etc
/licenses
&&
98 echo "$package: Unknown package license: $x"
101 grep '^\[.*(\*)$' etc
/desc_format |
102 sed 's/. ./|/g; s/|\*)//; s/^\[//;' |
104 egrep -q "^\[($line)\]" $pdir/$package.desc ||
105 echo "$package: No [$line] tag found."
109 echo "$package: File not found: $pdir/$package.desc"
112 if [ -f $pdir/$package.conf
] ; then
113 bash
-n $pdir/$package.conf
2>&1 |
sed "s,^,$package: ,"