Return-Path: Received: from mail1.windriver.com (mail1.windriver.com [147.11.146.13]) by mail.openembedded.org (Postfix) with ESMTP id 476F4780F3 for ; Tue, 13 Mar 2018 01:33:45 +0000 (UTC) Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id w2D1XlYb028093 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL) for ; Mon, 12 Mar 2018 18:33:47 -0700 (PDT) Received: from [128.224.163.220] (128.224.163.220) by ALA-HCA.corp.ad.wrs.com (147.11.189.50) with Microsoft SMTP Server (TLS) id 14.3.361.1; Mon, 12 Mar 2018 18:33:07 -0700 To: References: <1520298700-20804-1-git-send-email-yi.zhao@windriver.com> <1520381739-22740-1-git-send-email-yi.zhao@windriver.com> From: Yi Zhao Message-ID: Date: Tue, 13 Mar 2018 09:33:44 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1520381739-22740-1-git-send-email-yi.zhao@windriver.com> X-Originating-IP: [128.224.163.220] Subject: Re: [PATCH V2] insane.bbclass: skip opening symlinks in package_qa_check_libdir 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: , X-List-Received-Date: Tue, 13 Mar 2018 01:33:47 -0000 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Ping //Yi 在 2018年03月07日 08:15, Yi Zhao 写道: > If the library is installed in a non-standard location and don't set > INSANE_SKIP, e.g. libfoo.so is installed in /usr/local/lib. The > package_qa_check_libdir will cause a traceback because it will try to > open the .so link in package-dev to check if it's an ELF: > The stack trace of python calls that resulted in this exception/failure > was: > File: 'exec_python_func() autogenerated', lineno: 2, function: > 0001: > *** 0002:do_package_qa(d) > [snip] > 0048: def open(self): > *** 0049: with open(self.name, "rb") as f: > 0050: try: > 0051: self.data = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ) > 0052: except ValueError: > 0053: # This means the file is empty > Exception: FileNotFoundError: [Errno 2] No such file or directory: > '/buildarea1/build/tmp/work/i586-poky-linux/foo/1.0-r0/packages-split/foo-dev/usr/local/lib/libfoo.so' > > For .so sysmlinks, we don't need to open it and report it directly. > > [YOCTO #11862] > > Signed-off-by: Yi Zhao > --- > meta/classes/insane.bbclass | 30 ++++++++++++++++++------------ > 1 file changed, 18 insertions(+), 12 deletions(-) > > diff --git a/meta/classes/insane.bbclass b/meta/classes/insane.bbclass > index 7407b29..b5689b7 100644 > --- a/meta/classes/insane.bbclass > +++ b/meta/classes/insane.bbclass > @@ -358,22 +358,28 @@ def package_qa_check_libdir(d): > rel_path = os.sep + rel_path > if lib_re.match(rel_path): > if base_libdir not in rel_path: > - # make sure it's an actual ELF file > - elf = oe.qa.ELFFile(full_path) > - try: > - elf.open() > + if os.path.islink(full_path): > messages.append("%s: found library in wrong location: %s" % (package, rel_path)) > - except (oe.qa.NotELFFileError): > - pass > + else: > + # make sure it's an actual ELF file > + elf = oe.qa.ELFFile(full_path) > + try: > + elf.open() > + messages.append("%s: found library in wrong location: %s" % (package, rel_path)) > + except (oe.qa.NotELFFileError): > + pass > if exec_re.match(rel_path): > if libdir not in rel_path and libexecdir not in rel_path: > - # make sure it's an actual ELF file > - elf = oe.qa.ELFFile(full_path) > - try: > - elf.open() > + if os.path.islink(full_path): > messages.append("%s: found library in wrong location: %s" % (package, rel_path)) > - except (oe.qa.NotELFFileError): > - pass > + else: > + # make sure it's an actual ELF file > + elf = oe.qa.ELFFile(full_path) > + try: > + elf.open() > + messages.append("%s: found library in wrong location: %s" % (package, rel_path)) > + except (oe.qa.NotELFFileError): > + pass > > if messages: > package_qa_handle_error("libdir", "\n".join(messages), d)