- Up to 8.0.553.0 r62376
[packages/chromium-browser-bin.git] / update-source.sh
1 #!/bin/sh
2 # Usage:
3 # ./update-source.sh [spec|rev]
4 #     Download latest binary tarball based on latest release from
5 #     buildbot, current version referenced in spec file, or custom
6 #     version number.
7 set -e
8 dropin=
9
10 # Work in package dir
11 dir=$(dirname "$0")
12 cd "$dir"
13
14 if [ "$1" == "spec" ]; then
15         rev=$(grep -e "^%define.*svnrev" chromium-browser-bin.spec | cut -f4)
16         echo "Using $rev from spec file"
17 elif [ "$1" ]; then
18         rev=$1
19         echo "Using $rev..."
20 else
21         echo "Fetching latest revno... "
22         rev=$(wget -q -O - http://build.chromium.org/buildbot/continuous/linux/LATEST/REVISION)
23         rev64=$(wget -q -O - http://build.chromium.org/buildbot/continuous/linux64/LATEST/REVISION)
24         # be sure that we use same rev on both arch
25         if [ "$rev" != "$rev64" ]; then
26                 echo "Current 32bit build ($rev) does not match 64bit build ($rev64)"
27                 echo "The upstream buildbot probably failed."
28                 if [ "$rev" -lt "$rev64" ]; then
29                         echo "Using latest 32bit revision..."
30                         rev64=$rev
31                 else
32                         echo "Using latest 64bit revision..."
33                         rev=$rev64
34                 fi
35         fi
36         echo "$rev"
37         # TODO: use release branches instead of trunk. Current release can be looked up like this:
38         #linuxdev=$(wget -q -O - http://omahaproxy.appspot.com | grep '^linux,dev' | cut -d, -f3)
39 fi
40
41 if [ ! -f chromium-browser32-r$rev.zip ]; then
42         wget http://build.chromium.org/buildbot/snapshots/chromium-rel-linux/$rev/chrome-linux.zip -c -O chromium-browser32-r$rev.zip
43         upload_32="chromium-browser32-r$rev.zip"
44 fi
45 if [ ! -f chromium-browser64-r$rev.zip ]; then
46         wget http://build.chromium.org/buildbot/snapshots/chromium-rel-linux-64/$rev/chrome-linux.zip -c -O chromium-browser64-r$rev.zip
47         upload_64="chromium-browser64-r$rev.zip"
48 fi
49
50 if [ "$dropin" ]; then
51         if [ -x ./dropin ]; then
52                 dropin=./dropin
53         elif [ -x ../dropin ]; then
54                 dropin=../dropin
55         fi
56
57         if [ "$upload_32" -o "$upload_64" ]; then
58                 echo "Uploading to dropin. ^C to abort"
59                 ../dropin $upload_32 $upload_64
60         fi
61 fi
62
63 specfile=chromium-browser-bin.spec
64 oldrev=$(awk '/^%define[        ]+svnrev[       ]+/{print $NF}' $specfile)
65 if [ "$oldrev" != "$rev" ]; then
66         # revno => VERSION hint by Caleb Maclennan <caleb#alerque.com>
67         wget -q -O VERSION.sh http://src.chromium.org/viewvc/chrome/trunk/src/chrome/VERSION?revision=$rev
68         if grep -Ev '^(MAJOR|MINOR|BUILD|PATCH)=[0-9]+$' VERSION.sh >&2; then
69                 echo >&2 "I refuse to execute garbled file for security concerns"
70                 exit 1
71         fi
72         . ./VERSION.sh
73         version=$MAJOR.$MINOR.$BUILD.$PATCH
74
75         echo "Updating $specfile for $version r$rev"
76         sed -i -e "
77                 s/^\(%define[ \t]\+svnrev[ \t]\+\)[0-9]\+\$/\1$rev/
78                 s/^\(Version:[ \t]\+\)[.0-9]\+\$/\1$version/
79         " $specfile
80         ../builder -ncs -5 $specfile
81 fi
This page took 0.066713 seconds and 3 git commands to generate.