summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2016-05-10 16:47:34 +0200
committerErich Eckner <git@eckner.net>2016-05-10 16:47:34 +0200
commit8ffec1e9d907c23c6aa66f999e44e2cbc658871c (patch)
treef3f204ca47640333843e48af75af4ac0de3fecbb
downloadcrux-enhancements-8ffec1e9d907c23c6aa66f999e44e2cbc658871c.tar.xz
Initial commit
new file: compare-my-ports-to-others
-rwxr-xr-xcompare-my-ports-to-others60
1 files changed, 60 insertions, 0 deletions
diff --git a/compare-my-ports-to-others b/compare-my-ports-to-others
new file mode 100755
index 0000000..cab06b1
--- /dev/null
+++ b/compare-my-ports-to-others
@@ -0,0 +1,60 @@
+#!/bin/bash
+
+for pkg in $( \
+ curl 'https://crux.eckner.net/REPO' 2> /dev/null | \
+ grep '^d:' | \
+ cut -d : -f 2
+)
+do
+ inhalt="$( \
+ curl "https://crux.nu/portdb/index.php?q=${pkg}&a=search" 2> /dev/null \
+ )"
+ echo "${inhalt}" | \
+ grep -v '>deepthought<' | \
+ grep -q '<td><a href="?a=repo&q=' \
+ || continue
+
+ for pkgfile in $( \
+ echo "${inhalt}" | \
+ tr '\n' ' ' | \
+ sed 's|<tr>|\n<tr>|g' | \
+ grep -v '>deepthought<' | \
+ tr '"' '\n' | \
+ grep 'Pkgfile$' \
+ )
+ do
+ remPkgCont="$(
+ wget -O - "${pkgfile}" 2> /dev/null
+ )"
+ numLinesDiff=$( \
+ diff \
+ <( \
+ echo "${remPkgCont}" | \
+ sed 's|^\s*||' | \
+ sed 's|#.*$||' | \
+ grep -v '^$'
+ ) \
+ <( \
+ curl "https://crux.eckner.net/${pkg}/Pkgfile" 2> /dev/null | \
+ sed 's|^\s*||' | \
+ sed 's|#.*$||' | \
+ grep -v '^$'
+ ) | \
+ grep -c '^[<>]' \
+ )
+ [ ${numLinesDiff} -ge 10 ] && echo "${pkg}: ${numLinesDiff}" && continue
+ echo "${pkg} gibt es noch mal so ähnlich: ${pkgfile}"
+ diff -u3 \
+ <( \
+ echo "${remPkgCont}" | \
+ grep -v '^#' | \
+ sed 's|^\s\+| |' \
+ ) \
+ <( \
+ curl "https://crux.eckner.net/${pkg}/Pkgfile" 2> /dev/null | \
+ grep -v '^#' | \
+ sed 's|^\s\+| |' \
+ )
+ done
+
+done