Commit 6c29e50c authored by Ludovic Desroches's avatar Ludovic Desroches Committed by Peter Korsgaard
Browse files

apply-patches.sh: use series file to apply patches in proper order



If a series file is present use it to determine the proper order to apply
patches instead of using ls sorting order.

Signed-off-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
Tested-by: default avatarLudovic Desroches <ludovic.desroches@atmel.com>
add a series file with a wrong patch order into an archive containing several
patches whose correct order is the alphabetical one
Acked-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: default avatarPeter Korsgaard <jacmet@sunsite.dk>
parent 4f9e82da
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -58,6 +58,13 @@ function scan_patchdir {
    shift 1
    patches=${@-*}

    # 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
        done
    else
        for i in `cd $path; ls -d $patches 2> /dev/null` ; do
            if [ -d "${path}/$i" ] ; then
                echo "${path}/$i skipped"
@@ -71,6 +78,7 @@ function scan_patchdir {
                apply_patch "$path" "$i" || exit 1
            fi
        done
    fi
}

scan_patchdir $patchdir $patchpattern