From patchwork Wed Oct 4 13:13:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 114776 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3110312qgn; Wed, 4 Oct 2017 06:13:35 -0700 (PDT) X-Received: by 10.101.78.201 with SMTP id w9mr1520603pgq.24.1507122815179; Wed, 04 Oct 2017 06:13:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507122815; cv=none; d=google.com; s=arc-20160816; b=wglJOGzUf627Cd28F2ZfQAbKDfaVkUwIKzfOEDVDoCFMlcCsDuyKQaJmQxEJKNRhiM yD4mwF58YF4jxlAyJ51dq1RrpzFO4ew/w4JSqrbvlB72G6GtUWqZMW9iNJIgxpK+TxbZ 1AwMjDEvTix5jZRFNP0L29CHWNSCUcyK9IdUlbjMKOvrkHEZHRiE4EL1mI/at9e63ZlG r3Nu1mAv0u4vlLBJHoeIQJJwvZzBlQ8CFmxFFgB+n/v57OgIyXBmY3Vd30a8OBjWWNAo yMwTX9inrB7v32dI6HCs9IecSz1hbsN2A0wSWDSqul1bXl42PHPKb8IhnuXSG0vHav+W EXnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=CrCN28W+nT8a0Et43imEYda491t7zPQTTzGinvNWTgo=; b=zoLr+Av78oKu5/gGMkDHXpuE8xRjL1rkJqqCr09Lmy4gb0Urm2nbDdE3+T0oW2TWl8 mymnioZzLgd/jnpqhThfTmx4Lc2E/DZRGAQgyHbtJB2J5W/i8uDFfzeIj/AysXF/ZxxH uBi0OXt99At83nxmGjGF6ELYhyohTpMdWFLrpjOXDR9mKnPBlNWnuVnsnj4s4OswuGV+ E5CFaP2pyy7KPhK0lPiJGOiuz7/XT/ddz4A47nHXQDumktGgHQhET91OQ2PfVBcoLgKd O3VU7BarkXSuG0Hb7m3QM5o5R3GSFGtxXKMaTbFVyv5U9yk5gGXWHIxtn5+H2bnsYlx6 gHuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=uV8ELZBg; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id u73si11735500pfk.424.2017.10.04.06.13.34; Wed, 04 Oct 2017 06:13:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) client-ip=140.211.169.62; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=uV8ELZBg; spf=pass (google.com: best guess record for domain of openembedded-core-bounces@lists.openembedded.org designates 140.211.169.62 as permitted sender) smtp.mailfrom=openembedded-core-bounces@lists.openembedded.org Received: from review.yoctoproject.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id E56FE77BDF; Wed, 4 Oct 2017 13:13:29 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by mail.openembedded.org (Postfix) with ESMTP id 164E06FF73 for ; Wed, 4 Oct 2017 13:13:27 +0000 (UTC) Received: by mail-wm0-f48.google.com with SMTP id l68so9242447wmd.5 for ; Wed, 04 Oct 2017 06:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=pyR7ua5dHbykbq5vDq/v+v7v5XzH2N2DNU02Lehzk2k=; b=uV8ELZBgwlzLjnrE3WlIvB/fO14BVtRoikoE7CLGNhwvTW+hxmUa88JQ3O8wafUh4k N2k+U1aYKZclESeUQqyqB8m0Y6RrCqdhCMUGHvOgigdd8eIob3UKLrbzceQDKzEQtyyA yVr4EcYyFbQo5F4YggxvA49EE7ZSa7a4bXtrPselLFnv4QYn5PBp4Lje/kSUWieGZSB0 /mW3IuWC+BncmuRD/LfEAHy+XmxF7tsXR+dW0PUXgxxD222I9c5C8oTksXK+TIJi74xM ttyj7sk2JekG+bZA9JfFmyQt7YVOsOyWlsZEbpHgsGcDxhm4sQ619MLyJRHZdAIOg/Om 0ooA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=pyR7ua5dHbykbq5vDq/v+v7v5XzH2N2DNU02Lehzk2k=; b=a2lOtHJUO2pSBGjcCdDvfOBHB+hwyTtmUI4tmh2zNQwR7aEyfkn0iCzQ4hX9S/bsTs BA2econMpI8MELPpoH09sPSgWUepDAw7GULf5/ho/mLR2R4XvRUXgTBSs8l51wkb+urQ 4OZpBbiWkw+G0TnVG4eRZUtsdgd25RGgzBeS7ikrhMxLuJvTpDzXLMxGgyNRoq3B2jn8 IQQezqtPqZC6GTvq+osXwV1A7JMcrpE1vLGJ/JoZ0O3TDUBZe7Xzj4HUc8RYpjyKUdGJ xQpA5qrQWbKKJYh8qBnMuaMbxW8AAtR0CwJOPS36KswOOx02Jllh8SiQG/cQZP7l3bqL W7zw== X-Gm-Message-State: AMCzsaUOrDOlyWQY5As7nG3mglQYZ9+UyDu8K/1wTvie4MsxqPJho7KI 6OIU+LTujnlGm+LR0Zg3YauT9nVb X-Google-Smtp-Source: AOwi7QAukLa8JFpYYyp83G88Af6IQG1kzu1xGJdJvye11WC19XsBukpUkFGPUjcLPVArVr9cWq8XPw== X-Received: by 10.28.152.5 with SMTP id a5mr8133181wme.131.1507122808269; Wed, 04 Oct 2017 06:13:28 -0700 (PDT) Received: from flashheart.burtonini.com (home.burtonini.com. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id 9sm15225847wml.24.2017.10.04.06.13.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 06:13:27 -0700 (PDT) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Wed, 4 Oct 2017 14:13:25 +0100 Message-Id: <20171004131325.26620-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH] oe-pkgdata-util: add unescape option to read-value X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: openembedded-core-bounces@lists.openembedded.org Errors-To: openembedded-core-bounces@lists.openembedded.org Some fields are multiline values which have been escaped, so add an option to unescape the \n and \t. Signed-off-by: Ross Burton --- scripts/oe-pkgdata-util | 5 +++++ 1 file changed, 5 insertions(+) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index a690870b1c5..c6fba56c89b 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',