]> git.pld-linux.org Git - packages/google-chrome.git/blob - update-source.sh
- Up to 41.0.2272.89. Archives sent to droppin.
[packages/google-chrome.git] / update-source.sh
1 #!/bin/sh
2
3 if [ "$1" = "-k" ]; then
4         cache=yes
5         shift
6 else
7         cache=no
8 fi
9
10 # product name
11 product=chrome
12 # name
13 name=google-$product
14 # this package
15 specfile=$name.spec
16 # arch to check package. irrelevant for actual arch
17 arch=x86_64
18 # branch: stable, beta, unstable. default: stable
19 branch=${1:-stable}
20
21 case "${branch}" in
22         stable|beta|unstable)
23                 ;;
24         *)
25                 echo "$0: Unknown branch: $branch. Supported branches: stable, beta, unstable." >&2
26                 exit 1
27                 ;;
28 esac
29
30 sourceurl=http://dl.google.com/linux/$product/rpm/stable/$arch
31
32 set -e
33
34 echo -n "Fetching latest version... "
35 t=$(mktemp)
36
37 # poldek is buggy, see https://bugs.launchpad.net/poldek/+bug/1026762
38 #poldek -q --st=metadata --source "$sourceurl/" --update
39 #poldek -q --skip-installed --st=metadata --source "$sourceurl/" --cmd "ls google-chrome-$branch" > $t
40
41 repodata=primary-$branch-$(date +%Y%m%d).xml
42 [ "$cache" = "yes" ] || rm -f "$repodata"
43 test -e $repodata || {
44         wget -c $sourceurl/repodata/primary.xml.gz -O $repodata.gz
45         gzip -dc $repodata.gz > $repodata || test -s $repodata
46 }
47 perl -ne 'm{<name>google-'$product-$branch'</name>} and m{<version epoch="0" ver="([\d.]+)" rel="(\d+)"/>} and print "$1 $2"' > $t < $repodata
48
49 set -- $(sed -re "s,^.+-([^-]+)-([^-]+).$arch$,\1 \2," $t)
50
51 ver=$1
52 rev=$2
53
54 # check google-chrome ver only
55 oldrev=$(awk '/^%define[        ]+svnrev[       ]+/{print $NF}' $specfile)
56 oldver=$(awk '/^Version:[ \t]+/{print $NF; exit}' $specfile)
57 if [ "$oldrev" = "$rev" -a "$oldver" = "$ver" ]; then
58         echo "Already up to date (google-chrome/$ver-$rev)"
59         exit 0
60 fi
61
62 # extract flash version
63 rpm=$name-$branch-$ver-$rev.$arch.rpm
64 manifest=manifest-$ver.json
65 test -e $rpm || wget -c $sourceurl/$rpm
66 test -e $manifest || {
67         echo ./opt/google/chrome*/PepperFlash/manifest.json > $t
68         rpm2cpio $rpm | cpio -i -E $t --to-stdout > manifest-$ver.json
69         if [ ! -s manifest-$ver.json ]; then
70                 echo "Failed to extract flash version."
71                 exit 1
72         fi
73 }
74 flashv=$(awk -F'"' '/version/{print $4}' manifest-$ver.json)
75
76 rm -f "$t" "$manifest"
77
78 # check google-chrome and flash ver
79 oldflash=$(awk '/^%define[      ]+flashv[       ]+/{print $NF}' $specfile)
80 if [ "$oldrev" = "$rev" -a "$oldver" = "$ver" -a "$oldflash" = "$flashv" ]; then
81         echo "Already up to date (google-chrome/$ver-$rev flash/$flashv)"
82         exit 0
83 fi
84
85 echo "Updating $specfile for google-chrome/$oldver-$oldrev -> $ver-$rev, flash/$oldflash -> $flashv"
86 sed -i -e "
87         s/^\(%define[ \t]\+svnrev[ \t]\+\)[0-9]\+\$/\1$rev/
88         s/^\(%define[ \t]\+state[ \t]\+\)[a-z]\+\$/\1$branch/
89         s/^\(%define[ \t]\+flashv[ \t]\+\)[0-9.]\+\$/\1$flashv/
90         s/^\(Version:[ \t]\+\)[.0-9]\+\$/\1$ver/
91 " $specfile
92 ../builder -ncs -nd -n5 -g $specfile || :
93 ../builder -ncs -nd -5 $specfile
This page took 0.104008 seconds and 3 git commands to generate.