aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ammerlaan <andrewammerlaan@riseup.net>2021-02-18 11:51:33 +0100
committerAndrew Ammerlaan <andrewammerlaan@riseup.net>2021-02-18 11:51:33 +0100
commit04573fbb57a934aae0e23369b013c31f1a3e4969 (patch)
tree540a006fd93f293fc4dd80cb27d564b26d530c12 /scripts
parentdev-python/graphene: minor version bump (diff)
downloadguru-04573fbb57a934aae0e23369b013c31f1a3e4969.tar.gz
guru-04573fbb57a934aae0e23369b013c31f1a3e4969.tar.bz2
guru-04573fbb57a934aae0e23369b013c31f1a3e4969.zip
scripts/check-duplicates.sh: read repo-name from profiles/
- also match foo-bar and foo_bar Signed-off-by: Andrew Ammerlaan <andrewammerlaan@riseup.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/check-duplicates.sh34
1 files changed, 19 insertions, 15 deletions
diff --git a/scripts/check-duplicates.sh b/scripts/check-duplicates.sh
index fe86a89ebb..85af7839c4 100755
--- a/scripts/check-duplicates.sh
+++ b/scripts/check-duplicates.sh
@@ -2,7 +2,7 @@
# Maintainer: Andrew Ammerlaan <andrewammerlaan@riseup.net>
# Maintainer: Theo Anderson <telans@posteo.de>
#
-# This checks for potential and exact package matches within ::guru & ::gentoo
+# This checks for potential and exact package matches within an overlay & ::gentoo
# Note that this is not going to be 100% accurate
#
@@ -12,41 +12,45 @@ GENTOO_PACKAGES=(
| sort | grep -Ev "^(.git|.github|metadata|profiles|scripts)/"
)
)
-GURU_PACKAGES=(
+REPO_PACKAGES=(
$(find . -mindepth 2 -maxdepth 2 -printf "%P\n" \
| sort | grep -Ev "^(.git|.github|metadata|profiles|scripts)/"
)
)
+REPO_NAME="$(cat profiles/repo_name)"
+
printf "\nChecking for duplicates...\n"
for GENTOO_PKG in ${GENTOO_PACKAGES[@]}; do
GENTOO_CATEGORIES+=( ${GENTOO_PKG%%/*} ) # Separate category
GENTOO_PKG_NAME=${GENTOO_PKG##*/} # Separate name
- GENTOO_PKG_NAME=${GENTOO_PKG_NAME,,} # Force lower case
+ GENTOO_PKG_NAME=${GENTOO_PKG_NAME,,} # Force lower case, e.g. to match foobar and FooBar
+ GENTOO_PKG_NAME=${GENTOO_PKG_NAME/[-_]} # Remove underscores and dashes, e.g. to match foo-bar and foo_bar
GENTOO_PKG_NAMES+=( ${GENTOO_PKG_NAME} )
done
-printf "Testing ${#GURU_PACKAGES[@]} GURU packages against ${#GENTOO_PKG_NAMES[@]} Gentoo packages\n"
+printf "Testing ${#REPO_PACKAGES[@]} ${REPO_NAME^} packages against ${#GENTOO_PKG_NAMES[@]} Gentoo packages\n"
-for GURU_PKG in ${GURU_PACKAGES[@]}; do
- GURU_PKG_CATEGORY=${GURU_PKG%%/*}
- GURU_PKG_NAME=${GURU_PKG##*/}
- GURU_PKG_NAME=${GURU_PKG_NAME,,}
+for REPO_PKG in ${REPO_PACKAGES[@]}; do
+ REPO_PKG_CATEGORY=${REPO_PKG%%/*}
+ REPO_PKG_NAME=${REPO_PKG##*/}
+ REPO_PKG_NAME=${REPO_PKG_NAME,,}
+ REPO_PKG_NAME=${REPO_PKG_NAME/[-_]}
- if [[ ${GENTOO_PKG_NAMES[@]} =~ " ${GURU_PKG_NAME} " ]]; then # Check for a matcing name in the Gentoo tree,
+ if [[ ${GENTOO_PKG_NAMES[@]} =~ " ${REPO_PKG_NAME} " ]]; then # Check for a matcing name in the Gentoo tree,
for (( i=0; i<${#GENTOO_PKG_NAMES[@]}; i++ )); do # otherwise there is no need to continue
- [[ ${GENTOO_PKG_NAMES[$i]} == ${GURU_PKG_NAME} ]] && index+=( $i ) # Find the category/index for multiple matching names
+ [[ ${GENTOO_PKG_NAMES[$i]} == ${REPO_PKG_NAME} ]] && index+=( $i ) # Find the category/index for multiple matching names
done
for i in ${index[@]}; do # For each possible match
- if [[ ${GENTOO_PACKAGES[$i]} == ${GURU_PKG} ]]; then
- PKG_EXACT_MATCH+="\t${GURU_PKG}::guru exact match of ${GENTOO_PACKAGES[$i]}::gentoo\n"
+ if [[ ${GENTOO_PACKAGES[$i]} == ${REPO_PKG} ]]; then
+ PKG_EXACT_MATCH+="\t${REPO_PKG}::${REPO_NAME} exact match of ${GENTOO_PACKAGES[$i]}::gentoo\n"
break # An exact match is fatal, no need to continue
- elif [[ ${GENTOO_CATEGORIES[$i]} == ${GURU_PKG_CATEGORY} ]]; then # Possible match within the same category
- PKG_CATEGORY_MATCH+="\t${GURU_PKG}::guru possible duplicate of ${GENTOO_PACKAGES[$i]}::gentoo\n"
+ elif [[ ${GENTOO_CATEGORIES[$i]} == ${REPO_PKG_CATEGORY} ]]; then # Possible match within the same category
+ PKG_CATEGORY_MATCH+="\t${REPO_PKG}::${REPO_NAME} possible duplicate of ${GENTOO_PACKAGES[$i]}::gentoo\n"
else # Possible match in a different category
- PKG_SPECULATIVE_MATCH+="\t${GURU_PKG}::guru possible duplicate of ${GENTOO_PACKAGES[$i]}::gentoo\n"
+ PKG_SPECULATIVE_MATCH+="\t${REPO_PKG}::${REPO_NAME} possible duplicate of ${GENTOO_PACKAGES[$i]}::gentoo\n"
fi
done
unset index