diff --git a/bin/count.c b/bin/count.c deleted file mode 100644 index 786f15eb9..000000000 --- a/bin/count.c +++ /dev/null @@ -1,26 +0,0 @@ -#include - -int main( void ) -{ - int c; - int count = 0; - - //turn off buffering - setvbuf(stdin, NULL, _IONBF, 0); - setvbuf(stdout, NULL, _IONBF, 0); - setvbuf(stderr, NULL, _IONBF, 0); - - c = fgetc(stdin); - while(c != EOF) - { - if (c=='.' || c=='E' || c=='F' || c=='s') count++; else count=0; - fputc(c, stdout); - fflush(stdout); - if (count && count % 76 == 0) { - fprintf(stderr, "%4d\n", count); - fflush(stderr); - } - c = fgetc(stdin); - } - return 0; -} diff --git a/bin/daily b/bin/daily deleted file mode 100755 index e6e530465..000000000 --- a/bin/daily +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Nightly datatracker jobs. -# -# This script is expected to be triggered by cron from -# /etc/cron.d/datatracker -export LANG=en_US.UTF-8 - -# Make sure we stop if something goes wrong: -program=${0##*/} -trap 'echo "$program($LINENO): Command failed with error code $? ([$$] $0 $*)"; exit 1' ERR - -# Datatracker directory -DTDIR=/a/www/ietf-datatracker/web -cd $DTDIR/ - -logger -p user.info -t cron "Running $DTDIR/bin/daily" - -# Get IANA-registered yang models -#YANG_IANA_DIR=$(python -c 'import ietf.settings; print ietf.settings.SUBMIT_YANG_IANA_MODEL_DIR') -# Hardcode the rsync target to avoid any unwanted deletes: -# rsync -avzq --delete rsync.ietf.org::iana/yang-parameters/ /a/www/ietf-ftp/yang/ianamod/ -rsync -avzq --delete /a/www/ietf-ftp/iana/yang-parameters/ /a/www/ietf-ftp/yang/ianamod/ - -# Get Yang models from Yangcatalog. -#rsync -avzq rsync://rsync.yangcatalog.org:10873/yangdeps /a/www/ietf-ftp/yang/catalogmod/ -/a/www/ietf-datatracker/scripts/sync_to_yangcatalog diff --git a/bin/drop-new-tables b/bin/drop-new-tables deleted file mode 100755 index ec1594ae2..000000000 --- a/bin/drop-new-tables +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# Drop tables which don't exist in the database dump. - -[ -n "$1" ] || { echo -e "\nUsage: $0 DUMPFILE\n\nError: No database dump file given"; exit 1; } - -zcat $1 | head | grep "Database: ietf_utf8" || { echo "Is this a database dump? Expected to see 'Database: ietf_utf8' "; exit 1; } - -echo -e "\nSQL commands:\n" - -diff <(zcat $1 | grep '^DROP TABLE IF EXISTS' | tr -d '`;' | field 5) <(ietf/manage.py dbshell <<< 'show tables;' | tail -n +2) | grep '^>' | awk '{print "drop table if exists", $2, ";";}' | tee /dev/stderr | ietf/manage.py dbshell - -echo -e "\nDone" diff --git a/bin/dump-to-names-json b/bin/dump-to-names-json deleted file mode 100644 index 20d4e0f95..000000000 --- a/bin/dump-to-names-json +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# This script provides a limited selected dump of database content with the -# purpose of generating a test fixture that provides the test data needed -# by the test suite. -# -# The generated data fixture is sorted and normalized in order to produce -# minimal commit diffs which reflect only actual changes in the fixture data, -# without apparent changes resulting only from ordering changes. - -set -x -ietf/manage.py dumpdata --indent 1 doc.State doc.BallotType doc.StateType \ - mailtrigger.MailTrigger mailtrigger.Recipient name \ - group.GroupFeatures stats.CountryAlias dbtemplate.DBTemplate \ - | jq --sort-keys "sort_by(.model, .pk)" \ - | jq '[.[] | select(.model!="dbtemplate.dbtemplate" or .pk==354)]' > ietf/name/fixtures/names.json diff --git a/bin/mkdiagram b/bin/mkdiagram deleted file mode 100755 index 4f015c0ab..000000000 --- a/bin/mkdiagram +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# assume we're in bin/, sibling to ietf/ - -cd ${0%/*}/../ietf || { echo "CD to ietf directory failed, bailing out"; exit; } - -trap 'echo "$program($LINENO): Command failed with error code $? ($0 $*)"; exit 1' ERR - -if [ "$*" ]; then apps="$@"; graph="${1%.*}"; else apps=$(ls */models.py | sed 's!/models.py!!'); graph="models"; fi - -newapps="doc group meeting message person name" -legacyapps="announcements idindex idrfc idtracker iesg ietfauth ipr liaisons mailinglists proceedings redirects submit wgcharter wginfo" - -proxy="$(grep ^class */proxy.py | tr '()' ' ' | awk '{printf $2 ","}')" -names="$(grep ^class name/models.py | tr '()' ' ' | awk '{printf $2 ","}')" -legacy="$(for app in $legacyapps; do grep ^class $app/models.py | tr '()' ' '; done | grep -v ' Meeting\\(' | awk '{printf $2 ","}')" -events="$(egrep '^class .+DocEvent' doc/models.py | tr '()' ' ' | awk '{printf $2 ","}')" - -echo -e "proxy: $proxy\n" -echo -e "names: $names\n" -echo -e "legacy:$legacy\n" -echo -e "events:$events\n" - -exclude="--exclude=$proxy,$names,$legacy" - -export PYTHONPATH="$PWD/.." - -echo "Validating..." -./manage.py validate - -export PYTHONPATH=`dirname $PWD` -module=${PWD##*/} -export DJANGO_SETTINGS_MODULE=$module.settings -export graph -export title - -echo "Generate model graph" -graph="models-with-names-and-events" -title="New IETF Database schema" -${0%/*}/../ietf/manage.py graph_models --exclude="$proxy,$legacy" --title "$title" $apps > $graph.dot && dot -Tpng $graph.dot > $graph.png - -echo "Generate new model without names" -graph="models-with-names" -title="New IETF Database schema, without name tables" -modelviz.py --exclude="$proxy,$legacy,$names" --title "$title" $apps > $graph.dot && dot -Tpng $graph.dot > $graph.png - -echo "Generate new model without names and subevents" -graph="models" -title="New IETF Database schema, without name tables and subevents" -modelviz.py --exclude="$proxy,$legacy,$names,$events" --title "$title" $apps > $graph.dot && dot -Tpng $graph.dot > $graph.png diff --git a/bin/release-coverage b/bin/release-coverage deleted file mode 100755 index 22177c17a..000000000 --- a/bin/release-coverage +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -zcat release-coverage.json.gz | jq 'to_entries[] | [.value.time, .key, .value.code.coverage, .value.template.coverage, .value.url.coverage] ' 2>/dev/null | tr "\n][" " \n" | tr -d ' "Z' | tr ",T" " " | sort -n | cut -c 2- | sed -n '/2015-03-10/,$p' diff --git a/bin/update b/bin/update deleted file mode 100755 index bcb6e8b12..000000000 --- a/bin/update +++ /dev/null @@ -1,229 +0,0 @@ -#!/bin/bash - -version="0.34" -program=$(basename $0) - -NEW="" # If there are more than $NEW % new lines, skip update -OLD="" # If there are more than $OLD % deleted lines, skip update -FILE="" -verbose="" -silent="" - -# ---------------------------------------------------------------------- -function usage() { -cat < -EOF -exit -} - - -# ---------------------------------------------------------------------- -function note() { - if [ -n "$verbose" ]; then - echo -e "$program: $*" - fi -} - -# ---------------------------------------------------------------------- -function warn() { - [ "$QUIET" ] || echo -e "$program: $*" -} - -# ---------------------------------------------------------------------- -function err() { - echo -e "$program: $*" > /dev/stderr -} - -# ----------------------------------------------------------------------------- -function leave() { - errcode=$1; shift - if [ "$errcode" -ge "2" ]; then warn "$*"; else note "$*"; fi - if [ -f "$tempfile" ]; then rm $tempfile; fi - if [ -f "$difffile" ]; then rm $difffile; fi - if [ "$errcode" = "1" -a "$RESULT" = "0" ]; then exit 0; else exit $errcode; fi -} - -# ---------------------------------------------------------------------- -# Set up error trap -trap 'leave 127 "$program($LINENO): Command failed with error code $? while processing '$origfile'."' ERR - -# exit with a message if a command fails -set -e - -# ---------------------------------------------------------------------- -# Get any options -# - -# Default values -PAT="\$path\$base.%Y-%m-%d_%H%M" -RESULT="0" -QUIET="" - -# Based on the sample code in /usr/share/doc/util-linux/examples/parse.bash.gz -if [ "$(uname)" = "Linux" ]; then - GETOPT_RESULT=$(getopt -o bc:ef:hn:o:p:qrvV --long backup,maxchg:,empty,file:,help,maxnew:,maxold:,prefix:,report,quiet,verbose,version -n "$program" -- "$@") -else - GETOPT_RESULT=$(getopt bc:ef:hn:o:p:qrvV "$@") -fi - -if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi - -note "GETOPT_RESULT: $GETOPT_RESULT" -eval set -- "$GETOPT_RESULT" - -while true ; do - case "$1" in - -b|--backup) backup=1; shift ;; # Back up earlier versions by creating a backup file - -c|--maxchg) CHG="$2"; shift 2 ;; # Limit on percentage of changed lines - -e|--empty) empty=1; shift ;; # Permit the update to be empty (default: discard) - -f|--file) FILE="$2"; shift 2 ;; # Read input from FILE instead of standard input - -h|--help) usage; shift ;; # Show this text and exit - -n|--maxnew) NEW="$2"; shift 2 ;; # Limit on percentage of new (added) lines - -o|--maxold) OLD="$2"; shift 2 ;; # Limit on percentage of old (deleted) lines - -p|--pat*) PAT="$2"; shift 2 ;; # Backup name base ('$path$base.%Y%m%d_%H%M') - -q|--quiet) QUIET=1; shift;; # Be less verbose - -r|--result) RESULT=1; shift ;; # Return 1 if update not done - -v|--verbose) verbose=1; shift ;; # Be more verbose about what's happening - -V|--version) echo -e "$program\t$version"; exit;; # Show version and exit - --) shift ; break ;; - *) echo "$program: Internal error, inconsistent option specification." ; exit 1 ;; - esac -done - -if [ $CHG ]; then OLD=$CHG; NEW=$CHG; fi - -if [ $# -lt 1 ]; then echo -e "$program: Missing output filename\n"; usage; fi - -origfile=$1 -tempfile=$(mktemp) -difffile=$(mktemp) - -if [ -e "$origfile" ]; then - cp -p $origfile $tempfile # For ownership and permissions - cat $FILE > $tempfile - [ "$FILE" ] && touch -r $FILE $tempfile - # This won't work if we don't have sufficient privileges: - #chown --reference=$origfile $tempfile - #chmod --reference=$origfile $tempfile -else - cat $FILE > $origfile - [ "$FILE" ] && touch -r $FILE $tempfile - leave 0 "Created file '$origfile'" -fi - -origlen=$(wc -c < $origfile) -newlen=$(wc -c < $tempfile) - -if [ $origlen = 0 -a $newlen = 0 ]; then - rm $tempfile - leave 1 "New content is identical (and void) - not updating '$origfile'." -fi -if [ $newlen = 0 -a -z "$empty" ]; then - leave 1 "New content is void - not updating '$origfile'." -fi - -diff $origfile $tempfile > $difffile || [ $? -le 1 ] && true # suppress the '1' error code on differences -difflen=$(wc -l < $difffile) -if [ $difflen = 0 ]; then - leave 1 "New content is identical - not updating '$origfile'." -fi - -if [ "$OLD" -o "$NEW" ]; then - - if [ "$NEW" ]; then maxnew=$(( $origlen * $NEW / 100 )); fi - if [ "$OLD" ]; then maxdel=$(( $origlen * $OLD / 100 )); fi - - newcount=$(grep "^> " $difffile | wc -c) - outcount=$(grep "^< " $difffile | wc -c) - delcount=$(grep "^! " $difffile | wc -c) - delcount=$(( $outcount + $delcount )) - rm $difffile - - if [ "$OLD" ]; then - if [ "$delcount" -ge "$maxdel" ]; then - cp $tempfile $origfile.update - leave 2 "New content has too many removed lines ($delcount/$origlen)\n - not updating '$origfile'.\nNew content placed in '$origfile.update' instead" - fi - fi - if [ "$NEW" ]; then - if [ "$newcount" -ge "$maxnew" ]; then - cp $tempfile $origfile.update - leave 2 "New content has too many added lines ($newcount/$origlen)\n - not updating '$origfile'.\nNew content placed in '$origfile.update' instead" - fi - fi -fi - -if [ "$backup" ]; then - - path=${origfile%/*} - name=${origfile##*/} - base=${name%.*} - ext=${origfile##*.} - - if [ "$ext" = "$origfile" ]; then - ext="" - elif [ ! "${ext%/*}" = "$ext" ]; then - ext="" - else - ext=".$ext" - fi - - if [ "$path" = "$origfile" ]; then - path="" - else - path="$path/" - fi - - ver=1 - backfile=$(eval date +"$PAT") - backpath="${backfile%/*}" - if [ "$backpath" = "$backfile" ]; then - backpath="." - fi - if [ ! -d $backpath ]; then - if [ -e $backpath ]; then - leave 3 "The backup path '$backpath' exists but isn't a directory" - else - mkdir -p $backpath - fi - fi - while [ -e "$backfile,$ver$ext" ]; do - ver=$(( $ver+1 )) - done - note "Saving backup: $backfile,$ver$ext" - cp -p "$origfile" "$backfile,$ver$ext" - chmod -w "$backfile,$ver$ext" || true -fi - -if ! mv $tempfile $origfile; then cp -p $tempfile $origfile; fi -leave 0 "Updated file '$origfile'"