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