Bump

On Tue, Jun 14, 2011 at 1:52 PM, Jon Ringle <j...@ringle.org> wrote:
> The patch series I have for the Linux kernel includes incremental patches
> from upstream like
>
> patch-2.6.33.1.bz2
> patch-2.6.33.1-2.bz2
>
> followed by a patch series for my board.
> But ptxdist messes this up when applying the patch series with git.
>
> This patch allows one to mark the base tag in the series with:
> #base
> Patches between "# generated by git-ptx-patches" and "#base" are left
> untouched in the series
>
> e.g.:
> # generated by git-ptx-patches
> patch-2.6.33.1.bz2
> patch-2.6.33.1-2.bz2
> patch-2.6.33.2-3.bz2
> #base
> 0001-000-mspd-kernel_linux_33_6_00_6.patch.patch
> 0002-xfrm-fix-comcerto-hacks-by-Mindspeed.patch
> 0003-si3220-Fix-for-2.6.33.patch
> # 25a3096f40bc8d841c8bf3ec24dd101f  - git-ptx-patches magic
>
> Signed-off-by: Jon Ringle <j...@ringle.org>
> ---
>  scripts/git-ptx-patches                |   31 +++++++++++++++++++++++++------
>  scripts/lib/ptxd_make_world_patchin.sh |   17 ++++++++++++++++-
>  2 files changed, 41 insertions(+), 7 deletions(-)
>
> diff --git a/scripts/git-ptx-patches b/scripts/git-ptx-patches
> index c5eb405..898a1dc 100755
> --- a/scripts/git-ptx-patches
> +++ b/scripts/git-ptx-patches
> @@ -31,6 +31,15 @@ if grep -q "$PTX_PATCHES_HEADER" .ptxdist/series; then
>        fi
>  fi
>
> +if grep -q "#base" .ptxdist/series; then
> +    sed -n "/$PTX_PATCHES_HEADER/,/#base/p" .ptxdist/series > 
> .ptxdist/series.base
> +    # Remove patches before #base so they don't get rm'd with remove_old=yes
> +    sed "/$PTX_PATCHES_HEADER/,/#base/d" .ptxdist/series > .ptxdist/series
> +else
> +    echo "$PTX_PATCHES_HEADER" > .ptxdist/series.base
> +    echo "#base" >> .ptxdist/series.base
> +fi
> +
>  if [ "x$1" = "x--force-remove" ]; then
>        remove_old="force"
>  fi
> @@ -53,7 +62,13 @@ case "$remove_old" in
>                                ".ptxdist/patches/") continue ;;
>                                ".ptxdist/patches/series") continue ;;
>                                ".ptxdist/patches/autogen.sh") continue ;;
> -                               *) rm -rf "$file" ;;
> +                               *)
> +                                       if grep -q 
> "${file##\.ptxdist/patches/}" .ptxdist/series.base; then
> +                                               echo "Keep base patch ${file}"
> +                                       else
> +                                               rm -rf "$file"
> +                                       fi
> +                                       ;;
>                        esac
>                done
>                ;;
> @@ -63,8 +78,9 @@ if git format-patch -h 2>&1 | grep -q signature; then
>        GIT_EXTRA_ARGS="--no-signature"
>  fi
>
> -echo "$PTX_PATCHES_HEADER" > .ptxdist/series
> -git format-patch -N $GIT_EXTRA_ARGS -o .ptxdist/patches/ base | sed -e 
> 's,^.ptxdist/patches/,,' >> .ptxdist/series
> +cat .ptxdist/series.base > .ptxdist/series
> +git format-patch -N $GIT_EXTRA_ARGS -o .ptxdist/patches/ base | sed -e 
> 's,^.ptxdist/patches/,,' > .ptxdist/series.1
> +cat .ptxdist/series.1 >> .ptxdist/series
>  cat .ptxdist/series | _md5sum >> .ptxdist/series
>
>  # The first line of the patch is 'From <some-git-hash> ...'
> @@ -75,14 +91,17 @@ while read patch para; do
>                "series"|"autogen.sh") continue ;;
>                *) ;;
>        esac
> -       if grep -q "$patch" .ptxdist/series; then
> +       if grep -q "$patch" .ptxdist/series.1; then
>                p=".ptxdist/patches/$patch"
>                lines=$(cat "$p" | wc -l)
>                lines=$[lines-1]
>                tail -n$lines "$p" > ".$patch.ptx-patches"
>                mv ".$patch.ptx-patches" "$p"
>        else
> -               echo "Old patch \"$patch\"!"
> +               if grep -q "$patch" .ptxdist/series.base; then
> +                       echo "Base patch \"$patch\"!"
> +               else
> +                       echo "Old patch \"$patch\"!"
> +               fi
>        fi
>  done
> -
> diff --git a/scripts/lib/ptxd_make_world_patchin.sh 
> b/scripts/lib/ptxd_make_world_patchin.sh
> index bbb7490..1f0d3c0 100644
> --- a/scripts/lib/ptxd_make_world_patchin.sh
> +++ b/scripts/lib/ptxd_make_world_patchin.sh
> @@ -112,6 +112,10 @@ ptxd_make_world_patchin_apply_git_compat()
>        esac
>
>        case "${patch}" in
> +           "#base")
> +               mv ${pkg_patchin_dir}/.ptxdist/git-patches/series{,.base} || 
> return
> +               continue
> +               ;;
>            ""|"#"*) continue ;;        # skip empty lines and comments
>            *.gz)  cat="zcat" ;;
>            *.bz2) cat="bzcat" ;;
> @@ -130,7 +134,6 @@ ptxd_make_world_patchin_apply_git_compat()
>  }
>  export -f ptxd_make_world_patchin_apply_git_compat
>
> -
>  #
>  # apply patch series with git
>  #
> @@ -141,6 +144,18 @@ ptxd_make_world_patchin_apply_git()
>     #
>     ptxd_make_world_patchin_apply_git_compat || return
>
> +    if [ -f "${pkg_patchin_dir}/.ptxdist/git-patches/series.base" ]; then
> +       mv ${pkg_patchin_dir}/.ptxdist/git-patches/series{,.1} || return
> +       mv ${pkg_patchin_dir}/.ptxdist/git-patches/series{.base,} || return
> +
> +       git quiltimport \
> +           --patches "${pkg_patchin_dir}/.ptxdist/git-patches" \
> +           --author "unknown author <unknown.aut...@example.com>"
> +       git tag -f base
> +       mv ${pkg_patchin_dir}/.ptxdist/git-patches/series{,.base} || return
> +       mv ${pkg_patchin_dir}/.ptxdist/git-patches/series{.1,} || return
> +    fi
> +
>     git quiltimport \
>        --patches "${pkg_patchin_dir}/.ptxdist/git-patches" \
>        --author "unknown author <unknown.aut...@example.com>"
> --
> 1.7.0.4
>
>

-- 
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to