From patchwork Fri Dec 14 01:08:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 153704 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1494852ljp; Thu, 13 Dec 2018 17:09:40 -0800 (PST) X-Google-Smtp-Source: AFSGD/UXzxjDrOEp7riYgEIX6qU2V/0Rm/SDqbAzWkARPPXg6vONHUGGl/CE3pp4orFiODpRds1n X-Received: by 2002:a62:6cc8:: with SMTP id h191mr968097pfc.89.1544749780081; Thu, 13 Dec 2018 17:09:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544749780; cv=none; d=google.com; s=arc-20160816; b=dDyc/zdXKmGOmm1JeLQ9xYDvl55Cz5NgFHZRqbL3410Jkg39fAows/02rEDEo85N7Q Ypaq6ynxovxx7kRNZTKlPrg8Ohb9cT6QkPPrVPCt/p368X+WGviNa0t+NkNNpP6eUWTD hy07fhIdX7v/1W4OkKW3L+WA9Y/xcU8a2pNhUC7vxIES4YQOt95nXzmxAMl2l8UUkiO+ RZTkzBM9PQk2Sxbq/NRt1/tugEFCjX4UZqP0cIMClYVgAybZlpj5jrOhYgToIWa6D7OT qVRoNoDkS+aQ1JARZ3bKIIDsIEGHtay8DkzC8C15AQGFQKT2FAdAKKLaALQZEfxbOyQo bKgQ== 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; bh=3pVFW498aYd3Gj9JBX7wQDBVgzCsdsEhQ42iSGhI+B8=; b=0EIt7do1NZj2tmj4caR53thUQa2nBDG6YsXp8X5/G+SvIYZ0uQD1mTxh1uHz1t6LF3 NMhMs5k+CSgU2ZgMCi1eJv/KPaRTezqLbKXFq+QhQ/jNkoh1dZ4G3wzxis3P8kSR4Qx/ LykZDLs/2TJ0buGOBTos8PGYc9ls8/BvX2l/y9B/N0rYSWs2VZB0iJV62PIRABi4vYMH txarcTf2AFgf5bhaR6uiVVSBBlG105DiIor0iT/cCjzGoRygKrIR5mRcDMmgPbPiY9qs m2LO15pPWrykEi37Qkr1LcuFHBMDd0XjJNU6ORHYKnVs/vo1aRgtEK6iaTtUqIt/j53F olCA== 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=Z2k1xUtB; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id 3si2819508plq.138.2018.12.13.17.09.39; Thu, 13 Dec 2018 17:09:40 -0800 (PST) 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=Z2k1xUtB; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from 165.28.230.35.bc.googleusercontent.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 1025D7964F; Fri, 14 Dec 2018 01:09:36 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mail.openembedded.org (Postfix) with ESMTP id DBD967964F for ; Fri, 14 Dec 2018 01:09:32 +0000 (UTC) Received: by mail-wm1-f44.google.com with SMTP id a62so4165046wmh.4 for ; Thu, 13 Dec 2018 17:09:34 -0800 (PST) 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=6/8QEqjJLeYVExbk3COeanRoaCBhQbT5LdzVNxLSb1w=; b=Z2k1xUtBZpwabbXJBNKos5ECIwfYemc6OSUT2fHk0PjX/kJQV2EGNW3fmuRE95EE7y aQ8ioe3TR1JOQeuQ5C6oTR09jBfmkJGpFGOrmDW20aPCRhR1g1YBzN5o7oDUQ7nfFcUv 8U30Ez88wkMu/YrKnDqhhlTBjo069fQlMX2FVbLzU/MWv+rF0ox+/2YpajG7gq7nKaLn O1YffVW1WaL10BJJl3dQrxPr1d8WI17oy+MWURRHmpLDc4P5T74GcXaUXDGkzyRKARWF ZU3TFr8JpHjoRQ4VtAJ4RrAmaxZiH/0k+EIBn24euz81dPBlpA7clp6c4CLk4cza8mff teDQ== 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=6/8QEqjJLeYVExbk3COeanRoaCBhQbT5LdzVNxLSb1w=; b=Q/N/w3EoNZAMZ5IgZUbsMCaxViAAzKZPDE9KKmSgmEvFRkPytH5ipWv44RkpQ+eNpr acyPM4jsGhoI0wMvcliGB8kypyHX0LNibFspS9XEC1M5ZuWZiN4obDpbL6cukY633kma fnl6hAqwGThZ2R5RcdU/JUt2aDEXu2TdOkIYqFio9B5/v1F1t0WJkrIH4teAq7P95FiT jKNbsUxQZmF1gcnpUTxIF0LBO+CcRoWppwr3/QedRZXD/aEM3esJP+5J3M22v2PuXsfj vT7Xjw1XvrElEn4iJUN02Zn4aKzh4e9G9I85UkO6qcotf0+1XXg7L8CO6nQdFgFARa56 7N9w== X-Gm-Message-State: AA+aEWapK2WpxQSNNcFg3aK5+5QI8azzQiawhOf0fr1DKbE0qk2FEt94 C69f2NvSimeJQeTsBjbR3atsh/GzC8E= X-Received: by 2002:a1c:cf82:: with SMTP id f124mr1452504wmg.95.1544749773198; Thu, 13 Dec 2018 17:09:33 -0800 (PST) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id h129sm7524265wma.0.2018.12.13.17.09.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 17:09:32 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Fri, 14 Dec 2018 01:08:47 +0000 Message-Id: <20181214010848.24170-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH 1/2] package_manager: don't search for binaries in $PATH explicitly 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 There's no point in looking for a command on $PATH using bb.utils.which() but then passing it to subprocess.check*() which will search $PATH. By just using the command directly, the code is visibly neater. Signed-off-by: Ross Burton --- meta/lib/oe/package_manager.py | 43 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 22 deletions(-) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index f08190efc0d..f0d98dd0ffc 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -155,8 +155,7 @@ class RpmIndexer(Indexer): else: signer = None - createrepo_c = bb.utils.which(os.environ['PATH'], "createrepo_c") - create_index("%s --update -q %s" % (createrepo_c, deploy_dir)) + create_index("createrepo_c --update -q %s" % (deploy_dir)) # Sign repomd if signer: @@ -316,11 +315,11 @@ class OpkgPkgsList(PkgsList): def __init__(self, d, rootfs_dir, config_file): super(OpkgPkgsList, self).__init__(d, rootfs_dir) - self.opkg_args = "-f %s -o %s " % (config_file, rootfs_dir) - self.opkg_args += self.d.getVar("OPKG_ARGS") + self.opkg_cmd = "opkg -f %s -o %s " % (config_file, rootfs_dir) + self.opkg_cmd += self.d.getVar("OPKG_ARGS") def list_pkgs(self, format=None): - cmd = "opkg %s status" % (self.opkg_args) + cmd = "%s status" % (self.opkg_cmd) # opkg returns success even when it printed some # "Collected errors:" report to stderr. Mixing stderr into @@ -870,12 +869,12 @@ class RpmPM(PackageManager): args = ["rpm", "-e", "-v", "--nodeps", "--root=%s" %self.target_rootfs] try: - bb.note("Running %s" % ' '.join([cmd] + args + pkgs)) - output = subprocess.check_output([cmd] + args + pkgs, stderr=subprocess.STDOUT).decode("utf-8") + bb.note("Running %s" % ' '.join(args + pkgs)) + output = subprocess.check_output(args + pkgs, stderr=subprocess.STDOUT).decode("utf-8") bb.note(output) except subprocess.CalledProcessError as e: bb.fatal("Could not invoke rpm. Command " - "'%s' returned %d:\n%s" % (' '.join([cmd] + args + pkgs), e.returncode, e.output.decode("utf-8"))) + "'%s' returned %d:\n%s" % (' '.join(args + pkgs), e.returncode, e.output.decode("utf-8"))) def upgrade(self): self._prepare_pkg_transaction() @@ -1132,8 +1131,8 @@ class OpkgPM(OpkgDpkgPM): self.deploy_dir = oe.path.join(self.d.getVar('WORKDIR'), ipk_repo_workdir) self.deploy_lock_file = os.path.join(self.deploy_dir, "deploy.lock") - self.opkg_args = "--volatile-cache -f %s -t %s -o %s " % (self.config_file, self.d.expand('${T}/ipktemp/'), target_rootfs) - self.opkg_args += self.d.getVar("OPKG_ARGS") + self.opkg_cmd = "opkg --volatile-cache -f %s -t %s -o %s " % (self.config_file, self.d.expand('${T}/ipktemp/'), target_rootfs) + self.opkg_cmd += self.d.getVar("OPKG_ARGS") if prepare_index: create_packages_dir(self.d, self.deploy_dir, d.getVar("DEPLOY_DIR_IPK"), "package_write_ipk", filterbydependencies) @@ -1292,7 +1291,7 @@ class OpkgPM(OpkgDpkgPM): def update(self): self.deploy_dir_lock() - cmd = "opkg %s update" % (self.opkg_args) + cmd = "%s update" % (self.opkg_cmd) try: subprocess.check_output(cmd.split(), stderr=subprocess.STDOUT) @@ -1307,7 +1306,7 @@ class OpkgPM(OpkgDpkgPM): if not pkgs: return - cmd = "opkg %s" % (self.opkg_args) + cmd = self.opkg_cmd for exclude in (self.d.getVar("PACKAGE_EXCLUDE") or "").split(): cmd += " --add-exclude %s" % exclude cmd += " install " @@ -1342,11 +1341,11 @@ class OpkgPM(OpkgDpkgPM): return if with_dependencies: - cmd = "opkg %s --force-remove --force-removal-of-dependent-packages remove %s" % \ - (self.opkg_args, ' '.join(pkgs)) + cmd = "%s --force-remove --force-removal-of-dependent-packages remove %s" % \ + (self.opkg_cmd, ' '.join(pkgs)) else: - cmd = "opkg %s --force-depends remove %s" % \ - (self.opkg_args, ' '.join(pkgs)) + cmd = "%s --force-depends remove %s" % \ + (self.opkg_cmd, ' '.join(pkgs)) try: bb.note(cmd) @@ -1390,7 +1389,7 @@ class OpkgPM(OpkgDpkgPM): if os.path.exists(status_file): return - cmd = "opkg %s info " % (self.opkg_args) + cmd = "%s info " % (self.opkg_cmd) with open(status_file, "w+") as status: for pkg in bad_recommendations.split(): @@ -1432,10 +1431,10 @@ class OpkgPM(OpkgDpkgPM): temp_opkg_dir = os.path.join(temp_rootfs, opkg_lib_dir, 'opkg') bb.utils.mkdirhier(temp_opkg_dir) - opkg_args = "-f %s -o %s " % (self.config_file, temp_rootfs) + opkg_args = "opkg -f %s -o %s " % (self.config_file, temp_rootfs) opkg_args += self.d.getVar("OPKG_ARGS") - - cmd = "opkg %s update" % (opkg_args) + + cmd = "%s update" % (opkg_args) try: subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as e: @@ -1443,7 +1442,7 @@ class OpkgPM(OpkgDpkgPM): "returned %d:\n%s" % (cmd, e.returncode, e.output.decode("utf-8"))) # Dummy installation - cmd = "opkg %s --noaction install %s " % (opkg_args, ' '.join(pkgs)) + cmd = "%s --noaction install %s " % (opkg_args, ' '.join(pkgs)) try: output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as e: @@ -1477,7 +1476,7 @@ class OpkgPM(OpkgDpkgPM): """ Returns a dictionary with the package info. """ - cmd = "opkg %s info %s" % (self.opkg_args, pkg) + cmd = "%s info %s" % (self.opkg_cmd, pkg) pkg_info = super(OpkgPM, self).package_info(pkg, cmd) pkg_arch = pkg_info[pkg]["arch"] From patchwork Fri Dec 14 01:08:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 153705 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1495067ljp; Thu, 13 Dec 2018 17:09:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/WR1LcSmWQ8e833YC3mP2bqRl+pJ/nF5AvM2BI9rbyAmQ33iNJhlIGp4fmlbDXrTQxkt7JM X-Received: by 2002:a63:160d:: with SMTP id w13mr940220pgl.43.1544749796721; Thu, 13 Dec 2018 17:09:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544749796; cv=none; d=google.com; s=arc-20160816; b=h/2Zjsh5Q5IRjRHF8uJKtuTB6J/VHYnenwg29KMaJg5zvL3Cg2Q1VESHVDuzI6W9V8 Y3g4td/uNVv8gIDkKGFwQbymt/t6WYwVZkG67WPENQ0QkyI0UXQO2xrCdAFk33IEIKWV Igdjk7tbZjf87mu6ZvuhAhBPmLwXOiguO062CK8i/GgrK2fFqZBA4H8skdfZXB2fxhQV VPZrhWy2TvETIAxORSakamlaFTHwq7mOj73m6kgOI7HSSw545FypTIXVDA5NnYEIfjc/ 5yZ73uIXYKItJV2ez3J7HAiNoX2vzR5qY55kODhPUXLHB9jNb6TDkErSck8ZEyErurM1 pVmw== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to; bh=M1ESRbq/LxpDeQuy5EYauiUziuHXMfaLpW6oRHFKZjE=; b=wtueHeZ/ZdI36S8U1LM3cAQlbmio3x7TR4z+4hdqopLkSZFVCPXn1epaMUHMB58a/U 5IAnNKFX3Z2zu8FIiL26CcU8dPrS1w0H8m4NJLfnRmlBWU9EWXrZTWQvlEEjvcKdYTbX 68ufV4/o9pw8OZ5QBSxJoHQcOcTojwlmVuUSubdUwJpENwf7EYv3mw5cvcGnD99CO8mb KFJIhGohJ9cmoPGvJTs/ISRFPF16c7PNPRU16LBVA0UkIDFJTCbzENARBWlp9I0Jdthj /pO12hEnOB9+kkXU0lgt9DeYLf0xUdIIiaT93yaXhkDtyJTm99fa+OrIW+odNIfBVslk nGtg== 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=KQ1yruNZ; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from mail.openembedded.org (mail.openembedded.org. [140.211.169.62]) by mx.google.com with ESMTP id t13si2540285pga.102.2018.12.13.17.09.56; Thu, 13 Dec 2018 17:09:56 -0800 (PST) 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=KQ1yruNZ; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from 165.28.230.35.bc.googleusercontent.com (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id B60EA79DF1; Fri, 14 Dec 2018 01:09:53 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by mail.openembedded.org (Postfix) with ESMTP id DE66E79D75 for ; Fri, 14 Dec 2018 01:09:33 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id c14so3873037wrr.0 for ; Thu, 13 Dec 2018 17:09:35 -0800 (PST) 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:in-reply-to:references; bh=waaC7t7OCnuQlRw591CBy/99ZPdvByUbmSNXNDej2CM=; b=KQ1yruNZBunGTatruw8VpoMCBPNOSPXTeJ2cN0nUXCAaFlk5BliWXjmTGMpTn6YXY0 bvvt8/nshTh+B4qaPv83tV+wJULl3o08KCNL1XEeycPQH/4KFJfmFQ47ErcDb42M7/lm 1VfQmQaYCDBbxKdE19IdSlHsVhRkDem6kmqlKT6pMYDLMr3FV6ZZWedCDhl04PB67JJv eaB4yyAiIZMp1YLiPnUkzKEHLr7KrIVUIpRE27s3TjASU2wUIBO0T8qvrlEpAmvzBLg6 995v13w35ifi2BDM0ZEptRBuehmo3ZsT7Oyt1p9bRB6kjAwn8hy2ksRovpgkrmsQ/rvV 0YSw== 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:in-reply-to :references; bh=waaC7t7OCnuQlRw591CBy/99ZPdvByUbmSNXNDej2CM=; b=ndMqlzhuInoDxySu8dgeG/YqoBFDFkULMUuEtvPGZcRJZFfm5WluWVoW45V2Qk6yK+ BGsuQXt84vBTVyXw4/2gVqajpoGLSeYK/toWpN7lu09bbFyY88FNxZwMfIZoVlmEUPh3 +VURduVegobZfbkNedlVRPu5LQgJtP7U1WTS5fVHI5URdn+d47uc94rVi7Bsd+8jYayj MqINIMtUDNoSx3Pm4vmGux+tzFd59JKjyH4wk+sTD3JWfFnb++w3RbePeO4pqVMa/dBT tFz3DZ01dlW7CzEPTngKjQkKv8peR2rt5XMXcSfFst9jFQn7+RRAWsKW0mU3HxSWG7f9 gvdg== X-Gm-Message-State: AA+aEWZT4Kr9tg9P3kMYhVCtqxPtAm87ztD7N/IJS2gzWk5Y10iuDSH+ iVdZqQo7N5RerE8gncejymIXAT93M3w= X-Received: by 2002:adf:ce86:: with SMTP id r6mr833203wrn.257.1544749774243; Thu, 13 Dec 2018 17:09:34 -0800 (PST) Received: from flashheart.burtonini.com (35.106.2.81.in-addr.arpa. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id h129sm7524265wma.0.2018.12.13.17.09.33 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Dec 2018 17:09:33 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Fri, 14 Dec 2018 01:08:48 +0000 Message-Id: <20181214010848.24170-2-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181214010848.24170-1-ross.burton@intel.com> References: <20181214010848.24170-1-ross.burton@intel.com> Subject: [OE-core] [PATCH 2/2] package-manager: pylint fixes 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 mark_packages() is implicitly abstract in OpkgDpkgPM so implement it for clarity. Also trivial whitespace, semicolons, unused variables, and regex strings. Signed-off-by: Ross Burton --- meta/lib/oe/package_manager.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) -- 2.11.0 -- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py index f0d98dd0ffc..564b74ae7b5 100644 --- a/meta/lib/oe/package_manager.py +++ b/meta/lib/oe/package_manager.py @@ -29,7 +29,7 @@ def opkg_query(cmd_output): a dictionary with the information of the packages. This is used when the packages are in deb or ipk format. """ - verregex = re.compile(' \([=<>]* [^ )]*\)') + verregex = re.compile(r" \([=<>]* [^ )]*\)") output = dict() pkg = "" arch = "" @@ -237,9 +237,9 @@ class DpkgIndexer(Indexer): bb.utils.mkdirhier(os.path.join(self.apt_conf_dir, "apt.conf.d")) bb.utils.mkdirhier(os.path.join(self.apt_conf_dir, "preferences.d")) - with open(os.path.join(self.apt_conf_dir, "preferences"), "w") as prefs_file: + with open(os.path.join(self.apt_conf_dir, "preferences"), "w"): pass - with open(os.path.join(self.apt_conf_dir, "sources.list"), "w+") as sources_file: + with open(os.path.join(self.apt_conf_dir, "sources.list"), "w+"): pass with open(self.apt_conf_file, "w") as apt_conf: @@ -1118,6 +1118,10 @@ class OpkgDpkgPM(PackageManager): return tmp_dir + @abstractmethod + def mark_packages(self, status_tag, packages=None): + pass + def _handle_intercept_failure(self, registered_pkgs): self.mark_packages("unpacked", registered_pkgs.split()) @@ -1633,13 +1637,13 @@ class DpkgPM(OpkgDpkgPM): # rename *.dpkg-new files/dirs for root, dirs, files in os.walk(self.target_rootfs): for dir in dirs: - new_dir = re.sub("\.dpkg-new", "", dir) + new_dir = re.sub(r"\.dpkg-new", "", dir) if dir != new_dir: os.rename(os.path.join(root, dir), os.path.join(root, new_dir)) for file in files: - new_file = re.sub("\.dpkg-new", "", file) + new_file = re.sub(r"\.dpkg-new", "", file) if file != new_file: os.rename(os.path.join(root, file), os.path.join(root, new_file)) @@ -1744,11 +1748,10 @@ class DpkgPM(OpkgDpkgPM): os.path.join(self.deploy_dir, arch)) base_arch_list = base_archs.split() - multilib_variants = self.d.getVar("MULTILIB_VARIANTS"); + multilib_variants = self.d.getVar("MULTILIB_VARIANTS") for variant in multilib_variants.split(): localdata = bb.data.createCopy(self.d) variant_tune = localdata.getVar("DEFAULTTUNE_virtclass-multilib-" + variant, False) - orig_arch = localdata.getVar("DPKG_ARCH") localdata.setVar("DEFAULTTUNE", variant_tune) variant_arch = localdata.getVar("DPKG_ARCH") if variant_arch not in base_arch_list: @@ -1762,7 +1765,7 @@ class DpkgPM(OpkgDpkgPM): if match_arch: for base_arch in base_arch_list: architectures += "\"%s\";" % base_arch - apt_conf.write(" Architectures {%s};\n" % architectures); + apt_conf.write(" Architectures {%s};\n" % architectures) apt_conf.write(" Architecture \"%s\";\n" % base_archs) else: line = re.sub("#ROOTFS#", self.target_rootfs, line)