Debian Codegraph @

doc/corelib/make-library-index

raw symbols ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 #!/usr/bin/env bash
2
3 # Instantiate links to library files in index template
4
5 set -e
6
7 FILE=$1
8 HIDDEN=$2
9 tmp=$(mktemp)
10 tmp2=$(mktemp)
11
12 cp -f "$FILE.template" "$tmp"
13 echo -n "Building file index-list.prehtml... "
14
15 LIBDIRS=$(find theories -type d ! -name .coq-native)
16
17 missing=
18
19 for k in $LIBDIRS; do
20 d=$(basename "$k")
21 p=$(echo "$k" | sed 's:^[^/]*/::' | sed 's:/:.:g')
22 for j in "$k"/*.v; do
23 if ! [ -e "$j" ]; then break; fi
24 b=$(basename "$j" .v)
25
26 a=0; grep -q "$k/$b.v" "$tmp" || a=$?
27 h=0; grep -q "$k/$b.v" "$HIDDEN" || h=$?
28 if [ $a = 0 ]; then
29 if [ $h = 0 ]; then
30 echo "Error: $FILE and $HIDDEN both mention $k/$b.v" >&2
31 exit 1
32 else
33 sed -e "s:$k/$b.v:<a href=\"$p.$b.html\">$b</a>:g" "$tmp" > "$tmp2"
34 mv -f "$tmp2" "$tmp"
35 fi
36 else
37 if [ $h = 0 ]; then
38 # Skipping file from the index
39 :
40 else
41 missing="$missing $k/$b.v"
42 fi
43 fi
44 done
45 sed -e "s/#$d#//" "$tmp" > "$tmp2"
46 mv -f "$tmp2" "$tmp"
47 done
48
49 if [ "$missing" ]; then
50 echo "Error: none of $FILE and $HIDDEN mention$missing" >&2
51 exit 1
52 fi
53
54 if a=$(grep theories "$tmp"); then echo Error: extra files: >&2; echo "$a" >&2; exit 1; fi
55 mv "$tmp" "$FILE"
56 echo Done