public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Jason Cooper <jason@lakedaemon.net>
To: Masahiro Yamada <yamada.m@jp.panasonic.com>
Cc: linux-kbuild@vger.kernel.org
Subject: Re: [PATCH 4/7] scripts: objdiff: improve path flexibility for record command
Date: Fri, 6 Jun 2014 11:33:18 -0400	[thread overview]
Message-ID: <20140606153318.GK8664@titan.lakedaemon.net> (raw)
In-Reply-To: <1401448315-800-5-git-send-email-yamada.m@jp.panasonic.com>

On Fri, May 30, 2014 at 08:11:52PM +0900, Masahiro Yamada wrote:
> Prior to this commit, scripts/objdiff expected to be run at the top
> directory and only the reltive path of objects.

nit: s/reltive/relative/

thx,

Jason.

> This commit provides more flexibility in terms of object path:
> 
> [1] scripts/objdiff can be run at any directory
> 
> For example,
> 
>   $ scripts/objdiff record init/main.o
> 
> and
> 
>   $ cd init; ../scripts/objdiff record main.o
> 
> produce the same result.
> 
> [2] Support absolute path for objects
> 
>   $ scripts/objdiff record /home/foo/bar/linux/init/main.o
> 
> work as well.
> 
> Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Cc: Jason Cooper <jason@lakedaemon.net>
> ---
>  scripts/objdiff | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/objdiff b/scripts/objdiff
> index 6e72f96..499eb4b 100755
> --- a/scripts/objdiff
> +++ b/scripts/objdiff
> @@ -25,7 +25,7 @@
>  #
>  # Note: 'make mrproper' will also remove .tmp_objdiff
>  
> -SRCTREE=$(git rev-parse --show-toplevel 2>/dev/null)
> +SRCTREE=$(cd $(git rev-parse --show-toplevel 2>/dev/null); pwd)
>  
>  if [ -z "$SRCTREE" ]; then
>  	echo >&2 "ERROR: Not a git repository."
> @@ -42,6 +42,18 @@ usage() {
>  	exit 1
>  }
>  
> +get_output_dir() {
> +	dir=${1%/*}
> +
> +	if [ "$dir" = "$1" ]; then
> +		dir=.
> +	fi
> +
> +	dir=$(cd $dir; pwd)
> +
> +	echo $TMPD/$CMT${dir#$SRCTREE}
> +}
> +
>  dorecord() {
>  	[ $# -eq 0 ] && usage
>  
> @@ -50,18 +62,16 @@ dorecord() {
>  	CMT="`git rev-parse --short HEAD`"
>  
>  	OBJDUMP="${CROSS_COMPILE}objdump"
> -	OBJDIFFD="$TMPD/$CMT"
>  
>  	for f in $FILES; do
> -		dn="${f%/*}"
> +		dir=$(get_output_dir $f)
>  		bn="${f##*/}"
>  
> -		[ ! -d "$OBJDIFFD/$dn" ] && mkdir -p "$OBJDIFFD/$dn"
> +		[ ! -d "$dir" ] && mkdir -p $dir
>  
>  		# remove addresses for a more clear diff
>  		# http://dummdida.tumblr.com/post/60924060451/binary-diff-between-libc-from-scientificlinux-and
> -		$OBJDUMP -D "$f" | sed "s/^[[:space:]]\+[0-9a-f]\+//" \
> -			>"$OBJDIFFD/$dn/$bn"
> +		$OBJDUMP -D $f | sed "s/^[[:space:]]\+[0-9a-f]\+//" > $dir/$bn
>  	done
>  }
>  
> -- 
> 1.9.1
> 

  reply	other threads:[~2014-06-06 15:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 11:11 [PATCH 0/7] scripts: objdiff: various clean-up, fix and new features Masahiro Yamada
2014-05-30 11:11 ` [PATCH 1/7] scripts: objdiff: get the path to .tmp_objdiff more simply Masahiro Yamada
2014-05-30 11:11 ` [PATCH 2/7] scripts: objdiff: direct error messages to stderr Masahiro Yamada
2014-06-06 15:28   ` Jason Cooper
2014-05-30 11:11 ` [PATCH 3/7] scripts: objdiff: remove unnecessary code Masahiro Yamada
2014-05-30 11:11 ` [PATCH 4/7] scripts: objdiff: improve path flexibility for record command Masahiro Yamada
2014-06-06 15:33   ` Jason Cooper [this message]
2014-05-30 11:11 ` [PATCH 5/7] scripts: objdiff: change the extension of disassembly from .o to .dis Masahiro Yamada
2014-05-30 11:11 ` [PATCH 6/7] scripts: objdiff: fix a comment Masahiro Yamada
2014-06-06 15:35   ` Jason Cooper
2014-05-30 11:11 ` [PATCH 7/7] scripts: objdiff: support directories for the augument of record command Masahiro Yamada
2014-06-06 15:38 ` [PATCH 0/7] scripts: objdiff: various clean-up, fix and new features Jason Cooper
2014-06-09  2:21   ` Masahiro Yamada
2014-06-10 10:04     ` Michal Marek

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=20140606153318.GK8664@titan.lakedaemon.net \
    --to=jason@lakedaemon.net \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=yamada.m@jp.panasonic.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox