systemd/pre_checkin.sh

29 lines
1.1 KiB
Bash

#!/bin/sh
# This script is based on libcdio_spec-prepare.sh (thanks to sbrabec@suse.cz)
# create a -mini spec for systemd for bootstrapping
ORIG_SPEC=systemd
for patch in $(grep -lE 'Makefile.(am|in)|configure\.ac' *.patch)
do
sed -rn 's/^Patch([0-9]+):\s+'${patch}'/patch\1/p' $ORIG_SPEC.spec
done | while read patch
do
grep -1E '^%'${patch}'[^0-9]' $ORIG_SPEC.spec | grep -q bootstrap
if ((${PIPESTATUS[1]} != 0))
then
echo Patch ${patch} does trigger 'auto(re)configure' 1>&2
exit 1
fi
done
EDIT_WARNING="##### WARNING: please do not edit this auto generated spec file. Use the ${ORIG_SPEC}.spec! #####\n"
sed "s/^%define bootstrap.*$/${EDIT_WARNING}%define bootstrap 1/;
s/^%define udevpkgname.*$/${EDIT_WARNING}%define udevpkgname udev-mini/;
s/^\(Name:.*\)$/\1-mini/;
s/^BuildRoot.*/&\n\nProvides: %{real} = %{version}-%{release}\n/
" < ${ORIG_SPEC}.spec > ${ORIG_SPEC}-mini.spec
cp ${ORIG_SPEC}.changes ${ORIG_SPEC}-mini.changes
cp ${ORIG_SPEC}-rpmlintrc ${ORIG_SPEC}-mini-rpmlintrc
osc service localrun format_spec_file