]> git.pld-linux.org Git - packages/chromium-browser.git/blame_incremental - get-source.sh
up to 43.0.2357.52
[packages/chromium-browser.git] / get-source.sh
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4# CHANNEL: any from CHANNELS_URL: stable, beta, dev
5CHANNEL=${1:-beta}
6
7CHANNELS_URL=http://omahaproxy.appspot.com/all
8PACKAGE_NAME=chromium-browser
9PROGRAM=${0##*/}
10WORK_DIR=$(cd "$(dirname "$0")"; pwd)
11LOCKFILE=$WORK_DIR/$PACKAGE_NAME-$CHANNEL.lock
12# Browse URL: http://gsdview.appspot.com/chromium-browser-official/
13OFFICIAL_URL=http://commondatastorage.googleapis.com/chromium-browser-official
14ALT_URL=https://github.com/zcbenz/chromium-source-tarball/releases/download
15DIST_DIR=$HOME/public_html/chromium-browser/src/$CHANNEL
16
17# skip package build if interactive
18tty -s && build_package=0
19
20VERSION=${2:-$(wget -qO - "$CHANNELS_URL?os=linux&channel=$CHANNEL" | awk -F, 'NR > 1{print $3}')}
21if [ -z "$VERSION" ]; then
22 echo >&2 "Can't figure out version for $CHANNEL"
23 exit 1
24fi
25
26# don't use .xz for beta channels, annoying if unpacks that slowly
27if [ "$CHANNEL" = "stable" ]; then
28 EXT=xz
29else
30 EXT=gz
31fi
32VERSION_FILE=$DIST_DIR/$PACKAGE_NAME-$VERSION.tar.$EXT
33
34if [ -e $VERSION_FILE -a -z "$FORCE" ]; then
35 # nothing to update
36 exit 0
37fi
38
39set -x
40
41(
42 flock -n 9 || { echo "$PROGRAM: locked"; exit 1; }
43
44 TMP_DIR=$(mktemp -d $WORK_DIR/$PACKAGE_NAME-$CHANNEL-$VERSION-_XXXXXX)
45 LOGFILE=$TMP_DIR/$PACKAGE_NAME-$VERSION.log
46
47 (
48 cd "$TMP_DIR"
49 srctarball=$PACKAGE_NAME-$VERSION.tar.xz
50 wget -nc -nv -O $srctarball "$OFFICIAL_URL/chromium-$VERSION.tar.xz" || :
51 wget -nc -nv -O $srctarball "$ALT_URL/$VERSION/chromium-$VERSION.tar.xz" || :
52 test -f $srctarball
53
54 # repackage cleaned up tarball
55 test -d $PACKAGE_NAME-$VERSION || {
56 tar xvf $srctarball
57 mv chromium-$VERSION $PACKAGE_NAME-$VERSION
58 }
59
60 ls -lh $srctarball
61 rm $srctarball
62
63 cd $PACKAGE_NAME-$VERSION
64 du -sh .
65
66 awk '/^#define/ && /(MAJOR|MINOR)_VERSION|BUILD_NUMBER|PATCH_LEVEL/ { printf("%s=%s\n", $2, $3) }' v8/src/version.cc | tee -a v8.sh
67
68 if [ "$CHANNEL" = "stable" ]; then
69 patch -p1 < $WORK_DIR/remove_bundled_libraries-stale.patch
70 sh -x $WORK_DIR/clean-source.sh emptydirs=1 v8=0 mesa=0 sqlite=0 ffmpeg=0 protobuf=0
71 patch -p1 -R < $WORK_DIR/remove_bundled_libraries-stale.patch
72 fi
73
74 # do not keep REMOVED*.txt in tarball. they are visible in .log anyway
75 rm -vf REMOVED-*.txt
76
77 du -sh .
78
79 # add LASTCHANGE info, take "branch_revision" item
80 svnver=$(wget -qO - "$CHANNELS_URL?os=linux&channel=$CHANNEL" | awk -F, 'NR > 1{print $8}')
81 echo "$svnver" > build/LASTCHANGE.in
82
83 cd ..
84
85 tarball=$PACKAGE_NAME-$VERSION.tar.$EXT
86 # xz -9 OOM's on carme
87 XZ_OPT=-e8 tar -caf $tarball $PACKAGE_NAME-$VERSION
88 ls -lh $tarball
89
90 rm -rf $PACKAGE_NAME-$VERSION
91
92 chmod 644 $tarball
93 mv $tarball $DIST_DIR
94
95 ) > $LOGFILE 2>&1
96
97 chmod 644 $LOGFILE
98 mv $LOGFILE $DIST_DIR
99
100 rm -rf $TMP_DIR
101
102 # create diff patches
103 BASEVER=${VERSION%.*}.0
104 if [ -e $DIST_DIR/$PACKAGE_NAME-$BASEVER.tar.$EXT ]; then
105 base=$(readlink -f $DIST_DIR/$PACKAGE_NAME-$BASEVER.tar.$EXT)
106 current=$DIST_DIR/$PACKAGE_NAME-$VERSION.tar.$EXT
107 if [ "$(basename $base)" != "$(basename $current)" ]; then
108 sh -x $WORK_DIR/make-diff-patch.sh $base $current
109 chmod 644 $PACKAGE_NAME-$VERSION.patch.xz
110 mv $PACKAGE_NAME-$VERSION.patch.xz $DIST_DIR
111 # for beta and dev channels, update the diff pointer
112 if [ "$CHANNEL" != "stable" ]; then
113 ln -sf $PACKAGE_NAME-$VERSION.tar.$EXT $DIST_DIR/$PACKAGE_NAME-$BASEVER.tar.$EXT
114 fi
115 fi
116 fi
117
118 # try updating spec and build it as well
119 if [ -x $WORK_DIR/update-source.sh ]; then
120 build_package=${build_package-1} \
121 publish_packages=${publish_packages-1} \
122 sh -x $WORK_DIR/update-source.sh
123 fi
124
125 rm $LOCKFILE
126) 9>$LOCKFILE
This page took 0.036515 seconds and 4 git commands to generate.