aboutsummaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-05-13 17:50:06 +0200
committerJochen Topf <jochen@topf.org>2014-05-13 17:50:06 +0200
commitb7bebb4060149235ec29beb6ac9c076f763ebdef (patch)
treec31d754f57b033fc66014c872f04074432a252ce /sources
parent421e6cdb19833e9d335ee48c8067b9a8bb4b1aec (diff)
downloadtaginfo-b7bebb4060149235ec29beb6ac9c076f763ebdef.tar
taginfo-b7bebb4060149235ec29beb6ac9c076f763ebdef.tar.gz
Fix selection db path and general cleanups in update scripts.
Diffstat (limited to 'sources')
-rwxr-xr-xsources/db/update.sh7
-rwxr-xr-xsources/master/update.sh44
2 files changed, 23 insertions, 28 deletions
diff --git a/sources/db/update.sh b/sources/db/update.sh
index 24d430b..a189c96 100755
--- a/sources/db/update.sh
+++ b/sources/db/update.sh
@@ -27,7 +27,7 @@ fi
echo "`$DATECMD` Start db..."
DATABASE=$DIR/taginfo-db.db
-SELECTION_DB=$DIR/selection.db
+SELECTION_DB=$DIR/../selection.db
rm -f $DATABASE
@@ -46,10 +46,7 @@ width=`../../bin/taginfo-config.rb geodistribution.width`
height=`../../bin/taginfo-config.rb geodistribution.height`
min_tag_combination_count=`../../bin/taginfo-config.rb sources.master.min_tag_combination_count 1000`
-TAGSTATS=`../../bin/taginfo-config.rb sources.db.tagstats`
-if [ "x" = "x$TAGSTATS" ]; then
- TAGSTATS="./tagstats"
-fi
+TAGSTATS=`../../bin/taginfo-config.rb sources.db.tagstats ../../tagstats/tagstats`
if [ -f $SELECTION_DB ]; then
OPEN_SELECTION_DB="--selection-db=$SELECTION_DB"
diff --git a/sources/master/update.sh b/sources/master/update.sh
index 9fc5d63..d262ba1 100755
--- a/sources/master/update.sh
+++ b/sources/master/update.sh
@@ -18,47 +18,45 @@ fi
echo "`$DATECMD` Start master..."
-EXEC_RUBY="$TAGINFO_RUBY"
-if [ "x$EXEC_RUBY" = "x" ]; then
- EXEC_RUBY=ruby
-fi
-echo "Running with ruby set as '${EXEC_RUBY}'"
-
-DATABASE=$DIR/taginfo-master.db
-HISTORYDB=$DIR/taginfo-history.db
+MASTER_DB=$DIR/taginfo-master.db
+HISTORY_DB=$DIR/taginfo-history.db
SELECTION_DB=$DIR/selection.db
echo "`$DATECMD` Create search database..."
rm -f $DIR/taginfo-search.db
-$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" search.sql | sqlite3 $DIR/taginfo-search.db
-
-rm -f $DATABASE
-rm -f $SELECTION_DB
+m4 -D __DIR__=$DIR search.sql | sqlite3 $DIR/taginfo-search.db
echo "`$DATECMD` Create master database..."
+
+rm -f $MASTER_DB
+sqlite3 $MASTER_DB <languages.sql
+m4 -D __DIR__=$DIR master.sql | sqlite3 $MASTER_DB
+
+echo "`$DATECMD` Create selection database..."
+
min_count_tags=`../../bin/taginfo-config.rb sources.master.min_count_tags 10000`
min_count_for_map=`../../bin/taginfo-config.rb sources.master.min_count_for_map 1000`
min_count_relations_per_type=`../../bin/taginfo-config.rb sources.master.min_count_relations_per_type 100`
-sqlite3 $DATABASE <languages.sql
-$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" master.sql | sqlite3 $DATABASE
-$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" interesting_tags.sql | $EXEC_RUBY -pe "\$_.sub!(/__MIN_COUNT_TAGS__/, '$min_count_tags')" | sqlite3 $DATABASE
-$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" frequent_tags.sql | $EXEC_RUBY -pe "\$_.sub!(/__MIN_COUNT_FOR_MAP__/, '$min_count_for_map')" | sqlite3 $DATABASE
-$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" interesting_relation_types.sql | $EXEC_RUBY -pe "\$_.sub!(/__MIN_COUNT_RELATIONS_PER_TYPE__/, '$min_count_relations_per_type')" | sqlite3 $DATABASE
-
-echo "`$DATECMD` Create selection database..."
+rm -f $SELECTION_DB
m4 -D __DIR__=$DIR \
-D __MIN_COUNT_FOR_MAP__=$min_count_for_map \
-D __MIN_COUNT_TAGS__=$min_count_tags \
-D __MIN_COUNT_RELATIONS_PER_TYPE__=$min_count_relations_per_type \
selection.sql | sqlite3 $SELECTION_DB
-echo "`$DATECMD` Updating history database..."
-if [ ! -e $HISTORYDB ]; then
- sqlite3 $HISTORYDB < history_init.sql
+echo "`$DATECMD` Update history database..."
+
+if [ ! -e $HISTORY_DB ]; then
+ sqlite3 $HISTORY_DB < history_init.sql
fi
-$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" history_update.sql | sqlite3 $HISTORYDB
+
+m4 -D __DIR__=$DIR history_update.sql | sqlite3 $HISTORY_DB
+
+# Remove old *.lst files. This is only temporary and can be removed once
+# everybody has the new version which doesn't create these files any more
+rm -f frequent_tags.lst interesting_relation_types.lst interesting_tags.lst
echo "`$DATECMD` Done master."