#!/bin/bash # # --- ROCK-COPYRIGHT-NOTE-BEGIN --- # # This copyright note is auto-generated by ./scripts/Create-CopyPatch. # Please add additional copyright information _after_ the line containing # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by # the ./scripts/Create-CopyPatch script. Do not edit this copyright text! # # ROCK Linux: rock-src/scripts/Check-PkgFormat # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. A copy of the GNU General Public # License can be found at Documentation/COPYING. # # Many people helped and are helping developing ROCK Linux. Please # have a look at https://www.rocklinux.org/ and the Documentation/TEAM # file for details. # # --- ROCK-COPYRIGHT-NOTE-END --- if [ "$1" = "-all" ] ; then $0 -repository `ls package/. | egrep -v '(CVS|\.svn)'` exit 0 fi if [ "$1" = "-repository" ] ; then shift ; for y ; do for x in package/$y/[a-z0-9]* ; do [ -f "$x/${x##*/}.desc" ] && $0 ${x##*/} done done exit 0 fi if [ "$1" != "${1#-}" -o $# -eq 0 ] ; then echo "Usage: $0 " echo "or $0 -repository " echo "or $0 -all" echo echo " Do a few very simple tests to auto-detect errors in the package *.desc and" echo " *.conf files." echo " Run tests on single packages, repositories, or all packages." exit 1 fi . ./scripts/functions # from ../scripts/parse-config base=$(pwd -P) for package ; do pkg=${package%=*} ; xpkg=${package#*=} lastpdir="" for pdir in package/*/$pkg ; do [ -f $pdir/$pkg.desc ] || continue [ "$lastpdir" ] && echo "$package: Found dup: $pdir $lastpdir" lastpdir="$pdir" done if [ -z "$lastpdir" ] ; then pdir="..." else pdir="$lastpdir" fi if [ -f $pdir/$pkg.conf ] ; then if egrep -q '^[^#]*\bflistdel' $pdir/$pkg.conf ; then echo "$package: Use of \$flistdel is evil!" fi fi if [ -f $pdir/$pkg.desc ] ; then grep '[^ ]' $pdir/$pkg.desc | \ egrep -v '^(\[[A-Z0-9-]+\]( |$)|#)' | \ sed "s,^,$package: Syntax error in $pkg.desc: ," egrep '^\[[A-Z0-9-]+\]( |$)' $pdir/$pkg.desc | \ tr '[]' '||' | cut -f2 -d'|' | \ while read tag ; do grep -q "\\[$tag\\]" Documentation/Developers/$( )PKG-DESC-FORMAT && continue [ "${tag#X-}" != "$tag" ] && continue echo "$package: Unknown tag in $pkg.desc: [$tag]" done for x in `egrep '^\[(C|CATEGORY)\]' $pdir/$pkg.desc | \ cut -f2- -d']'` ; do egrep -q "^$x( |$)" Documentation/Developers/$( )PKG-CATEGORIES && continue echo "$package: Unknown package category: $x" done for x in `egrep '^\[(F|FLAG)\]' $pdir/$pkg.desc | \ cut -f2- -d']'` ; do egrep -q "^$x " Documentation/Developers/$( )PKG-FLAGS && continue echo "$package: Unknown package flag: $x" done for x in `egrep '^\[(S|STATUS)\]' $pdir/$pkg.desc | \ cut -f2- -d']'` ; do case $x in Alpha|Beta|Gamma|Stable) ;; *) echo "$package: Unknown package" \ "status: $x" ;; esac done for x in `egrep '^\[(L|LICENSE)\]' $pdir/$pkg.desc | \ cut -f2- -d']'` ; do case $x in Unknown|GPL|LGPL|MPL|FDL|MIT|BSD) ;; OpenSource|Free-to-use|Commercial) ;; IBM-Public-License|DLJ) ;; *) echo "$package: Unknown package" \ "license: $x" ;; esac done grep '^\[.*(\*)$' Documentation/Developers/PKG-DESC-FORMAT | sed 's/. ./|/g; s/|\*)//; s/^\[//;' | \ while read line ; do parse_desc $pdir/$pkg.desc "${line%%\|*}" eval tag="desc_${line%%\|*}" eval [ -z "$tag" ] && echo "$package: No [$line] tag found." done else echo "$package: File not found: $pdir/$pkg.desc" fi if [ -f $pdir/$pkg.conf ] ; then bash -n $pdir/$pkg.conf 2>&1 | sed "s,^,$package: ," fi done