From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6657041487194226688 X-Received: by 2002:a2e:9693:: with SMTP id q19-v6mr172727lji.20.1549963254912; Tue, 12 Feb 2019 01:20:54 -0800 (PST) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a2e:4711:: with SMTP id u17-v6ls1880257lja.8.gmail; Tue, 12 Feb 2019 01:20:54 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia4ZTchHSk6efbOtcn2zUR1QE4CPbIYmc/bpZngrTqllh6DCS8lFqU4hbDDOqV2bDSKXqeD X-Received: by 2002:a2e:6c0c:: with SMTP id h12-v6mr170475ljc.9.1549963254348; Tue, 12 Feb 2019 01:20:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549963254; cv=none; d=google.com; s=arc-20160816; b=qfy2IiHqh0Vvnq/Y5uAFK5UVI+3uAn4AKyqw6A6JeqjtLJFB/VZc6EUeo/T/Ifu0pD QCESFcEauczc46zWBS6r7N2C4d/+Vpc8T+dEmBWiqC51FHVzfctrsNGMFP8gl7vvKaxw V0KXvobAHeXdjADowVqvvb7SWE3Sysv0xR5XtlF/bpeN3mZ/AwazI7xg/YF5a3FiDYqa jjzqDJXcrEJcqUuKhiphOHHW0Ewk6dwUtfS9CpkN7R8eiOKYYa5twm/HR8oObAgRvvTC pJOw9joa3VSDHb48wJhcYxESsOrlcNLR63q07+Q54FmwOJKmoBy6guyhTD6IyxfzSpGH 2BAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from; bh=/KrJ9rjQKUhkwyS9kUq31SD/IxD2E0CUBKrWTfvLkPg=; b=VBCoE2Ng2hjFH1Y6m/+0BS8VvqaBqsM9wNL/P0hIF5M1DV1AagncTCff7u7/gXY719 AZsjamDoHYWEDbIrLsRNutGcSYkDYFmdl93wERgp/RIJjHOh4qmVdJpHE1XOJBYV+eqi S+D2uIDKHJ376us8tPzapIQdCfPm9iIGegUEyCelVbbZBtMHGr8fpVrAB2C2yLogkDoh G2jFz0wsFtZ04pI2k8GHeO1GH6nfVgp0qPGAA9DX+9wCqkYd2wivXVtBHayiM06l17db 9ErQ6xslAnfOO+dvOJZfDVYU/7qr6dPmRQMUIFHCh1W21i3ZLgiCr5P8AxcUvisbaY9N gH5A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of hws@denx.de) smtp.mailfrom=hws@denx.de Return-Path: Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id 81-v6si475320ljc.2.2019.02.12.01.20.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Feb 2019 01:20:54 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of hws@denx.de) client-ip=212.18.0.9; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of hws@denx.de) smtp.mailfrom=hws@denx.de Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 43zHFd5pWyz1rfNJ for ; Tue, 12 Feb 2019 10:20:53 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 43zHFd5jGpz1qvWq for ; Tue, 12 Feb 2019 10:20:53 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id fZAGS6H_MLYV for ; Tue, 12 Feb 2019 10:20:52 +0100 (CET) X-Auth-Info: mUrFCzfQSgwugZO8FUAY7IHQsSWU/0LJcPTJ20t3nVQ= Received: from sandvich.fritz.box (p578a821c.dip0.t-ipconnect.de [87.138.130.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA for ; Tue, 12 Feb 2019 10:20:52 +0100 (CET) From: Harald Seiler To: isar-users@googlegroups.com Subject: [PATCH 0/4] Python refactoring Date: Tue, 12 Feb 2019 10:20:42 +0100 Message-Id: <20190212092046.6508-1-hws@denx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TUID: me7CXvmAzl6Z This series contains a number of improvements to python code in isar: * All instancess of subprocess.{call,Popen,check_call}() have been changed to never use `shell=True`. This will hopefully prevent bugs in the future. * The use of the % formatter was replaced by other methods, as % was deprecated because it can behave weirdly. Unfortunately, as we have to support python back to 3.5, we can not yet make use of f-Strings, so other options had to be used. I decided to use string concatenation for simple cases where the use of .format() would have been too verbose. * A recursive call in get_image_name was removed in favor of an imperative code style. This should make the respective function easier to read. Harald Seiler (4): Remove all uses of subprocess.call(shell=True) Use modern python formatting image: Remove recursion in get_image_name wic: Refactor fakeroot script meta/classes/base.bbclass | 47 +++++++++++++++------- meta/classes/image.bbclass | 22 +++++++--- meta/classes/isar-bootstrap-helper.bbclass | 9 ++--- meta/classes/isar-events.bbclass | 13 +++--- meta/classes/patch.bbclass | 16 ++++++-- meta/classes/wic-img.bbclass | 21 +++++++--- .../recipes-core/isar-bootstrap/isar-bootstrap.inc | 12 +++--- scripts/wic_fakeroot | 9 ++--- 8 files changed, 95 insertions(+), 54 deletions(-) -- 2.14.1