From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0D80AA04B5; Thu, 10 Sep 2020 16:21:58 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 88AE41C0DC; Thu, 10 Sep 2020 16:21:36 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 9CA291C0D8 for ; Thu, 10 Sep 2020 16:21:34 +0200 (CEST) IronPort-SDR: 9w+1v4yKtRj71EcewFmQuTNuNG9/R7Flb/lC1R+YMtzHj65JgCf95uchW7esiEf0FUBIj+j3vn 23Rgr79giqFg== X-IronPort-AV: E=McAfee;i="6000,8403,9739"; a="138054717" X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="138054717" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 07:21:34 -0700 IronPort-SDR: NFbmLQ0FO9axlTsqNnRN9bsOGxIi0RKcE9FUMla46NaX/hKA1rXimFFwM9pVdNHUjk8hwcIEwB dUgMoHGcCpFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,413,1592895600"; d="scan'208";a="329346323" Received: from silpixa00400466.ir.intel.com ([10.237.213.195]) by fmsmga004.fm.intel.com with ESMTP; 10 Sep 2020 07:21:31 -0700 From: Conor Walsh To: dev@dpdk.org Cc: david.marchand@redhat.com, ray.kinsella@intel.com, nhorman@tuxdriver.com, aconole@redhat.com, maicolgabriel@hotmail.com, thomas@monjalon.net, bruce.richardson@intel.com, Conor Walsh Date: Thu, 10 Sep 2020 14:21:20 +0000 Message-Id: <20200910142121.3995680-4-conor.walsh@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200910142121.3995680-1-conor.walsh@intel.com> References: <20200910140116.3995345-1-conor.walsh@intel.com> <20200910142121.3995680-1-conor.walsh@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/4] buildtools: add script to setup abi checks for meson X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch adds a script that is intended to be invoked by meson to do the required setup for performing ABI breakage checks at build time. The required ABI dump archives can come from several sources including being generated at build time or prebuilt archives can be pulled from a remote http location or local directory. Invoke using "./abi-setup.py -t -d " - : dpdk tag e.g. "v20.11" - : path to dpdk source directory E.g. "./abi-setup.py -t v20.08 -d /root/dpdk" As this script is intended to be run by meson during a build some options can be specified by environmental variables: - DPDK_ABI_DUMPS_PATH: Can be used to specify a custom directory for the systems dump directories. - CC: The required compiler will be determined using this environmental variable - DPDK_ABI_TAR_URI: Can be used to specify a location that the script can pull prebuilt or cached dump archives from. This can be a remote http location or a local directory After the script has setup an appropriate ABI dump directory using one of the multiple methods available to it, it will print the location of this directory to the command line. Signed-off-by: Conor Walsh --- buildtools/abi-setup.py | 104 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 buildtools/abi-setup.py diff --git a/buildtools/abi-setup.py b/buildtools/abi-setup.py new file mode 100755 index 000000000..c156b3c73 --- /dev/null +++ b/buildtools/abi-setup.py @@ -0,0 +1,104 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Intel Corporation + +import sys +import os +import argparse + +# Get command line arguments +parser = argparse.ArgumentParser(usage='\rThis script is intended to setup ABI dumps for meson to perform ABI checks\n'+ + 'Supported environmental variables\n'+ + '\t- DPDK_ABI_DUMPS_PATH: Can be used to specify a custom directory for the systems dump directories.\n'+ + '\t- CC: The required compiler will be determined using this environmental variable.\n'+ + '\t- DPDK_ABI_TAR_URI: Can be used to specify a location that the script can pull prebuilt or cached dump archives from. This can be a remote http location or a local directory.\n') +parser.add_argument('-t', '--tag', dest='tag', type=str, help='DPDK tag e.g. latest or v20.11') +parser.add_argument('-d', '--dpdk', dest='dpdk', type=str, help='Path to DPDK source directory') +args = parser.parse_args() + +# Get the DPDK tag if not supplied set as latest +if args.tag: + user_tag = args.tag +else: + user_tag = 'latest' + +tag = '' +# If the user did not supply tag or wants latest then get latest tag +if user_tag == 'latest': + # Get latest quarterly build tag from git repo + tag = os.popen('git ls-remote --tags http://dpdk.org/git/dpdk | grep -v "rc\|{}" | tail -n 1 | sed "s/.*\///"').read().strip() +else: + tag = user_tag + # If the user supplied tag does not exist then fail + tag_check = int(os.popen('git ls-remote http://dpdk.org/git/dpdk refs/tags/'+tag+' | wc -l').read().strip()) + if tag_check != 1: + print('ERROR supplied tag does not exist in DPDK repo') + exit() + +# Get the specified compiler from system +comp_env = 'CC' +if comp_env in os.environ: + comp = os.environ[comp_env] +else: + comp = 'gcc' + +# Get the systems architecture +arch = os.popen('uname -m').read().strip() + +# Get devtools path +devtools_path = '' +if args.dpdk: + devtools_path = os.path.abspath(os.path.join(args.dpdk,'devtools')) +else: + print('ERROR DPDK source directory must be specified') + exit() + +# Get the abi dumps folder from args or env fail if none supplied +abi_folder = '' +abi_env = 'DPDK_ABI_DUMPS_PATH' +if abi_env in os.environ: + abi_folder = os.path.abspath(os.environ[abi_env]) +else: + abi_folder = os.path.abspath(os.path.join(args.dpdk,'abi_dumps')) + +# If the directory doesn't exist create it and add a README to explain what it does +if not os.path.exists(abi_folder): + os.makedirs(abi_folder) + f=open(abi_folder+'/README','w+') + f.write('This directory has been setup to contain the ABI dump folders needed to perform ABI checks\n') + f.write('Directories here must be in the format {DPDK Tag}-{Compiler ID}-{Architecture}-abi_dump\n') + f.write('e.g. v20.11-gcc-x86_64-abi_dump\n') + f.write('Directories that do not use this format will not be picked up by the meson ABI checks\n') + f.write('This directory is managed automatically unless desired by the user\n') + f.close() + +# Move to abi folder +os.chdir(abi_folder) +abi_dump=tag+'-'+comp+'-'+arch+'-abi_dump' +# Download and untar abi dump if not present +if not os.path.exists(abi_dump): + # Check DPDK_ABI_TAR_URI for the location of the tarballs local or web + tar_uri_env = 'DPDK_ABI_TAR_URI' + if tar_uri_env in os.environ: + abi_tar_uri = os.environ[tar_uri_env] + if abi_tar_uri.startswith('http'): + # Wget the required tarball + os.popen('wget '+os.path.join(abi_tar_uri,abi_dump)+'.tar.gz >/dev/null 2>&1').read() + else: + abi_tar_uri = os.path.abspath(abi_tar_uri) + os.popen('cp '+os.path.join(abi_tar_uri,abi_dump)+'.tar.gz . >/dev/null 2>&1').read() + # Check tarball was downloaded + if os.path.isfile(abi_dump+'.tar.gz'): + os.popen('tar -xzf '+abi_dump+'.tar.gz >/dev/null 2>&1').read() + os.popen('rm -rf '+abi_dump+'.tar.gz').read() + # If the tarball was not found then generate it + else: + os.popen(os.path.join(devtools_path,'gen-abi-tarball.py')+' -t '+tag+' -a '+arch+' >/dev/null 2>&1').read() + if not os.path.isfile(abi_dump+'.tar.gz'): + print('ERROR ABI check generation failed '+os.path.join(devtools_path,'gen-abi-tarball.py')+' -t '+tag+' -a '+arch) + exit() + os.popen('tar -xzf '+abi_dump+'.tar.gz >/dev/null 2>&1').read() + os.popen('rm -rf '+abi_dump+'.tar.gz').read() + +# Tell user where specified directory is +print(os.path.abspath(abi_dump)) -- 2.25.1