From patchwork Tue Jan 16 13:37:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 124676 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1016817lje; Tue, 16 Jan 2018 05:38:12 -0800 (PST) X-Google-Smtp-Source: ACJfBotNmpuEvkpwkXEsCRbFrnWaU2yqQjTuVIKPMw8z0i/N62F8I7b0n3021ULe2s/3wxWQm3Gk X-Received: by 10.84.130.66 with SMTP id 60mr34775341plc.376.1516109892346; Tue, 16 Jan 2018 05:38:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516109892; cv=none; d=google.com; s=arc-20160816; b=c1Zlw4xd0l9+0ArBtIelhe1hEBbcuZdb9d946Mo7HLgr5Qg1oFQkiCfRn5B/gupJNr WJ+5MWHon38BHQFZLE/Lg2yLVRRxXvjuMHh4rX1i/7oOL5evMPvzCiWl7T4wTyMfFpkR 9dYYwqowYGP2gbGkqQcSwo9ZX2mzltppTXNLmJDY0bYfaQ7BnROPfkhXVkkT8VzugHAA SXthT7xSv709QAfVeVktvzQL2zTrDVz4Ly45TKoJDujGRPUClb0oRVKl6lOG1xmdg0+8 EAj/PuAtpR3vq0yNx9BR4FvtMRyP5ONX/inyCIjxW2PA+WqjrE/s1+AfR/F6rNo94y6P 2cDA== 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:arc-authentication-results; bh=ndssa5a3UVQKjVscUEeFAhduCOlQ8KW99mf3DeVzLIY=; b=0zK8sVyseuXrx7hfWHyV67zjSANu7lBBAsFQYK5C3fLUYxeqrnz9kbgP/siFXaPi8Q BZ68BvPptX+8V+B2H48SciGsDslIQd9OblvApS3KzM5j4YiSlBRcpP7q8uFKRQs3yd+l jDK24PDgOq3dAvctBnyJkyXz52hwxC02pT7u1AoDxt1e4wu2iE1ONy960VN4/azTAwbQ HwjErdRdT+x5dGF7lmOD7ilg56s/tkbuO6nh8R+PB5EFFc2zearaRAYXE5uUOx/Oywdk /oWD5CtNJvOZMnljJql95uJoygeK/Dnr9frAR5smn5mhLV1vFfcFS+ExRaVmloTfWqPz Fv/A== 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=VCtpy5bt; 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 y38si2000698plh.434.2018.01.16.05.38.12; Tue, 16 Jan 2018 05:38:12 -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=VCtpy5bt; 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 layers.openembedded.org (localhost [127.0.0.1]) by mail.openembedded.org (Postfix) with ESMTP id 6DE8D7869E; Tue, 16 Jan 2018 13:38:09 +0000 (UTC) X-Original-To: openembedded-core@lists.openembedded.org Delivered-To: openembedded-core@lists.openembedded.org Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by mail.openembedded.org (Postfix) with ESMTP id E2C2F78674 for ; Tue, 16 Jan 2018 13:37:58 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id e41so14856739wre.9 for ; Tue, 16 Jan 2018 05:38:00 -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=WMa561vAFEmIQeSyuA/q8s2Nq38zkviV8ceeoxk9aeU=; b=VCtpy5btivGAiAWmDam5dnYS5frAwEMh/JYEftJ/4CzG29iylnsTuzVGTMtsdTrt4B IUXUxS4YnRcXn5KdfhKTjxOejdx8+GouHAdrX6+BCQSxadzg3Gvt/wzE3XiprM4y76mI KrOVSb6SJXx3wBzpbKXAyYuMc3GKE/95Sn9JSkroWeirVgNyWp6keMvJmxmcW6evN3lC Q7W3AHvuzqXHd1T8yXOasrvaiKf2Di2S3vt27OQnRGW1dFV4Yo5dm/4yb/P/oDgMLs+K wuNX5TFpWxcQ/ilms0oHvtPwWAUadblWIfr7j9iTJrn3ymqQnjMhxv29F9B0Me3ZCZQz +BGg== 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=WMa561vAFEmIQeSyuA/q8s2Nq38zkviV8ceeoxk9aeU=; b=onmuD9O3TZrqwHM8juj5VyYrmyaXBfCWtFftbPRIiTotutracipH95GQQS6iS216bo Q0G5ejzeJgTMZqzWZ26HJffpq5VELPmR7VMu5kkUZLT14+pC1A5w83wtSdRlPusYVXQe qcoDTE7t8Lid3Xi+7OTQhDUEQ3drtWezyG7dQ6A/TAIOJRu+7ln84KkOcIsxYwRFXfxC YixEnk9S/70sOTdfZP1Om3gdyn+4nqWWYF4ta8aeBP5IPWDgQMtd9PX5Sab5WJaDHvxl /vD/6aK6Em4UiCWBr50O44bYmE2pHzLwMSWYiuiILePMkTpIdhHy8/mh/Rqk05hmn+H1 KsUQ== X-Gm-Message-State: AKwxytc1DoHBsRfJspU1bGkkZlyIpl2S+HFWDobNxnsxezPZUteR3hAw QF1BNbm7McC3wILjzyIVo4hI6RW5 X-Received: by 10.223.186.194 with SMTP id w2mr24059403wrg.173.1516109879841; Tue, 16 Jan 2018 05:37:59 -0800 (PST) Received: from flashheart.burtonini.com (home.burtonini.com. [81.2.106.35]) by smtp.gmail.com with ESMTPSA id f48sm462153wra.72.2018.01.16.05.37.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 05:37:59 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Tue, 16 Jan 2018 13:37:54 +0000 Message-Id: <20180116133754.29471-2-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180116133754.29471-1-ross.burton@intel.com> References: <20180116133754.29471-1-ross.burton@intel.com> Subject: [OE-core] [PATCH 2/2] classes/debian: clean up process spawning 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 This code is old and was of it's time, rewrite it to use modernish (we support Python 3.4, so can't use subprocess.run()) subprocess and re idioms instead. Signed-off-by: Ross Burton --- meta/classes/debian.bbclass | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 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/classes/debian.bbclass b/meta/classes/debian.bbclass index edc6da1ba3a..989ea8f8d28 100644 --- a/meta/classes/debian.bbclass +++ b/meta/classes/debian.bbclass @@ -25,7 +25,7 @@ python () { } python debian_package_name_hook () { - import glob, copy, stat, errno, re, pathlib + import glob, copy, stat, errno, re, pathlib, subprocess pkgdest = d.getVar("PKGDEST") packages = d.getVar('PACKAGES') @@ -76,15 +76,14 @@ python debian_package_name_hook () { if path in libdirs: has_libs = 1 if so_re.match(os.path.basename(f)): - cmd = (d.getVar('TARGET_PREFIX') or "") + "objdump -p " + f + " 2>/dev/null" - fd = os.popen(cmd) - lines = fd.readlines() - fd.close() - for l in lines: - m = re.match("\s+SONAME\s+([^\s]*)", l) - if m and not m.group(1) in sonames: - sonames.append(m.group(1)) - + try: + cmd = [d.expand("${TARGET_PREFIX}objdump"), "-p", f] + output = subprocess.check_output(cmd).decode("utf-8") + for m in re.finditer("\s+SONAME\s+([^\s]+)", output): + if m.group(1) not in sonames: + sonames.append(m.group(1)) + except subprocess.CalledProcessError: + pass bb.debug(1, 'LIBNAMES: pkg %s libs %d bins %d sonames %s' % (orig_pkg, has_libs, has_bins, sonames)) soname = None if len(sonames) == 1: