Skip to content

Commit 032705f

Browse files
committed
Moved some utility command-line scripts from test/ to bin/. Added bin/graph-models.
- Legacy-Id: 5450
1 parent 9fe4ba8 commit 032705f

6 files changed

Lines changed: 77 additions & 0 deletions

File tree

File renamed without changes.

bin/graph-models

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
#
3+
# Copyright The IETF Trust 2007, All Rights Reserved
4+
#
5+
# Requires modelviz.py from
6+
# http://code.djangoproject.com/wiki/DjangoGraphviz
7+
#
8+
PYTHONPATH=`dirname $PWD`
9+
export PYTHONPATH
10+
module=${PWD##*/}
11+
DJANGO_SETTINGS_MODULE=$module.settings
12+
export DJANGO_SETTINGS_MODULE
13+
for d in *
14+
do
15+
if grep models.Model $d/models.py > /dev/null 2>&1
16+
then
17+
models="$models $d"
18+
fi
19+
done
20+
modelviz.py $* $models > models.dot
21+
dot -Tpng models.dot
File renamed without changes.

test/mkdevbranch renamed to bin/mkdevbranch

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ for n in $(seq $((num-5)) $num); do
5656
trac-admin /www/tools.ietf.org/tools/ietfdb wiki export IETF${n}SprintSignUp \
5757
| egrep "^\|\|" | tail -n +2 | python -c '
5858
import sys, re
59+
altlogin = {
60+
"ietf@augustcellars.com": "schaad",
61+
}
5962
for line in sys.stdin:
6063
blank, name, email, rest = line.strip().split("||", 3)
6164
login, dummy = re.split("[@.]", email, 1)
65+
if email in altlogin:
66+
login = altlogin[email]
6267
print "\t".join((login.strip().lower(), email.strip().lower(), name.strip())) ' \
6368
| update $progdir/sprint$n.txt
6469
done

bin/mkdiagram

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
# assume we're in bin/, sibling to ietf/
4+
5+
cd ${0%/*}/../ietf || { echo "CD to ietf directory failed, bailing out"; exit; }
6+
7+
trap 'echo "$program($LINENO): Command failed with error code $? ($0 $*)"; exit 1' ERR
8+
9+
if [ "$*" ]; then apps="$@"; graph="${1%.*}"; else apps=$(ls */models.py | sed 's!/models.py!!'); graph="models"; fi
10+
11+
newapps="doc group meeting message person name"
12+
legacyapps="announcements idindex idrfc idtracker iesg ietfauth ietfworkflows ipr liaisons mailinglists proceedings redirects submit wgchairs wgcharter wginfo"
13+
14+
proxy="$(grep ^class */proxy.py | tr '()' ' ' | awk '{printf $2 ","}')"
15+
names="$(grep ^class name/models.py | tr '()' ' ' | awk '{printf $2 ","}')"
16+
legacy="$(for app in $legacyapps; do grep ^class $app/models.py | tr '()' ' '; done | grep -v ' Meeting\\(' | awk '{printf $2 ","}')"
17+
events="$(egrep '^class .+DocEvent' doc/models.py | tr '()' ' ' | awk '{printf $2 ","}')"
18+
19+
echo -e "proxy: $proxy\n"
20+
echo -e "names: $names\n"
21+
echo -e "legacy:$legacy\n"
22+
echo -e "events:$events\n"
23+
24+
exclude="--exclude=$proxy,$names,$legacy"
25+
26+
export PYTHONPATH="$PWD/.."
27+
28+
echo "Validating..."
29+
./manage.py validate
30+
31+
echo "Dump tables"
32+
./manage.py sql $apps > tables.sql
33+
export PYTHONPATH=`dirname $PWD`
34+
module=${PWD##*/}
35+
export DJANGO_SETTINGS_MODULE=$module.settings
36+
export graph
37+
export title
38+
echo "Generate model graph"
39+
graph="models-with-names-and-events"
40+
title="New IETF Database schema"
41+
modelviz.py --exclude="$proxy,$legacy" --title "$title" $apps > $graph.dot && dot -Tpng $graph.dot > $graph.png
42+
43+
echo "Generate new model without names"
44+
graph="models-with-names"
45+
title="New IETF Database schema, without name tables"
46+
modelviz.py --exclude="$proxy,$legacy,$names" --title "$title" $apps > $graph.dot && dot -Tpng $graph.dot > $graph.png
47+
48+
echo "Generate new model without names and subevents"
49+
graph="models"
50+
title="New IETF Database schema, without name tables and subevents"
51+
modelviz.py --exclude="$proxy,$legacy,$names,$events" --title "$title" $apps > $graph.dot && dot -Tpng $graph.dot > $graph.png
File renamed without changes.

0 commit comments

Comments
 (0)