-
Notifications
You must be signed in to change notification settings - Fork 36
/
.release
executable file
·84 lines (69 loc) · 2.86 KB
/
.release
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# This script is intended to be run by the release-gap-package script which is
# part of the the ReleaseTools for GAP:
#
# https://github.com/gap-system/ReleaseTools/
set -e
# ensure we are in the same directory as this script
cd "$(dirname "${BASH_SOURCE[0]}")"
notice_it() {
printf '\033[93m%s\033[0m\n' "$*"
}
error() {
printf '\033[31mERROR: %s\033[0m\n' "$*"
exit 1
}
# TODO: This function can be deleted once the code to compile the manual is gone
run_gap() {
gap_output=$( \
(echo 'OnBreak:=function() Print("FATAL ERROR"); FORCE_QUIT_GAP(1); end;;' ; cat - ; echo ; echo "FORCE_QUIT_GAP(0);") \
| $GAP -A -q -b 2>&1 \
| tr -d '\r' )
mkdir -p "$TMP_DIR"
echo "$gap_output" > "$TMP_DIR/gap-error.log"
if echo "$gap_output" | grep -q '\(Error\|FATAL ERROR\|Syntax \)' ; then
error "there was an error running GAP, see $TMP_DIR/gap-error.log"
fi
}
notice_it "Running Semigroups package .release script"
# Delete unnecessary files
notice_it "Deleting additional unnecessary files"
rm -f .covignore .gaplint.yml
rm -rf ci etc
# download libsemigroups
if [ -d "libsemigroups" ] && [ "$(ls -A libsemigroups)" ]; then
error "the libsemigroups directory exists and is non-empty"
fi
./prerequisites.sh
# TODO: in the newest commits of ReleaseTools, the manual is now built by the
# time that this script is called, and soon release-gap-package will also
# perform the check for non resolved references. Once this is the case, we will
# be able to get rid of the compilation of the manual in this script.
notice_it "Building Semigroups package documentation for archives (using makedoc.g)"
run_gap <<GAPInput
LogTo("makedoc.log");
if not IsPackageMarkedForLoading("$PKG", "") then
SetPackagePath("$PKG", ".");
fi;
PushOptions(rec(relativePath:="../../.."));
Read("makedoc.g");
GAPInput
rm -f doc/*.tex
rm -f doc/*.aux doc/*.bbl doc/*.blg doc/*.brf doc/*.idx doc/*.ilg doc/*.ind doc/*.log doc/*.out doc/*.pnr doc/*.tst
! grep -E "WARNING: non resolved reference" makedoc.log
rm -f makedoc.log
# Note: Long term, this functionality may become a standard part of ReleaseTools
notice_it "Fixing the links in the documentation"
for f in ./*/*.htm* ; do
sed 's;href="[^"]*digraphs[^"]*/doc/;href="https://digraphs.github.io/Digraphs/doc/;gi' "$f" > "$f.bak"
mv "$f.bak" "$f"
sed 's;href="[^"]*io[^"]*/doc/;href="https://gap-packages.github.io/io/doc/;gi' "$f" > "$f.bak"
mv "$f.bak" "$f"
sed 's;href="[^"]*smallsemi[^"]*/doc/;href="https://gap-packages.github.io/smallsemi/doc/;gi' "$f" > "$f.bak"
mv "$f.bak" "$f"
sed 's;href="[^"]*images[^"]*/doc/;href="https://gap-packages.github.io/images/doc/;gi' "$f" > "$f.bak"
mv "$f.bak" "$f"
sed 's;href="[^"]*GAPDoc[^"]*/doc/;href="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc/doc/;gi' "$f" > "$f.bak"
mv "$f.bak" "$f"
done
notice_it "Finished running Semigroups package .release script!!!"