Openembedded Devel Discussions
 help / color / mirror / Atom feed
From: Chris Larson <clarson@mvista.com>
To: openembedded-devel@lists.openembedded.org
Subject: [PATCH] Shorten some full paths printed to the user.
Date: Wed,  8 Apr 2009 09:52:36 -0700	[thread overview]
Message-ID: <1239209556-847-2-git-send-email-clarson@mvista.com> (raw)
In-Reply-To: <1239209556-847-1-git-send-email-clarson@mvista.com>

Adds a base_path_out convenience function, which prepares a full path for
display to the user.  The initial implementation just makes it relative to
${TOPDIR}.  This function is then used for some messages outputted to the
user (packaged-staging, patch application, clean, unpack tasks).

Signed-off-by: Chris Larson <clarson@mvista.com>
---
 classes/base.bbclass             |   17 +++++++++++++----
 classes/packaged-staging.bbclass |    2 +-
 classes/patch.bbclass            |    2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/classes/base.bbclass b/classes/base.bbclass
index 7cfebf2..500e39a 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -39,6 +39,14 @@ def base_path_relative(src, dest):
 
     return sep.join(relpath)
 
+def base_path_out(path, d):
+    """ Prepare a path for display to the user. """
+    rel = base_path_relative(d.getVar("TOPDIR", 1), path)
+    if len(rel) > len(path):
+        return path
+    else:
+        return rel
+
 # for MD5/SHA handling
 def base_chk_load_parser(config_path):
     import ConfigParser, os, bb
@@ -70,6 +78,7 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data):
 
     # md5 and sha256 should be valid now
     if not os.path.exists(localpath):
+        localpath = base_path_out(localpath, data)
         bb.note("The localpath does not exist '%s'" % localpath)
         raise Exception("The path does not exist '%s'" % localpath)
 
@@ -496,11 +505,11 @@ python base_do_clean() {
 	"""clear the build and temp directories"""
 	dir = bb.data.expand("${WORKDIR}", d)
 	if dir == '//': raise bb.build.FuncFailed("wrong DATADIR")
-	bb.note("removing " + dir)
+	bb.note("removing " + base_path_out(dir, d))
 	os.system('rm -rf ' + dir)
 
 	dir = "%s.*" % bb.data.expand(bb.data.getVar('STAMP', d), d)
-	bb.note("removing " + dir)
+	bb.note("removing " + base_path_out(dir, d))
 	os.system('rm -f '+ dir)
 }
 
@@ -555,7 +564,7 @@ python base_do_distclean() {
 		except bb.MalformedUrl, e:
 			bb.debug(1, 'Unable to generate local path for malformed uri: %s' % e)
 		else:
-			bb.note("removing %s" % local)
+			bb.note("removing %s" % base_path_out(local, d))
 			try:
 				if os.path.exists(local + ".md5"):
 					os.remove(local + ".md5")
@@ -771,7 +780,7 @@ def oe_unpack_file(file, data, url = None):
 		os.chdir(newdir)
 
 	cmd = "PATH=\"%s\" %s" % (bb.data.getVar('PATH', data, 1), cmd)
-	bb.note("Unpacking %s to %s/" % (file, os.getcwd()))
+	bb.note("Unpacking %s to %s/" % (base_path_out(file, data), base_path_out(os.getcwd(), data)))
 	ret = os.system(cmd)
 
 	os.chdir(save_cwd)
diff --git a/classes/packaged-staging.bbclass b/classes/packaged-staging.bbclass
index 82c1a0d..bd7b9ea 100644
--- a/classes/packaged-staging.bbclass
+++ b/classes/packaged-staging.bbclass
@@ -135,7 +135,7 @@ do_clean_prepend() {
 	pstage_cleanpackage(removepkg, d)
 
 	stagepkg = bb.data.expand("${PSTAGE_PKG}", d)
-	bb.note("Removing staging package %s" % stagepkg)
+	bb.note("Removing staging package %s" % base_path_out(stagepkg, d))
 	os.system('rm -rf ' + stagepkg)
 }
 
diff --git a/classes/patch.bbclass b/classes/patch.bbclass
index 075e826..cce8289 100644
--- a/classes/patch.bbclass
+++ b/classes/patch.bbclass
@@ -519,7 +519,7 @@ python patch_do_patch() {
 				bb.note("Patch '%s' applies to earlier revisions" % pname)
 				continue
 
-		bb.note("Applying patch '%s' (%s)" % (pname, unpacked))
+		bb.note("Applying patch '%s' (%s)" % (pname, base_path_out(unpacked, d)))
 		try:
 			patchset.Import({"file":unpacked, "remote":url, "strippath": pnum}, True)
 		except:
-- 
1.6.0.2




  reply	other threads:[~2009-04-08 16:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-08 16:52 [PATCH] First pass of cleanup of messages outputted to the user Chris Larson
2009-04-08 16:52 ` Chris Larson [this message]
2009-04-08 17:22   ` [PATCH] Shorten some full paths printed " Otavio Salvador
2009-04-08 18:48     ` Denys Dmytriyenko
2009-04-08 17:21 ` [PATCH] First pass of cleanup of messages outputted " Otavio Salvador
2009-04-08 18:46   ` Denys Dmytriyenko
2009-04-09 12:43     ` Otavio Salvador
2009-04-09 15:05       ` Christopher Larson
2009-04-08 18:59 ` Michael 'Mickey' Lauer

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=1239209556-847-2-git-send-email-clarson@mvista.com \
    --to=clarson@mvista.com \
    --cc=openembedded-devel@lists.openembedded.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox