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