File: rebuild.sh

package info (click to toggle)
numpy 1%3A1.24.2-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 44,720 kB
  • sloc: ansic: 188,931; python: 156,261; asm: 111,405; javascript: 32,693; cpp: 14,210; f90: 755; sh: 638; fortran: 478; makefile: 292; sed: 140; perl: 34
file content (64 lines) | stat: -rwxr-xr-x 1,494 bytes parent folder | download | duplicates (6)
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
#!/bin/sh
set -e -u -x

DOWNLOAD_NAME=2.7.1.tar.gz
DOWNLOAD_FILE="build/download/$DOWNLOAD_NAME"
DOWNLOAD_URL=https://github.com/mathjax/MathJax/archive/$DOWNLOAD_NAME
DOWNLOAD_HASH="2bb4c0c6f326dd1964ecad1d302d2f9f4a3eb4364f89a30d5e3b4b3069597169"
PACKAGE_DIR=MathJax-2.7.1

download() {
    install -d build/download
    if ! test -f "$DOWNLOAD_FILE"; then
	wget -c -O "$DOWNLOAD_FILE" "$DOWNLOAD_URL"
    fi
    HASH=`sha256sum "$DOWNLOAD_FILE"`
    if ! test "$HASH" = "$DOWNLOAD_HASH  $DOWNLOAD_FILE"; then
        echo "Invalid checksum: $HASH"
	exit 1
    fi
    return 0
}

npm_install() {
    npm install --save-dev
}

unpack_patch() {
    rm -rf build/unpack
    install -d build/unpack
    (cd build/unpack && tar xz) < "$DOWNLOAD_FILE"
    cp Gruntfile.js "build/unpack/$PACKAGE_DIR"
    ln -s ../../../node_modules "build/unpack/$PACKAGE_DIR/node_modules"
    (cd "build/unpack/$PACKAGE_DIR" && \
	./node_modules/grunt-cli/bin/grunt TeX_SVG)
    rm -f "build/unpack/$PACKAGE_DIR/node_modules"
}

replace() {
    for f in LICENSE; do
	rm -rf "$f"
	mv "build/unpack/$PACKAGE_DIR/$f" "$f"
    done
    for f in extensions jax MathJax.js; do
	rm -rf "$f"
	mv "build/unpack/$PACKAGE_DIR/unpacked/$f" "$f"
    done
}

git_commit() {
    git add LICENSE extensions jax MathJax.js
    git add -u extensions jax
    git commit -m "MAINT: rebuild MathJax

    Base package: $DOWNLOAD_HASH  $DOWNLOAD_NAME"
}

download
npm_install
unpack_patch
replace
git_commit

echo "Rebuild successful!"