Comments (3)
Thank you, you're example and your script are really nice.
I've tried to adept my script and added ^(?!.*#).*(?<!-)
in order to reduce the false positive.
Luckily in case of dev-util/bazel
and also others it correctly removed them from the output. However i still have a problem with dev-util/strace
(haven't checked others, but there might be more)
As far as i understand your code only outputs a result if a function is used and the inherit is missing.
However, i'm also checking the opposite and look if a ebuild inherits a eclass and doesn't use any function of it (which is then presented in the unused_eclasses report).
Now with the updated code i get a false positive for dev-utils/strace, as it finds flag-o-matic
to be unused. (only in the versions 5.8, 5.9 and 9999)
For some reason the script doesn't find the filter-lfs-flags
call in the ebuild. However, there is a comment after the call, which i think is the reason why it gets ignored. But as far as i understand the regex, comments should only be ignored when it's preceding a possible function.
I'll definitely look into it as it never the less would remove a lot of false positives. But maybe you have an idea why this might happen?
from gentoo-scripts.
I'll definitely look into it as it never the less would remove a lot of false positives. But maybe you have an idea why this might happen?
It was defintely the .*
in the negative lookahead causing that. This should work: ^(?!#).*(?<!-)
from gentoo-scripts.
The script got a bit of an upgrade. Excluding all python and eapi7-ver eclasses, it seems to fix everything nicely. Doesn't check unused eclasses yet though...
#! /usr/bin/env bash
N=16
TREE="/home/telans/src/guru"
ECLASS_DIR="/home/telans/src/gentoo_local/eclass"
case "${1}" in
"eapi") # EAPI checking
for EBUILD in $(find "${TREE}" -mindepth 3 -maxdepth 3 -type f -name "*.ebuild"); do
EAPI=4567; EAPI_CHOICE="${2}"
! grep -qP "EAPI=[\"]?[${EAPI/${EAPI_CHOICE}/}][\"]?" "${EBUILD}" && echo "${EBUILD}"
done;;
"eclass") # Inherit checking
inherit_eclass() {
INHERIT=$(grep "^inherit" "${EBUILD}")
INHERIT_NEW=$(echo "${INHERIT/inherit } ${ECLASS%.*}" | tr " " "\n" | sort | tr "\n" " " | sed -e 's:^:inherit :' -e 's: $::')
if [ -n "${INHERIT}" ]; then
sed -i "0,/^${INHERIT}/s//${INHERIT_NEW}/" "${EBUILD}"
else
echo "No current inherit for ${EBUILD}"
fi
}
for ECLASS_PATH in $(find "${ECLASS_DIR}" -type f -name "*.eclass" -not -name "*python*.eclass" -not -name "*eapi7-ver.eclass" -not -name "*multilib*.eclass"); do
[ -n "${2}" ] && ECLASS_PATH="${ECLASS_DIR}/${2}.eclass"
ECLASS="${ECLASS_PATH##*/}"
FUNC_LIST=$(sed -n 's:# @FUNCTION\: ::p' "${ECLASS_PATH}" | sed ':a;N;$!ba;s/\n/|/g')
if [ -n "${FUNC_LIST}" ]; then
for EBUILD in $(find "${TREE}" -mindepth 3 -maxdepth 3 -type f -name "*.ebuild"); do ((i=i%N)); ((i++==0)) && wait; ( \
grep -qP "^(?!#).*[\s-\(](${FUNC_LIST})" "${EBUILD}" && \
! grep -qP "^inherit.* ${ECLASS%.*}" "${EBUILD}" && \
inherit_eclass && echo "Adding ${ECLASS} to ${EBUILD}"
#grep -qP "^(?!#).*inherit.* ${ECLASS%.*}(?!-)" "${EBUILD}" && ! grep -qP "^(?!#).*[\s-\(](${FUNC_LIST})" "${EBUILD}" && echo "${ECLASS} ${EBUILD}" && MISSING="true"
) & done
fi
[ -n "${2}" ] && break
done;;
esac
I imagine it spawns quite a few processes though
from gentoo-scripts.
Related Issues (20)
- FR: check for git:// usage HOT 1
- FR: high profile QA issues. HOT 7
- FR: lists sorted by number HOT 4
- FR: detailed EAC-STA-ebuild_obsolete_eapi breakdown HOT 5
- EAPI-7 ideas HOT 1
- FR: live ebuilds not on latest EAPI HOT 4
- Repo request: abendbrot HOT 1
- FR: Checks when BDEPEND should be used instead HOT 1
- Deptree for eclasses? HOT 4
- FR: implicit eclass inheritance HOT 4
- FR: breakdown of cmake-multilib usage by maintainer/etc HOT 2
- FR: SRC_URI="${P}.tar.gz" HOT 1
- FR: docinto without any followup dodoc
- Website should indicate some sort of contact details (github, dev names, etc) HOT 2
- EAC-STA-ebuild_stable_candidates is confusing and broken looking HOT 4
- EAC-STA-ebuild_stable_candidates should possibly have a "last changed" time field for new_ebuild HOT 7
- date math confused by reverts of older revision HOT 4
- FR: Non-HTML index format for machine consumption (JSON?) HOT 3
- Consider running scripts for GURU overlay HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gentoo-scripts.