diff options
author | Chris Larson <clarson@mvista.com> | 2009-03-13 13:42:06 -0700 |
---|---|---|
committer | Chris Larson <clarson@mvista.com> | 2009-05-14 11:33:13 -0700 |
commit | 9699a955d48cb500b0b3dd691be68979c93bc72e (patch) | |
tree | aa1d2990d463eb51fffdc4a09ce565db64789a48 /classes/base.bbclass | |
parent | c0622e65a95f42f921e24bfcbc90bce8c838903e (diff) |
Shorten some full paths printed to the user.
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>
Diffstat (limited to 'classes/base.bbclass')
-rw-r--r-- | classes/base.bbclass | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/classes/base.bbclass b/classes/base.bbclass index 3d4a426e75..e622aeec51 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_paths): import ConfigParser, os, bb @@ -69,6 +77,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) @@ -497,11 +506,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) } @@ -556,7 +565,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") @@ -777,7 +786,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) |