All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] Try to use git commit id if hg changeset is unavailable
@ 2013-05-08 15:15 Marek Marczykowski
  2013-05-08 15:45 ` Ian Campbell
  2013-05-13 13:52 ` [PATCH v3] Try to use git commit id if hg changeset is unavailable Olaf Hering
  0 siblings, 2 replies; 16+ messages in thread
From: Marek Marczykowski @ 2013-05-08 15:15 UTC (permalink / raw)
  To: xen-devel
  Cc: Sander Eikelenboom, Keir Fraser, Marek Marczykowski, Ian Campbell

As Xen uses git as primary repository, get git commit id for
xen_changeset info.

Changes in v2:
 - split scm calls into separate script - based on Linux kernel one,
   with tags handling removed

Changes in v3:
 - do not assume tools/scmversion started from the repository toplevel
   dir - it is actually called from xen/ subdir

Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
---
 xen/Makefile         |  2 +-
 xen/tools/scmversion | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 100 insertions(+), 1 deletion(-)
 create mode 100755 xen/tools/scmversion

diff --git a/xen/Makefile b/xen/Makefile
index 0fb3db7..945197b 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -126,7 +126,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner
 	    -e 's/@@version@@/$(XEN_VERSION)/g' \
 	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
 	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
-	    -e 's!@@changeset@@!$(shell ((hg parents --template "{date|date} {rev}:{node|short}" >/dev/null && hg parents --template "{date|date} {rev}:{node|short}") || echo "unavailable") 2>/dev/null)!g' \
+	    -e 's!@@changeset@@!$(shell tools/scmversion || echo "unavailable")!g' \
 	    < include/xen/compile.h.in > $@.new
 	@grep \" .banner >> $@.new
 	@grep -v \" .banner
diff --git a/xen/tools/scmversion b/xen/tools/scmversion
new file mode 100755
index 0000000..8cdca94
--- /dev/null
+++ b/xen/tools/scmversion
@@ -0,0 +1,99 @@
+#!/bin/sh
+#
+# This scripts adds local version information from the version
+# control systems git, mercurial (hg) and subversion (svn).
+#
+# If something goes wrong, send a mail the kernel build mailinglist
+# (see MAINTAINERS) and CC Nico Schottelius
+# <nico-linuxsetlocalversion -at- schottelius.org>.
+#
+# Based on setlocalversion from Linux kernel
+#
+#
+
+usage() {
+	echo "Usage: $0 [--save-scmversion] [srctree]" >&2
+	exit 1
+}
+
+scm_only=false
+srctree=.
+if test "$1" = "--save-scmversion"; then
+	scm_only=true
+	shift
+fi
+if test $# -gt 0; then
+	srctree=$1
+	shift
+fi
+if test $# -gt 0 -o ! -d "$srctree"; then
+	usage
+fi
+
+scm_version()
+{
+	local short
+	short=false
+
+	cd "$srctree"
+	if test -e .scmversion; then
+		cat .scmversion
+		return
+	fi
+	if test "$1" = "--short"; then
+		short=true
+	fi
+
+	# Check for git and a git repo.
+	if head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+		date=`git show -s --pretty="%ad" HEAD`
+
+		printf '%s %s%s' "$date" git: $head
+
+		# Is this git on svn?
+		if git config --get svn-remote.svn.url >/dev/null; then
+			printf -- 'svn:%s' "`git svn find-rev $head`"
+		fi
+
+		# Update index only on r/w media
+		[ -w . ] && git update-index --refresh --unmerged > /dev/null
+
+		# Check for uncommitted changes
+		if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
+			printf '%s' -dirty
+		fi
+
+		# All done with git
+		return
+	fi
+
+	# Check for mercurial and a mercurial repo.
+	if hgid=`hg id 2>/dev/null`; then
+		id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
+		date=`hg parents --template "{date|date}"`
+		printf '%s %s%s' "$date" hg: "$id"
+
+		# Are there uncommitted changes?
+		# These are represented by + after the changeset id.
+		case "$hgid" in
+			*+|*+\ *) printf '%s' -dirty ;;
+		esac
+
+		# All done with mercurial
+		return
+	fi
+
+	# Check for svn and a svn repo.
+	if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
+		rev=`echo $rev | awk '{print $NF}'`
+		printf -- 'svn:%s' "$rev"
+
+		# All done with svn
+		return
+	fi
+}
+
+# full scm version string
+res="$(scm_version)"
+
+echo "$res"
-- 
1.8.1.4

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

* Re: [PATCH v3] Try to use git commit id if hg changeset is unavailable
  2013-05-08 15:15 [PATCH v3] Try to use git commit id if hg changeset is unavailable Marek Marczykowski
@ 2013-05-08 15:45 ` Ian Campbell
  2013-05-08 19:16   ` Marek Marczykowski
  2013-05-13 13:52 ` [PATCH v3] Try to use git commit id if hg changeset is unavailable Olaf Hering
  1 sibling, 1 reply; 16+ messages in thread
From: Ian Campbell @ 2013-05-08 15:45 UTC (permalink / raw)
  To: Marek Marczykowski; +Cc: Sander Eikelenboom, Keir (Xen.org), xen-devel

On Wed, 2013-05-08 at 16:15 +0100, Marek Marczykowski wrote:
> As Xen uses git as primary repository, get git commit id for
> xen_changeset info.
> 
> Changes in v2:
>  - split scm calls into separate script - based on Linux kernel one,
>    with tags handling removed
> 
> Changes in v3:
>  - do not assume tools/scmversion started from the repository toplevel
>    dir - it is actually called from xen/ subdir

I see you did this by removing various checks for .hg and .igt
directories, but this seems a little fragile and doesn't cover
the .scmversion case properly.

The scmversion script already takes an optional source dir, why not just
pass $(XEN_ROOT) ?

Ian.

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

* Re: [PATCH v3] Try to use git commit id if hg changeset is unavailable
  2013-05-08 15:45 ` Ian Campbell
@ 2013-05-08 19:16   ` Marek Marczykowski
  2013-05-08 23:07     ` [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset Marek Marczykowski
  0 siblings, 1 reply; 16+ messages in thread
From: Marek Marczykowski @ 2013-05-08 19:16 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Sander Eikelenboom, Keir (Xen.org), xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 835 bytes --]

On 08.05.2013 17:45, Ian Campbell wrote:
> On Wed, 2013-05-08 at 16:15 +0100, Marek Marczykowski wrote:
>> As Xen uses git as primary repository, get git commit id for
>> xen_changeset info.
>>
>> Changes in v2:
>>  - split scm calls into separate script - based on Linux kernel one,
>>    with tags handling removed
>>
>> Changes in v3:
>>  - do not assume tools/scmversion started from the repository toplevel
>>    dir - it is actually called from xen/ subdir
> 
> I see you did this by removing various checks for .hg and .igt
> directories, but this seems a little fragile and doesn't cover
> the .scmversion case properly.
> 
> The scmversion script already takes an optional source dir, why not just
> pass $(XEN_ROOT) ?

Indeed, good idea.

-- 
Best Regards,
Marek Marczykowski
Invisible Things Lab


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 555 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset
  2013-05-08 19:16   ` Marek Marczykowski
@ 2013-05-08 23:07     ` Marek Marczykowski
  2013-05-10 13:29       ` Ian Campbell
  0 siblings, 1 reply; 16+ messages in thread
From: Marek Marczykowski @ 2013-05-08 23:07 UTC (permalink / raw)
  To: xen-devel
  Cc: Sander Eikelenboom, Keir Fraser, Marek Marczykowski, Ian Campbell

As Xen uses git as primary repository, get git commit id for
xen_changeset info.

Changes in v2:
 - split scm calls into separate script - based on Linux kernel one,
   with tags handling removed

Changes in v3:
 - do not assume tools/scmversion started from the repository toplevel
   dir - it is actually called from xen/ subdir

Changes in v4:
 - restore checks for .git and .hg dirs, use $(XEN_ROOT)

Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
---
 xen/Makefile         |   2 +-
 xen/tools/scmversion | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 102 insertions(+), 1 deletion(-)
 create mode 100755 xen/tools/scmversion

diff --git a/xen/Makefile b/xen/Makefile
index 0fb3db7..201d9bc 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -126,7 +126,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner
 	    -e 's/@@version@@/$(XEN_VERSION)/g' \
 	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
 	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
-	    -e 's!@@changeset@@!$(shell ((hg parents --template "{date|date} {rev}:{node|short}" >/dev/null && hg parents --template "{date|date} {rev}:{node|short}") || echo "unavailable") 2>/dev/null)!g' \
+	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
 	    < include/xen/compile.h.in > $@.new
 	@grep \" .banner >> $@.new
 	@grep -v \" .banner
diff --git a/xen/tools/scmversion b/xen/tools/scmversion
new file mode 100755
index 0000000..219d898
--- /dev/null
+++ b/xen/tools/scmversion
@@ -0,0 +1,101 @@
+#!/bin/sh
+#
+# This scripts adds local version information from the version
+# control systems git, mercurial (hg) and subversion (svn).
+#
+# If something goes wrong, send a mail the kernel build mailinglist
+# (see MAINTAINERS) and CC Nico Schottelius
+# <nico-linuxsetlocalversion -at- schottelius.org>.
+#
+# Based on setlocalversion from Linux kernel
+#
+#
+
+usage() {
+	echo "Usage: $0 [--save-scmversion] [srctree]" >&2
+	exit 1
+}
+
+scm_only=false
+srctree=.
+if test "$1" = "--save-scmversion"; then
+	scm_only=true
+	shift
+fi
+if test $# -gt 0; then
+	srctree=$1
+	shift
+fi
+if test $# -gt 0 -o ! -d "$srctree"; then
+	usage
+fi
+
+scm_version()
+{
+	local short
+	short=false
+
+	cd "$srctree"
+	if test -e .scmversion; then
+		cat .scmversion
+		return
+	fi
+	if test "$1" = "--short"; then
+		short=true
+	fi
+
+	# Check for git and a git repo.
+	if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
+		date=`git show -s --pretty="%ad" HEAD`
+
+		printf '%s %s%s' "$date" git: $head
+
+		# Is this git on svn?
+		if git config --get svn-remote.svn.url >/dev/null; then
+			printf -- 'svn:%s' "`git svn find-rev $head`"
+		fi
+
+		# Update index only on r/w media
+		[ -w . ] && git update-index --refresh --unmerged > /dev/null
+
+		# Check for uncommitted changes
+		if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
+			printf '%s' -dirty
+		fi
+
+		# All done with git
+		return
+	fi
+
+	# Check for mercurial and a mercurial repo.
+	if test -d .hg && hgid=`hg id 2>/dev/null`; then
+		id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
+		date=`hg parents --template "{date|date}"`
+		printf '%s %s%s' "$date" hg: "$id"
+
+		# Are there uncommitted changes?
+		# These are represented by + after the changeset id.
+		case "$hgid" in
+			*+|*+\ *) printf '%s' -dirty ;;
+		esac
+
+		# All done with mercurial
+		return
+	fi
+
+	# Check for svn and a svn repo.
+	if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
+		rev=`echo $rev | awk '{print $NF}'`
+		printf -- 'svn:%s' "$rev"
+
+		# All done with svn
+		return
+	fi
+}
+
+cd $srctree
+
+# full scm version string
+res="$(scm_version)"
+
+echo "$res"
-- 
1.8.1.4

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

* Re: [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset
  2013-05-08 23:07     ` [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset Marek Marczykowski
@ 2013-05-10 13:29       ` Ian Campbell
  2013-05-10 13:33         ` Andrew Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Campbell @ 2013-05-10 13:29 UTC (permalink / raw)
  To: Marek Marczykowski; +Cc: Sander Eikelenboom, Keir (Xen.org), xen-devel

On Thu, 2013-05-09 at 00:07 +0100, Marek Marczykowski wrote:
> As Xen uses git as primary repository, get git commit id for
> xen_changeset info.
> 
> Changes in v2:
>  - split scm calls into separate script - based on Linux kernel one,
>    with tags handling removed
> 
> Changes in v3:
>  - do not assume tools/scmversion started from the repository toplevel
>    dir - it is actually called from xen/ subdir
> 
> Changes in v4:
>  - restore checks for .git and .hg dirs, use $(XEN_ROOT)
> 
> Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>

I tried this on git and hg and it appeared to do the right thing,
thanks.

Reviewed-by: Ian Campbell <ian.campbell@citrix.com>

> ---
>  xen/Makefile         |   2 +-
>  xen/tools/scmversion | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 102 insertions(+), 1 deletion(-)
>  create mode 100755 xen/tools/scmversion
> 
> diff --git a/xen/Makefile b/xen/Makefile
> index 0fb3db7..201d9bc 100644
> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -126,7 +126,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner
>  	    -e 's/@@version@@/$(XEN_VERSION)/g' \
>  	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
>  	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
> -	    -e 's!@@changeset@@!$(shell ((hg parents --template "{date|date} {rev}:{node|short}" >/dev/null && hg parents --template "{date|date} {rev}:{node|short}") || echo "unavailable") 2>/dev/null)!g' \
> +	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
>  	    < include/xen/compile.h.in > $@.new
>  	@grep \" .banner >> $@.new
>  	@grep -v \" .banner
> diff --git a/xen/tools/scmversion b/xen/tools/scmversion
> new file mode 100755
> index 0000000..219d898
> --- /dev/null
> +++ b/xen/tools/scmversion
> @@ -0,0 +1,101 @@
> +#!/bin/sh
> +#
> +# This scripts adds local version information from the version
> +# control systems git, mercurial (hg) and subversion (svn).
> +#
> +# If something goes wrong, send a mail the kernel build mailinglist
> +# (see MAINTAINERS) and CC Nico Schottelius
> +# <nico-linuxsetlocalversion -at- schottelius.org>.
> +#
> +# Based on setlocalversion from Linux kernel
> +#
> +#
> +
> +usage() {
> +	echo "Usage: $0 [--save-scmversion] [srctree]" >&2
> +	exit 1
> +}
> +
> +scm_only=false
> +srctree=.
> +if test "$1" = "--save-scmversion"; then
> +	scm_only=true
> +	shift
> +fi
> +if test $# -gt 0; then
> +	srctree=$1
> +	shift
> +fi
> +if test $# -gt 0 -o ! -d "$srctree"; then
> +	usage
> +fi
> +
> +scm_version()
> +{
> +	local short
> +	short=false
> +
> +	cd "$srctree"
> +	if test -e .scmversion; then
> +		cat .scmversion
> +		return
> +	fi
> +	if test "$1" = "--short"; then
> +		short=true
> +	fi
> +
> +	# Check for git and a git repo.
> +	if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
> +		date=`git show -s --pretty="%ad" HEAD`
> +
> +		printf '%s %s%s' "$date" git: $head
> +
> +		# Is this git on svn?
> +		if git config --get svn-remote.svn.url >/dev/null; then
> +			printf -- 'svn:%s' "`git svn find-rev $head`"
> +		fi
> +
> +		# Update index only on r/w media
> +		[ -w . ] && git update-index --refresh --unmerged > /dev/null
> +
> +		# Check for uncommitted changes
> +		if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
> +			printf '%s' -dirty
> +		fi
> +
> +		# All done with git
> +		return
> +	fi
> +
> +	# Check for mercurial and a mercurial repo.
> +	if test -d .hg && hgid=`hg id 2>/dev/null`; then
> +		id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
> +		date=`hg parents --template "{date|date}"`
> +		printf '%s %s%s' "$date" hg: "$id"
> +
> +		# Are there uncommitted changes?
> +		# These are represented by + after the changeset id.
> +		case "$hgid" in
> +			*+|*+\ *) printf '%s' -dirty ;;
> +		esac
> +
> +		# All done with mercurial
> +		return
> +	fi
> +
> +	# Check for svn and a svn repo.
> +	if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
> +		rev=`echo $rev | awk '{print $NF}'`
> +		printf -- 'svn:%s' "$rev"
> +
> +		# All done with svn
> +		return
> +	fi
> +}
> +
> +cd $srctree
> +
> +# full scm version string
> +res="$(scm_version)"
> +
> +echo "$res"

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

* Re: [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset
  2013-05-10 13:29       ` Ian Campbell
@ 2013-05-10 13:33         ` Andrew Cooper
  2013-05-13  9:49           ` Ian Campbell
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Cooper @ 2013-05-10 13:33 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Sander Eikelenboom, Keir (Xen.org), Marek Marczykowski, xen-devel

On 10/05/13 14:29, Ian Campbell wrote:
> On Thu, 2013-05-09 at 00:07 +0100, Marek Marczykowski wrote:
>> As Xen uses git as primary repository, get git commit id for
>> xen_changeset info.
>>
>> Changes in v2:
>>  - split scm calls into separate script - based on Linux kernel one,
>>    with tags handling removed
>>
>> Changes in v3:
>>  - do not assume tools/scmversion started from the repository toplevel
>>    dir - it is actually called from xen/ subdir
>>
>> Changes in v4:
>>  - restore checks for .git and .hg dirs, use $(XEN_ROOT)
>>
>> Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
> I tried this on git and hg and it appeared to do the right thing,
> thanks.
>
> Reviewed-by: Ian Campbell <ian.campbell@citrix.com>

As soon as this gets into staging, I will rebase my much older patch on
top to allow XEN_CHANGESET to be overridden on the make invocation.

~Andrew

>
>> ---
>>  xen/Makefile         |   2 +-
>>  xen/tools/scmversion | 101 +++++++++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 102 insertions(+), 1 deletion(-)
>>  create mode 100755 xen/tools/scmversion
>>
>> diff --git a/xen/Makefile b/xen/Makefile
>> index 0fb3db7..201d9bc 100644
>> --- a/xen/Makefile
>> +++ b/xen/Makefile
>> @@ -126,7 +126,7 @@ include/xen/compile.h: include/xen/compile.h.in .banner
>>  	    -e 's/@@version@@/$(XEN_VERSION)/g' \
>>  	    -e 's/@@subversion@@/$(XEN_SUBVERSION)/g' \
>>  	    -e 's/@@extraversion@@/$(XEN_EXTRAVERSION)/g' \
>> -	    -e 's!@@changeset@@!$(shell ((hg parents --template "{date|date} {rev}:{node|short}" >/dev/null && hg parents --template "{date|date} {rev}:{node|short}") || echo "unavailable") 2>/dev/null)!g' \
>> +	    -e 's!@@changeset@@!$(shell tools/scmversion $(XEN_ROOT) || echo "unavailable")!g' \
>>  	    < include/xen/compile.h.in > $@.new
>>  	@grep \" .banner >> $@.new
>>  	@grep -v \" .banner
>> diff --git a/xen/tools/scmversion b/xen/tools/scmversion
>> new file mode 100755
>> index 0000000..219d898
>> --- /dev/null
>> +++ b/xen/tools/scmversion
>> @@ -0,0 +1,101 @@
>> +#!/bin/sh
>> +#
>> +# This scripts adds local version information from the version
>> +# control systems git, mercurial (hg) and subversion (svn).
>> +#
>> +# If something goes wrong, send a mail the kernel build mailinglist
>> +# (see MAINTAINERS) and CC Nico Schottelius
>> +# <nico-linuxsetlocalversion -at- schottelius.org>.
>> +#
>> +# Based on setlocalversion from Linux kernel
>> +#
>> +#
>> +
>> +usage() {
>> +	echo "Usage: $0 [--save-scmversion] [srctree]" >&2
>> +	exit 1
>> +}
>> +
>> +scm_only=false
>> +srctree=.
>> +if test "$1" = "--save-scmversion"; then
>> +	scm_only=true
>> +	shift
>> +fi
>> +if test $# -gt 0; then
>> +	srctree=$1
>> +	shift
>> +fi
>> +if test $# -gt 0 -o ! -d "$srctree"; then
>> +	usage
>> +fi
>> +
>> +scm_version()
>> +{
>> +	local short
>> +	short=false
>> +
>> +	cd "$srctree"
>> +	if test -e .scmversion; then
>> +		cat .scmversion
>> +		return
>> +	fi
>> +	if test "$1" = "--short"; then
>> +		short=true
>> +	fi
>> +
>> +	# Check for git and a git repo.
>> +	if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
>> +		date=`git show -s --pretty="%ad" HEAD`
>> +
>> +		printf '%s %s%s' "$date" git: $head
>> +
>> +		# Is this git on svn?
>> +		if git config --get svn-remote.svn.url >/dev/null; then
>> +			printf -- 'svn:%s' "`git svn find-rev $head`"
>> +		fi
>> +
>> +		# Update index only on r/w media
>> +		[ -w . ] && git update-index --refresh --unmerged > /dev/null
>> +
>> +		# Check for uncommitted changes
>> +		if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
>> +			printf '%s' -dirty
>> +		fi
>> +
>> +		# All done with git
>> +		return
>> +	fi
>> +
>> +	# Check for mercurial and a mercurial repo.
>> +	if test -d .hg && hgid=`hg id 2>/dev/null`; then
>> +		id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
>> +		date=`hg parents --template "{date|date}"`
>> +		printf '%s %s%s' "$date" hg: "$id"
>> +
>> +		# Are there uncommitted changes?
>> +		# These are represented by + after the changeset id.
>> +		case "$hgid" in
>> +			*+|*+\ *) printf '%s' -dirty ;;
>> +		esac
>> +
>> +		# All done with mercurial
>> +		return
>> +	fi
>> +
>> +	# Check for svn and a svn repo.
>> +	if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
>> +		rev=`echo $rev | awk '{print $NF}'`
>> +		printf -- 'svn:%s' "$rev"
>> +
>> +		# All done with svn
>> +		return
>> +	fi
>> +}
>> +
>> +cd $srctree
>> +
>> +# full scm version string
>> +res="$(scm_version)"
>> +
>> +echo "$res"
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

* Re: [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset
  2013-05-10 13:33         ` Andrew Cooper
@ 2013-05-13  9:49           ` Ian Campbell
  2013-05-13 11:43             ` Keir Fraser
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Campbell @ 2013-05-13  9:49 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Sander Eikelenboom, Keir (Xen.org), Marek Marczykowski, xen-devel

On Fri, 2013-05-10 at 14:33 +0100, Andrew Cooper wrote:
> On 10/05/13 14:29, Ian Campbell wrote:
> > On Thu, 2013-05-09 at 00:07 +0100, Marek Marczykowski wrote:
> >> As Xen uses git as primary repository, get git commit id for
> >> xen_changeset info.
> >>
> >> Changes in v2:
> >>  - split scm calls into separate script - based on Linux kernel one,
> >>    with tags handling removed
> >>
> >> Changes in v3:
> >>  - do not assume tools/scmversion started from the repository toplevel
> >>    dir - it is actually called from xen/ subdir
> >>
> >> Changes in v4:
> >>  - restore checks for .git and .hg dirs, use $(XEN_ROOT)
> >>
> >> Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
> > I tried this on git and hg and it appeared to do the right thing,
> > thanks.
> >
> > Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
> 
> As soon as this gets into staging, I will rebase my much older patch on
> top to allow XEN_CHANGESET to be overridden on the make invocation.

Thanks. It needs an Ack from a hypervisor maintainer first (Keir
presumably).

Ian.

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

* Re: [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset
  2013-05-13  9:49           ` Ian Campbell
@ 2013-05-13 11:43             ` Keir Fraser
  2013-05-13 11:52               ` Ian Campbell
  0 siblings, 1 reply; 16+ messages in thread
From: Keir Fraser @ 2013-05-13 11:43 UTC (permalink / raw)
  To: Ian Campbell, Andrew Cooper
  Cc: Sander Eikelenboom, Marek Marczykowski, xen-devel

On 13/05/2013 10:49, "Ian Campbell" <Ian.Campbell@citrix.com> wrote:

> On Fri, 2013-05-10 at 14:33 +0100, Andrew Cooper wrote:
>> On 10/05/13 14:29, Ian Campbell wrote:
>>> On Thu, 2013-05-09 at 00:07 +0100, Marek Marczykowski wrote:
>>>> As Xen uses git as primary repository, get git commit id for
>>>> xen_changeset info.
>>>> 
>>>> Changes in v2:
>>>>  - split scm calls into separate script - based on Linux kernel one,
>>>>    with tags handling removed
>>>> 
>>>> Changes in v3:
>>>>  - do not assume tools/scmversion started from the repository toplevel
>>>>    dir - it is actually called from xen/ subdir
>>>> 
>>>> Changes in v4:
>>>>  - restore checks for .git and .hg dirs, use $(XEN_ROOT)
>>>> 
>>>> Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
>>> I tried this on git and hg and it appeared to do the right thing,
>>> thanks.
>>> 
>>> Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
>> 
>> As soon as this gets into staging, I will rebase my much older patch on
>> top to allow XEN_CHANGESET to be overridden on the make invocation.
> 
> Thanks. It needs an Ack from a hypervisor maintainer first (Keir
> presumably).

Okay, well it looked quite fine to me :)

Acked-by: Keir Fraser <keir@xen.org>

> Ian.
> 

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

* Re: [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset
  2013-05-13 11:43             ` Keir Fraser
@ 2013-05-13 11:52               ` Ian Campbell
  2013-05-13 13:39                 ` Ian Campbell
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Campbell @ 2013-05-13 11:52 UTC (permalink / raw)
  To: Keir Fraser
  Cc: Andrew Cooper, xen-devel, Marek Marczykowski, Sander Eikelenboom

On Mon, 2013-05-13 at 12:43 +0100, Keir Fraser wrote:
> On 13/05/2013 10:49, "Ian Campbell" <Ian.Campbell@citrix.com> wrote:
> 
> > On Fri, 2013-05-10 at 14:33 +0100, Andrew Cooper wrote:
> >> On 10/05/13 14:29, Ian Campbell wrote:
> >>> On Thu, 2013-05-09 at 00:07 +0100, Marek Marczykowski wrote:
> >>>> As Xen uses git as primary repository, get git commit id for
> >>>> xen_changeset info.
> >>>> 
> >>>> Changes in v2:
> >>>>  - split scm calls into separate script - based on Linux kernel one,
> >>>>    with tags handling removed
> >>>> 
> >>>> Changes in v3:
> >>>>  - do not assume tools/scmversion started from the repository toplevel
> >>>>    dir - it is actually called from xen/ subdir
> >>>> 
> >>>> Changes in v4:
> >>>>  - restore checks for .git and .hg dirs, use $(XEN_ROOT)
> >>>> 
> >>>> Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
> >>> I tried this on git and hg and it appeared to do the right thing,
> >>> thanks.
> >>> 
> >>> Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
> >> 
> >> As soon as this gets into staging, I will rebase my much older patch on
> >> top to allow XEN_CHANGESET to be overridden on the make invocation.
> > 
> > Thanks. It needs an Ack from a hypervisor maintainer first (Keir
> > presumably).
> 
> Okay, well it looked quite fine to me :)
> 
> Acked-by: Keir Fraser <keir@xen.org>

Thanks, I'll apply shortly.

Ian.

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

* Re: [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset
  2013-05-13 11:52               ` Ian Campbell
@ 2013-05-13 13:39                 ` Ian Campbell
  0 siblings, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2013-05-13 13:39 UTC (permalink / raw)
  To: Keir Fraser
  Cc: Andrew Cooper, Sander Eikelenboom, Marek Marczykowski, xen-devel

On Mon, 2013-05-13 at 12:52 +0100, Ian Campbell wrote:
> On Mon, 2013-05-13 at 12:43 +0100, Keir Fraser wrote:
> > On 13/05/2013 10:49, "Ian Campbell" <Ian.Campbell@citrix.com> wrote:
> > 
> > > On Fri, 2013-05-10 at 14:33 +0100, Andrew Cooper wrote:
> > >> On 10/05/13 14:29, Ian Campbell wrote:
> > >>> On Thu, 2013-05-09 at 00:07 +0100, Marek Marczykowski wrote:
> > >>>> As Xen uses git as primary repository, get git commit id for
> > >>>> xen_changeset info.
> > >>>> 
> > >>>> Changes in v2:
> > >>>>  - split scm calls into separate script - based on Linux kernel one,
> > >>>>    with tags handling removed
> > >>>> 
> > >>>> Changes in v3:
> > >>>>  - do not assume tools/scmversion started from the repository toplevel
> > >>>>    dir - it is actually called from xen/ subdir
> > >>>> 
> > >>>> Changes in v4:
> > >>>>  - restore checks for .git and .hg dirs, use $(XEN_ROOT)
> > >>>> 
> > >>>> Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
> > >>> I tried this on git and hg and it appeared to do the right thing,
> > >>> thanks.
> > >>> 
> > >>> Reviewed-by: Ian Campbell <ian.campbell@citrix.com>
> > >> 
> > >> As soon as this gets into staging, I will rebase my much older patch on
> > >> top to allow XEN_CHANGESET to be overridden on the make invocation.
> > > 
> > > Thanks. It needs an Ack from a hypervisor maintainer first (Keir
> > > presumably).
> > 
> > Okay, well it looked quite fine to me :)
> > 
> > Acked-by: Keir Fraser <keir@xen.org>
> 
> Thanks, I'll apply shortly.

Done, FSVO "shortly"...

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

* Re: [PATCH v3] Try to use git commit id if hg changeset is unavailable
  2013-05-08 15:15 [PATCH v3] Try to use git commit id if hg changeset is unavailable Marek Marczykowski
  2013-05-08 15:45 ` Ian Campbell
@ 2013-05-13 13:52 ` Olaf Hering
  2013-05-13 18:22   ` Marek Marczykowski
  1 sibling, 1 reply; 16+ messages in thread
From: Olaf Hering @ 2013-05-13 13:52 UTC (permalink / raw)
  To: Marek Marczykowski
  Cc: Sander Eikelenboom, Keir Fraser, Ian Campbell, xen-devel

On Wed, May 08, Marek Marczykowski wrote:

> +scm_version()
> +{
> +	local short

What is short supposed to do? Looks like a write-only variable.

Olaf

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

* Re: [PATCH v3] Try to use git commit id if hg changeset is unavailable
  2013-05-13 13:52 ` [PATCH v3] Try to use git commit id if hg changeset is unavailable Olaf Hering
@ 2013-05-13 18:22   ` Marek Marczykowski
  2013-05-13 18:23     ` [PATCH] Cleanup scmversion script, fix --save-scmversion option Marek Marczykowski
  0 siblings, 1 reply; 16+ messages in thread
From: Marek Marczykowski @ 2013-05-13 18:22 UTC (permalink / raw)
  To: Olaf Hering; +Cc: Sander Eikelenboom, Keir Fraser, Ian Campbell, xen-devel


[-- Attachment #1.1: Type: text/plain, Size: 560 bytes --]

On 13.05.2013 15:52, Olaf Hering wrote:
> On Wed, May 08, Marek Marczykowski wrote:
> 
>> +scm_version()
>> +{
>> +	local short
> 
> What is short supposed to do? Looks like a write-only variable.

Some leftover from --short option of kernel script, not used here. But
--save-scmversion option is broken. This should be equivalent for
"xen/tools/scmversion > .scmversion". So either option should be fixed or
removed completely. I vote for fix and do so in the patch (next email).

-- 
Best Regards,
Marek Marczykowski
Invisible Things Lab


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 555 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* [PATCH] Cleanup scmversion script, fix --save-scmversion option
  2013-05-13 18:22   ` Marek Marczykowski
@ 2013-05-13 18:23     ` Marek Marczykowski
  2013-05-14  8:50       ` Ian Campbell
  0 siblings, 1 reply; 16+ messages in thread
From: Marek Marczykowski @ 2013-05-13 18:23 UTC (permalink / raw)
  To: Olaf Hering
  Cc: Sander Eikelenboom, Marek Marczykowski, Keir Fraser,
	Ian Campbell, xen-devel

Remove unused variable, fix erroneously removed --save-scmversion code.

Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
---
 xen/tools/scmversion | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/xen/tools/scmversion b/xen/tools/scmversion
index 219d898..b0c3b95 100755
--- a/xen/tools/scmversion
+++ b/xen/tools/scmversion
@@ -16,10 +16,10 @@ usage() {
 	exit 1
 }
 
-scm_only=false
+save_scm=false
 srctree=.
 if test "$1" = "--save-scmversion"; then
-	scm_only=true
+	save_scm=true
 	shift
 fi
 if test $# -gt 0; then
@@ -32,17 +32,10 @@ fi
 
 scm_version()
 {
-	local short
-	short=false
-
-	cd "$srctree"
 	if test -e .scmversion; then
 		cat .scmversion
 		return
 	fi
-	if test "$1" = "--short"; then
-		short=true
-	fi
 
 	# Check for git and a git repo.
 	if test -d .git && head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
@@ -98,4 +91,8 @@ cd $srctree
 # full scm version string
 res="$(scm_version)"
 
+if [ "$save_scm" = "true" ]; then
+    echo $res > .scmversion
+fi
+
 echo "$res"
-- 
1.8.1.4

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

* Re: [PATCH] Cleanup scmversion script, fix --save-scmversion option
  2013-05-13 18:23     ` [PATCH] Cleanup scmversion script, fix --save-scmversion option Marek Marczykowski
@ 2013-05-14  8:50       ` Ian Campbell
  2013-07-04  9:56         ` Ian Campbell
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Campbell @ 2013-05-14  8:50 UTC (permalink / raw)
  To: Marek Marczykowski
  Cc: Sander Eikelenboom, Olaf Hering, Keir (Xen.org), xen-devel

On Mon, 2013-05-13 at 19:23 +0100, Marek Marczykowski wrote:
> Remove unused variable, fix erroneously removed --save-scmversion code.
> 
> Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>

Acked-by: Ian Campbell <ian.campbell@citrix.com>

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

* Re: [PATCH] Cleanup scmversion script, fix --save-scmversion option
  2013-05-14  8:50       ` Ian Campbell
@ 2013-07-04  9:56         ` Ian Campbell
  2013-07-17 10:36           ` Ian Campbell
  0 siblings, 1 reply; 16+ messages in thread
From: Ian Campbell @ 2013-07-04  9:56 UTC (permalink / raw)
  To: Marek Marczykowski
  Cc: Sander Eikelenboom, Olaf Hering, Keir (Xen.org), xen-devel

On Tue, 2013-05-14 at 09:50 +0100, Ian Campbell wrote:
> On Mon, 2013-05-13 at 19:23 +0100, Marek Marczykowski wrote:
> > Remove unused variable, fix erroneously removed --save-scmversion code.
> > 
> > Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
> 
> Acked-by: Ian Campbell <ian.campbell@citrix.com>

Keir/Jan -- shall I apply to staging or will one of you?
> 
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

* Re: [PATCH] Cleanup scmversion script, fix --save-scmversion option
  2013-07-04  9:56         ` Ian Campbell
@ 2013-07-17 10:36           ` Ian Campbell
  0 siblings, 0 replies; 16+ messages in thread
From: Ian Campbell @ 2013-07-17 10:36 UTC (permalink / raw)
  To: Marek Marczykowski
  Cc: Sander Eikelenboom, Olaf Hering, Keir (Xen.org), xen-devel

On Thu, 2013-07-04 at 10:56 +0100, Ian Campbell wrote:
> On Tue, 2013-05-14 at 09:50 +0100, Ian Campbell wrote:
> > On Mon, 2013-05-13 at 19:23 +0100, Marek Marczykowski wrote:
> > > Remove unused variable, fix erroneously removed --save-scmversion code.
> > > 
> > > Signed-off-by: Marek Marczykowski <marmarek@invisiblethingslab.com>
> > 
> > Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Keir/Jan -- shall I apply to staging or will one of you?

I took it that no one objected and applied. I forgot to edit in my ack
though, oops.

Ian.

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

end of thread, other threads:[~2013-07-17 10:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-08 15:15 [PATCH v3] Try to use git commit id if hg changeset is unavailable Marek Marczykowski
2013-05-08 15:45 ` Ian Campbell
2013-05-08 19:16   ` Marek Marczykowski
2013-05-08 23:07     ` [PATCH v4] Use {git, hg, svn} commit id if available for xen_changeset Marek Marczykowski
2013-05-10 13:29       ` Ian Campbell
2013-05-10 13:33         ` Andrew Cooper
2013-05-13  9:49           ` Ian Campbell
2013-05-13 11:43             ` Keir Fraser
2013-05-13 11:52               ` Ian Campbell
2013-05-13 13:39                 ` Ian Campbell
2013-05-13 13:52 ` [PATCH v3] Try to use git commit id if hg changeset is unavailable Olaf Hering
2013-05-13 18:22   ` Marek Marczykowski
2013-05-13 18:23     ` [PATCH] Cleanup scmversion script, fix --save-scmversion option Marek Marczykowski
2013-05-14  8:50       ` Ian Campbell
2013-07-04  9:56         ` Ian Campbell
2013-07-17 10:36           ` Ian Campbell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.