All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: David Ahern <dsahern@gmail.com>
Cc: acme@ghostprotocols.net, linux-kernel@vger.kernel.org,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>
Subject: Re: [PATCH] perf: Fix version when building out of tree
Date: Wed, 6 Nov 2013 06:36:54 +0100	[thread overview]
Message-ID: <20131106053654.GA23746@gmail.com> (raw)
In-Reply-To: <1383699213-23981-1-git-send-email-dsahern@gmail.com>


* David Ahern <dsahern@gmail.com> wrote:

> When building perf out of tree
>     make perf-tar-src-pkg
>     tar -xf perf-<ver>.tar -C /tmp
>     cd /tmp/perf<ver>
>     make -C tools/perf
> 
> you get the warning message:
>     make[1]: *** No rule to make target `kernelversion'.  Stop.
> 
> Fix by saving the perf version in the tar file and using that for the
> out of tree builds.
> 
> Suggested-by: Ingo Molnar <mingo@kernel.org>
> Signed-off-by: David Ahern <dsahern@gmail.com>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Jiri Olsa <jolsa@redhat.com>
> ---
>  scripts/package/Makefile         |    4 +++-
>  tools/perf/util/PERF-VERSION-GEN |   16 +++++++++++++++-
>  2 files changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/package/Makefile b/scripts/package/Makefile
> index a4f31c900fa6..e44653986e0a 100644
> --- a/scripts/package/Makefile
> +++ b/scripts/package/Makefile
> @@ -115,7 +115,9 @@ git --git-dir=$(srctree)/.git archive --prefix=$(perf-tar)/         \
>  	-o $(perf-tar).tar;                                         \
>  mkdir -p $(perf-tar);                                               \
>  git --git-dir=$(srctree)/.git rev-parse HEAD > $(perf-tar)/HEAD;    \
> -tar rf $(perf-tar).tar $(perf-tar)/HEAD;                            \
> +(cd $(srctree)/tools/perf;                                          \
> +util/PERF-VERSION-GEN short ../../$(perf-tar)/ 2>/dev/null);        \
> +tar rf $(perf-tar).tar $(perf-tar)/HEAD $(perf-tar)/PERF-VERSION-FILE; \
>  rm -r $(perf-tar);                                                  \
>  $(if $(findstring tar-src,$@),,                                     \
>  $(if $(findstring bz2,$@),bzip2,                                    \
> diff --git a/tools/perf/util/PERF-VERSION-GEN b/tools/perf/util/PERF-VERSION-GEN
> index 15a77b7c0e36..142d7dcccfd2 100755
> --- a/tools/perf/util/PERF-VERSION-GEN
> +++ b/tools/perf/util/PERF-VERSION-GEN
> @@ -1,5 +1,12 @@
>  #!/bin/sh
>  
> +SHORT_FORM=no
> +
> +if [ "$1" = "short" ]  ; then
> +	SHORT_FORM=yes
> +	shift
> +fi
> +
>  if [ $# -eq 1 ]  ; then
>  	OUTPUT=$1
>  fi
> @@ -19,6 +26,9 @@ if test -d ../../.git -o -f ../../.git
>  then
>  	TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null )
>  	CID=$(git log -1 --abbrev=4 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID"
> +elif test -f ../../PERF-VERSION-FILE
> +then
> +	TAG=$(cat ../../PERF-VERSION-FILE)
>  fi
>  if test -z "$TAG"
>  then
> @@ -41,7 +51,11 @@ else
>  fi
>  test "$VN" = "$VC" || {
>  	echo >&2 "PERF_VERSION = $VN"
> -	echo "#define PERF_VERSION \"$VN\"" >$GVF
> +	if [ "$SHORT_FORM" = "yes" ]; then
> +		echo "$VN" >$GVF
> +	else
> +		echo "#define PERF_VERSION \"$VN\"" >$GVF
> +	fi
>  }

I think you could avoid the 'short' complication altogether by doing 
something like this:

> +elif test -f ../../PERF-VERSION-FILE
> +then
> +	TAG=$(cut -d' ' -f3 ../../PERF-VERSION-FILE)

That extracts 'TAG' as a true sha1 and makes GVF correct on out of tree 
builds as well.

haven't tested it though.

Thanks,

	Ingo

  reply	other threads:[~2013-11-06  5:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06  0:53 [PATCH] perf: Fix version when building out of tree David Ahern
2013-11-06  5:36 ` Ingo Molnar [this message]
2013-11-06 14:54   ` David Ahern
2013-11-07  8:30     ` Ingo Molnar
2013-11-07 14:30       ` David Ahern
2013-11-11 11:50         ` Ingo Molnar

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=20131106053654.GA23746@gmail.com \
    --to=mingo@kernel.org \
    --cc=acme@ghostprotocols.net \
    --cc=dsahern@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namhyung@kernel.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.