From f609448491411a3e9bc14b20db1a8fa258f935ba Mon Sep 17 00:00:00 2001 From: Christian Lachner Date: Sun, 29 Apr 2018 10:00:22 +0200 Subject: [PATCH] haproxy: Add a script for package maintainers to simplify upstream patch collection Manually fetching patches is cumbersome so I created a simple bash-script which uses Git-mechanisms to collect all patches inside a branch from a specific TAG to the current HEAD revision. Signed-off-by: Christian Lachner --- net/haproxy/get-latest-patches.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 net/haproxy/get-latest-patches.sh diff --git a/net/haproxy/get-latest-patches.sh b/net/haproxy/get-latest-patches.sh new file mode 100755 index 000000000..b74107f21 --- /dev/null +++ b/net/haproxy/get-latest-patches.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +CLONEURL=http://git.haproxy.org/git/haproxy-1.8.git +BASE_TAG=v1.8.8 +TMP_REPODIR=tmprepo +PATCHESDIR=patches + +if test -d "${TMP_REPODIR}"; then rm -rf "${TMP_REPODIR}"; fi + +git clone "${CLONEURL}" "${TMP_REPODIR}" + +printf "Cleaning patches\n" +find ${PATCHESDIR} -type f -name "*.patch" -exec rm -f "{}" \; + +i=0 +for cid in $(git -C "${TMP_REPODIR}" rev-list ${BASE_TAG}..HEAD | tac); do + filename="$(printf "%04d" $i)-$(git -C "${TMP_REPODIR}" log --format=%s -n 1 $cid | sed -e"s/[()']//g" -e's/[^_a-zA-Z0-9+-]\+/-/g' -e's/-$//').patch" + printf "Creating ${filename}\n" + git -C "${TMP_REPODIR}" show $cid > "${PATCHESDIR}/$filename" + git add "${PATCHESDIR}/$filename" + let i++ +done + +rm -rf "${TMP_REPODIR}" + +printf "finished\n" +