OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 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 # TODO(mmoss) This currently only works with official builds, since non-official | 7 # TODO(mmoss) This currently only works with official builds, since non-official |
8 # builds don't add the "${BUILDDIR}/installer/" files needed for packaging. | 8 # builds don't add the "${BUILDDIR}/installer/" files needed for packaging. |
9 | 9 |
10 set -e | 10 set -e |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 # Remove temporary files and unwanted packaging output. | 116 # Remove temporary files and unwanted packaging output. |
117 cleanup() { | 117 cleanup() { |
118 echo "Cleaning..." | 118 echo "Cleaning..." |
119 rm -rf "${STAGEDIR}" | 119 rm -rf "${STAGEDIR}" |
120 rm -rf "${TMPFILEDIR}" | 120 rm -rf "${TMPFILEDIR}" |
121 } | 121 } |
122 | 122 |
123 usage() { | 123 usage() { |
124 echo "usage: $(basename $0) [-c channel] [-a target_arch] [-o 'dir'] " | 124 echo "usage: $(basename $0) [-c channel] [-a target_arch] [-o 'dir'] " |
125 echo " [-b 'dir']" | 125 echo " [-b 'dir'] [-d 'dir]" |
126 echo "-c channel the package channel (trunk, asan, unstable, beta, stable)" | 126 echo "-c channel the package channel (trunk, asan, unstable, beta, stable)" |
127 echo "-a arch package architecture (ia32 or x64)" | 127 echo "-a arch package architecture (ia32 or x64)" |
128 echo "-o dir package output directory [${OUTPUTDIR}]" | 128 echo "-o dir package output directory [${OUTPUTDIR}]" |
129 echo "-b dir build input directory [${BUILDDIR}]" | 129 echo "-b dir build input directory [${BUILDDIR}]" |
| 130 echo "-d dir dpkg directory [${DPKGDIR}]" |
130 echo "-h this help message" | 131 echo "-h this help message" |
131 } | 132 } |
132 | 133 |
133 # Check that the channel name is one of the allowable ones. | 134 # Check that the channel name is one of the allowable ones. |
134 verify_channel() { | 135 verify_channel() { |
135 case $CHANNEL in | 136 case $CHANNEL in |
136 stable ) | 137 stable ) |
137 CHANNEL=stable | 138 CHANNEL=stable |
138 RELEASENOTES="http://googlechromereleases.blogspot.com/search/label/Stable
%20updates" | 139 RELEASENOTES="http://googlechromereleases.blogspot.com/search/label/Stable
%20updates" |
139 ;; | 140 ;; |
(...skipping 14 matching lines...) Expand all Loading... |
154 * ) | 155 * ) |
155 echo | 156 echo |
156 echo "ERROR: '$CHANNEL' is not a valid channel type." | 157 echo "ERROR: '$CHANNEL' is not a valid channel type." |
157 echo | 158 echo |
158 exit 1 | 159 exit 1 |
159 ;; | 160 ;; |
160 esac | 161 esac |
161 } | 162 } |
162 | 163 |
163 process_opts() { | 164 process_opts() { |
164 while getopts ":o:b:c:a:h" OPTNAME | 165 while getopts ":o:b:c:a:d:h" OPTNAME |
165 do | 166 do |
166 case $OPTNAME in | 167 case $OPTNAME in |
167 o ) | 168 o ) |
168 OUTPUTDIR=$(readlink -f "${OPTARG}") | 169 OUTPUTDIR=$(readlink -f "${OPTARG}") |
169 mkdir -p "${OUTPUTDIR}" | 170 mkdir -p "${OUTPUTDIR}" |
170 ;; | 171 ;; |
171 b ) | 172 b ) |
172 BUILDDIR=$(readlink -f "${OPTARG}") | 173 BUILDDIR=$(readlink -f "${OPTARG}") |
173 ;; | 174 ;; |
174 c ) | 175 c ) |
175 CHANNEL="$OPTARG" | 176 CHANNEL="$OPTARG" |
176 ;; | 177 ;; |
177 a ) | 178 a ) |
178 TARGETARCH="$OPTARG" | 179 TARGETARCH="$OPTARG" |
179 ;; | 180 ;; |
| 181 d ) |
| 182 DPKGDIR="$OPTARG" |
| 183 ;; |
180 h ) | 184 h ) |
181 usage | 185 usage |
182 exit 0 | 186 exit 0 |
183 ;; | 187 ;; |
184 \: ) | 188 \: ) |
185 echo "'-$OPTARG' needs an argument." | 189 echo "'-$OPTARG' needs an argument." |
186 usage | 190 usage |
187 exit 1 | 191 exit 1 |
188 ;; | 192 ;; |
189 * ) | 193 * ) |
190 echo "invalid command-line option: $OPTARG" | 194 echo "invalid command-line option: $OPTARG" |
191 usage | 195 usage |
192 exit 1 | 196 exit 1 |
193 ;; | 197 ;; |
194 esac | 198 esac |
195 done | 199 done |
196 } | 200 } |
197 | 201 |
198 #========= | 202 #========= |
199 # MAIN | 203 # MAIN |
200 #========= | 204 #========= |
201 | 205 |
202 SCRIPTDIR=$(readlink -f "$(dirname "$0")") | 206 SCRIPTDIR=$(readlink -f "$(dirname "$0")") |
203 OUTPUTDIR="${PWD}" | 207 OUTPUTDIR="${PWD}" |
| 208 BUILDDIR="$(readlink -f "${SCRIPTDIR}/../../../../out/Release")" |
| 209 DPKGDIR=/var/lib/dpkg |
204 STAGEDIR=$(mktemp -d -t deb.build.XXXXXX) || exit 1 | 210 STAGEDIR=$(mktemp -d -t deb.build.XXXXXX) || exit 1 |
205 TMPFILEDIR=$(mktemp -d -t deb.tmp.XXXXXX) || exit 1 | 211 TMPFILEDIR=$(mktemp -d -t deb.tmp.XXXXXX) || exit 1 |
206 DEB_CHANGELOG="${TMPFILEDIR}/changelog" | 212 DEB_CHANGELOG="${TMPFILEDIR}/changelog" |
207 DEB_FILES="${TMPFILEDIR}/files" | 213 DEB_FILES="${TMPFILEDIR}/files" |
208 DEB_CONTROL="${TMPFILEDIR}/control" | 214 DEB_CONTROL="${TMPFILEDIR}/control" |
209 CHANNEL="trunk" | 215 CHANNEL="trunk" |
| 216 |
210 # Default target architecture to same as build host. | 217 # Default target architecture to same as build host. |
211 if [ "$(uname -m)" = "x86_64" ]; then | 218 if [ "$(uname -m)" = "x86_64" ]; then |
212 TARGETARCH="x64" | 219 TARGETARCH="x64" |
213 else | 220 else |
214 TARGETARCH="ia32" | 221 TARGETARCH="ia32" |
215 fi | 222 fi |
216 | 223 |
217 # call cleanup() on exit | 224 # call cleanup() on exit |
218 trap cleanup 0 | 225 trap cleanup 0 |
| 226 |
219 process_opts "$@" | 227 process_opts "$@" |
220 BUILDDIR=${BUILDDIR:=$(readlink -f "${SCRIPTDIR}/../../../../out/Release")} | |
221 | 228 |
222 source ${BUILDDIR}/installer/common/installer.include | 229 source ${BUILDDIR}/installer/common/installer.include |
223 | 230 |
224 get_version_info | 231 get_version_info |
225 VERSIONFULL="${VERSION}-${PACKAGE_RELEASE}" | 232 VERSIONFULL="${VERSION}-${PACKAGE_RELEASE}" |
226 | 233 |
227 if [ "$CHROMIUM_BUILD" = "_google_chrome" ]; then | 234 if [ "$CHROMIUM_BUILD" = "_google_chrome" ]; then |
228 source "${BUILDDIR}/installer/common/google-chrome.info" | 235 source "${BUILDDIR}/installer/common/google-chrome.info" |
229 else | 236 else |
230 source "${BUILDDIR}/installer/common/chromium-browser.info" | 237 source "${BUILDDIR}/installer/common/chromium-browser.info" |
(...skipping 23 matching lines...) Expand all Loading... |
254 | 261 |
255 # Generate the dependencies, | 262 # Generate the dependencies, |
256 # TODO(mmoss): This is a workaround for a problem where dpkg-shlibdeps was | 263 # TODO(mmoss): This is a workaround for a problem where dpkg-shlibdeps was |
257 # resolving deps using some of our build output shlibs (i.e. | 264 # resolving deps using some of our build output shlibs (i.e. |
258 # out/Release/lib.target/libfreetype.so.6), and was then failing with: | 265 # out/Release/lib.target/libfreetype.so.6), and was then failing with: |
259 # dpkg-shlibdeps: error: no dependency information found for ... | 266 # dpkg-shlibdeps: error: no dependency information found for ... |
260 # It's not clear if we ever want to look in LD_LIBRARY_PATH to resolve deps, | 267 # It's not clear if we ever want to look in LD_LIBRARY_PATH to resolve deps, |
261 # but it seems that we don't currently, so this is the most expediant fix. | 268 # but it seems that we don't currently, so this is the most expediant fix. |
262 SAVE_LDLP=${LD_LIBRARY_PATH:-} | 269 SAVE_LDLP=${LD_LIBRARY_PATH:-} |
263 unset LD_LIBRARY_PATH | 270 unset LD_LIBRARY_PATH |
264 DPKG_SHLIB_DEPS=$(dpkg-shlibdeps -O "$BUILDDIR/chrome" | \ | 271 DPKG_SHLIB_DEPS=$(dpkg-shlibdeps -O "$BUILDDIR/chrome" --admindir="$DPKGDIR" | \ |
265 sed 's/^shlibs:Depends=//') | 272 sed 's/^shlibs:Depends=//') |
266 if [ -n "$SAVE_LDLP" ]; then | 273 if [ -n "$SAVE_LDLP" ]; then |
267 LD_LIBRARY_PATH=$SAVE_LDLP | 274 LD_LIBRARY_PATH=$SAVE_LDLP |
268 fi | 275 fi |
269 | 276 |
270 # Format it nicely and save it for comparison. | 277 # Format it nicely and save it for comparison. |
271 # The grep -v is for a duplicate libc6 dep caused by Lucid glibc silliness. | 278 echo "$DPKG_SHLIB_DEPS" | sed 's/, /\n/g' > actual |
272 echo "$DPKG_SHLIB_DEPS" | sed 's/, /\n/g' | \ | |
273 grep -v '^libc6 (>= 2.3.6-6~)$' > actual | |
274 | 279 |
275 # Compare the expected dependency list to the generate list. | 280 # Compare the expected dependency list to the generate list. |
276 BAD_DIFF=0 | 281 BAD_DIFF=0 |
277 diff "$SCRIPTDIR/expected_deps_$TARGETARCH" actual || BAD_DIFF=1 | 282 diff "$SCRIPTDIR/expected_deps_$TARGETARCH" actual || BAD_DIFF=1 |
278 if [ $BAD_DIFF -ne 0 ] && [ -z "${IGNORE_DEPS_CHANGES:-}" ]; then | 283 if [ $BAD_DIFF -ne 0 ] && [ -z "${IGNORE_DEPS_CHANGES:-}" ]; then |
279 echo | 284 echo |
280 echo "ERROR: Shared library dependencies changed!" | 285 echo "ERROR: Shared library dependencies changed!" |
281 echo "If this is intentional, please update:" | 286 echo "If this is intentional, please update:" |
282 echo "chrome/installer/linux/debian/expected_deps_ia32" | 287 echo "chrome/installer/linux/debian/expected_deps_ia32" |
283 echo "chrome/installer/linux/debian/expected_deps_x64" | 288 echo "chrome/installer/linux/debian/expected_deps_x64" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 ;; | 322 ;; |
318 * ) | 323 * ) |
319 echo | 324 echo |
320 echo "ERROR: Don't know how to build DEBs for '$TARGETARCH'." | 325 echo "ERROR: Don't know how to build DEBs for '$TARGETARCH'." |
321 echo | 326 echo |
322 exit 1 | 327 exit 1 |
323 ;; | 328 ;; |
324 esac | 329 esac |
325 | 330 |
326 do_package | 331 do_package |
OLD | NEW |