public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Eugeniu Rosca <eugeniu.m.rosca@gmail.com>
To: Michal Marek <mmarek@suse.com>
Cc: linux-kbuild@vger.kernel.org, eugeniu.m.rosca@gmail.com
Subject: Re: [PATCH v2] scripts/tags.sh: Handle missing {c,e,g}tags/cscope utilities
Date: Mon, 16 May 2016 15:37:31 +0200	[thread overview]
Message-ID: <20160516133731.GA4829@eugeniu-X230> (raw)
In-Reply-To: <57397167.4000000@suse.com>

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: 0001-scripts-tags.sh-Handle-missing-c-e-g-tags-cscope-uti.patch.txt --]
[-- Type: text/plain, Size: 2415 bytes --]

From 5917e6602bd0e44c4a672bc4ac8c7a323b6300b6 Mon Sep 17 00:00:00 2001
From: Eugeniu Rosca <eugeniu.m.rosca@gmail.com>
Date: Sun, 24 Apr 2016 17:30:53 +0200
Subject: [PATCH v2] scripts/tags.sh: Handle missing {c,e,g}tags/cscope utilities

If the required ctags/etags/gtags/cscope host utility is not found,
current behavior is:

$> make cscope
  GEN     cscope
./scripts/tags.sh: line 140: cscope: command not found
$> make gtags
  GEN     gtags
./scripts/tags.sh: line 145: gtags: command not found
$> make tags
  GEN     tags
xargs: ctags: No such file or directory
sed: can't read tags: No such file or directory
Makefile:1509: recipe for target 'tags' failed
make: *** [tags] Error 2
$> make TAGS
  GEN     TAGS
xargs: etags: No such file or directory
sed: can't read TAGS: No such file or directory
Makefile:1509: recipe for target 'TAGS' failed
make: *** [TAGS] Error 2

Instead of implementing a more graceful handling, this patch only
makes sure that tags.sh script exits immediately upon the first
failure caused by the missing ctags/etags/gtags/cscope tool. By not
altering the exit code, the user will additionally get the failed
recipe in the root Makefile. The output becomes:

$> make cscope
  GEN     cscope
./scripts/tags.sh: line 140: cscope: command not found
Makefile:1517: recipe for target 'cscope' failed
make: *** [cscope] Error 127
$> make gtags
  GEN     gtags
./scripts/tags.sh: line 145: gtags: command not found
Makefile:1517: recipe for target 'gtags' failed
make: *** [gtags] Error 127
$> make tags
  GEN     tags
xargs: ctags: No such file or directory
Makefile:1517: recipe for target 'tags' failed
make: *** [tags] Error 127
$> make TAGS
  GEN     TAGS
xargs: etags: No such file or directory
Makefile:1517: recipe for target 'TAGS' failed
make: *** [TAGS] Error 127

Signed-off-by: Eugeniu Rosca <eugeniu.m.rosca@gmail.com>
---
 scripts/tags.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/scripts/tags.sh b/scripts/tags.sh
index f72f48f..96b6dec 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -318,22 +318,22 @@ fi
 remove_structs=
 case "$1" in
 	"cscope")
-		docscope
+		docscope || exit
 		;;
 
 	"gtags")
-		dogtags
+		dogtags || exit
 		;;
 
 	"tags")
 		rm -f tags
-		xtags ctags
+		xtags ctags || exit
 		remove_structs=y
 		;;
 
 	"TAGS")
 		rm -f TAGS
-		xtags etags
+		xtags etags || exit
 		remove_structs=y
 		;;
 esac
-- 
2.7.4


      reply	other threads:[~2016-05-16 13:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-24 16:42 [PATCH] scripts/tags.sh: Exit gracefully if *tags tool not found Eugeniu Rosca
2016-04-25 12:35 ` Michal Marek
2016-05-15 13:44   ` Eugeniu Rosca
2016-05-16  7:06     ` Michal Marek
2016-05-16 13:37       ` Eugeniu Rosca [this message]

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=20160516133731.GA4829@eugeniu-X230 \
    --to=eugeniu.m.rosca@gmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.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