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