1#!/bin/bash
2
3echo 'This script is not compatible with the current version of CHART-EPSSG and should not be run'
4exit -1
5
6set -e
7
8banner() {
9 echo "=================="
10 echo -e $1
11 echo "=================="
12}
13
14
15fix_TM_xml() { cat <<'EOF'
16from pathlib import Path
17import re
18
19tm_file = Path("./chartepssg/db/ts/TM.xml")
20regex = r".*name.*(AST00178|CST01557).*name.*"
21with tm_file.open("r") as f:
22 for line in f:
23 if re.match(regex, line):
24 print(line, end="")
25 for _ in range(2):
26 print(next(f), end="")
27 next(f)
28 print(" <!-- HACK applied here -->")
29 print(" <dimensions>1</dimensions>")
30 continue
31 print(line, end="")
32EOF
33}
34
35mkdir -p chartepssg/db/ts
36banner 'python bin/chartepssg srdb --gen-param1-param2-xml'
37python bin/chartepssg srdb --gen-param1-param2-xml
38banner 'python bin/chartepssg srdb --gen-table-xml chartepssg/db/ts/TM.xml --storage-table TM_STORE'
39python bin/chartepssg srdb --gen-table-xml chartepssg/db/ts/TM.xml --storage-table TM_STORE
40banner 'python bin/chartepssg srdb --gen-table-xml chartepssg/db/ts/TC.xml --tc --storage-table TC_STORE'
41python bin/chartepssg srdb --gen-table-xml chartepssg/db/ts/TC.xml --tc --storage-table TC_STORE
42banner 'python bin/chartepssg srdb --gen-packets-xml -s epssga'
43python bin/chartepssg srdb --gen-packets-xml -s epssga
44banner 'python bin/chartepssg srdb --gen-packets-xml -s epssga --tc'
45python bin/chartepssg srdb --gen-packets-xml -s epssga --tc
46banner 'python bin/chartepssg srdb --gen-cal-xml -s epssga'
47python bin/chartepssg srdb --gen-cal-xml -s epssga
48banner 'python bin/chartepssg srdb --gen-cal-xml -s epssga --tc'
49python bin/chartepssg srdb --gen-cal-xml -s epssga --tc
50banner 'python bin/chartepssg srdb --gen-limits-xml -s epssga'
51python bin/chartepssg srdb --gen-limits-xml -s epssga
52banner 'Applying Hack to make the current CCSDS ingestion work with different dimensions of the same parameter\nFIXING: dimesions of AST00178 and CST01557'
53fix_TM_xml | python3 > TM2.xml
54mv TM2.xml chartepssg/db/ts/TM.xml