1 #!/bin/sh 2 3 # Update package Control files. 4 # 5 # Copyright (C) 2018, 2023 Paul Boddie <paul@boddie.org.uk> 6 # 7 # This program is free software; you can redistribute it and/or 8 # modify it under the terms of the GNU General Public License as 9 # published by the Free Software Foundation; either version 2 of 10 # the License, or (at your option) any later version. 11 # 12 # This program is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 # GNU General Public License for more details. 16 # 17 # You should have received a copy of the GNU General Public License 18 # along with this program; if not, write to the Free Software 19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 # Boston, MA 02110-1301, USA 21 22 PROGNAME=$(basename "$0") 23 24 if [ "$1" = '--help' ] || [ ! "$1" ] || [ ! -e "$1" ] ; then 25 cat 1>&2 <<EOF 26 Usage: $PROGNAME <package location> 27 28 Search for package declarations in the given package, overwriting the Control 29 file for the package with an updated version. 30 EOF 31 exit 1 32 fi 33 34 PACKAGE="$1" 35 36 # Obtain the existing Control file and extract the non-provides fields. 37 38 grep -v '^provides: ' "$PACKAGE/Control" > _non_provides.tmp 39 40 # Search for package declarations and build provides fields. 41 42 grep PC_FILENAME -r "$PACKAGE" | cut -d'=' -f 2 | sort -u | sed 's/^ /provides: /' > _provides.tmp 43 44 # Concatenate the files and overwrite the Control file. 45 46 cat _provides.tmp _non_provides.tmp > "$PACKAGE/Control" 47 48 # Remove the temporary files. 49 50 rm _provides.tmp _non_provides.tmp 51 52 # vim: tabstop=4 expandtab shiftwidth=4