@@ -58,19 +58,27 @@ function scan_patchdir {
shift 1
patches=${@-*}
- for i in `cd $path; ls -d $patches 2> /dev/null` ; do
- if [ -d "${path}/$i" ] ; then
- echo "${path}/$i skipped"
- elif echo "$i" | grep -q -E "\.tar(\..*)?$|\.tbz2?$|\.tgz$" ; then
- unpackedarchivedir="$builddir/.patches-$(basename $i)-unpacked"
- rm -rf "$unpackedarchivedir" 2> /dev/null
- mkdir "$unpackedarchivedir"
- tar -C "$unpackedarchivedir" --strip-components=1 -xaf "${path}/$i"
- scan_patchdir "$unpackedarchivedir"
- else
+ # If there is a series file, use it instead of using ls sort order
+ # to apply patches. Skip line starting with a dash.
+ if [ -e "${path}/series" ] ; then
+ for i in `grep -Ev "^#" ${path}/series 2> /dev/null` ; do
apply_patch "$path" "$i" || exit 1
- fi
- done
+ done
+ else
+ for i in `cd $path; ls -d $patches 2> /dev/null` ; do
+ if [ -d "${path}/$i" ] ; then
+ echo "${path}/$i skipped"
+ elif echo "$i" | grep -q -E "\.tar(\..*)?$|\.tbz2?$|\.tgz$" ; then
+ unpackedarchivedir="$builddir/.patches-$(basename $i)-unpacked"
+ rm -rf "$unpackedarchivedir" 2> /dev/null
+ mkdir "$unpackedarchivedir"
+ tar -C "$unpackedarchivedir" --strip-components=1 -xaf "${path}/$i"
+ scan_patchdir "$unpackedarchivedir"
+ else
+ apply_patch "$path" "$i" || exit 1
+ fi
+ done
+ fi
}
scan_patchdir $patchdir $patchpattern