From 537669243eb781bb4484f03ef651d243fba0d563 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 16 Mar 2024 23:48:26 +0100 Subject: [PATCH] remove unused scripts (#1198) --- scripts/authors.scala | 69 --------------------------- scripts/convert_tabs_to_spaces.sh | 23 --------- scripts/dos_to_unix.sh | 6 --- scripts/find_fixed_tickets.sh | 32 ------------- scripts/ip-mod.sh | 31 ------------ scripts/line_count.sh | 1 - scripts/multi-node-log-replace.sh | 25 ---------- scripts/release_stats.sh | 61 ----------------------- scripts/remove_trailing_whitespace.sh | 2 - scripts/show-serializer.sh | 4 -- 10 files changed, 254 deletions(-) delete mode 100755 scripts/authors.scala delete mode 100755 scripts/convert_tabs_to_spaces.sh delete mode 100755 scripts/dos_to_unix.sh delete mode 100755 scripts/find_fixed_tickets.sh delete mode 100755 scripts/ip-mod.sh delete mode 100755 scripts/line_count.sh delete mode 100755 scripts/multi-node-log-replace.sh delete mode 100755 scripts/release_stats.sh delete mode 100755 scripts/remove_trailing_whitespace.sh delete mode 100755 scripts/show-serializer.sh diff --git a/scripts/authors.scala b/scripts/authors.scala deleted file mode 100755 index 46ab12c782e..00000000000 --- a/scripts/authors.scala +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh -exec scala "$0" "$@" -!# - -/* - * Usage: - * authors.scala tag1 tag2 - * - * or if on non unixy os: - * scala authors.scala tag1 tag2 - * - * requires scala 2.13.x+ and command line git on path - */ - -import scala.sys.process._ - -require(args.length == 2, "usage: authors prevTag currTag") - -val gitCmd = "git log --no-merges --shortstat -z --minimal -w -C " + args(0) + ".." + args(1) - -case class Stats(name: String, email: String, commits: Int = 0, inserts: Int = 0, deletes: Int = 0, filesChanged: Int = 0) - -val AuthorExp = """Author: (.*) <([^>]+)>""".r -val FilesExp = """(\d+)\sfile[s]? changed""".r -val InsertionsExp = """(\d+)\sinsertion[s]?\(\+\)""".r -val DeletionsExp = """(\d+)\sdeletion[s]?\(-\)""".r - -val entries = gitCmd.lazyLines_!.foldLeft("")(_ + "\n" + _).split('\u0000') - -val map = entries.foldLeft(Map.empty[String, Stats]) { (map, entry) => - val lines = entry.trim.split('\n') - val authorLine = lines(1) - val summary = lines.last - - val statsEntry = authorLine match { - case AuthorExp(name, email) => - map.get(name.toLowerCase).orElse { - // look for same email, but different name - map.values.find(_.email.equalsIgnoreCase(email)).orElse { - Some(Stats(name, email)) - } - } - case _ => - println(s"Unparseable author line: \n$authorLine\n in entry $entry") - None - } - - val updatedEntry = - statsEntry.map(entry => summary.trim.split(',').map(_.trim).foldLeft(entry.copy(commits = entry.commits + 1)) { - case (entry, FilesExp(f)) => entry.copy(filesChanged = entry.filesChanged + f.toInt) - case (entry, InsertionsExp(a)) => entry.copy(inserts = entry.inserts + a.toInt) - case (entry, DeletionsExp(d)) => entry.copy(deletes = entry.deletes + d.toInt) - case (entry, uff) => - println(s"Couldn't parse summary section for $entry '$uff'") - entry - }) - - updatedEntry.fold( - map - )(entry => map + (entry.name.toLowerCase -> entry)) -} - -val sorted = map.values.toSeq.sortBy(s => (s.commits, s.inserts + s.deletes)).reverse - -println("commits added removed") -sorted.foreach { entry => - println("%7d%7d%9d %s".format(entry.commits, entry.inserts, entry.deletes, entry.name)) -} - diff --git a/scripts/convert_tabs_to_spaces.sh b/scripts/convert_tabs_to_spaces.sh deleted file mode 100755 index 51beee7a207..00000000000 --- a/scripts/convert_tabs_to_spaces.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -find . -name "*.java" |while read line -do - expand $line > $line.new - mv -f $line.new $line -done -find . -name "*.scala" |while read line -do - expand $line > $line.new - mv -f $line.new $line -done -find . -name "*.html" |while read line -do - expand $line > $line.new - mv -f $line.new $line -done -find . -name "*.xml" |while read line -do - expand $line > $line.new - mv -f $line.new $line -done -echo "converted all tabs to 2 spaces" -exit 0 diff --git a/scripts/dos_to_unix.sh b/scripts/dos_to_unix.sh deleted file mode 100755 index eb998a2a809..00000000000 --- a/scripts/dos_to_unix.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -find . -name *.scala -exec dos2unix {} \; -find . -name *.java -exec dos2unix {} \; -find . -name *.html -exec dos2unix {} \; -find . -name *.xml -exec dos2unix {} \; -find . -name *.conf -exec dos2unix {} \; diff --git a/scripts/find_fixed_tickets.sh b/scripts/find_fixed_tickets.sh deleted file mode 100755 index 58fa0788945..00000000000 --- a/scripts/find_fixed_tickets.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# -# Finds fixed tickets in repository -# -# This script takes Organization, Repository, Github username, Password as inputs. -# It writes all the closed tickets in "closed-issues.txt" file. -# -read -p "Organization: " ORG; read -p "Repository: " REPO; read -p "Github username: " USER; read -s -p "Password: " PASS -CLOSED_FILE="closed-issues.txt" -if [[ ! -e $CLOSED_FILE ]]; then - for (( i = 1 ; i < 200; i++ )); do - URL="https://api.github.com/repos/$ORG/$REPO/issues?state=closed&page=$i&per_page=100" - echo "fetching $URL" - HEADERS="" - { HEADERS=$(curl -vs -u "$USER:$PASS" "$URL" 2>&1 1>&3-); } 3> >(grep -oP "(?<=^[[:space:]]{4}\"number\":[[:space:]])([0-9]{1,5})" >> $CLOSED_FILE) - echo "$HEADERS" - if [[ ! "$HEADERS" == *"rel=\"next\""* ]]; then - break - fi - done -else - echo "$CLOSED_FILE found" -fi - -ISSUE_PATTERN="[^&A-Za-z](#)([0-9]{1,5})($|[^0-9A-Za-z])" -grep -rn --include=\*.{scala,java} -E "$ISSUE_PATTERN" . | while read LINE; do - if [[ $LINE =~ $ISSUE_PATTERN ]]; then - if grep -xq ${BASH_REMATCH[2]} $CLOSED_FILE; then - echo "$LINE" - fi - fi -done diff --git a/scripts/ip-mod.sh b/scripts/ip-mod.sh deleted file mode 100755 index e9b509ae59c..00000000000 --- a/scripts/ip-mod.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# flush rules -ipfw del pipe 1 -ipfw del pipe 2 -ipfw -q -f flush -ipfw -q -f pipe flush - -if [ "$1" == "" ]; then - echo "Options: ip-mod.sh slow" - echo " ip-mod.sh block" - echo " ip-mod.sh reset" - echo " ip-mod.sh restore" - exit -elif [ "$1" == "restore" ]; then - echo "restoring normal network" - exit -elif [ "$1" == "slow" ]; then - # simulate slow connection - echo "enabling slow connection" - ipfw add pipe 1 ip from any to any - ipfw add pipe 2 ip from any to any - ipfw pipe 1 config bw 60KByte/s delay 350ms - ipfw pipe 2 config bw 60KByte/s delay 350ms -elif [ "$1" == "block" ]; then - echo "enabling blocked connections" - ipfw add 1 deny tcp from any to any 1024-65535 -elif [ "$1" == "reset" ]; then - echo "enabling reset connections" - ipfw add 1 reset tcp from any to any 1024-65535 -fi diff --git a/scripts/line_count.sh b/scripts/line_count.sh deleted file mode 100755 index 3e624758b96..00000000000 --- a/scripts/line_count.sh +++ /dev/null @@ -1 +0,0 @@ -wc -l `find . -name \*.scala -print` \ No newline at end of file diff --git a/scripts/multi-node-log-replace.sh b/scripts/multi-node-log-replace.sh deleted file mode 100755 index c9ab8f4ef55..00000000000 --- a/scripts/multi-node-log-replace.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -# -# Utility to make log files from multi-node tests easier to analyze. -# Replaces jvm names and host:port with corresponding logical role name. -# -# Use with 0, 1 or 2 arguments. -# -# When using 0 arguments it reads from standard input -# and writes to standard output. -# -# With 1 argument it reads from the file specified in the first argument -# and writes to standard output. -# -# With 2 arguments it reads the file specified in the first argument -# and writes to the file specified in the second argument. -# -# You can also replace the contents of the clipboard instead of using files -# by supplying `clipboard` as argument -# - - -# check for an sbt command -type -P sbt &> /dev/null || fail "sbt command not found" - -sbt "project remote-tests" "test:run-main org.apache.pekko.remote.testkit.LogRoleReplace $1 $2" diff --git a/scripts/release_stats.sh b/scripts/release_stats.sh deleted file mode 100755 index 99cffc0ed3c..00000000000 --- a/scripts/release_stats.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env bash -# -# Generates statistics for release notes -# - -# get the source location for this script; handles symlinks -function get_script_path { - local source="${BASH_SOURCE[0]}" - while [ -h "${source}" ] ; do - source="$(readlink "${source}")"; - done - echo ${source} -} - -# path, name, and dir for this script -declare -r script_path=$(get_script_path) -declare -r script_name=$(basename "${script_path}") -declare -r script_dir="$(cd -P "$(dirname "${script_path}")" && pwd)" - -# print usage info -function usage { - echo "Usage: ${script_name} " - echo "Example: ${script_name} v2.3.2 v2.3.3 2.3.3" -} - -declare -r tag1=$1 -declare -r tag2=$2 -declare -r milestone_name=$3 - -declare -r tag_range="$tag1..$tag2" -declare authors=$($script_dir/authors.pl $tag_range) -declare author_count=$(echo "$authors" | wc -l | grep -o '[1-9].*') -declare diff_short=$(git diff --shortstat $tag_range | grep -o '[1-9].*') - -declare script_user_agent="User-Agent: Akka-Stats-Script" -declare open_milestones=$(curl -s -H "$script_user_agent" "https://api.github.com/repos/apache/incubator-pekko/milestones?state=open") -declare closed_milestones=$(curl -s -H "$script_user_agent" "https://api.github.com/repos/apache/incubator-pekko/milestones?state=closed") -declare milestone_id=$(echo "$open_milestones$closed_milestones" | sed 's/"description"/\n/g' | perl -ne 'm/number":([0-9]+),"title":"(.+?)",/ && print "$1,$2\n"' | grep "$milestone_name" | cut -d"," -f 1) -declare tickets=$(curl -s -H "$script_user_agent" "https://api.github.com/repos/apache/incubator-pekko/issues?milestone=$milestone_id&state=all&per_page=100" | sed 's/"comments"/\n/g' | perl -ne 'm/number":([0-9]+),"title":"(.+?)",/ && print " - *$1* $2\n"' | sort -n) -declare ticket_count=$(echo "$tickets" | wc -l | grep -o '[1-9].*') - -echo "$tag1 compared to Pekko $tag2": - -echo "* $ticket_count tickets closed" - -echo "* $diff_short" - -echo "* X pages of docs vs Y in $tag1" - -echo "* … and a total of $author_count committers!" - -echo "" -echo "Fixed Tickets:" -echo "$tickets" - -echo "" -echo "Credits:" -echo "commits added removed" -echo "$authors" - - diff --git a/scripts/remove_trailing_whitespace.sh b/scripts/remove_trailing_whitespace.sh deleted file mode 100755 index 242b2d161d1..00000000000 --- a/scripts/remove_trailing_whitespace.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -sed -i '' 's/[[:space:]]*$//g' **/*.scala \ No newline at end of file diff --git a/scripts/show-serializer.sh b/scripts/show-serializer.sh deleted file mode 100755 index 003c350fa57..00000000000 --- a/scripts/show-serializer.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -# Locate akka.serialization.Serializer.identifier() -find . -name *.scala | xargs grep "def identifier =" * | sort