]> git.pld-linux.org Git - packages/crossnacl-gcc.git/blob - get-source.sh
use bare git repo
[packages/crossnacl-gcc.git] / get-source.sh
1 #!/bin/sh
2 # Make snapshot of nacl-binutils
3 # Author: Elan Ruusamäe <glen@pld-linux.org>
4 set -e
5
6 # Generated from git
7 # git clone http://git.chromium.org/native_client/nacl-gcc.git
8 # (Checkout ID taken from chromium-15.0.874.106/native_client/tools/REVISIONS)
9 # cd nacl-gcc
10 # git checkout cff9ac884908ba53ae16149e7c7d19c336aa4895
11 # cd ..
12 # For gcc version, echo gcc/BASE-VER
13 # mv nacl-gcc nacl-gcc-4.4.3-gitcff9ac88
14 # tar cfj nacl-gcc-4.4.3-gitcff9ac88.tar.bz2 nacl-gcc-4.4.3-gitcff9ac88
15
16 package=nacl-gcc
17 repo_url=http://git.chromium.org/native_client/$package.git
18 nacl_trunk=http://src.chromium.org/native_client/trunk
19 omahaproxy_url=https://omahaproxy.appspot.com
20 specfile=crossnacl-gcc.spec
21
22 # if you get errors that sha1 hash not found, try increasing depth
23 # fatal: Path 'gcc/BASE-VER' does not exist in 'c69a5b7252d2f073d0f526800e4fca3b63cd1fab'
24 depth=5
25
26 chrome_channel=${1:-stable}
27 chrome_version=$(curl -s "$omahaproxy_url/?os=linux&channel=$chrome_channel" | awk -F, 'NR > 1{print $3}')
28 test -n "$chrome_version"
29 chrome_revision=$(curl -s $omahaproxy_url/revision?version=$chrome_version)
30 test -n "$chrome_revision"
31 chrome_branch=$(IFS=.; set -- $chrome_version; echo $3)
32
33 test -e DEPS.py || svn cat http://src.chromium.org/chrome/branches/$chrome_branch/src/DEPS@$chrome_revision > DEPS.py
34 nacl_revision=$(awk -F'"' '/nacl_revision.:/{print $4}' DEPS.py)
35 test -n "$nacl_revision"
36
37 export GIT_DIR=$package.git
38
39 if [ ! -d $GIT_DIR ]; then
40         install -d $GIT_DIR
41         git init --bare
42         git remote add origin $repo_url
43         git fetch --depth $depth origin refs/heads/master:refs/remotes/origin/master
44 else
45         git fetch origin refs/heads/master:refs/remotes/origin/master
46 fi
47
48 # get src/native_client/tools/REVISIONS directly from svn
49 test -n "$nacl_revision"
50 test -e NACL_REVISIONS.sh || svn cat $nacl_trunk/src/native_client/tools/REVISIONS@$nacl_revision > NACL_REVISIONS.sh
51
52 if grep -Ev '^(#|(LINUX_HEADERS_FOR_NACL|NACL_(BINUTILS|GCC|GDB|GLIBC|NEWLIB))_COMMIT=[0-9a-f]+$|)' NACL_REVISIONS.sh >&2; then
53         echo >&2 "I refuse to execute grabbed file for security concerns"
54         exit 1
55 fi
56 . ./NACL_REVISIONS.sh
57
58 githash=$NACL_GCC_COMMIT
59 version=$(git show $githash:gcc/BASE-VER)
60 shorthash=$(git rev-parse --short $githash)
61 prefix=$package-$version-git$shorthash
62
63 if [ -f $prefix.tar.xz ]; then
64         echo "Tarball $prefix.tar.xz already exists at $shorthash"
65         rm -f NACL_REVISIONS.sh DEPS.py
66         exit 0
67 fi
68
69 git archive $githash --prefix $prefix/ > $prefix.tar
70 xz -9 $prefix.tar
71
72 ../dropin $prefix.tar.xz
73
74 rm -f NACL_REVISIONS.sh DEPS.py
This page took 0.075984 seconds and 3 git commands to generate.