aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2017-10-04 14:12:41 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-10-06 12:22:44 +0100
commit4165ec0057c6bbb24de681572034262351d9b34f (patch)
tree27e1e0c684f78160448c5c3c0a622470f714a7e2
parentc17c6ba906425d4035b8e044c8bd8bd68c47ef74 (diff)
downloadopenembedded-core-contrib-4165ec0057c6bbb24de681572034262351d9b34f.tar.gz
oe-pkgdata-util: add unescape option to read-value
Some fields are multiline values which have been escaped, so add an option to unescape the \n and \t. Signed-off-by: Ross Burton <ross.burton@intel.com>
-rwxr-xr-xscripts/oe-pkgdata-util5
1 files changed, 5 insertions, 0 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index a690870b1c..c6fba56c89 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -197,6 +197,10 @@ def read_value(args):
# PKGSIZE is now in bytes, but we we want it in KB
pkgsize = (int(value) + 1024 // 2) // 1024
value = "%d" % pkgsize
+ if args.unescape:
+ import codecs
+ # escape_decode() unescapes backslash encodings in byte streams
+ value = codecs.escape_decode(bytes(value, "utf-8"))[0].decode("utf-8")
if args.prefix_name:
print('%s %s' % (pkg_name, value))
else:
@@ -552,6 +556,7 @@ def main():
parser_read_value.add_argument('pkg', nargs='*', help='Runtime package name to look up')
parser_read_value.add_argument('-f', '--file', help='Read package names from the specified file (one per line, first field only)')
parser_read_value.add_argument('-n', '--prefix-name', help='Prefix output with package name', action='store_true')
+ parser_read_value.add_argument('-u', '--unescape', help='Expand escapes such as \\n', action='store_true')
parser_read_value.set_defaults(func=read_value)
parser_glob = subparsers.add_parser('glob',