From patchwork Thu Jun 8 01:07:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Schwierzeck X-Patchwork-Id: 772755 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3wjnNp5zqSz9s7M for ; Thu, 8 Jun 2017 11:08:26 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QQ73Ysmp"; dkim-atps=neutral Received: by lists.denx.de (Postfix, from userid 105) id 94B2AC21C41; Thu, 8 Jun 2017 01:07:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6719BC21C55; Thu, 8 Jun 2017 01:07:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 314E2C21CA9; Thu, 8 Jun 2017 01:07:24 +0000 (UTC) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by lists.denx.de (Postfix) with ESMTPS id EF4BCC21C40 for ; Thu, 8 Jun 2017 01:07:21 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id g76so2491995wrd.2 for ; Wed, 07 Jun 2017 18:07:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZH3CzMDCAFa1MQTwQYUz5l9NoL43YufghYw4Ko8bs8A=; b=QQ73YsmpcamV62JYYeEWPEGY/JFks4DG5OKObUIiC7JyGVT9ozmbrlgiOeg7iO3/XS 2RZ4ZMFVIxzHsTGh5N7Lsr0tk4Jj/qJ+rK9R1EfLHhlAOoR5/IKdVdoM7rfjPfBvho3C mVDaQddeRtbBHU3aBDIgAFlztN+bK16o+z4rakGxsQS6D8OKbD+T3v8Olh9hXXuZjCmq XS4cvC70K5VO8OUTGzrshRiKwcf1qJLabyr7toGOr+o6YCge0dbjItUZXzbL6NN1T5jo IPF8Byl0uXH1LXxM5NhEGRkPmudGJ8bEq9dcTLUm/KGe3HOyTxaVhLAM6lZFCvtRhHJD AYSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZH3CzMDCAFa1MQTwQYUz5l9NoL43YufghYw4Ko8bs8A=; b=Z5VO9MvJLFb3xAMl7habt5s4Rb3Adf4InChBhIhGByIzn557AfHmf6tdu25kmvwtu4 TExkU2XFcCfjQEs7UMmvqMvoMTbxmwFIFZPnx1vIfGKYhMXdKufu2FTJA8f4iuhb6oNO E2VWSBNyE9d59WRj7fF+71xFKKZQI31/POp5t+fnVMyf3N2A4IdxUUd4ATHV+6rOZVL8 bGtN7LZGl6Zm05KtudLHjAXn//7Is3uYehBS4NEq1CA5Tx/2bUfA/4IBw+uj83SDpyrt Wq2U6zci6AzrTCkFXOLksLkz0NyxwpjLz9fkblpJJtvqpcpzmqdg45A2pARkgbX6FSnZ 9bZQ== X-Gm-Message-State: AODbwcCFh4G+M0eBpAXCCG/wKtTKIJSqg1s83JDb0VUU6O8HQCl1xaPz p0gZTnsYozGEKxBl X-Received: by 10.223.145.75 with SMTP id j69mr22362068wrj.23.1496884041448; Wed, 07 Jun 2017 18:07:21 -0700 (PDT) Received: from workstation.zombienet.local (p2003005F2C2C8800982ACC5723F6B53B.dip0.t-ipconnect.de. [2003:5f:2c2c:8800:982a:cc57:23f6:b53b]) by smtp.gmail.com with ESMTPSA id v13sm5101202wmd.5.2017.06.07.18.07.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jun 2017 18:07:20 -0700 (PDT) From: Daniel Schwierzeck To: u-boot@lists.denx.de Date: Thu, 8 Jun 2017 03:07:09 +0200 Message-Id: <20170608010709.28197-3-daniel.schwierzeck@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170608010709.28197-1-daniel.schwierzeck@gmail.com> References: <20170607121901.16873-1-daniel.schwierzeck@gmail.com> <20170608010709.28197-1-daniel.schwierzeck@gmail.com> Cc: Tom Rini Subject: [U-Boot] [PATCH 2/2] buildman: properly translate strings for log and err files to ASCII X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The build output can still produce unicode encoded output. But in the buildman's log and err files we only want plain ASCII characters. To handle all situations with unicode and non-unicode output, encode the stdout and stderr strings to UTF-8 and afterwards to ASCII with replacing all special characters. Signed-off-by: Daniel Schwierzeck Signed-off-by: Daniel Schwierzeck --- tools/buildman/builderthread.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index acaf5007f5..9e8ca80c5b 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -280,13 +280,15 @@ class BuilderThread(threading.Thread): outfile = os.path.join(build_dir, 'log') with open(outfile, 'w') as fd: if result.stdout: - fd.write(result.stdout.encode('latin-1', 'ignore')) + # We don't want unicode characters in log files + fd.write(result.stdout.decode('UTF-8').encode('ASCII', 'replace')) errfile = self.builder.GetErrFile(result.commit_upto, result.brd.target) if result.stderr: with open(errfile, 'w') as fd: - fd.write(result.stderr.encode('latin-1', 'ignore')) + # We don't want unicode characters in log files + fd.write(result.stderr.decode('UTF-8').encode('ASCII', 'replace')) elif os.path.exists(errfile): os.remove(errfile)