eef588dfe267122da34ad3290000c74b04c22cfcjim# Lukas Slebodnik <lslebodn@redhat.com>
eef588dfe267122da34ad3290000c74b04c22cfcjim# Copyright (C) 2013 Red Hat
eef588dfe267122da34ad3290000c74b04c22cfcjim# This program is free software; you can redistribute it and/or modify
eef588dfe267122da34ad3290000c74b04c22cfcjim# it under the terms of the GNU General Public License as published by
eef588dfe267122da34ad3290000c74b04c22cfcjim# the Free Software Foundation; either version 3 of the License, or
eef588dfe267122da34ad3290000c74b04c22cfcjim# (at your option) any later version.
eef588dfe267122da34ad3290000c74b04c22cfcjim# This program is distributed in the hope that it will be useful,
eef588dfe267122da34ad3290000c74b04c22cfcjim# but WITHOUT ANY WARRANTY; without even the implied warranty of
eef588dfe267122da34ad3290000c74b04c22cfcjim# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eef588dfe267122da34ad3290000c74b04c22cfcjim# GNU General Public License for more details.
eef588dfe267122da34ad3290000c74b04c22cfcjim# You should have received a copy of the GNU General Public License
eef588dfe267122da34ad3290000c74b04c22cfcjim# along with this program. If not, see <http://www.gnu.org/licenses/>.
eef588dfe267122da34ad3290000c74b04c22cfcjim echo "$(basename $0) [OPTIONS] [-P|--patches <patch>...]"
4ab0fd1b54ce76f0fb6812b89b0b4dc7541014d6minfrin echo -e "\t-c, --clean Remove directory rpmbuild and exit."
eef588dfe267122da34ad3290000c74b04c22cfcjim echo -e "\t-P, --patches Requires list of patches for SRPM."
eef588dfe267122da34ad3290000c74b04c22cfcjim # unknown option
eef588dfe267122da34ad3290000c74b04c22cfcjimif [ -n "$CLEAN" ]; then
eef588dfe267122da34ad3290000c74b04c22cfcjim echo "This script must be run from the $PACKAGE_NAME git repository!"
eef588dfe267122da34ad3290000c74b04c22cfcjimif [ "x$SRC_DIR" = x ]; then
eef588dfe267122da34ad3290000c74b04c22cfcjim echo "Fatal: Could not find source directory!"
eef588dfe267122da34ad3290000c74b04c22cfcjimif [ ! -f "$VERSION_FILE" ]; then
eef588dfe267122da34ad3290000c74b04c22cfcjim echo "Fatal: Could not find file version.m4 in source directory!"
19f5359fc7b955a110e5ebe345ef4962cdd76473jailletcif [ ! -f "$SPEC_TEMPLATE" ]; then
19f5359fc7b955a110e5ebe345ef4962cdd76473jailletc echo "Fatal: Could not find $PACKAGE_NAME.spec.in in contrib subdirectory!"
2c4ed36c350564e8bfb68e9d9ba58fe77b9bf3c0jimPACKAGE_VERSION=$(grep "\[VERSION_NUMBER\]" $VERSION_FILE \
2c4ed36c350564e8bfb68e9d9ba58fe77b9bf3c0jimif [ "x$PACKAGE_VERSION" = x ]; then
2c4ed36c350564e8bfb68e9d9ba58fe77b9bf3c0jim echo "Fatal: Could parse version from file:$VERSION_FILE!"
b1e3273c2e70ad5ac64feef979b2ed1d98c09963jimif [ -n "$PRERELEASE" ]; then
19f5359fc7b955a110e5ebe345ef4962cdd76473jailletc PRERELEASE_VERSION=.$(date +%Y%m%d.%H%M).git$(git log -1 --pretty=format:%h)
b1e3273c2e70ad5ac64feef979b2ed1d98c09963jim -e "s/@PACKAGE_VERSION@/$PACKAGE_VERSION/" \
9a0e1ad272fdbe3fee989e93bdae8253418429edjfclere -e "s/@PRERELEASE_VERSION@/$PRERELEASE_VERSION/" \
eef588dfe267122da34ad3290000c74b04c22cfcjim > "$RPMBUILD/SPECS/$PACKAGE_NAME.spec"
eef588dfe267122da34ad3290000c74b04c22cfcjimcp "$SRC_DIR"/contrib/*.patch "$RPMBUILD/SOURCES" 2>/dev/null
36ef8f77bffe75d1aa327882be1b5bdbe2ff567asf "$RPMBUILD/SOURCES" \
eef588dfe267122da34ad3290000c74b04c22cfcjim "${patches[@]}"