patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Xueming Li <xuemingl@nvidia.com>
To: Christian Ehrhardt <christian.ehrhardt@canonical.com>,
	Luca Boccassi <bluca@debian.org>
Cc: <dev@dpdk.org>, <xuemingl@nvidia.com>,
	Thomas Monjalon <thomas@monjalon.net>, <stable@dpdk.org>,
	Yuanhan Liu <yuanhan.liu@linux.intel.com>
Subject: [dpdk-stable] [PATCH v1 2/2] devtools: auto detect branch to search fix patches
Date: Wed, 16 Jun 2021 07:03:22 +0300
Message-ID: <20210616040324.311461-2-xuemingl@nvidia.com> (raw)
In-Reply-To: <20210612135628.20460-1-xuemingl@nvidia.com>

Current fix scan scripts scanned specified range in current(HEAD)
branch. When users run it in an earlier branch, few patches were
scanned.

This patch introduces optional <branch> argument, auto detects from
range if not provided.

Fixes: 752d8e097ec1 ("scripts: show fixes with release version of bug")
Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: stable@dpdk.org

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 devtools/check-git-log.sh |  2 +-
 devtools/git-log-fixes.sh | 24 ++++++++++++++++++------
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh
index 9988bf863d..b463110a90 100755
--- a/devtools/check-git-log.sh
+++ b/devtools/check-git-log.sh
@@ -51,7 +51,7 @@ commits=$(git log --format='%h' --reverse $range)
 headlines=$(git log --format='%s' --reverse $range)
 bodylines=$(git log --format='%b' --reverse $range)
 fixes=$(git log --format='%h %s' --reverse $range | grep -i ': *fix' | cut -d' ' -f1)
-stablefixes=$($selfdir/git-log-fixes.sh $range | sed '/(N\/A)$/d'  | cut -d' ' -f2)
+stablefixes=$($selfdir/git-log-fixes.sh $range HEAD | sed '/(N\/A)$/d'  | cut -d' ' -f2)
 tags=$(git log --format='%b' --reverse $range | grep -i -e 'by *:' -e 'fix.*:')
 bytag='\(Reported\|Suggested\|Signed-off\|Acked\|Reviewed\|Tested\)-by:'
 
diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 5fc57da913..9d2d0ef96c 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -4,7 +4,7 @@
 
 print_usage ()
 {
-	echo "usage: $(basename $0) [-h] <git_range>"
+	echo "usage: $(basename $0) [-h] <git_range> [branch]"
 }
 
 print_help ()
@@ -15,6 +15,7 @@ print_help ()
 	Find fixes to backport on previous versions.
 	It looks for the word "fix" in the headline or a tag "Fixes" or "Reverts".
 	The oldest bug origin is printed as well as partially fixed versions.
+	It looks into the branch specified, otherwise any branch contains the range.
 	END_OF_HELP
 }
 
@@ -33,14 +34,23 @@ while getopts h ARG ; do
 done
 shift $(($OPTIND - 1))
 [ $# -ge 1 ] || usage_error 'range argument required'
-range="$*"
+range="$1"
+branch="$2"
+
+if [ -z "$branch" ] ; then
+	# last commit in range
+	range_last=$(git log --oneline v21.05-rc3..v21.05 |head -n1|cut -d' ' -f1)
+	# use first branch contains the commit
+	refbranch=$(git branch --contains $range_last -r --sort=-authordate |head -n1)
+else
+	refbranch=$(git rev-parse --abbrev-ref $branch)
+fi
 
 # get major release version of a commit
 commit_version () # <hash>
 {
 	local VER="v*.*"
 	# use current branch as history reference
-	local refbranch=$(git rev-parse --abbrev-ref HEAD)
 	local tag=$( (git tag -l $VER --contains $1 --sort=creatordate --merged $refbranch 2>&- ||
 		# tag --merged option has been introduced in git 2.7.0
 		# below is a fallback in case of old git version
@@ -49,9 +59,11 @@ commit_version () # <hash>
 			sed "s,.\+,$t,"
 		done) |
 		head -n1)
-	if [ -z "$tag" ] ; then
-		# before -rc1 tag of release in progress
-		cat VERSION | cut -d'.' -f-2
+	if [ -z "$tag" ]; then
+		if [ "$branch" = 'HEAD' ]; then
+			# before -rc1 tag of release in progress
+			cat VERSION | cut -d'.' -f-2
+		fi
 	else
 		echo $tag | sed 's,^v,,' | sed 's,-rc.*,,'
 	fi
-- 
2.25.1


  parent reply	other threads:[~2021-06-16  4:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-12 13:56 [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search Xueming Li
2021-06-12 13:56 ` [dpdk-stable] [PATCH 2/2] devtools: auto detect branch to search fix patches Xueming Li
2021-06-14 14:15   ` Christian Ehrhardt
2021-06-15 10:56     ` Xueming(Steven) Li
2021-06-30  6:46       ` Xueming(Steven) Li
2021-06-14 13:56 ` [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search Christian Ehrhardt
2021-06-16  4:03 ` [dpdk-stable] [PATCH v1 " Xueming Li
2021-06-30  6:34   ` [dpdk-stable] [PATCH v2 " Xueming Li
2021-06-30  6:34     ` [dpdk-stable] [PATCH v2 2/2] devtools: fix patches missing if range newer than HEAD Xueming Li
2021-08-08 11:24       ` Thomas Monjalon
2021-08-09  7:44         ` Xueming(Steven) Li
2021-08-08 11:14     ` [dpdk-stable] [PATCH v2 1/2] devtools: fix version pattern for fix search Thomas Monjalon
2021-08-09  3:32       ` Xueming(Steven) Li
2021-06-16  4:03 ` Xueming Li [this message]
2021-08-11 11:22 ` [dpdk-stable] [PATCH v3 " Xueming Li
2021-08-11 11:22   ` [dpdk-stable] [PATCH v3 2/2] devtools: fix patches missing if range newer than HEAD Xueming Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210616040324.311461-2-xuemingl@nvidia.com \
    --to=xuemingl@nvidia.com \
    --cc=bluca@debian.org \
    --cc=christian.ehrhardt@canonical.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    --cc=yuanhan.liu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git