forked from Raku/modules.raku.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-modules.perl6.org
executable file
·52 lines (47 loc) · 1.4 KB
/
update-modules.perl6.org
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
. /home/modules.perl6.org/perl5/perlbrew/etc/bashrc
set -e -x
echo 'Starting module update'
date
cd ~/modules.perl6.org/
git fetch
before=$(git rev-parse HEAD)
git checkout origin/master
after=$(git rev-parse HEAD)
cp update-modules.perl6.org ../
DO_REBUILD=0
standard_db_file="modulesperl6.db"
db_file="$standard_db_file"
if [ "$before" != "$after" ]
then
echo "Got new commits"
if [[ `git log "$before"..."$after" --oneline` =~ '[REBUILD]' ]]; then
echo "Full database rebuild triggered"
DO_REBUILD=1
fi
if [[ `git log "$before"..."$after" --oneline` =~ '[NEWDB]' ]]; then
db_file=$(mktemp -u)
echo "New database creation requested; using $db_file as temp db"
fi
if [[ `git log "$before"..."$after" --oneline` =~ '[REAPP]'
&& "$db_file" == "$standard_db_file"
&& "$DO_REBUILD" != "1"
]]; then
echo "Restarting app before build"
set +e
hypnotoad bin/ModulesPerl6.pl
set -e
fi
fi
log_file=$(mktemp);
FULL_REBUILD=$DO_REBUILD perl bin/build-project-list.pl --restart-app \
--db-file="$db_file" > "$log_file" 2>&1 &&
cp "$log_file" public/update.log ||
{ echo 'Building failed'; rm $log_file; exit 1; }
if [ "$db_file" != "$standard_db_file" ]
then
echo "Moving temp db to regular place"
mv "$db_file" "$standard_db_file"
hypnotoad bin/ModulesPerl6.pl
fi
rm $log_file;