From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 5DF0915808B for ; Sat, 19 Mar 2022 18:52:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A27942BC00A; Sat, 19 Mar 2022 18:52:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8553F2BC00A for ; Sat, 19 Mar 2022 18:52:29 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B189D3437FE for ; Sat, 19 Mar 2022 18:52:28 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 32C1FD0 for ; Sat, 19 Mar 2022 18:52:27 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1647715935.4484c577af41785358982daf4829f71091207567.sam@gentoo> Subject: [gentoo-commits] proj/qa-scripts:master commit in: / X-VCS-Repository: proj/qa-scripts X-VCS-Files: check-eapis.sh X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 4484c577af41785358982daf4829f71091207567 X-VCS-Branch: master Date: Sat, 19 Mar 2022 18:52:27 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: de894869-a37d-46de-8df1-7a177415457b X-Archives-Hash: 81c9c9b0736f414394b9e13a4c10b407 commit: 4484c577af41785358982daf4829f71091207567 Author: Sam James gentoo org> AuthorDate: Sat Mar 19 18:48:58 2022 +0000 Commit: Sam James gentoo org> CommitDate: Sat Mar 19 18:52:15 2022 +0000 URL: https://gitweb.gentoo.org/proj/qa-scripts.git/commit/?id=4484c577 check-eapis.sh: new script to list each ebuild using each EAPI Signed-off-by: Sam James gentoo.org> check-eapis.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/check-eapis.sh b/check-eapis.sh new file mode 100755 index 0000000..cfd58a1 --- /dev/null +++ b/check-eapis.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# Arguments: +# $1: output directory. Defaults to eapi-usage. + +. /lib/gentoo/functions.sh +dir=${1} +if [[ -n ${1} && ! -d ${dir} ]] ; then + eerror "Output directory given (${dir}) is not a directory! Exiting." + exit 1 +elif [[ -z ${dir} ]] ; then + ewarn "No output directory argument given! Defaulting to 'eapi-usage'." + dir=eapi-usage +fi + +REPO_PATH=$(portageq get_repo_path ${EROOT:-/} gentoo || exit 1) + +mkdir -p ${dir} || exit 1 + +ebegin "Getting list of supported EAPIs" +eapi_list=$(python3 -c 'import portage.repository.config; print("\n".join(list(portage._supported_eapis)))' || exit 1) +eend $? +einfo "EAPI list:" ${eapi_list} + +TMPDIR="$(mktemp -d || exit 1)" + +einfo "Working in TMPDIR=${TMPDIR}" +pushd "${TMPDIR}" &>/dev/null || exit 1 +mkdir -p eapi-usage || exit 1 +cd eapi-usage || exit 1 + +for eapi in ${eapi_list[@]} ; do + [[ -f ${eapi}.txt ]] && rm -r ${eapi}.txt + touch ${eapi}.txt +done + +ebegin "Finding ebuilds" +( + for ebuild in $(find "${REPO_PATH}/metadata/md5-cache" -mindepth 2 -maxdepth 2 -type f -name '*-[0-9]*') ; do + cpf=$(echo ${ebuild} | rev | cut -d/ -f1-2 | rev) + eapi=$(grep -oi "eapi=.*" ${ebuild} | sed -e 's:EAPI=::') + + echo "${cpf}" >> ${eapi}.txt + done +) || { eend $? || exit 1; } +eend ${?} + +ebegin "Sorting EAPI files" +for eapi in ${eapi_list[@]} ; do + sort -u ${eapi}.txt > ${eapi}.txt.sorted + mv ${eapi}.txt.sorted ${eapi}.txt +done || { eend $? || exit 1; } +eend $? + +popd &>/dev/null || exit 1 +mv ${TMPDIR}/eapi-usage/*.txt ${dir}/ || exit 1 + +rm -r "${TMPDIR}" || exit 1