From patchwork Tue Jan 16 13:37:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 124674 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1016773lje; Tue, 16 Jan 2018 05:38:04 -0800 (PST) X-Google-Smtp-Source: ACJfBotw7PSGf4+2VbqnKgeiPPlz4O0qSbt146ZgBRGtimO5YpgF0EpA+vN7IcoRWikjCU6qa7Z4 X-Received: by 10.98.34.206 with SMTP id p75mr23393023pfj.235.1516109884634; Tue, 16 Jan 2018 05:38:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516109884; cv=none; d=google.com; s=arc-20160816; b=C6irvUQOYJjkV3EnjtwlNLRPoqAxIZEJlxlDX+zMhborGa9dofVSbE7bVUX7RpihrH +QTMsrNJ2KxNDjv9eMZv1C4IO0I0cAVVptpY1c9ZPO8xep5rSVePcikRt9oMWMPz4Jfr uiw9AdJLqB82iZNi0rWiNvAELM5xiBM2h1g7T6bpo/lcZiuqJ9Bn6JVW9SowWBdDpgLd sIKCZFgDjfCjJaztqg5/Ou8Q9/QN4cjdxblxX4pw9OY39qTa6hxSorUCWdwMPL6eIhJC e8SEdh5P2H3/DbrG/4aFrjaW+RFcvTYdAS/eXNpRayU7zTjRu93ecQwJKXvOtq/5TR56 UyAg== 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:arc-authentication-results; bh=w65PpmxMC6OW9SIJIqWUnx07cGpDn8OcfVysogBfITE=; b=0XF0sDx9Q/AkHI7nSzxcmdOGDtvxoZFYOUzxw92eo+ngn4wpPikNkyDnfuMM8g5xhH a2AYM8HHgv1d62Q5xet3u/kZmIUURc02e40TVVY9oO64lm10uU1EhA7dmTZ+rjqSPSq2 obGvV3sxJDhYQ/tmO5hPHEfD+KDfak3pAY33RqcRFNIUa5W9WyThrrBRY+W01dfabkoS 8DxrIcfIN6y1+pouYs/woYNPznnWYJOyPPGJ3L3v11ouhAhNWz8oCBJnLNuOXKjojpYD AcFVIpEF0pmZHz5uJU3sHbyr71EqbLAa08OEkyFUgXvUXcYMWVPVyd5I8cTZQQhQRfcA HjOg== 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=QtNErh4R; 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 i3si1901903pld.62.2018.01.16.05.38.04; Tue, 16 Jan 2018 05:38:04 -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=QtNErh4R; 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 EFA427869B; Tue, 16 Jan 2018 13:38:00 +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 AA21D78411 for ; Tue, 16 Jan 2018 13:37:58 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id z48so15198253wrz.6 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; bh=ySeF/mPlLaDx3XyP2r6znE9prfavJeMkycN28o7KNW8=; b=QtNErh4RmO839mjtc5Edd1rhhZeT6DI3iRPU/wS4XBsoDHFw1SCeUvKfLZiPDjHx+X e8qu4j1dOQN3gL+SCniNuVYzguVGdT85m0/Q2XGJXvChj+1kvKpH0mbC+y5CTzZyg+Cq WyWggqZ8sDSz/76OjHwQ7eSnSs5DDmfGmU9mYMEevV2ahVjfoQL7EzLFN3USrMEPlPjd qfQ0bxEoelIa+SHT09ws/PGkmhpyce8EfQjp+alNaikYoj0fsoBxv95vOWQOgPZSachn Qzcqy0tEsxdAB0QAcjucjL5j9JGegWcTUBexlxsY9t+pegIKSZMyU1kaDsv6Vy92OWFC ROyA== 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=ySeF/mPlLaDx3XyP2r6znE9prfavJeMkycN28o7KNW8=; b=Sb/RRUsxjWIDu1DJ0boqBDx7vAQ5xeK6hHjn8zySxyJtk1A/e5ANfWzS5kbcntCSAT kwKB++nvoSj8HaFd3S6Fyfkda3BNDex0ohQBNv3axOor3f4NfqytCufAxolEMEmJWwSh fMUudXe6phmbT1f6FjJ69Og4AHZIXDofBcJJEFJRzn300e+tGtccMhdS/xzraUbMIO8Y IQ2QdI+VZRlqeTc1prj2+nPLAKhbnYkILZtXRHBKmJHxAbxhEhSC15A33RFCSeWBQsc6 GmaOIRpIfWFRljs8VMgW1LcbL6GP5BsmfI0oE3owNa9JOssWlu5lgwlV0ZlDMgTvGaCS 782A== X-Gm-Message-State: AKGB3mJ2FI+Wty77gdqc+Zl4/gnnuqAVUb4OzO+nmFDCCjGWmHOe8eHn Dh0fOmi6vWCqHHLMEO+zBX1LZ4Iy X-Received: by 10.223.161.65 with SMTP id r1mr32327958wrr.235.1516109878933; Tue, 16 Jan 2018 05:37:58 -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.57 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 05:37:58 -0800 (PST) From: Ross Burton To: openembedded-core@lists.openembedded.org Date: Tue, 16 Jan 2018 13:37:53 +0000 Message-Id: <20180116133754.29471-1-ross.burton@intel.com> X-Mailer: git-send-email 2.11.0 Subject: [OE-core] [PATCH 1/2] classes/debian: fix library path handling 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 The existing code is looking for libraries in all paths which end in ${libdir}. This caused false-positives for recipes such as lz4 which had files called /usr/lib/lz4/ptest/usr/lib/liblz4.so, and resulted in lz4-ptest being incorrectly renamed to liblz4. Solve this by explicitly looking for ${libdir} etc under the packages-split directory. Signed-off-by: Ross Burton --- meta/classes/debian.bbclass | 26 ++++++++++++++++---------- 1 file changed, 16 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 5cdbf360dcb..edc6da1ba3a 100644 --- a/meta/classes/debian.bbclass +++ b/meta/classes/debian.bbclass @@ -25,12 +25,10 @@ python () { } python debian_package_name_hook () { - import glob, copy, stat, errno, re + import glob, copy, stat, errno, re, pathlib - pkgdest = d.getVar('PKGDEST') + pkgdest = d.getVar("PKGDEST") packages = d.getVar('PACKAGES') - bin_re = re.compile(".*/s?" + os.path.basename(d.getVar("bindir")) + "$") - lib_re = re.compile(".*/" + os.path.basename(d.getVar("libdir")) + "$") so_re = re.compile("lib.*\.so") def socrunch(s): @@ -60,17 +58,25 @@ python debian_package_name_hook () { d.appendVar('RPROVIDES_' + pkg, " " + pkg + " (=" + d.getVar("PKGV") + ")") def auto_libname(packages, orig_pkg): + p = lambda var: pathlib.PurePath(d.getVar(var)) + libdirs = (p("base_libdir"), p("libdir")) + bindirs = (p("base_bindir"), p("base_sbindir"), p("bindir"), p("sbindir")) + sonames = [] has_bins = 0 has_libs = 0 - for file in pkgfiles[orig_pkg]: - root = os.path.dirname(file) - if bin_re.match(root): + for f in pkgfiles[orig_pkg]: + # This is .../packages-split/orig_pkg/ + pkgpath = pathlib.PurePath(pkgdest, orig_pkg) + # Strip pkgpath off the full path to a file in the package, re-root + # so it is absolute, and then get the parent directory of the file. + path = pathlib.PurePath("/") / (pathlib.PurePath(f).relative_to(pkgpath).parent) + if path in bindirs: has_bins = 1 - if lib_re.match(root): + if path in libdirs: has_libs = 1 - if so_re.match(os.path.basename(file)): - cmd = (d.getVar('TARGET_PREFIX') or "") + "objdump -p " + file + " 2>/dev/null" + 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() 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: