File: get-orig-source.sh

package info (click to toggle)
mathjax-docs 2.7%2B20171212-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,100 kB
  • sloc: javascript: 28; sh: 22; python: 19; makefile: 8
file content (34 lines) | stat: -rw-r--r-- 981 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# Get the DFSG-compatible source tarball from GitHub
# Author: 2014 Dmitry Shachnev

set -e

export TAR_OPTIONS='--owner root --group root --mode a+rX'
export GZIP_OPTIONS='-9n'

BRANCH="master"
MJ_COMMITS="https://github.com/mathjax/mathjax-docs/commits/$BRANCH"
MJ_TARBALL="https://github.com/mathjax/mathjax-docs/archive/$BRANCH.tar.gz"
DATE=`wget "$MJ_COMMITS" -qO- | grep -P '\d{4}-\d\d-\d\d' -o | sed 's/-//g' | head -n1`

pwd=$(pwd)

cd "$(dirname "$0")/../"
tmpdir=$(mktemp -t -d get-orig-source.XXXXXX)
cd "$tmpdir"

wget -nv "$MJ_TARBALL"
tar xzf "$BRANCH.tar.gz"
rm "$BRANCH.tar.gz"

BASEVERSION=`grep ^version "MathJax-docs-$BRANCH/conf.py" | grep '[0-9.]*' -o`
VERSION="$BASEVERSION+$DATE"
FILENAME="mathjax-docs_$VERSION.orig.tar.gz"

mv "MathJax-docs-$BRANCH" "mathjax-docs-$VERSION"
GZIP=-n tar --sort=name --mode=u=rwX,go=rX -czf "$pwd/$FILENAME" "mathjax-docs-$VERSION"
cd ..
rm -Rf "$tmpdir"

echo "Successfully created upstream tarball as $FILENAME."