File pkg-buildrequires-update of Package pkg-buildrequires
#! /bin/bash
# Check requires defined by pkgconfig .pc files.
#
# Copyright (C) 2005, 2007 Stanislav Brabec <sbrabec@suse.cz>, SuSE Linux
#
# 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.
#
# See http://www.gnu.org/copyleft/lesser.html
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if test -d "$1" ; then
LOG="$1"/pkg-buildrequires.log
else
LOG="$1"
fi
if test -z "$2" ; then
eval FILES=\" *.spec \"
else
FILES="$2"
fi
NEW_REQUIRES="$(sed -n <"$LOG" '/#BEGIN pkg-buildrequires/,/#END pkg-buildrequires/p' | sed 's/$/\\/;$,$s/\\$//' )"
sed "
/^#BEGIN pkg-buildrequires/,/^#END pkg-buildrequires/d
1,/^BuildRequires:/{
/^BuildRequires:/a$NEW_REQUIRES
}" -i $FILES