OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 # | 6 # |
7 | 7 |
8 # Clones the dom-distiller repo, compiles and extracts its javascript Then | 8 # Clones the dom-distiller repo, compiles and extracts its javascript Then |
9 # copies that js into the Chromium tree. | 9 # copies that js into the Chromium tree. |
10 # This script should be run from the src/ directory and requires that ant is | 10 # This script should be run from the src/ directory and requires that ant is |
11 # installed. It takes an optional parameter for which SHA1 to roll to. If left | 11 # installed. It takes an optional parameter for which SHA1 to roll to. If left |
12 # unspecified the script rolls to HEAD. | 12 # unspecified the script rolls to HEAD. |
13 | 13 |
14 ( | 14 ( |
15 set -e | 15 set -e |
16 | 16 |
17 dom_distiller_js_path=third_party/dom_distiller_js | 17 dom_distiller_js_path=third_party/dom_distiller_js |
18 dom_distiller_js_package=$dom_distiller_js_path/package | 18 dom_distiller_js_package=$dom_distiller_js_path/package |
19 readme_chromium=$dom_distiller_js_path/README.chromium | 19 readme_chromium=$dom_distiller_js_path/README.chromium |
20 tmpdir=/tmp/domdistiller-$$ | 20 tmpdir=/tmp/domdistiller-$$ |
21 changes=$tmpdir/domdistiller.changes | 21 changes=$tmpdir/domdistiller.changes |
22 bugs=$tmpdir/domdistiller.bugs | 22 bugs=$tmpdir/domdistiller.bugs |
23 curr_gitsha=$(grep 'Version:' $readme_chromium | awk '{print $2}') | 23 curr_gitsha=$(grep 'Version:' $readme_chromium | awk '{print $2}') |
24 | 24 |
25 rm -rf $tmpdir | 25 rm -rf $tmpdir |
26 mkdir $tmpdir | 26 mkdir $tmpdir |
27 pushd $tmpdir | |
27 | 28 |
28 pushd $tmpdir | 29 git clone https://github.com/chromium/dom-distiller.git |
29 git clone https://github.com/chromium/dom-distiller/ . | 30 pushd dom-distiller |
30 | 31 |
31 # The new git SHA1 is HEAD or the first command line parameter. | 32 # The new git SHA1 is HEAD or the first command line parameter. |
32 [[ -z "$1" ]] && gitsha_target="HEAD" || gitsha_target="$1" | 33 [[ -z "$1" ]] && gitsha_target="HEAD" || gitsha_target="$1" |
33 new_gitsha=$(git rev-parse --short=10 ${gitsha_target}) | 34 new_gitsha=$(git rev-parse --short=10 ${gitsha_target}) |
34 git reset --hard ${new_gitsha} | 35 git reset --hard ${new_gitsha} |
35 git log --oneline ${curr_gitsha}..${new_gitsha} > $changes | 36 git log --oneline ${curr_gitsha}..${new_gitsha} > $changes |
36 | 37 |
37 echo -n BUG= > $bugs | 38 echo -n BUG= > $bugs |
38 | 39 |
39 # This extracts BUG= lines from the log, extracts the numbers part, removes | 40 # This extracts BUG= lines from the log, extracts the numbers part, removes |
40 # whitespace and deletes empty lines. Then, split on ',', sort, uniquify and | 41 # whitespace and deletes empty lines. Then, split on ',', sort, uniquify and |
41 # rejoin. Finally, remove the trailing ',' and concat to $bugs. | 42 # rejoin. Finally, remove the trailing ',' and concat to $bugs. |
42 git log ${curr_gitsha}..${new_gitsha} \ | 43 git log ${curr_gitsha}..${new_gitsha} \ |
43 | grep BUG= \ | 44 | grep BUG= \ |
44 | sed -e 's/.*BUG=\(.*\)/\1/' -e 's/\s*//g' -e '/^$/d' \ | 45 | sed -e 's/.*BUG=\(.*\)/\1/' -e 's/\s*//g' -e '/^$/d' \ |
45 | tr ',' '\n' \ | 46 | tr ',' '\n' \ |
46 | sort \ | 47 | sort \ |
47 | uniq \ | 48 | uniq \ |
48 | tr '\n' ',' \ | 49 | tr '\n' ',' \ |
49 | head --bytes=-1 \ | 50 | head --bytes=-1 \ |
50 >> $bugs | 51 >> $bugs |
51 | 52 |
52 echo >> $bugs # add a newline | 53 echo >> $bugs # add a newline |
53 | 54 |
54 ant package | 55 ant package |
55 popd | 56 popd # dom-distiller |
56 | 57 |
57 rm -rf $dom_distiller_js_package | 58 git clone https://github.com/chromium/dom-distiller-package.git $tmpdir/dom-di stiller-package |
58 mkdir $dom_distiller_js_package | 59 rm -rf $tmpdir/dom-distiller-package/* |
59 cp -rf $tmpdir/out/package/* $dom_distiller_js_package | 60 pushd dom-distiller-package |
60 git add $dom_distiller_js_package | 61 cp -r $tmpdir/dom-distiller/out/package/* . |
61 cp $tmpdir/LICENSE $dom_distiller_js_path/ | 62 git add . |
63 if [[ $(git status --short | wc -l) -ne 0 ]]; then | |
64 git commit -a -m "Package for ${new_gitsha}" | |
65 git push origin master | |
66 fi | |
cjhopman
2015/03/12 02:12:22
Is there a case where i hit the else clause here a
nyquist
2015/03/17 00:46:21
There used to be when only tests where checked out
| |
67 package_gitsha=$(git rev-parse HEAD) | |
68 popd # dom-distiller-package | |
69 | |
70 popd # tmpdir | |
71 | |
72 cp $tmpdir/dom-distiller/LICENSE $dom_distiller_js_path/ | |
62 sed -i "s/Version: [0-9a-f]*/Version: $new_gitsha/" $readme_chromium | 73 sed -i "s/Version: [0-9a-f]*/Version: $new_gitsha/" $readme_chromium |
74 sed -i -e "s/\('\/external\/github.com\/chromium\/dom-distiller-package.git' + '@' + '\)\([0-9a-f]\+\)'/\1$package_gitsha'/" DEPS | |
63 | 75 |
64 gen_message () { | 76 gen_message () { |
65 echo "Roll DomDistillerJS" | 77 echo "Roll DomDistillerJS" |
66 echo | 78 echo |
67 echo "Picked up changes:" | 79 echo "Picked up changes:" |
cjhopman
2015/03/12 02:12:22
Can this include a link to somewhere that I can vi
nyquist
2015/03/17 00:46:22
Done.
nyquist
2015/03/17 00:47:30
By the way, here's an example:
https://github.com/
| |
68 cat $changes | 80 cat $changes |
69 echo | 81 echo |
70 cat $bugs | 82 cat $bugs |
71 } | 83 } |
72 | 84 |
73 message=$tmpdir/message | 85 message=$tmpdir/message |
74 gen_message > $message | 86 gen_message > $message |
75 | 87 |
76 # Run checklicenses.py on the pulled files, but only print the output on | 88 # Run checklicenses.py on the pulled files, but only print the output on |
77 # failures. | 89 # failures. |
78 tools/checklicenses/checklicenses.py $dom_distiller_js_path > $tmpdir/checklic enses.out || cat $tmpdir/checklicenses.out | 90 tools/checklicenses/checklicenses.py $dom_distiller_js_path > $tmpdir/checklic enses.out || cat $tmpdir/checklicenses.out |
79 | 91 |
80 git commit -a -F $message | 92 git commit -a -F $message |
81 | 93 |
82 rm -rf $tmpdir | 94 rm -rf $tmpdir |
83 ) | 95 ) |
OLD | NEW |