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