patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search
@ 2021-06-12 13:56 Xueming Li
  2021-06-12 13:56 ` [dpdk-stable] [PATCH 2/2] devtools: auto detect branch to search fix patches Xueming Li
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Xueming Li @ 2021-06-12 13:56 UTC (permalink / raw)
  To: dev
  Cc: Luca Boccassi, Christian Ehrhardt, Thomas Monjalon, stable, Yuanhan Liu

When scanning fixes from current(HEAD) branch, local tags were included
and reported as version. For example:
  $ git tag --contains <commit_id> --merged
  20.11_backport_202010506   // user tag
  v20.11
  v20.11.1

This patch matches DPDK officail version pattern in search, selects
the most early tag. Official tag pattern: "v<major>.<minor>"

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/git-log-fixes.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 210c8dcf25..5fc57da913 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -38,12 +38,13 @@ range="$*"
 # 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 --contains $1 --merged $refbranch 2>&- ||
+	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
-		for t in $(git tag -l --contains $1) ; do
+		for t in $(git tag -l $VER --contains $1) ; do
 			git branch $refbranch --contains $t |
 			sed "s,.\+,$t,"
 		done) |
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-stable] [PATCH 2/2] devtools: auto detect branch to search fix patches
  2021-06-12 13:56 [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search Xueming Li
@ 2021-06-12 13:56 ` Xueming Li
  2021-06-14 14:15   ` Christian Ehrhardt
  2021-06-14 13:56 ` [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search Christian Ehrhardt
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Xueming Li @ 2021-06-12 13:56 UTC (permalink / raw)
  To: dev
  Cc: Luca Boccassi, Christian Ehrhardt, Thomas Monjalon, stable, Yuanhan Liu

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

This patch auto etects branch to scan from range.

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/git-log-fixes.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 5fc57da913..9a8a9d6739 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -34,13 +34,15 @@ done
 shift $(($OPTIND - 1))
 [ $# -ge 1 ] || usage_error 'range argument required'
 range="$*"
+range_last=$(git log --oneline v21.05-rc3..v21.05 |head -n1|cut -d' ' -f1)
+# use first branch
+refbranch=$(git branch --contains $range_last -r --sort=-authordate |head -n1)
 
 # 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
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search
  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 13:56 ` Christian Ehrhardt
  2021-06-16  4:03 ` [dpdk-stable] [PATCH v1 " Xueming Li
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 17+ messages in thread
From: Christian Ehrhardt @ 2021-06-14 13:56 UTC (permalink / raw)
  To: Xueming Li; +Cc: dev, Luca Boccassi, Thomas Monjalon, dpdk stable, Yuanhan Liu

On Sat, Jun 12, 2021 at 3:57 PM Xueming Li <xuemingl@nvidia.com> wrote:
>
> When scanning fixes from current(HEAD) branch, local tags were included
> and reported as version. For example:
>   $ git tag --contains <commit_id> --merged
>   20.11_backport_202010506   // user tag
>   v20.11
>   v20.11.1
>
> This patch matches DPDK officail version pattern in search, selects
> the most early tag. Official tag pattern: "v<major>.<minor>"
>
> 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/git-log-fixes.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> index 210c8dcf25..5fc57da913 100755
> --- a/devtools/git-log-fixes.sh
> +++ b/devtools/git-log-fixes.sh
> @@ -38,12 +38,13 @@ range="$*"
>  # 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 --contains $1 --merged $refbranch 2>&- ||
> +       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
> -               for t in $(git tag -l --contains $1) ; do
> +               for t in $(git tag -l $VER --contains $1) ; do
>                         git branch $refbranch --contains $t |
>                         sed "s,.\+,$t,"
>                 done) |
> --

LGTM - thanks for improving the scripts!

Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>

> 2.25.1
>


-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH 2/2] devtools: auto detect branch to search fix patches
  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
  0 siblings, 1 reply; 17+ messages in thread
From: Christian Ehrhardt @ 2021-06-14 14:15 UTC (permalink / raw)
  To: Xueming Li; +Cc: dev, Luca Boccassi, Thomas Monjalon, dpdk stable, Yuanhan Liu

On Sat, Jun 12, 2021 at 3:57 PM Xueming Li <xuemingl@nvidia.com> wrote:
>
> Current fix scan scripts scanned specified range in current(HEAD)
> branch. When users run it in a earlier branch, few patches were

^^ typo missing "an" (if you care)

> scanned.
>
> This patch auto etects branch to scan from range.

^^ typo missing "d" (if you care)

>
> 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/git-log-fixes.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> index 5fc57da913..9a8a9d6739 100755
> --- a/devtools/git-log-fixes.sh
> +++ b/devtools/git-log-fixes.sh
> @@ -34,13 +34,15 @@ done
>  shift $(($OPTIND - 1))
>  [ $# -ge 1 ] || usage_error 'range argument required'
>  range="$*"
> +range_last=$(git log --oneline v21.05-rc3..v21.05 |head -n1|cut -d' ' -f1)

Instead of these values that would need to be dynamic to be generally
reliable right?
Everyone might need something different.

I thought about the same and wondered if this script should get a new
optional argument.
If passed it will use this new argument instead of $refbranch

That would allow any user today to be able to continue to use it as-is
and anyone else can for reliable behavior define the branch to look
in.

> +# use first branch
> +refbranch=$(git branch --contains $range_last -r --sort=-authordate |head -n1)
>
>  # 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
> --
> 2.25.1
>


-- 
Christian Ehrhardt
Staff Engineer, Ubuntu Server
Canonical Ltd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH 2/2] devtools: auto detect branch to search fix patches
  2021-06-14 14:15   ` Christian Ehrhardt
@ 2021-06-15 10:56     ` Xueming(Steven) Li
  2021-06-30  6:46       ` Xueming(Steven) Li
  0 siblings, 1 reply; 17+ messages in thread
From: Xueming(Steven) Li @ 2021-06-15 10:56 UTC (permalink / raw)
  To: Christian Ehrhardt
  Cc: dev, Luca Boccassi, NBU-Contact-Thomas Monjalon, dpdk stable,
	Yuanhan Liu



> -----Original Message-----
> From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> Sent: Monday, June 14, 2021 10:16 PM
> To: Xueming(Steven) Li <xuemingl@nvidia.com>
> Cc: dev <dev@dpdk.org>; Luca Boccassi <bluca@debian.org>; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; dpdk stable
> <stable@dpdk.org>; Yuanhan Liu <yuanhan.liu@linux.intel.com>
> Subject: Re: [PATCH 2/2] devtools: auto detect branch to search fix patches
> 
> On Sat, Jun 12, 2021 at 3:57 PM Xueming Li <xuemingl@nvidia.com> wrote:
> >
> > Current fix scan scripts scanned specified range in current(HEAD)
> > branch. When users run it in a earlier branch, few patches were
> 
> ^^ typo missing "an" (if you care)
> 
> > scanned.
> >
> > This patch auto etects branch to scan from range.
> 
> ^^ typo missing "d" (if you care)

Thanks :)

> 
> >
> > 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/git-log-fixes.sh | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> > index 5fc57da913..9a8a9d6739 100755
> > --- a/devtools/git-log-fixes.sh
> > +++ b/devtools/git-log-fixes.sh
> > @@ -34,13 +34,15 @@ done
> >  shift $(($OPTIND - 1))
> >  [ $# -ge 1 ] || usage_error 'range argument required'
> >  range="$*"
> > +range_last=$(git log --oneline v21.05-rc3..v21.05 |head -n1|cut -d' '
> > +-f1)
> 
> Instead of these values that would need to be dynamic to be generally reliable right?
> Everyone might need something different.
> 
> I thought about the same and wondered if this script should get a new optional argument.
> If passed it will use this new argument instead of $refbranch
> 
> That would allow any user today to be able to continue to use it as-is and anyone else can for reliable behavior define the branch to
> look in.

Looks good. There are two scenarios for this script:
	Called from check-git-log.sh: if version not found, default to VERSION file
	Standalone running with range: I don't think a default is required.
So the default version only valid when "branch" argument is "HEAD"
 
> 
> > +# use first branch
> > +refbranch=$(git branch --contains $range_last -r --sort=-authordate
> > +|head -n1)
> >
> >  # 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
> > --
> > 2.25.1
> >
> 
> 
> --
> Christian Ehrhardt
> Staff Engineer, Ubuntu Server
> Canonical Ltd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-stable] [PATCH v1 1/2] devtools: fix version pattern for fix search
  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 13:56 ` [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search Christian Ehrhardt
@ 2021-06-16  4:03 ` Xueming Li
  2021-06-30  6:34   ` [dpdk-stable] [PATCH v2 " Xueming Li
  2021-06-16  4:03 ` [dpdk-stable] [PATCH v1 2/2] devtools: auto detect branch to search fix patches Xueming Li
  2021-08-11 11:22 ` [dpdk-stable] [PATCH v3 1/2] devtools: fix version pattern for fix search Xueming Li
  4 siblings, 1 reply; 17+ messages in thread
From: Xueming Li @ 2021-06-16  4:03 UTC (permalink / raw)
  To: Christian Ehrhardt, Luca Boccassi
  Cc: dev, xuemingl, Thomas Monjalon, stable, Yuanhan Liu

When scanning fixes from current(HEAD) branch, local tags were included
and reported as version. For example:
  $ git tag --contains <commit_id> --merged
  20.11_backport_202010506   // user tag
  v20.11
  v20.11.1

This patch matches DPDK officail version pattern in search, selects
the most early tag. Official tag pattern: "v<major>.<minor>"

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>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 devtools/git-log-fixes.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 210c8dcf25..5fc57da913 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -38,12 +38,13 @@ range="$*"
 # 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 --contains $1 --merged $refbranch 2>&- ||
+	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
-		for t in $(git tag -l --contains $1) ; do
+		for t in $(git tag -l $VER --contains $1) ; do
 			git branch $refbranch --contains $t |
 			sed "s,.\+,$t,"
 		done) |
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-stable] [PATCH v1 2/2] devtools: auto detect branch to search fix patches
  2021-06-12 13:56 [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search Xueming Li
                   ` (2 preceding siblings ...)
  2021-06-16  4:03 ` [dpdk-stable] [PATCH v1 " Xueming Li
@ 2021-06-16  4:03 ` Xueming Li
  2021-08-11 11:22 ` [dpdk-stable] [PATCH v3 1/2] devtools: fix version pattern for fix search Xueming Li
  4 siblings, 0 replies; 17+ messages in thread
From: Xueming Li @ 2021-06-16  4:03 UTC (permalink / raw)
  To: Christian Ehrhardt, Luca Boccassi
  Cc: dev, xuemingl, Thomas Monjalon, stable, Yuanhan Liu

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-stable] [PATCH v2 1/2] devtools: fix version pattern for fix search
  2021-06-16  4:03 ` [dpdk-stable] [PATCH v1 " Xueming Li
@ 2021-06-30  6:34   ` 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:14     ` [dpdk-stable] [PATCH v2 1/2] devtools: fix version pattern for fix search Thomas Monjalon
  0 siblings, 2 replies; 17+ messages in thread
From: Xueming Li @ 2021-06-30  6:34 UTC (permalink / raw)
  To: dev; +Cc: Thomas Monjalon, stable, Christian Ehrhardt, Yuanhan Liu

When scanning fixes from current(HEAD) branch, local tags were included
and reported as version. For example:
  $ git tag --contains <commit_id> --merged
  20.11_backport_202010506   // user tag
  v20.11
  v20.11.1

This patch matches DPDK officail version pattern in search, selects
the most early tag. Official tag pattern: "v<major>.<minor>"

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>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 devtools/git-log-fixes.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 210c8dcf25..153ba5b438 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -38,12 +38,13 @@ range="$*"
 # 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 --contains $1 --merged $refbranch 2>&- ||
+	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
-		for t in $(git tag -l --contains $1) ; do
+		for t in $(git tag -l "$VER" --contains $1) ; do
 			git branch $refbranch --contains $t |
 			sed "s,.\+,$t,"
 		done) |
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-stable] [PATCH v2 2/2] devtools: fix patches missing if range newer than HEAD
  2021-06-30  6:34   ` [dpdk-stable] [PATCH v2 " Xueming Li
@ 2021-06-30  6:34     ` Xueming Li
  2021-08-08 11:24       ` Thomas Monjalon
  2021-08-08 11:14     ` [dpdk-stable] [PATCH v2 1/2] devtools: fix version pattern for fix search Thomas Monjalon
  1 sibling, 1 reply; 17+ messages in thread
From: Xueming Li @ 2021-06-30  6:34 UTC (permalink / raw)
  To: dev; +Cc: Thomas Monjalon, stable, Christian Ehrhardt, Yuanhan Liu

Current fix scan scripts scanned specified range in HEAD branch.
When users ran it in an earlier branch, few patches were scanned
due to the fixes in the range are newer and not merged to HEAD
branch.

This patch introduces optional <branch> argument, default to HEAD
if not specified. Checks the <range> specified in parameter must
being merged in <branch>.

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

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 devtools/git-log-fixes.sh | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 153ba5b438..51d8b19942 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 current branch or the branch specified.
 	END_OF_HELP
 }
 
@@ -33,14 +34,22 @@ while getopts h ARG ; do
 done
 shift $(($OPTIND - 1))
 [ $# -ge 1 ] || usage_error 'range argument required'
-range="$*"
+range="$1"
+branch="$2"
+
+[ -n "$branch" ] || branch="HEAD"
+refbranch=$(git rev-parse --abbrev-ref $branch)
+range_last=$(git log --oneline $range |head -n1|cut -d' ' -f1)
+if ! git branch -a --contains $range_last |grep -q -e " $refbranch$" -e " remotes/$refbranch$"; then
+	echo "range $range not included by branch $refbranch"
+	exit 1
+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 +58,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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH 2/2] devtools: auto detect branch to search fix patches
  2021-06-15 10:56     ` Xueming(Steven) Li
@ 2021-06-30  6:46       ` Xueming(Steven) Li
  0 siblings, 0 replies; 17+ messages in thread
From: Xueming(Steven) Li @ 2021-06-30  6:46 UTC (permalink / raw)
  To: Xueming(Steven) Li, Christian Ehrhardt
  Cc: dev, Luca Boccassi, NBU-Contact-Thomas Monjalon, dpdk stable,
	Yuanhan Liu



> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Xueming(Steven) Li
> Sent: Tuesday, June 15, 2021 6:56 PM
> To: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> Cc: dev <dev@dpdk.org>; Luca Boccassi <bluca@debian.org>; NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; dpdk stable
> <stable@dpdk.org>; Yuanhan Liu <yuanhan.liu@linux.intel.com>
> Subject: Re: [dpdk-dev] [PATCH 2/2] devtools: auto detect branch to search fix patches
> 
> 
> 
> > -----Original Message-----
> > From: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > Sent: Monday, June 14, 2021 10:16 PM
> > To: Xueming(Steven) Li <xuemingl@nvidia.com>
> > Cc: dev <dev@dpdk.org>; Luca Boccassi <bluca@debian.org>;
> > NBU-Contact-Thomas Monjalon <thomas@monjalon.net>; dpdk stable
> > <stable@dpdk.org>; Yuanhan Liu <yuanhan.liu@linux.intel.com>
> > Subject: Re: [PATCH 2/2] devtools: auto detect branch to search fix
> > patches
> >
> > On Sat, Jun 12, 2021 at 3:57 PM Xueming Li <xuemingl@nvidia.com> wrote:
> > >
> > > Current fix scan scripts scanned specified range in current(HEAD)
> > > branch. When users run it in a earlier branch, few patches were
> >
> > ^^ typo missing "an" (if you care)
> >
> > > scanned.
> > >
> > > This patch auto etects branch to scan from range.
> >
> > ^^ typo missing "d" (if you care)
> 
> Thanks :)
> 
> >
> > >
> > > 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/git-log-fixes.sh | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> > > index 5fc57da913..9a8a9d6739 100755
> > > --- a/devtools/git-log-fixes.sh
> > > +++ b/devtools/git-log-fixes.sh
> > > @@ -34,13 +34,15 @@ done
> > >  shift $(($OPTIND - 1))
> > >  [ $# -ge 1 ] || usage_error 'range argument required'
> > >  range="$*"
> > > +range_last=$(git log --oneline v21.05-rc3..v21.05 |head -n1|cut -d' '
> > > +-f1)
> >
> > Instead of these values that would need to be dynamic to be generally reliable right?
> > Everyone might need something different.
> >
> > I thought about the same and wondered if this script should get a new optional argument.
> > If passed it will use this new argument instead of $refbranch
> >
> > That would allow any user today to be able to continue to use it as-is
> > and anyone else can for reliable behavior define the branch to look in.
> 
> Looks good. There are two scenarios for this script:
> 	Called from check-git-log.sh: if version not found, default to VERSION file
> 	Standalone running with range: I don't think a default is required.
> So the default version only valid when "branch" argument is "HEAD"

It might not be a good idea to "guess" the branch from commit range.
V2 adds branch parameter, default to HEAD, then verifies branch contains the commit range.

Now in any branch, below command works correctly:
	devtools/git-log-fixes.sh v21.05-rc1..v21.05 origin/main
If current branch is older, like 20.11, below command will abort with error:
	devtools/git-log-fixes.sh v21.05-rc1..v21.05

> 
> >
> > > +# use first branch
> > > +refbranch=$(git branch --contains $range_last -r --sort=-authordate
> > > +|head -n1)
> > >
> > >  # 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
> > > --
> > > 2.25.1
> > >
> >
> >
> > --
> > Christian Ehrhardt
> > Staff Engineer, Ubuntu Server
> > Canonical Ltd

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH v2 1/2] devtools: fix version pattern for fix search
  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:14     ` Thomas Monjalon
  2021-08-09  3:32       ` Xueming(Steven) Li
  1 sibling, 1 reply; 17+ messages in thread
From: Thomas Monjalon @ 2021-08-08 11:14 UTC (permalink / raw)
  To: Xueming Li; +Cc: dev, stable, Christian Ehrhardt, david.marchand, Luca Boccassi

30/06/2021 08:34, Xueming Li:
> When scanning fixes from current(HEAD) branch, local tags were included
> and reported as version. For example:
>   $ git tag --contains <commit_id> --merged
>   20.11_backport_202010506   // user tag
>   v20.11
>   v20.11.1
> 
> This patch matches DPDK officail version pattern in search, selects
> the most early tag. Official tag pattern: "v<major>.<minor>"
> 
> 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>
> Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> ---
>  devtools/git-log-fixes.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> index 210c8dcf25..153ba5b438 100755
> --- a/devtools/git-log-fixes.sh
> +++ b/devtools/git-log-fixes.sh
> @@ -38,12 +38,13 @@ range="$*"
>  # get major release version of a commit
>  commit_version () # <hash>
>  {
> +	local VER="v*.*"

Which tag is it supposed to match? What would not be matched?
What about something like v19.11.8 ?
What about the above example 20.11_backport_202010506?

>  	# use current branch as history reference
>  	local refbranch=$(git rev-parse --abbrev-ref HEAD)
> -	local tag=$( (git tag -l --contains $1 --merged $refbranch 2>&- ||
> +	local tag=$( (git tag -l "$VER" --contains $1 --sort=creatordate --merged $refbranch 2>&- ||

Why adding "--sort=creatordate" ?
It is not mentioned in the commit log.

>  		# tag --merged option has been introduced in git 2.7.0
>  		# below is a fallback in case of old git version
> -		for t in $(git tag -l --contains $1) ; do
> +		for t in $(git tag -l "$VER" --contains $1) ; do
>  			git branch $refbranch --contains $t |
>  			sed "s,.\+,$t,"
>  		done) |







^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH v2 2/2] devtools: fix patches missing if range newer than HEAD
  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
  0 siblings, 1 reply; 17+ messages in thread
From: Thomas Monjalon @ 2021-08-08 11:24 UTC (permalink / raw)
  To: Xueming Li
  Cc: dev, stable, Christian Ehrhardt, bluca, ktraynor, david.marchand

30/06/2021 08:34, Xueming Li:
> Current fix scan scripts scanned specified range in HEAD branch.

I cannot parse the above sentence.

> When users ran it in an earlier branch, few patches were scanned
> due to the fixes in the range are newer and not merged to HEAD
> branch.

You mean some patches were not scanned?

> 
> This patch introduces optional <branch> argument, default to HEAD
> if not specified. Checks the <range> specified in parameter must
> being merged in <branch>.

Cannot parse either.

> Fixes: 752d8e097ec1 ("scripts: show fixes with release version of bug")
> Cc: Thomas Monjalon <thomas@monjalon.net>
> Cc: stable@dpdk.org
> Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
[...]
> -	echo "usage: $(basename $0) [-h] <git_range>"
> +	echo "usage: $(basename $0) [-h] <git_range> [<branch>]"
[...]
> -range="$*"
> +range="$1"

I think it breaks passing range in multiple parameters without quotes.
But it is not really a problem.

> +branch="$2"
> +
> +[ -n "$branch" ] || branch="HEAD"
> +refbranch=$(git rev-parse --abbrev-ref $branch)

Why this line is needed? A comment may help.
If $branch is not used anymore, we can overwrite it
instead of introducing one more variable $refbranch.

> +range_last=$(git log --oneline $range |head -n1|cut -d' ' -f1)

spaces missing around pipes.
You can avoid "head" and "cut" by providing the right options to git.

> +if ! git branch -a --contains $range_last |grep -q -e " $refbranch$" -e " remotes/$refbranch$"; then
> +	echo "range $range not included by branch $refbranch"
> +	exit 1
> +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)

You move a line but not its comment above.



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH v2 1/2] devtools: fix version pattern for fix search
  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
  0 siblings, 0 replies; 17+ messages in thread
From: Xueming(Steven) Li @ 2021-08-09  3:32 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon
  Cc: dev, stable, Christian Ehrhardt, david.marchand, Luca Boccassi

Hi,

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Sunday, August 8, 2021 7:15 PM
> To: Xueming(Steven) Li <xuemingl@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Christian Ehrhardt <christian.ehrhardt@canonical.com>; david.marchand@redhat.com; Luca
> Boccassi <bluca@debian.org>
> Subject: Re: [dpdk-stable] [PATCH v2 1/2] devtools: fix version pattern for fix search
> 
> 30/06/2021 08:34, Xueming Li:
> > When scanning fixes from current(HEAD) branch, local tags were
> > included and reported as version. For example:
> >   $ git tag --contains <commit_id> --merged
> >   20.11_backport_202010506   // user tag
> >   v20.11
> >   v20.11.1
> >
> > This patch matches DPDK officail version pattern in search, selects
> > the most early tag. Official tag pattern: "v<major>.<minor>"
> >
> > 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>
> > Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> > ---
> >  devtools/git-log-fixes.sh | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> > index 210c8dcf25..153ba5b438 100755
> > --- a/devtools/git-log-fixes.sh
> > +++ b/devtools/git-log-fixes.sh
> > @@ -38,12 +38,13 @@ range="$*"
> >  # get major release version of a commit  commit_version () # <hash>
> > {
> > +	local VER="v*.*"
> 
> Which tag is it supposed to match? What would not be matched?
> What about something like v19.11.8 ?
> What about the above example 20.11_backport_202010506?

It matches any tag version like started with "v" and a "." in the middle.
So v19.11.8 matches as at least one "." in the middle.
20.11_backport_202010506 can't match since it not started with "v"

> 
> >  	# use current branch as history reference
> >  	local refbranch=$(git rev-parse --abbrev-ref HEAD)
> > -	local tag=$( (git tag -l --contains $1 --merged $refbranch 2>&- ||
> > +	local tag=$( (git tag -l "$VER" --contains $1 --sort=creatordate --merged $refbranch 2>&- ||
> 
> Why adding "--sort=creatordate" ?
> It is not mentioned in the commit log.

Mentioned a little bit: "select the most early tag"
By default git output tag in alpha order, this makes v19.11 appears earlier than v2.x, that's wrong.

> 
> >  		# tag --merged option has been introduced in git 2.7.0
> >  		# below is a fallback in case of old git version
> > -		for t in $(git tag -l --contains $1) ; do
> > +		for t in $(git tag -l "$VER" --contains $1) ; do
> >  			git branch $refbranch --contains $t |
> >  			sed "s,.\+,$t,"
> >  		done) |
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH v2 2/2] devtools: fix patches missing if range newer than HEAD
  2021-08-08 11:24       ` Thomas Monjalon
@ 2021-08-09  7:44         ` Xueming(Steven) Li
  0 siblings, 0 replies; 17+ messages in thread
From: Xueming(Steven) Li @ 2021-08-09  7:44 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon
  Cc: dev, stable, Christian Ehrhardt, bluca, ktraynor, david.marchand



> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Sunday, August 8, 2021 7:25 PM
> To: Xueming(Steven) Li <xuemingl@nvidia.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Christian Ehrhardt <christian.ehrhardt@canonical.com>; bluca@debian.org;
> ktraynor@redhat.com; david.marchand@redhat.com
> Subject: Re: [dpdk-stable] [PATCH v2 2/2] devtools: fix patches missing if range newer than HEAD
> 
> 30/06/2021 08:34, Xueming Li:
> > Current fix scan scripts scanned specified range in HEAD branch.
> 
> I cannot parse the above sentence.

The scripts scans patches and try to get patch version info from current branch.

> 
> > When users ran it in an earlier branch, few patches were scanned due
> > to the fixes in the range are newer and not merged to HEAD branch.
> 
> You mean some patches were not scanned?

Scanned but failed to retrieve correct version info. 

> 
> >
> > This patch introduces optional <branch> argument, default to HEAD if
> > not specified. Checks the <range> specified in parameter must being
> > merged in <branch>.
> 
> Cannot parse either.
> 
> > Fixes: 752d8e097ec1 ("scripts: show fixes with release version of
> > bug")
> > Cc: Thomas Monjalon <thomas@monjalon.net>
> > Cc: stable@dpdk.org
> > Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> >
> > Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> [...]
> > -	echo "usage: $(basename $0) [-h] <git_range>"
> > +	echo "usage: $(basename $0) [-h] <git_range> [<branch>]"
> [...]
> > -range="$*"
> > +range="$1"
> 
> I think it breaks passing range in multiple parameters without quotes.
> But it is not really a problem.
> 
> > +branch="$2"
> > +
> > +[ -n "$branch" ] || branch="HEAD"
> > +refbranch=$(git rev-parse --abbrev-ref $branch)
> 
> Why this line is needed? A comment may help.

OK

> If $branch is not used anymore, we can overwrite it instead of introducing one more variable $refbranch.

$branch will be used in function commit_version().

>
> > +range_last=$(git log --oneline $range |head -n1|cut -d' ' -f1)
> 
> spaces missing around pipes.
> You can avoid "head" and "cut" by providing the right options to git.

Yes, rev-parse will do this efficiently.

> 
> > +if ! git branch -a --contains $range_last |grep -q -e " $refbranch$" -e " remotes/$refbranch$"; then
> > +	echo "range $range not included by branch $refbranch"
> > +	exit 1
> > +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)
> 
> You move a line but not its comment above.
> 


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-stable] [PATCH v3 1/2] devtools: fix version pattern for fix search
  2021-06-12 13:56 [dpdk-stable] [PATCH 1/2] devtools: fix version pattern for fix search Xueming Li
                   ` (3 preceding siblings ...)
  2021-06-16  4:03 ` [dpdk-stable] [PATCH v1 2/2] devtools: auto detect branch to search fix patches Xueming Li
@ 2021-08-11 11:22 ` Xueming Li
  2021-08-11 11:22   ` [dpdk-stable] [PATCH v3 2/2] devtools: fix patches missing if range newer than HEAD Xueming Li
  4 siblings, 1 reply; 17+ messages in thread
From: Xueming Li @ 2021-08-11 11:22 UTC (permalink / raw)
  Cc: dev, xuemingl, Thomas Monjalon, stable, Christian Ehrhardt, Yuanhan Liu

When scanning fixes from current(HEAD) branch, local tags were included
and reported as version. For example:
  $ git tag --contains <commit_id> --merged
  20.11_backport_202010506   // user tag
  v20.11
  v20.11.1

This patch matches DPDK officail version pattern in search, selects
the most early tag. Official tag pattern: "v<major>.<minor>"

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>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
---
 devtools/git-log-fixes.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 210c8dcf25..153ba5b438 100755
--- a/devtools/git-log-fixes.sh
+++ b/devtools/git-log-fixes.sh
@@ -38,12 +38,13 @@ range="$*"
 # 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 --contains $1 --merged $refbranch 2>&- ||
+	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
-		for t in $(git tag -l --contains $1) ; do
+		for t in $(git tag -l "$VER" --contains $1) ; do
 			git branch $refbranch --contains $t |
 			sed "s,.\+,$t,"
 		done) |
-- 
2.25.1


^ permalink raw reply	[flat|nested] 17+ messages in thread

* [dpdk-stable] [PATCH v3 2/2] devtools: fix patches missing if range newer than HEAD
  2021-08-11 11:22 ` [dpdk-stable] [PATCH v3 1/2] devtools: fix version pattern for fix search Xueming Li
@ 2021-08-11 11:22   ` Xueming Li
  2022-11-26 21:44     ` Thomas Monjalon
  0 siblings, 1 reply; 17+ messages in thread
From: Xueming Li @ 2021-08-11 11:22 UTC (permalink / raw)
  Cc: dev, xuemingl, Thomas Monjalon, stable, Christian Ehrhardt, Yuanhan Liu

Current fix scan scripts used HEAD branch as history reference.
When users ran it in an earlier branch, few patches were scanned
due to the fixes in the range are newer and not merged to current
branch.

This patch introduces optional <branch> argument, default to HEAD
if not specified. Checks the <range> specified in parameter must
being merged in <branch>.

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

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

diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
index 153ba5b438..dbed4b6419 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 current branch or the branch specified.
 	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"
+
+# default to current branch as history reference
+[ -n "$branch" ] || branch="HEAD"
+# get real brnach name
+refbranch=$(git rev-parse --abbrev-ref $branch)
+range_last=$(git rev-parse $range | head -n1)
+if ! git branch -a --contains $range_last | grep -q -e " $refbranch$" -e " remotes/$refbranch$"; then
+	echo "range $range not included by branch $refbranch"
+	exit 1
+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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [dpdk-stable] [PATCH v3 2/2] devtools: fix patches missing if range newer than HEAD
  2021-08-11 11:22   ` [dpdk-stable] [PATCH v3 2/2] devtools: fix patches missing if range newer than HEAD Xueming Li
@ 2022-11-26 21:44     ` Thomas Monjalon
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas Monjalon @ 2022-11-26 21:44 UTC (permalink / raw)
  To: Christian Ehrhardt, bluca, ktraynor; +Cc: stable, dev, Xueming Li

Someone to help with review of this patch please?
Is there a real need?


11/08/2021 13:22, Xueming Li:
> Current fix scan scripts used HEAD branch as history reference.
> When users ran it in an earlier branch, few patches were scanned
> due to the fixes in the range are newer and not merged to current
> branch.
> 
> This patch introduces optional <branch> argument, default to HEAD
> if not specified. Checks the <range> specified in parameter must
> being merged in <branch>.
> 
> Fixes: 752d8e097ec1 ("scripts: show fixes with release version of bug")
> Cc: Thomas Monjalon <thomas@monjalon.net>
> Cc: stable@dpdk.org
> Cc: Christian Ehrhardt <christian.ehrhardt@canonical.com>
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> ---
>  devtools/git-log-fixes.sh | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 
> diff --git a/devtools/git-log-fixes.sh b/devtools/git-log-fixes.sh
> index 153ba5b438..dbed4b6419 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 current branch or the branch specified.
>  	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"
> +
> +# default to current branch as history reference
> +[ -n "$branch" ] || branch="HEAD"
> +# get real brnach name
> +refbranch=$(git rev-parse --abbrev-ref $branch)
> +range_last=$(git rev-parse $range | head -n1)
> +if ! git branch -a --contains $range_last | grep -q -e " $refbranch$" -e " remotes/$refbranch$"; then
> +	echo "range $range not included by branch $refbranch"
> +	exit 1
> +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
> 






^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-11-26 21:44 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [dpdk-stable] [PATCH v1 2/2] devtools: auto detect branch to search fix patches Xueming Li
2021-08-11 11:22 ` [dpdk-stable] [PATCH v3 1/2] devtools: fix version pattern for fix search Xueming Li
2021-08-11 11:22   ` [dpdk-stable] [PATCH v3 2/2] devtools: fix patches missing if range newer than HEAD Xueming Li
2022-11-26 21:44     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).