paul@18 | 1 | #!/bin/sh |
paul@18 | 2 | |
paul@18 | 3 | PROGNAME=`basename "$0"` |
paul@18 | 4 | |
paul@18 | 5 | if [ "$1" = '--help' ] || [ ! "$1" ] || [ ! -e "$1" ] ; then |
paul@18 | 6 | cat 1>&2 <<EOF |
paul@18 | 7 | Usage: $PROGNAME <package location> |
paul@18 | 8 | |
paul@18 | 9 | Search for package declarations in the given package, overwriting the Control |
paul@18 | 10 | file for the package with an updated version. |
paul@18 | 11 | EOF |
paul@18 | 12 | exit 1 |
paul@18 | 13 | fi |
paul@18 | 14 | |
paul@18 | 15 | PACKAGE="$1" |
paul@18 | 16 | |
paul@18 | 17 | # Obtain the existing Control file and extract the non-provides fields. |
paul@18 | 18 | |
paul@18 | 19 | grep -v '^provides: ' "$PACKAGE/Control" > _non_provides.tmp |
paul@18 | 20 | |
paul@18 | 21 | # Search for package declarations and build provides fields. |
paul@18 | 22 | |
paul@18 | 23 | grep PC_FILENAME -r "$PACKAGE" | cut -d'=' -f 2 | sort -u | sed 's/^ /provides: /' > _provides.tmp |
paul@18 | 24 | |
paul@18 | 25 | # Concatenate the files and overwrite the Control file. |
paul@18 | 26 | |
paul@18 | 27 | cat _provides.tmp _non_provides.tmp > "$PACKAGE/Control" |
paul@18 | 28 | |
paul@18 | 29 | # Remove the temporary files. |
paul@18 | 30 | |
paul@18 | 31 | rm _provides.tmp _non_provides.tmp |