From: "Andrew Ammerlaan" <andrewammerlaan@riseup.net>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/sci:master commit in: scripts/, .github/workflows/
Date: Wed, 17 Feb 2021 19:39:27 +0000 (UTC) [thread overview]
Message-ID: <1613590732.c8511a14fec6323b99300f881502ba49c9878b32.andrewammerlaan@gentoo> (raw)
commit: c8511a14fec6323b99300f881502ba49c9878b32
Author: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
AuthorDate: Wed Feb 17 19:38:52 2021 +0000
Commit: Andrew Ammerlaan <andrewammerlaan <AT> riseup <DOT> net>
CommitDate: Wed Feb 17 19:38:52 2021 +0000
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=c8511a14
.github/workflows/duplicates.yml: add script to check for duplicates
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> riseup.net>
.github/workflows/duplicates.yml | 25 +++++++++++++
scripts/check-duplicates.sh | 76 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 101 insertions(+)
diff --git a/.github/workflows/duplicates.yml b/.github/workflows/duplicates.yml
new file mode 100644
index 000000000..2db452228
--- /dev/null
+++ b/.github/workflows/duplicates.yml
@@ -0,0 +1,25 @@
+name: duplicates
+
+on:
+ push:
+ branches: [ dev ]
+ pull_request:
+ branches: [ dev ]
+ schedule:
+ - cron: '0 0 * * *'
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+ - name: Setup master gentoo repository
+ run: |
+ sudo mkdir -p /var/db/repos/gentoo /etc/portage /var/cache/distfiles
+ wget -qO - "https://github.com/gentoo-mirror/gentoo/archive/master.tar.gz" | sudo tar xz -C /var/db/repos/gentoo --strip-components=1
+ sudo wget "https://www.gentoo.org/dtd/metadata.dtd" -O /var/cache/distfiles/metadata.dtd
+ sudo wget "https://gitweb.gentoo.org/proj/portage.git/plain/cnf/repos.conf" -O /etc/portage/repos.conf
+ sudo ln -s /var/db/repos/gentoo/profiles/default/linux/amd64/17.1 /etc/portage/make.profile
+ - name: Check for duplicates
+ run: |
+ ./scripts/check-duplicates.sh
diff --git a/scripts/check-duplicates.sh b/scripts/check-duplicates.sh
new file mode 100755
index 000000000..8f6b89af7
--- /dev/null
+++ b/scripts/check-duplicates.sh
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+# Maintainer: Andrew Ammerlaan <andrewammerlaan@riseup.net>
+#
+# This checks if packages in ::guru are also in ::gentoo
+#
+# Note that this is not going to be 100% accurate
+#
+#
+
+printf "\nChecking for duplicates....\n"
+
+gentoo_location="/var/db/repos/gentoo"
+guru_location="."
+
+gentoo_packs=$(find ${gentoo_location} -mindepth 2 -maxdepth 2 -printf "%P\n" | sort | grep -Ev "^(.git|.github|metadata|profiles|scripts)/")
+guru_packs=$(find ${guru_location} -mindepth 2 -maxdepth 2 -printf "%P\n" | sort | grep -Ev "^(.git|.github|metadata|profiles|scripts)/")
+
+pack_overrides="" pack_close_match_in_cat="" pack_close_match=""
+for guru_pack in ${guru_packs}; do
+ # separate category and packages
+ guru_pack_cat="${guru_pack%%/*}"
+ guru_pack_name="${guru_pack##*/}"
+
+ # convert all to lowercase
+ guru_pack_name="${guru_pack_name,,}"
+
+ # stip all numbers, dashes, underscores and pluses
+ guru_pack_name="${guru_pack_name/[0-9-_+]}"
+
+ for gentoo_pack in ${gentoo_packs}; do
+ # separate category and packages
+ gentoo_pack_cat="${gentoo_pack%%/*}"
+ gentoo_pack_name="${gentoo_pack##*/}"
+
+ # convert all to lowercase
+ gentoo_pack_name="${gentoo_pack_name,,}"
+
+ # stip all numbers, dashes, underscores and pluses
+ gentoo_pack_name="${gentoo_pack_name/[0-9-_+]}"
+
+ #TODO: check DESCRIPTION, HOMEPAGE and SRC_URI for close matches
+
+ if [[ "${gentoo_pack_name}" == "${guru_pack_name}" ]]; then
+ if [[ "${gentoo_pack_cat}" == "${guru_pack_cat}" ]]; then
+ if [[ "${gentoo_pack}" == "${guru_pack}" ]]; then
+ pack_overrides+="\t${guru_pack}::guru exact match of ${gentoo_pack}::gentoo\n"
+ else
+ pack_close_match_in_cat+="\t${guru_pack}::guru possible duplicate of ${gentoo_pack}::gentoo\n"
+ fi
+ else
+ pack_close_match+="\t${guru_pack}::guru possible duplicate of ${gentoo_pack}::gentoo\n"
+ fi
+ fi
+ done
+done
+
+if [ -n "${pack_close_match}" ]; then
+ printf "\nWARNING: The following packages closely match packages in the main Gentoo repository\n"
+ printf "${pack_close_match}"
+ printf "Please check these manually\n"
+fi
+
+if [ -n "${pack_close_match_in_cat}" ]; then
+ printf "\nWARNING: The following packages closely match packages in the main Gentoo repository in the same category\n"
+ printf "${pack_close_match_in_cat}"
+ printf "Please check these manually\n"
+fi
+
+if [ -n "${pack_overrides}" ]; then
+ printf "\nERROR: The following packages override packages in the main Gentoo repository\n"
+ printf "${pack_overrides}"
+ printf "Please remove these packages\n"
+ # do not exit fatally on ::science
+ # exit 1
+fi
+exit 0
next reply other threads:[~2021-02-17 19:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-17 19:39 Andrew Ammerlaan [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-04-02 10:05 [gentoo-commits] proj/sci:master commit in: scripts/, .github/workflows/ Andrew Ammerlaan
2022-05-02 12:14 Andrew Ammerlaan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1613590732.c8511a14fec6323b99300f881502ba49c9878b32.andrewammerlaan@gentoo \
--to=andrewammerlaan@riseup.net \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox