Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/installer/linux/sysroot_scripts/sysroot-creator.sh

Issue 271853003: Add support for building Ubuntu/Trusty sysroot images. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/bin/sh
2 #
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 3 # found in the LICENSE file.
6 # 4 #
7 #@ This script builds a Debian Wheezy sysroot for building Google Chrome. 5 # This script is should not be run directly but sourced by the other
Lei Zhang 2014/05/13 19:57:53 s/is should/should/
Sam Clegg 2014/05/13 20:13:22 Done.
6 # scripts (e.g. sysroot-creator-trusty.sh). Its up to the parent scripts
7 # to define certain environment variables: e.g.
8 # DIST=trusty
9 # APT_REPO=http://archive.ubuntu.com/ubuntu
10 # KEYRING_FILE=/usr/share/keyrings/ubuntu-archive-keyring.gpg
11 # DEBIAN_PACKAGES="gcc libz libssl"
12
13 #@ This script builds a Debian sysroot images for building Google Chrome.
8 #@ 14 #@
9 #@ Generally this script is invoked as: 15 #@ Generally this script is invoked as:
10 #@ sysroot-creator-debian.wheezy.sh <mode> <args>* 16 #@ sysroot-creator-<flavour>.sh <mode> <args>*
11 #@ Available modes are shown below. 17 #@ Available modes are shown below.
12 #@ 18 #@
13 #@ List of modes: 19 #@ List of modes:
14 20
15 ###################################################################### 21 ######################################################################
16 # Config 22 # Config
17 ###################################################################### 23 ######################################################################
18 24
19 set -o nounset 25 set -o nounset
20 set -o errexit 26 set -o errexit
21 27
22 readonly SCRIPT_DIR=$(dirname $0) 28 SCRIPT_DIR=$(cd $(dirname $0) && pwd)
29
30 if [ -z "${DIST:-}" ]; then
31 echo "error: DIST not defined"
32 exit 1
33 fi
34
35 if [ -z "${APT_REPO:-}" ]; then
36 echo "error: APT_REPO not defined"
37 exit 1
38 fi
39
40 if [ -z "${KEYRING_FILE:-}" ]; then
41 echo "error: KEYRING_FILE not defined"
42 exit 1
43 fi
44
45 if [ -z "${DEBIAN_PACKAGES:-}" ]; then
46 echo "error: DEBIAN_PACKAGES not defined"
47 exit 1
48 fi
49
50 readonly REPO_BASEDIR="${APT_REPO}/dists/${DIST}"
23 51
24 # This is where the staging sysroot is. 52 # This is where the staging sysroot is.
25 readonly INSTALL_ROOT_AMD64=$(pwd)/debian_wheezy_amd64_staging 53 readonly INSTALL_ROOT_AMD64=$(pwd)/${DIST}_amd64_staging
26 readonly INSTALL_ROOT_I386=$(pwd)/debian_wheezy_i386_staging 54 readonly INSTALL_ROOT_I386=$(pwd)/${DIST}_i386_staging
27 readonly INSTALL_ROOT_ARM=$(pwd)/debian_wheezy_arm_staging 55 readonly INSTALL_ROOT_ARM=$(pwd)/${DIST}_arm_staging
28 56
29 readonly REQUIRED_TOOLS="wget" 57 readonly REQUIRED_TOOLS="wget"
30 58
31 ###################################################################### 59 ######################################################################
32 # Package Config 60 # Package Config
33 ###################################################################### 61 ######################################################################
34 62
35 # This is where we get all the debian packages from.
36 readonly DEBIAN_REPO=http://http.us.debian.org/debian
37 readonly REPO_BASEDIR="${DEBIAN_REPO}/dists/wheezy"
38
39 readonly RELEASE_FILE="Release" 63 readonly RELEASE_FILE="Release"
40 readonly RELEASE_FILE_GPG="Release.gpg" 64 readonly RELEASE_FILE_GPG="Release.gpg"
41 readonly RELEASE_LIST="${REPO_BASEDIR}/${RELEASE_FILE}" 65 readonly RELEASE_LIST="${REPO_BASEDIR}/${RELEASE_FILE}"
42 readonly RELEASE_LIST_GPG="${REPO_BASEDIR}/${RELEASE_FILE_GPG}" 66 readonly RELEASE_LIST_GPG="${REPO_BASEDIR}/${RELEASE_FILE_GPG}"
43 readonly PACKAGE_FILE_AMD64="main/binary-amd64/Packages.bz2" 67 readonly PACKAGE_FILE_AMD64="main/binary-amd64/Packages.bz2"
44 readonly PACKAGE_FILE_I386="main/binary-i386/Packages.bz2" 68 readonly PACKAGE_FILE_I386="main/binary-i386/Packages.bz2"
45 readonly PACKAGE_FILE_ARM="main/binary-armhf/Packages.bz2" 69 readonly PACKAGE_FILE_ARM="main/binary-armhf/Packages.bz2"
46 readonly PACKAGE_LIST_AMD64="${REPO_BASEDIR}/${PACKAGE_FILE_AMD64}" 70 readonly PACKAGE_LIST_AMD64="${REPO_BASEDIR}/${PACKAGE_FILE_AMD64}"
47 readonly PACKAGE_LIST_I386="${REPO_BASEDIR}/${PACKAGE_FILE_I386}" 71 readonly PACKAGE_LIST_I386="${REPO_BASEDIR}/${PACKAGE_FILE_I386}"
48 readonly PACKAGE_LIST_ARM="${REPO_BASEDIR}/${PACKAGE_FILE_ARM}" 72 readonly PACKAGE_LIST_ARM="${REPO_BASEDIR}/${PACKAGE_FILE_ARM}"
49 73
50 # Sysroot packages: these are the packages needed to build chrome. 74 readonly DEBIAN_DEP_LIST_AMD64="packagelist.${DIST}.amd64"
51 # NOTE: When DEBIAN_PACKAGES is modified, the packagelist files must be updated 75 readonly DEBIAN_DEP_LIST_I386="packagelist.${DIST}.i386"
52 # by running this script in GeneratePackageList mode. 76 readonly DEBIAN_DEP_LIST_ARM="packagelist.${DIST}.arm"
53 readonly DEBIAN_PACKAGES="\
54 comerr-dev \
55 gcc-4.6 \
56 krb5-multidev \
57 libasound2 \
58 libasound2-dev \
59 libatk1.0-0 \
60 libatk1.0-dev \
61 libavahi-client3 \
62 libavahi-common3 \
63 libc6 \
64 libc6-dev \
65 libcairo2 \
66 libcairo2-dev \
67 libcairo-gobject2 \
68 libcairo-script-interpreter2 \
69 libcap-dev \
70 libcap2 \
71 libcomerr2 \
72 libcups2 \
73 libcups2-dev \
74 libdbus-1-3 \
75 libdbus-1-dev \
76 libdbus-glib-1-2 \
77 libdrm2 \
78 libelf1 \
79 libelf-dev \
80 libexif12 \
81 libexif-dev \
82 libexpat1 \
83 libexpat1-dev \
84 libffi5 \
85 libfontconfig1 \
86 libfontconfig1-dev \
87 libfreetype6 \
88 libfreetype6-dev \
89 libgcc1 \
90 libgcc1 \
91 libgconf-2-4 \
92 libgconf2-4 \
93 libgconf2-dev \
94 libgcrypt11 \
95 libgcrypt11-dev \
96 libgdk-pixbuf2.0-0 \
97 libgdk-pixbuf2.0-dev \
98 libgl1-mesa-dev \
99 libgl1-mesa-glx \
100 libglapi-mesa \
101 libglib2.0-0 \
102 libglib2.0-dev \
103 libgnome-keyring0 \
104 libgnome-keyring-dev \
105 libgnutls26 \
106 libgnutls-dev \
107 libgnutls-openssl27 \
108 libgnutlsxx27 \
109 libgomp1 \
110 libgpg-error0 \
111 libgpg-error-dev \
112 libgssapi-krb5-2 \
113 libgssrpc4 \
114 libgtk2.0-0 \
115 libgtk2.0-dev \
116 libk5crypto3 \
117 libkadm5clnt-mit8 \
118 libkadm5srv-mit8 \
119 libkdb5-6 \
120 libkeyutils1 \
121 libkrb5-3 \
122 libkrb5-dev \
123 libkrb5support0 \
124 libnspr4 \
125 libnspr4-dev \
126 libnss3 \
127 libnss3-dev \
128 libnss-db \
129 liborbit2 \
130 libp11-2 \
131 libp11-kit0 \
132 libpam0g \
133 libpam0g-dev \
134 libpango1.0-0 \
135 libpango1.0-dev \
136 libpci3 \
137 libpci-dev \
138 libpcre3 \
139 libpcre3-dev \
140 libpcrecpp0 \
141 libpixman-1-0 \
142 libpixman-1-dev \
143 libpng12-0 \
144 libpng12-dev \
145 libpulse0 \
146 libpulse-dev \
147 libpulse-mainloop-glib0 \
148 libselinux1 \
149 libspeechd2 \
150 libspeechd-dev \
151 libssl1.0.0 \
152 libssl-dev \
153 libstdc++6 \
154 libstdc++6-4.6-dev \
155 libtasn1-3 \
156 libudev0 \
157 libudev-dev \
158 libx11-6 \
159 libx11-dev \
160 libx11-xcb1 \
161 libxau6 \
162 libxau-dev \
163 libxcb1 \
164 libxcb1-dev \
165 libxcb-glx0 \
166 libxcb-render0 \
167 libxcb-render0-dev \
168 libxcb-shm0 \
169 libxcb-shm0-dev \
170 libxcomposite1 \
171 libxcomposite-dev \
172 libxcursor1 \
173 libxcursor-dev \
174 libxdamage1 \
175 libxdamage-dev \
176 libxdmcp6 \
177 libxext6 \
178 libxext-dev \
179 libxfixes3 \
180 libxfixes-dev \
181 libxi6 \
182 libxi-dev \
183 libxinerama1 \
184 libxinerama-dev \
185 libxrandr2 \
186 libxrandr-dev \
187 libxrender1 \
188 libxrender-dev \
189 libxss1 \
190 libxss-dev \
191 libxt6 \
192 libxt-dev \
193 libxtst6 \
194 libxtst-dev \
195 libxxf86vm1 \
196 linux-libc-dev \
197 mesa-common-dev \
198 speech-dispatcher \
199 x11proto-composite-dev \
200 x11proto-core-dev \
201 x11proto-damage-dev \
202 x11proto-fixes-dev \
203 x11proto-input-dev \
204 x11proto-kb-dev \
205 x11proto-randr-dev \
206 x11proto-record-dev \
207 x11proto-render-dev \
208 x11proto-scrnsaver-dev \
209 x11proto-xext-dev \
210 zlib1g \
211 zlib1g-dev"
212
213 DEBIAN_PACKAGES_X86="libquadmath0"
214
215 readonly DEBIAN_DEP_LIST_AMD64="packagelist.debian.wheezy.amd64"
216 readonly DEBIAN_DEP_LIST_I386="packagelist.debian.wheezy.i386"
217 readonly DEBIAN_DEP_LIST_ARM="packagelist.debian.wheezy.arm"
218 77
219 ###################################################################### 78 ######################################################################
220 # Helper 79 # Helper
221 ###################################################################### 80 ######################################################################
222 81
223 Banner() { 82 Banner() {
224 echo "######################################################################" 83 echo "######################################################################"
225 echo $* 84 echo $*
226 echo "######################################################################" 85 echo "######################################################################"
227 } 86 }
228 87
229 88
230 SubBanner() { 89 SubBanner() {
231 echo "......................................................................" 90 echo "----------------------------------------------------------------------"
232 echo $* 91 echo $*
233 echo "......................................................................" 92 echo "----------------------------------------------------------------------"
234 } 93 }
235 94
236 95
237 Usage() { 96 Usage() {
238 egrep "^#@" "$0" | cut --bytes=3- 97 egrep "^#@" "${BASH_SOURCE[0]}" | cut --bytes=3-
239 } 98 }
240 99
241 100
242 DownloadOrCopy() { 101 DownloadOrCopy() {
243 if [ -f "$2" ] ; then 102 if [ -f "$2" ] ; then
244 echo "$2 already in place" 103 echo "$2 already in place"
245 return 104 return
246 fi 105 fi
247 106
248 HTTP=0 107 HTTP=0
249 echo "$1" | grep -qs ^http:// && HTTP=1 108 echo "$1" | grep -qs ^http:// && HTTP=1
250 if [ "$HTTP" = "1" ]; then 109 if [ "$HTTP" = "1" ]; then
251 SubBanner "downloading from $1 -> $2" 110 SubBanner "downloading from $1 -> $2"
252 wget "$1" -O "$2" 111 wget "$1" -O "${2}.partial"
112 mv "${2}.partial" $2
253 else 113 else
254 SubBanner "copying from $1" 114 SubBanner "copying from $1"
255 cp "$1" "$2" 115 cp "$1" "$2"
256 fi 116 fi
257 } 117 }
258 118
259 119
260 SetEnvironmentVariables() { 120 SetEnvironmentVariables() {
261 ARCH="" 121 ARCH=""
262 echo $1 | grep -qs Amd64$ && ARCH=AMD64 122 echo $1 | grep -qs Amd64$ && ARCH=AMD64
(...skipping 13 matching lines...) Expand all
276 I386) 136 I386)
277 INSTALL_ROOT="$INSTALL_ROOT_I386"; 137 INSTALL_ROOT="$INSTALL_ROOT_I386";
278 ;; 138 ;;
279 *) 139 *)
280 echo "ERROR: Unexpected bad architecture." 140 echo "ERROR: Unexpected bad architecture."
281 exit 1 141 exit 1
282 ;; 142 ;;
283 esac 143 esac
284 } 144 }
285 145
286 Cleanup() {
287 echo "Cleaning: $TMP"
288 rm -rf "$TMP"
289 }
290 146
291 # some sanity checks to make sure this script is run from the right place 147 # some sanity checks to make sure this script is run from the right place
292 # with the right tools 148 # with the right tools
293 SanityCheck() { 149 SanityCheck() {
294 Banner "Sanity Checks" 150 Banner "Sanity Checks"
295 151
296 if [ "$(basename $(pwd))" != "sysroot_scripts" ] ; then
297 echo -n "ERROR: run this script from "
298 echo "src/chrome/installer/linux/sysroot_scripts"
299 exit 1
300 fi
301
302 if ! mkdir -p "${INSTALL_ROOT}" ; then 152 if ! mkdir -p "${INSTALL_ROOT}" ; then
303 echo "ERROR: ${INSTALL_ROOT} can't be created." 153 echo "ERROR: ${INSTALL_ROOT} can't be created."
304 exit 1 154 exit 1
305 fi 155 fi
306 156
307 TMP=$(mktemp -q -t -d debian-wheezy-XXXXXX) 157 CHROME_DIR=$(cd "${SCRIPT_DIR}/../../.." && pwd)
308 if [ -z "$TMP" ]; then 158 BUILD_DIR=${CHROME_DIR}/out/sysroot-build/${DIST}
309 echo "ERROR: temp dir can't be created." 159 mkdir -p ${BUILD_DIR}
310 exit 1 160 echo "Using build directory: ${BUILD_DIR}"
311 fi
312 trap Cleanup 0
313 161
314 for tool in ${REQUIRED_TOOLS} ; do 162 for tool in ${REQUIRED_TOOLS} ; do
315 if ! which ${tool} ; then 163 if ! which ${tool} > /dev/null ; then
316 echo "Required binary $tool not found." 164 echo "Required binary $tool not found."
317 echo "Exiting." 165 echo "Exiting."
318 exit 1 166 exit 1
319 fi 167 fi
320 done 168 done
321 } 169 }
322 170
323 171
324 ChangeDirectory() { 172 ChangeDirectory() {
325 # Change directory to where this script is. 173 # Change directory to where this script is.
(...skipping 24 matching lines...) Expand all
350 exit 1 198 exit 1
351 fi 199 fi
352 } 200 }
353 201
354 ExtractPackageBz2() { 202 ExtractPackageBz2() {
355 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" 203 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2"
356 } 204 }
357 205
358 GeneratePackageListAmd64() { 206 GeneratePackageListAmd64() {
359 local output_file="$1" 207 local output_file="$1"
360 local package_list="${TMP}/Packages.wheezy_amd64.bz2" 208 local package_list="${BUILD_DIR}/Packages.${DIST}_amd64.bz2"
361 local tmp_package_list="${TMP}/Packages.wheezy_amd64" 209 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_amd64"
362 DownloadOrCopy "${PACKAGE_LIST_AMD64}" "${package_list}" 210 DownloadOrCopy "${PACKAGE_LIST_AMD64}" "${package_list}"
363 VerifyPackageListing "${PACKAGE_FILE_AMD64}" "${package_list}" 211 VerifyPackageListing "${PACKAGE_FILE_AMD64}" "${package_list}"
364 ExtractPackageBz2 "$package_list" "$tmp_package_list" 212 ExtractPackageBz2 "$package_list" "$tmp_package_list"
365
366 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} 213 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}
367 ${DEBIAN_PACKAGES_X86}" 214 ${DEBIAN_PACKAGES_X86}"
368 } 215 }
369 216
370 GeneratePackageListI386() { 217 GeneratePackageListI386() {
371 local output_file="$1" 218 local output_file="$1"
372 local package_list="${TMP}/Packages.wheezy_i386.bz2" 219 local package_list="${BUILD_DIR}/Packages.${DIST}_i386.bz2"
373 local tmp_package_list="${TMP}/Packages.wheezy_amd64" 220 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_amd64"
374 DownloadOrCopy "${PACKAGE_LIST_I386}" "${package_list}" 221 DownloadOrCopy "${PACKAGE_LIST_I386}" "${package_list}"
375 VerifyPackageListing "${PACKAGE_FILE_I386}" "${package_list}" 222 VerifyPackageListing "${PACKAGE_FILE_I386}" "${package_list}"
376 ExtractPackageBz2 "$package_list" "$tmp_package_list" 223 ExtractPackageBz2 "$package_list" "$tmp_package_list"
377
378 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} 224 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}
379 ${DEBIAN_PACKAGES_X86}" 225 ${DEBIAN_PACKAGES_X86}"
380 } 226 }
381 227
382 GeneratePackageListARM() { 228 GeneratePackageListARM() {
383 local output_file="$1" 229 local output_file="$1"
384 local package_list="${TMP}/Packages.wheezy_arm.bz2" 230 local package_list="${BUILD_DIR}/Packages.${DIST}_arm.bz2"
385 local tmp_package_list="${TMP}/Packages.wheezy_arm" 231 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_arm"
386 DownloadOrCopy "${PACKAGE_LIST_ARM}" "${package_list}" 232 DownloadOrCopy "${PACKAGE_LIST_ARM}" "${package_list}"
387 VerifyPackageListing "${PACKAGE_FILE_ARM}" "${package_list}" 233 VerifyPackageListing "${PACKAGE_FILE_ARM}" "${package_list}"
388 ExtractPackageBz2 "$package_list" "$tmp_package_list" 234 ExtractPackageBz2 "$package_list" "$tmp_package_list"
389
390 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}" 235 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}"
391 } 236 }
392 237
393 StripChecksumsFromPackageList() { 238 StripChecksumsFromPackageList() {
394 local package_file="$1" 239 local package_file="$1"
395 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file" 240 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file"
396 } 241 }
397 242
398 VerifyPackageFilesMatch() { 243 VerifyPackageFilesMatch() {
399 local downloaded_package_file="$1" 244 local downloaded_package_file="$1"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 # which overwrites PKG_CONFIG_PATH internally 318 # which overwrites PKG_CONFIG_PATH internally
474 SubBanner "Package Configs Symlink" 319 SubBanner "Package Configs Symlink"
475 mkdir -p ${INSTALL_ROOT}/usr/share 320 mkdir -p ${INSTALL_ROOT}/usr/share
476 ln -s ../lib/arm-linux-gnueabihf/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig 321 ln -s ../lib/arm-linux-gnueabihf/pkgconfig ${INSTALL_ROOT}/usr/share/pkgconfig
477 } 322 }
478 323
479 324
480 InstallIntoSysroot() { 325 InstallIntoSysroot() {
481 Banner "Install Libs And Headers Into Jail" 326 Banner "Install Libs And Headers Into Jail"
482 327
483 mkdir -p ${TMP}/debian-packages 328 mkdir -p ${BUILD_DIR}/debian-packages
484 mkdir -p ${INSTALL_ROOT} 329 mkdir -p ${INSTALL_ROOT}
485 while (( "$#" )); do 330 while (( "$#" )); do
486 local file="$1" 331 local file="$1"
487 local package="${TMP}/debian-packages/${file##*/}" 332 local package="${BUILD_DIR}/debian-packages/${file##*/}"
488 shift 333 shift
489 local sha256sum="$1" 334 local sha256sum="$1"
490 shift 335 shift
491 if [ "${#sha256sum}" -ne "64" ]; then 336 if [ "${#sha256sum}" -ne "64" ]; then
492 echo "Bad sha256sum from package list" 337 echo "Bad sha256sum from package list"
493 exit 1 338 exit 1
494 fi 339 fi
495 340
496 Banner "Installing ${file}" 341 Banner "Installing ${file}"
497 DownloadOrCopy ${DEBIAN_REPO}/pool/${file} ${package} 342 DownloadOrCopy ${APT_REPO}/pool/${file} ${package}
498 if [ ! -s "${package}" ] ; then 343 if [ ! -s "${package}" ] ; then
499 echo 344 echo
500 echo "ERROR: bad package ${package}" 345 echo "ERROR: bad package ${package}"
501 exit 1 346 exit 1
502 fi 347 fi
503 echo "${sha256sum} ${package}" | sha256sum --quiet -c 348 echo "${sha256sum} ${package}" | sha256sum --quiet -c
504 349
505 SubBanner "Extracting to ${INSTALL_ROOT}" 350 SubBanner "Extracting to ${INSTALL_ROOT}"
506 dpkg --fsys-tarfile ${package}\ 351 dpkg --fsys-tarfile ${package}\
507 | tar -xvf - --exclude=./usr/share -C ${INSTALL_ROOT} 352 | tar -xf - --exclude=./usr/share -C ${INSTALL_ROOT}
508 done 353 done
509 } 354 }
510 355
511 356
512 CleanupJailSymlinks() { 357 CleanupJailSymlinks() {
513 Banner "Jail symlink cleanup" 358 Banner "Jail symlink cleanup"
514 359
515 SAVEDPWD=$(pwd) 360 SAVEDPWD=$(pwd)
516 cd ${INSTALL_ROOT} 361 cd ${INSTALL_ROOT}
517 find lib lib64 usr/lib -type l -printf '%p %l\n' | while read link target; do 362 find lib lib64 usr/lib -type l -printf '%p %l\n' | while read link target; do
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 cd "$SAVEDPWD" 396 cd "$SAVEDPWD"
552 } 397 }
553 398
554 #@ 399 #@
555 #@ BuildSysrootAmd64 <tarball-name> 400 #@ BuildSysrootAmd64 <tarball-name>
556 #@ 401 #@
557 #@ Build everything and package it 402 #@ Build everything and package it
558 BuildSysrootAmd64() { 403 BuildSysrootAmd64() {
559 CheckBuildSysrootArgs $@ 404 CheckBuildSysrootArgs $@
560 ClearInstallDir 405 ClearInstallDir
561 local package_file="$TMP/package_with_sha256sum_amd64" 406 local package_file="$BUILD_DIR/package_with_sha256sum_amd64"
562 GeneratePackageListAmd64 "$package_file" 407 GeneratePackageListAmd64 "$package_file"
563 local files_and_sha256sums="$(cat ${package_file})" 408 local files_and_sha256sums="$(cat ${package_file})"
564 StripChecksumsFromPackageList "$package_file" 409 StripChecksumsFromPackageList "$package_file"
565 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_AMD64" 410 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_AMD64"
566 InstallIntoSysroot "${files_and_sha256sums}" 411 InstallIntoSysroot ${files_and_sha256sums}
567 CleanupJailSymlinks 412 CleanupJailSymlinks
568 HacksAndPatchesAmd64 413 HacksAndPatchesAmd64
569 CreateTarBall "$1" 414 CreateTarBall "$1"
570 } 415 }
571 416
572 #@ 417 #@
573 #@ BuildSysrootI386 <tarball-name> 418 #@ BuildSysrootI386 <tarball-name>
574 #@ 419 #@
575 #@ Build everything and package it 420 #@ Build everything and package it
576 BuildSysrootI386() { 421 BuildSysrootI386() {
577 CheckBuildSysrootArgs $@ 422 CheckBuildSysrootArgs $@
578 ClearInstallDir 423 ClearInstallDir
579 local package_file="$TMP/package_with_sha256sum_i386" 424 local package_file="$BUILD_DIR/package_with_sha256sum_i386"
580 GeneratePackageListI386 "$package_file" 425 GeneratePackageListI386 "$package_file"
581 local files_and_sha256sums="$(cat ${package_file})" 426 local files_and_sha256sums="$(cat ${package_file})"
582 StripChecksumsFromPackageList "$package_file" 427 StripChecksumsFromPackageList "$package_file"
583 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_I386" 428 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_I386"
584 InstallIntoSysroot "${files_and_sha256sums}" 429 InstallIntoSysroot ${files_and_sha256sums}
585 CleanupJailSymlinks 430 CleanupJailSymlinks
586 HacksAndPatchesI386 431 HacksAndPatchesI386
587 CreateTarBall "$1" 432 CreateTarBall "$1"
588 } 433 }
589 434
590 #@ 435 #@
591 #@ BuildSysrootARM <tarball-name> 436 #@ BuildSysrootARM <tarball-name>
592 #@ 437 #@
593 #@ Build everything and package it 438 #@ Build everything and package it
594 BuildSysrootARM() { 439 BuildSysrootARM() {
595 CheckBuildSysrootArgs $@ 440 CheckBuildSysrootArgs $@
596 ClearInstallDir 441 ClearInstallDir
597 local package_file="$TMP/package_with_sha256sum_arm" 442 local package_file="$BUILD_DIR/package_with_sha256sum_arm"
598 GeneratePackageListARM "$package_file" 443 GeneratePackageListARM "$package_file"
599 local files_and_sha256sums="$(cat ${package_file})" 444 local files_and_sha256sums="$(cat ${package_file})"
600 StripChecksumsFromPackageList "$package_file" 445 StripChecksumsFromPackageList "$package_file"
601 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM" 446 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM"
602 InstallIntoSysroot "${files_and_sha256sums}" 447 APT_REPO=${APR_REPO_ARM:=$APT_REPO}
448 InstallIntoSysroot ${files_and_sha256sums}
603 CleanupJailSymlinks 449 CleanupJailSymlinks
604 HacksAndPatchesARM 450 HacksAndPatchesARM
605 CreateTarBall "$1" 451 CreateTarBall "$1"
606 } 452 }
607 453
608 # 454 #
609 # CheckForDebianGPGKeyring 455 # CheckForDebianGPGKeyring
610 # 456 #
611 # Make sure the Debian GPG keys exist. Otherwise print a helpful message. 457 # Make sure the Debian GPG keys exist. Otherwise print a helpful message.
612 # 458 #
613 CheckForDebianGPGKeyring() { 459 CheckForDebianGPGKeyring() {
614 if [ ! -e "/usr/share/keyrings/debian-archive-keyring.gpg" ]; then 460 if [ ! -e "$KEYRING_FILE" ]; then
615 echo "Debian GPG keys missing. Install the debian-archive-keyring package." 461 echo "Debian GPG keys missing. Install the debian-archive-keyring package."
616 exit 1 462 exit 1
617 fi 463 fi
618 } 464 }
619 465
620 # 466 #
621 # VerifyPackageListing 467 # VerifyPackageListing
622 # 468 #
623 # Verifies the downloaded Packages.bz2 file has the right checksums. 469 # Verifies the downloaded Packages.bz2 file has the right checksums.
624 # 470 #
625 VerifyPackageListing() { 471 VerifyPackageListing() {
626 local file_path=$1 472 local file_path=$1
627 local output_file=$2 473 local output_file=$2
628 local release_file="${TMP}/${RELEASE_FILE}" 474 local release_file="${BUILD_DIR}/${RELEASE_FILE}"
629 local release_file_gpg="${TMP}/${RELEASE_FILE_GPG}" 475 local release_file_gpg="${BUILD_DIR}/${RELEASE_FILE_GPG}"
630 476
631 CheckForDebianGPGKeyring 477 CheckForDebianGPGKeyring
632 478
633 DownloadOrCopy ${RELEASE_LIST} ${release_file} 479 DownloadOrCopy ${RELEASE_LIST} ${release_file}
634 DownloadOrCopy ${RELEASE_LIST_GPG} ${release_file_gpg} 480 DownloadOrCopy ${RELEASE_LIST_GPG} ${release_file_gpg}
635 echo "Verifying: ${release_file} with ${release_file_gpg}" 481 echo "Verifying: ${release_file} with ${release_file_gpg}"
636 gpgv --keyring /usr/share/keyrings/debian-archive-keyring.gpg \ 482 gpgv --keyring $KEYRING_FILE ${release_file_gpg} ${release_file}
637 ${release_file_gpg} ${release_file}
638 483
639 echo "Verifying: ${output_file}" 484 echo "Verifying: ${output_file}"
640 local checksums=$(grep ${file_path} ${release_file} | cut -d " " -f 2) 485 local checksums=$(grep ${file_path} ${release_file} | cut -d " " -f 2)
641 local sha256sum=$(echo ${checksums} | cut -d " " -f 3) 486 local sha256sum=$(echo ${checksums} | cut -d " " -f 3)
642 487
643 if [ "${#sha256sum}" -ne "64" ]; then 488 if [ "${#sha256sum}" -ne "64" ]; then
644 echo "Bad sha256sum from ${RELEASE_LIST}" 489 echo "Bad sha256sum from ${RELEASE_LIST}"
645 exit 1 490 exit 1
646 fi 491 fi
647 492
648 echo "${sha256sum} ${output_file}" | sha256sum --quiet -c 493 echo "${sha256sum} ${output_file}" | sha256sum --quiet -c
649 } 494 }
650 495
651 # 496 #
652 # GeneratePackageList 497 # GeneratePackageList
653 # 498 #
654 # Looks up package names in ${TMP}/Packages and write list of URLs 499 # Looks up package names in ${BUILD_DIR}/Packages and write list of URLs
655 # to output file. 500 # to output file.
656 # 501 #
657 GeneratePackageList() { 502 GeneratePackageList() {
658 local input_file="$1" 503 local input_file="$1"
659 local output_file="$2" 504 local output_file="$2"
660 echo "Updating: ${output_file} from ${input_file}" 505 echo "Updating: ${output_file} from ${input_file}"
661 /bin/rm -f "${output_file}" 506 /bin/rm -f "${output_file}"
662 shift 507 shift
663 shift 508 shift
664 for pkg in $@ ; do 509 for pkg in $@ ; do
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 echo "ERROR: unknown function '$1'." >&2 565 echo "ERROR: unknown function '$1'." >&2
721 echo "For help, try:" 566 echo "For help, try:"
722 echo " $0 help" 567 echo " $0 help"
723 exit 1 568 exit 1
724 else 569 else
725 ChangeDirectory 570 ChangeDirectory
726 SetEnvironmentVariables "$1" 571 SetEnvironmentVariables "$1"
727 SanityCheck 572 SanityCheck
728 "$@" 573 "$@"
729 fi 574 fi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698