Blob Blame History Raw
# Autogeneries the quilt `series` from the patch order in the spec file.
# We don't use `quilt setup` because it makes a huge mess and doesn't work.
rm -f
# Filter out the patches, and use `_` as our pseudo-IFS to prevent expansion.
for i in `grep '^%patch' glibc.spec | sed -e 's,%patch,,g' -e 's, ,_,g'`; do
    # Split the patch into number and arguments.
    # 1 - Patch number.
    # 2-N - Patch arguments.
    # Get back our elements by undoing pseudo-IFS change.
    elements=(`echo $i | sed -e 's,_, ,g'`)
    # Find the next patch that applies in order and write it out.
    # This way we transform the patch # list into a patch file list in order.
    grep "Patch${num}: " glibc.spec \
	| sed -e 's,Patch.*: ,,g' -e "s,\$, ${args[@]} ${extra_args},g" \
	| sed -e "s,%{name},${component},g" \
# Double check we processed the correct number of patches.
fcount=`wc -l | sed -e 's, .*$,,g'`
if [ $fcount -ne $count ]; then
    echo "Error! Processed patch count doesn't match spec file count ($fcount != $count)."
    exit 1
echo "Processed $count patches."
mv series
echo "Generated quilt ./series file, please commit."
exit 0