From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6D58C433F5 for ; Mon, 10 Jan 2022 03:20:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 676FD83461; Mon, 10 Jan 2022 04:16:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="nRibRGIE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id F248D8197D; Mon, 10 Jan 2022 04:15:56 +0100 (CET) Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B764781761 for ; Mon, 10 Jan 2022 04:15:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd32.google.com with SMTP id w9so2711245iol.13 for ; Sun, 09 Jan 2022 19:15:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z5/Q9+9vXWQP1/JuaEtsyKvn/azKXJ/5e2AbDmFlqi4=; b=nRibRGIEaaLHyjVRuZ30hBdn5j8EvG+GonjRaX7+4i3anfayTYdTUIioiDxOZZMQLu YS3BigBjY6l3b4JM7b9mT0h2zX+3RIl3dD55BAPDT1YPYEnSba3F4oaPekrORbfFnbM1 Q9p/RR1p2ilB7KRc3DdPcNUNSRTnqorbM/Ngg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z5/Q9+9vXWQP1/JuaEtsyKvn/azKXJ/5e2AbDmFlqi4=; b=r9l3WCxJOna3LQJijuU7/RmEEtuFhhBsVm0oLDb63JWaL5q88Lohn4Jsjlz3m/rjTI wjwEko719HEVECd/VBNXuN8T3v6wkUo6QR+mcbLxf4gwCkzaVZsB5J6fT8kV2dTC1uVU GTYPgs9ZikTuzB4XUbuS6ZCaICrAGEl276wZF4YtNDOQtQil+xkY6Ks68TIoJ/6OP/bO etO/LLr31oriEonH5hgB8LcTnsPs9JpYDQfm1uSTY1kjivfHw/zv2NCBW5Nn6eRydgDx skrbXxRZ0ApetBTVsIHy1ycBOZDludJavL0KGRpvMJbVRov7ou38fH7aOebXy+5uxDOp WKig== X-Gm-Message-State: AOAM532XHhQZXZ6gKqAIppG/zVWJxrOTyQEuqIgubzXczGjwj7nfJ99u S5NF7ytZOhvcpjaM0NE4UTK0GHViceZ9pQ== X-Google-Smtp-Source: ABdhPJyZ3ghnBZR/REoDDWRaks3D6auIPF6sYjvNTomLRTVPLPY25kgMzKbe+fQlbArifo5XckUopQ== X-Received: by 2002:a02:a517:: with SMTP id e23mr33106157jam.35.1641784528434; Sun, 09 Jan 2022 19:15:28 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id d16sm3542182ioy.29.2022.01.09.19.15.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jan 2022 19:15:28 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH v2 33/38] binman: Convert to using the lzma_alone bintool Date: Sun, 9 Jan 2022 20:14:08 -0700 Message-Id: <20220110031413.1970836-34-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.575.g55b058a8bb-goog In-Reply-To: <20220110031413.1970836-1-sjg@chromium.org> References: <20220110031413.1970836-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean Update the code to use this bintool, instead of running lzma_alone directly. This simplifies the code and provides more consistency. Signed-off-by: Simon Glass --- (no changes since v1) tools/binman/comp_util.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tools/binman/comp_util.py b/tools/binman/comp_util.py index baa29798bed..2f78bab9bbb 100644 --- a/tools/binman/comp_util.py +++ b/tools/binman/comp_util.py @@ -12,6 +12,9 @@ from patman import tools LZ4 = bintool.Bintool.create('lz4') HAVE_LZ4 = LZ4.is_present() +LZMA_ALONE = bintool.Bintool.create('lzma_alone') +HAVE_LZMA_ALONE = LZMA_ALONE.is_present() + def compress(indata, algo, with_header=True): """Compress some data using a given algorithm @@ -41,11 +44,7 @@ def compress(indata, algo, with_header=True): data = LZ4.compress(indata) # cbfstool uses a very old version of lzma elif algo == 'lzma': - outfname = tempfile.NamedTemporaryFile(prefix='%s.comp.otmp' % algo, - dir=tools.GetOutputDir()).name - tools.Run('lzma_alone', 'e', fname, outfname, '-lc1', '-lp0', '-pb0', - '-d8') - data = tools.ReadFile(outfname) + data = LZMA_ALONE.compress(indata) elif algo == 'gzip': data = tools.Run('gzip', '-c', fname, binary=True) else: @@ -81,9 +80,7 @@ def decompress(indata, algo, with_header=True): if algo == 'lz4': data = LZ4.decompress(indata) elif algo == 'lzma': - outfname = tools.GetOutputFilename('%s.decomp.otmp' % algo) - tools.Run('lzma_alone', 'd', fname, outfname) - data = tools.ReadFile(outfname, binary=True) + data = LZMA_ALONE.decompress(indata) elif algo == 'gzip': data = tools.Run('gzip', '-cd', fname, binary=True) else: -- 2.34.1.575.g55b058a8bb-goog