early: fixed modprobe
[opensde-nopast.git] / scripts / Check-PkgFormat
blob8977a9d20a031b2e6faa7837c17f9c5adc63f04d
1 #!/bin/bash
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)'`
21 exit 0
24 if [ "$1" = "-repository" ] ; then
25 shift ; for y ; do
26 for x in package/$y/[a-z0-9]* ; do
27 [ -f "$x/${x##*/}.desc" ] && $0 ${x##*/}
28 done
29 done
30 exit 0
33 if [ "$1" != "${1#-}" -o $# -eq 0 ] ; then
34 echo "Usage: $0 <package-names>"
35 echo "or $0 -repository <repository-names>"
36 echo "or $0 -all"
37 exit 1
40 for package ; do
41 lastpdir=
42 for pdir in package/*/$package ; do
43 [ -f $pdir/$package.desc ] || continue
44 [ "$lastpdir" ] && echo "$package: Found dup: $pdir $lastpdir"
45 lastpdir="$pdir"
46 done
47 if [ -z "$lastpdir" ] ; then
48 pdir="..."
49 else
50 pdir="$lastpdir"
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'|' |
66 while read tag ; do
67 grep -q "\\[$tag\\]" etc/desc_format &&
68 continue
69 [ "${tag#X-}" != "$tag" ] && continue
70 echo "$package: Unknown tag in $package.desc: [$tag]"
71 done
73 for x in `egrep '^\[(C|CATEGORY)\]' $pdir/$package.desc |
74 cut -f2- -d']'` ; do
75 egrep -q "^$x( |$)" etc/categories &&
76 continue
77 echo "$package: Unknown package category: $x"
78 done
80 for x in `egrep '^\[(F|FLAG)\]' $pdir/$package.desc |
81 cut -f2- -d']'` ; do
82 egrep -q "^$x " etc/flags &&
83 continue
84 echo "$package: Unknown package flag: $x"
85 done
87 for x in `egrep '^\[(S|STATUS)\]' $pdir/$package.desc |
88 cut -f2- -d']'` ; do
89 egrep -q "^$x" etc/status &&
90 continue
91 echo "$package: Unknown package status: $x"
92 done
94 for x in `egrep '^\[(L|LICENSE)\]' $pdir/$package.desc |
95 cut -f2- -d']'` ; do
96 egrep -q "^$x" etc/licenses &&
97 continue
98 echo "$package: Unknown package license: $x"
99 done
101 grep '^\[.*(\*)$' etc/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
108 else
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: ,"
115 done