File: get-orig-source.sh

package info (click to toggle)
mathjax-docs 2.4%2B20140903-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 916 kB
  • ctags: 14
  • sloc: sh: 21; python: 19; makefile: 8
file content (32 lines) | stat: -rw-r--r-- 934 bytes parent folder | download
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
#!/bin/sh
# Get the DFSG-compatible source tarball from GitHub
# Author: 2014 Dmitry Shachnev

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"
tar -czf "$pwd/$FILENAME" "mathjax-docs-$VERSION"
cd ..
rm -Rf "$tmpdir"

echo "Successfully created upstream tarball as $FILENAME."