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

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

Issue 2912533002: Add jessie-security repo to sysroot scripts (Closed)
Patch Set: Created 3 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # 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
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 # 4 #
5 # This script should not be run directly but sourced by the other 5 # This script should not be run directly but sourced by the other
6 # scripts (e.g. sysroot-creator-jessie.sh). Its up to the parent scripts 6 # scripts (e.g. sysroot-creator-jessie.sh). Its up to the parent scripts
7 # to define certain environment variables: e.g. 7 # to define certain environment variables: e.g.
8 # DISTRO=ubuntu 8 # DISTRO=ubuntu
9 # DIST=jessie 9 # DIST=jessie
10 # DIST_UPDATES=jessie-updates # optional 10 # # Similar in syntax to /etc/apt/sources.list
11 # REPO_EXTRA="universe restricted multiverse" # optional 11 # APT_SOURCES_LIST="http://ftp.us.debian.org/debian/ jessie main"
12 # APT_REPO=http://archive.ubuntu.com/ubuntu 12 # KEYRING_FILE=debian-archive-jessie-stable.gpg
13 # KEYRING_FILE=/usr/share/keyrings/ubuntu-archive-keyring.gpg
14 # DEBIAN_PACKAGES="gcc libz libssl" 13 # DEBIAN_PACKAGES="gcc libz libssl"
15 14
16 #@ This script builds Debian/Ubuntu sysroot images for building Google Chrome. 15 #@ This script builds Debian/Ubuntu sysroot images for building Google Chrome.
17 #@ 16 #@
18 #@ Generally this script is invoked as: 17 #@ Generally this script is invoked as:
19 #@ sysroot-creator-<flavour>.sh <mode> <args>* 18 #@ sysroot-creator-<flavour>.sh <mode> <args>*
20 #@ Available modes are shown below. 19 #@ Available modes are shown below.
21 #@ 20 #@
22 #@ List of modes: 21 #@ List of modes:
23 22
24 ###################################################################### 23 ######################################################################
25 # Config 24 # Config
26 ###################################################################### 25 ######################################################################
27 26
28 set -o nounset 27 set -o nounset
29 set -o errexit 28 set -o errexit
30 29
31 SCRIPT_DIR=$(cd $(dirname $0) && pwd) 30 SCRIPT_DIR=$(cd $(dirname $0) && pwd)
32 31
33 if [ -z "${DIST:-}" ]; then 32 if [ -z "${DIST:-}" ]; then
34 echo "error: DIST not defined" 33 echo "error: DIST not defined"
35 exit 1 34 exit 1
36 fi 35 fi
37 36
38 if [ -z "${APT_REPO:-}" ]; then
39 echo "error: APT_REPO not defined"
40 exit 1
41 fi
42
43 if [ -z "${KEYRING_FILE:-}" ]; then 37 if [ -z "${KEYRING_FILE:-}" ]; then
44 echo "error: KEYRING_FILE not defined" 38 echo "error: KEYRING_FILE not defined"
45 exit 1 39 exit 1
46 fi 40 fi
47 41
48 if [ -z "${DEBIAN_PACKAGES:-}" ]; then 42 if [ -z "${DEBIAN_PACKAGES:-}" ]; then
49 echo "error: DEBIAN_PACKAGES not defined" 43 echo "error: DEBIAN_PACKAGES not defined"
50 exit 1 44 exit 1
51 fi 45 fi
52 46
53 readonly HAS_ARCH_AMD64=${HAS_ARCH_AMD64:=0} 47 readonly HAS_ARCH_AMD64=${HAS_ARCH_AMD64:=0}
54 readonly HAS_ARCH_I386=${HAS_ARCH_I386:=0} 48 readonly HAS_ARCH_I386=${HAS_ARCH_I386:=0}
55 readonly HAS_ARCH_ARM=${HAS_ARCH_ARM:=0} 49 readonly HAS_ARCH_ARM=${HAS_ARCH_ARM:=0}
56 readonly HAS_ARCH_ARM64=${HAS_ARCH_ARM64:=0} 50 readonly HAS_ARCH_ARM64=${HAS_ARCH_ARM64:=0}
57 readonly HAS_ARCH_MIPS=${HAS_ARCH_MIPS:=0} 51 readonly HAS_ARCH_MIPS=${HAS_ARCH_MIPS:=0}
58 52
59 readonly REQUIRED_TOOLS="wget" 53 readonly REQUIRED_TOOLS="wget"
60 54
61 ###################################################################### 55 ######################################################################
62 # Package Config 56 # Package Config
63 ###################################################################### 57 ######################################################################
64 58
65 PACKAGES_EXT=${PACKAGES_EXT:-bz2} 59 readonly PACKAGES_EXT=gz
66 readonly RELEASE_FILE="Release" 60 readonly RELEASE_FILE="Release"
67 readonly RELEASE_FILE_GPG="Release.gpg" 61 readonly RELEASE_FILE_GPG="Release.gpg"
68 62
69 readonly DEBIAN_DEP_LIST_AMD64="packagelist.${DIST}.amd64" 63 readonly DEBIAN_DEP_LIST_AMD64="packagelist.${DIST}.amd64"
70 readonly DEBIAN_DEP_LIST_I386="packagelist.${DIST}.i386" 64 readonly DEBIAN_DEP_LIST_I386="packagelist.${DIST}.i386"
71 readonly DEBIAN_DEP_LIST_ARM="packagelist.${DIST}.arm" 65 readonly DEBIAN_DEP_LIST_ARM="packagelist.${DIST}.arm"
72 readonly DEBIAN_DEP_LIST_ARM64="packagelist.${DIST}.arm64" 66 readonly DEBIAN_DEP_LIST_ARM64="packagelist.${DIST}.arm64"
73 readonly DEBIAN_DEP_LIST_MIPS="packagelist.${DIST}.mipsel" 67 readonly DEBIAN_DEP_LIST_MIPS="packagelist.${DIST}.mipsel"
74 68
75 ###################################################################### 69 ######################################################################
(...skipping 24 matching lines...) Expand all
100 echo "$2 already in place" 94 echo "$2 already in place"
101 return 95 return
102 fi 96 fi
103 97
104 HTTP=0 98 HTTP=0
105 echo "$1" | grep -qs ^http:// && HTTP=1 99 echo "$1" | grep -qs ^http:// && HTTP=1
106 if [ "$HTTP" = "1" ]; then 100 if [ "$HTTP" = "1" ]; then
107 SubBanner "downloading from $1 -> $2" 101 SubBanner "downloading from $1 -> $2"
108 # Appending the "$$" shell pid is necessary here to prevent concurrent 102 # Appending the "$$" shell pid is necessary here to prevent concurrent
109 # instances of sysroot-creator.sh from trying to write to the same file. 103 # instances of sysroot-creator.sh from trying to write to the same file.
110 wget "$1" -O "${2}.partial.$$" 104 # --create-dirs is added in case there are slashes in the filename, as can
105 # happen with the "debian/security" release class.
106 curl "$1" --create-dirs -o "${2}.partial.$$"
Lei Zhang 2017/05/27 00:38:45 Oh, REQUIRED_TOOLS needs updating.
Tom Anderson 2017/05/27 00:52:44 Done.
111 mv "${2}.partial.$$" $2 107 mv "${2}.partial.$$" $2
112 else 108 else
113 SubBanner "copying from $1" 109 SubBanner "copying from $1"
114 cp "$1" "$2" 110 cp "$1" "$2"
115 fi 111 fi
116 } 112 }
117 113
118 114
119 SetEnvironmentVariables() { 115 SetEnvironmentVariables() {
120 ARCH="" 116 ARCH=""
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 Banner "Clearing dirs in ${INSTALL_ROOT}" 174 Banner "Clearing dirs in ${INSTALL_ROOT}"
179 rm -rf ${INSTALL_ROOT}/* 175 rm -rf ${INSTALL_ROOT}/*
180 } 176 }
181 177
182 178
183 CreateTarBall() { 179 CreateTarBall() {
184 Banner "Creating tarball ${TARBALL}" 180 Banner "Creating tarball ${TARBALL}"
185 tar zcf ${TARBALL} -C ${INSTALL_ROOT} . 181 tar zcf ${TARBALL} -C ${INSTALL_ROOT} .
186 } 182 }
187 183
188 ExtractPackageBz2() { 184 ExtractPackageGz() {
Lei Zhang 2017/05/27 00:37:42 Add some locals so we know what the arguments are?
Tom Anderson 2017/05/27 00:52:44 Done.
189 if [ "${PACKAGES_EXT}" = "bz2" ]; then 185 gunzip -c "$1" | egrep '^(Package:|Filename:|SHA256:) ' |
190 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" 186 sed "s|Filename: |Filename: $3|" > "$2"
191 else
192 xzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2"
193 fi
194 } 187 }
195 188
196 GeneratePackageListDist() { 189 GeneratePackageListDist() {
197 local arch="$1" 190 local arch="$1"
198 local apt_url="$2" 191 set -- $2
199 local dist="$3" 192 local repo="$1"
200 local repo_name="$4" 193 local dist="$2"
194 local repo_name="$3"
201 195
202 TMP_PACKAGE_LIST="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}" 196 TMP_PACKAGE_LIST="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}"
203 local repo_basedir="${apt_url}/dists/${dist}" 197 local repo_basedir="${repo}/dists/${dist}"
204 local package_list="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}.${PACKA GES_EXT}" 198 local package_list="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}.${PACKA GES_EXT}"
205 local package_file_arch="${repo_name}/binary-${arch}/Packages.${PACKAGES_EXT}" 199 local package_file_arch="${repo_name}/binary-${arch}/Packages.${PACKAGES_EXT}"
206 local package_list_arch="${repo_basedir}/${package_file_arch}" 200 local package_list_arch="${repo_basedir}/${package_file_arch}"
207 201
208 DownloadOrCopy "${package_list_arch}" "${package_list}" 202 DownloadOrCopy "${package_list_arch}" "${package_list}"
209 VerifyPackageListing "${package_file_arch}" "${package_list}" ${dist} 203 VerifyPackageListing "${package_file_arch}" "${package_list}" ${repo} ${dist}
210 ExtractPackageBz2 "${package_list}" "${TMP_PACKAGE_LIST}" 204 ExtractPackageGz "${package_list}" "${TMP_PACKAGE_LIST}" ${repo}
211 } 205 }
212 206
213 GeneratePackageListCommon() { 207 GeneratePackageListCommon() {
214 local output_file="$1" 208 local output_file="$1"
215 local arch="$2" 209 local arch="$2"
216 local apt_url="$3" 210 local packages="$3"
217 local packages="$4"
218 211
219 local dists="${DIST} ${DIST_UPDATES:-}" 212 local dists="${DIST} ${DIST_UPDATES:-}"
220 local repos="main ${REPO_EXTRA:-}" 213 local repos="main ${REPO_EXTRA:-}"
221 214
222 local list_base="${BUILD_DIR}/Packages.${DIST}_${arch}" 215 local list_base="${BUILD_DIR}/Packages.${DIST}_${arch}"
223 > "${list_base}" 216 > "${list_base}" # Create (or truncate) a zero-length file.
224 for dist in ${dists}; do 217 echo "${APT_SOURCES_LIST}" | while read source; do
225 for repo in ${repos}; do 218 GeneratePackageListDist "${arch}" "${source}"
226 GeneratePackageListDist "${arch}" "${apt_url}" "${dist}" "${repo}" 219 cat "${TMP_PACKAGE_LIST}" | ./merge-package-lists.py "${list_base}"
227 cat "${TMP_PACKAGE_LIST}" | ./merge-package-lists.py "${list_base}"
228 done
229 done 220 done
230 221
231 GeneratePackageList "${list_base}" "${output_file}" "${packages}" 222 GeneratePackageList "${list_base}" "${output_file}" "${packages}"
232 } 223 }
233 224
234 GeneratePackageListAmd64() { 225 GeneratePackageListAmd64() {
235 GeneratePackageListCommon "$1" amd64 ${APT_REPO} "${DEBIAN_PACKAGES} 226 GeneratePackageListCommon "$1" amd64 "${DEBIAN_PACKAGES}
236 ${DEBIAN_PACKAGES_X86:=} ${DEBIAN_PACKAGES_AMD64:=}" 227 ${DEBIAN_PACKAGES_X86:=} ${DEBIAN_PACKAGES_AMD64:=}"
237 } 228 }
238 229
239 GeneratePackageListI386() { 230 GeneratePackageListI386() {
240 GeneratePackageListCommon "$1" i386 ${APT_REPO} "${DEBIAN_PACKAGES} 231 GeneratePackageListCommon "$1" i386 "${DEBIAN_PACKAGES}
241 ${DEBIAN_PACKAGES_X86:=}" 232 ${DEBIAN_PACKAGES_X86:=}"
242 } 233 }
243 234
244 GeneratePackageListARM() { 235 GeneratePackageListARM() {
245 GeneratePackageListCommon "$1" armhf ${APT_REPO_ARM:-${APT_REPO}} \ 236 GeneratePackageListCommon "$1" armhf "${DEBIAN_PACKAGES}
246 "${DEBIAN_PACKAGES} ${DEBIAN_PACKAGES_ARM:=}" 237 ${DEBIAN_PACKAGES_ARM:=}"
247 } 238 }
248 239
249 GeneratePackageListARM64() { 240 GeneratePackageListARM64() {
250 GeneratePackageListCommon "$1" arm64 ${APT_REPO_ARM64:-${APT_REPO}} \ 241 GeneratePackageListCommon "$1" arm64 "${DEBIAN_PACKAGES}
251 "${DEBIAN_PACKAGES} ${DEBIAN_PACKAGES_ARM64:=}" 242 ${DEBIAN_PACKAGES_ARM64:=}"
252 } 243 }
253 244
254 GeneratePackageListMips() { 245 GeneratePackageListMips() {
255 GeneratePackageListCommon "$1" mipsel ${APT_REPO_MIPS:-${APT_REPO}} \ 246 GeneratePackageListCommon "$1" mipsel "${DEBIAN_PACKAGES}"
256 "${DEBIAN_PACKAGES}"
257 } 247 }
258 248
259 StripChecksumsFromPackageList() { 249 StripChecksumsFromPackageList() {
260 local package_file="$1" 250 local package_file="$1"
261 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file" 251 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file"
262 } 252 }
263 253
264 VerifyPackageFilesMatch() { 254 VerifyPackageFilesMatch() {
265 local downloaded_package_file="$1" 255 local downloaded_package_file="$1"
266 local stored_package_file="$2" 256 local stored_package_file="$2"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 local file="$1" 378 local file="$1"
389 local package="${BUILD_DIR}/debian-packages/${file##*/}" 379 local package="${BUILD_DIR}/debian-packages/${file##*/}"
390 shift 380 shift
391 local sha256sum="$1" 381 local sha256sum="$1"
392 shift 382 shift
393 if [ "${#sha256sum}" -ne "64" ]; then 383 if [ "${#sha256sum}" -ne "64" ]; then
394 echo "Bad sha256sum from package list" 384 echo "Bad sha256sum from package list"
395 exit 1 385 exit 1
396 fi 386 fi
397 387
398 Banner "Installing ${file}" 388 Banner "Installing $(basename ${file})"
399 DownloadOrCopy ${APT_REPO}/pool/${file} ${package} 389 DownloadOrCopy ${file} ${package}
400 if [ ! -s "${package}" ] ; then 390 if [ ! -s "${package}" ] ; then
401 echo 391 echo
402 echo "ERROR: bad package ${package}" 392 echo "ERROR: bad package ${package}"
403 exit 1 393 exit 1
404 fi 394 fi
405 echo "${sha256sum} ${package}" | sha256sum --quiet -c 395 echo "${sha256sum} ${package}" | sha256sum --quiet -c
406 396
407 SubBanner "Extracting to ${INSTALL_ROOT}" 397 SubBanner "Extracting to ${INSTALL_ROOT}"
408 dpkg-deb -x ${package} ${INSTALL_ROOT} 398 dpkg-deb -x ${package} ${INSTALL_ROOT}
409 399
(...skipping 18 matching lines...) Expand all
428 cd ${INSTALL_ROOT} 418 cd ${INSTALL_ROOT}
429 local libdirs="lib usr/lib" 419 local libdirs="lib usr/lib"
430 if [ "${ARCH}" != "MIPS" ]; then 420 if [ "${ARCH}" != "MIPS" ]; then
431 libdirs="${libdirs} lib64" 421 libdirs="${libdirs} lib64"
432 fi 422 fi
433 find $libdirs -type l -printf '%p %l\n' | while read link target; do 423 find $libdirs -type l -printf '%p %l\n' | while read link target; do
434 # skip links with non-absolute paths 424 # skip links with non-absolute paths
435 echo "${target}" | grep -qs ^/ || continue 425 echo "${target}" | grep -qs ^/ || continue
436 echo "${link}: ${target}" 426 echo "${link}: ${target}"
437 case "${link}" in 427 case "${link}" in
438 usr/lib/gcc/*-linux-gnu/4.*/* | usr/lib/gcc/arm-linux-gnueabihf/4.*/* |\ 428 usr/lib/gcc/*-linux-gnu/4.*/* | usr/lib/gcc/arm-linux-gnueabihf/4.*/* | \
439 usr/lib/gcc/aarch64-linux-gnu/4.*/*) 429 usr/lib/gcc/aarch64-linux-gnu/4.*/*)
440 # Relativize the symlink. 430 # Relativize the symlink.
441 ln -snfv "../../../../..${target}" "${link}" 431 ln -snfv "../../../../..${target}" "${link}"
442 ;; 432 ;;
443 usr/lib/*-linux-gnu/* | usr/lib/arm-linux-gnueabihf/*) 433 usr/lib/*-linux-gnu/* | usr/lib/arm-linux-gnueabihf/*)
444 # Relativize the symlink. 434 # Relativize the symlink.
445 ln -snfv "../../..${target}" "${link}" 435 ln -snfv "../../..${target}" "${link}"
446 ;; 436 ;;
447 usr/lib/*) 437 usr/lib/*)
448 # Relativize the symlink. 438 # Relativize the symlink.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 BuildSysrootARM() { 503 BuildSysrootARM() {
514 if [ "$HAS_ARCH_ARM" = "0" ]; then 504 if [ "$HAS_ARCH_ARM" = "0" ]; then
515 return 505 return
516 fi 506 fi
517 ClearInstallDir 507 ClearInstallDir
518 local package_file="$BUILD_DIR/package_with_sha256sum_arm" 508 local package_file="$BUILD_DIR/package_with_sha256sum_arm"
519 GeneratePackageListARM "$package_file" 509 GeneratePackageListARM "$package_file"
520 local files_and_sha256sums="$(cat ${package_file})" 510 local files_and_sha256sums="$(cat ${package_file})"
521 StripChecksumsFromPackageList "$package_file" 511 StripChecksumsFromPackageList "$package_file"
522 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM" 512 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM"
523 APT_REPO=${APT_REPO_ARM:=$APT_REPO}
524 InstallIntoSysroot ${files_and_sha256sums} 513 InstallIntoSysroot ${files_and_sha256sums}
525 CleanupJailSymlinks 514 CleanupJailSymlinks
526 HacksAndPatchesARM 515 HacksAndPatchesARM
527 CreateTarBall 516 CreateTarBall
528 } 517 }
529 518
530 #@ 519 #@
531 #@ BuildSysrootARM64 520 #@ BuildSysrootARM64
532 #@ 521 #@
533 #@ Build everything and package it 522 #@ Build everything and package it
534 BuildSysrootARM64() { 523 BuildSysrootARM64() {
535 if [ "$HAS_ARCH_ARM64" = "0" ]; then 524 if [ "$HAS_ARCH_ARM64" = "0" ]; then
536 return 525 return
537 fi 526 fi
538 ClearInstallDir 527 ClearInstallDir
539 local package_file="$BUILD_DIR/package_with_sha256sum_arm64" 528 local package_file="$BUILD_DIR/package_with_sha256sum_arm64"
540 GeneratePackageListARM64 "$package_file" 529 GeneratePackageListARM64 "$package_file"
541 local files_and_sha256sums="$(cat ${package_file})" 530 local files_and_sha256sums="$(cat ${package_file})"
542 StripChecksumsFromPackageList "$package_file" 531 StripChecksumsFromPackageList "$package_file"
543 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM64" 532 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM64"
544 APT_REPO=${APT_REPO_ARM64:=$APT_REPO}
545 InstallIntoSysroot ${files_and_sha256sums} 533 InstallIntoSysroot ${files_and_sha256sums}
546 CleanupJailSymlinks 534 CleanupJailSymlinks
547 HacksAndPatchesARM64 535 HacksAndPatchesARM64
548 CreateTarBall 536 CreateTarBall
549 } 537 }
550 538
551 539
552 #@ 540 #@
553 #@ BuildSysrootMips 541 #@ BuildSysrootMips
554 #@ 542 #@
555 #@ Build everything and package it 543 #@ Build everything and package it
556 BuildSysrootMips() { 544 BuildSysrootMips() {
557 if [ "$HAS_ARCH_MIPS" = "0" ]; then 545 if [ "$HAS_ARCH_MIPS" = "0" ]; then
558 return 546 return
559 fi 547 fi
560 ClearInstallDir 548 ClearInstallDir
561 local package_file="$BUILD_DIR/package_with_sha256sum_mips" 549 local package_file="$BUILD_DIR/package_with_sha256sum_mips"
562 GeneratePackageListMips "$package_file" 550 GeneratePackageListMips "$package_file"
563 local files_and_sha256sums="$(cat ${package_file})" 551 local files_and_sha256sums="$(cat ${package_file})"
564 StripChecksumsFromPackageList "$package_file" 552 StripChecksumsFromPackageList "$package_file"
565 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_MIPS" 553 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_MIPS"
566 APT_REPO=${APT_REPO_MIPS:=$APT_REPO}
567 InstallIntoSysroot ${files_and_sha256sums} 554 InstallIntoSysroot ${files_and_sha256sums}
568 CleanupJailSymlinks 555 CleanupJailSymlinks
569 HacksAndPatchesMips 556 HacksAndPatchesMips
570 CreateTarBall 557 CreateTarBall
571 } 558 }
572 559
573 #@ 560 #@
574 #@ BuildSysrootAll 561 #@ BuildSysrootAll
575 #@ 562 #@
576 #@ Build sysroot images for all architectures 563 #@ Build sysroot images for all architectures
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 657 }
671 658
672 # 659 #
673 # VerifyPackageListing 660 # VerifyPackageListing
674 # 661 #
675 # Verifies the downloaded Packages.bz2 file has the right checksums. 662 # Verifies the downloaded Packages.bz2 file has the right checksums.
676 # 663 #
677 VerifyPackageListing() { 664 VerifyPackageListing() {
678 local file_path="$1" 665 local file_path="$1"
679 local output_file="$2" 666 local output_file="$2"
680 local dist="$3" 667 local repo="$3"
668 local dist="$4"
681 669
682 local repo_basedir="${APT_REPO}/dists/${dist}" 670 local repo_basedir="${repo}/dists/${dist}"
683 local release_list="${repo_basedir}/${RELEASE_FILE}" 671 local release_list="${repo_basedir}/${RELEASE_FILE}"
684 local release_list_gpg="${repo_basedir}/${RELEASE_FILE_GPG}" 672 local release_list_gpg="${repo_basedir}/${RELEASE_FILE_GPG}"
685 673
686 local release_file="${BUILD_DIR}/${dist}-${RELEASE_FILE}" 674 local release_file="${BUILD_DIR}/${dist}-${RELEASE_FILE}"
687 local release_file_gpg="${BUILD_DIR}/${dist}-${RELEASE_FILE_GPG}" 675 local release_file_gpg="${BUILD_DIR}/${dist}-${RELEASE_FILE_GPG}"
688 676
689 CheckForDebianGPGKeyring 677 CheckForDebianGPGKeyring
690 678
691 DownloadOrCopy ${release_list} ${release_file} 679 DownloadOrCopy ${release_list} ${release_file}
692 DownloadOrCopy ${release_list_gpg} ${release_file_gpg} 680 DownloadOrCopy ${release_list_gpg} ${release_file_gpg}
(...skipping 22 matching lines...) Expand all
715 # 703 #
716 GeneratePackageList() { 704 GeneratePackageList() {
717 local input_file="$1" 705 local input_file="$1"
718 local output_file="$2" 706 local output_file="$2"
719 echo "Updating: ${output_file} from ${input_file}" 707 echo "Updating: ${output_file} from ${input_file}"
720 /bin/rm -f "${output_file}" 708 /bin/rm -f "${output_file}"
721 shift 709 shift
722 shift 710 shift
723 for pkg in $@ ; do 711 for pkg in $@ ; do
724 local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \ 712 local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \
725 egrep -o "pool/.*") 713 egrep "pool/.*" | sed 's/.*Filename: //')
726 if [ -z "${pkg_full}" ]; then 714 if [ -z "${pkg_full}" ]; then
727 echo "ERROR: missing package: $pkg" 715 echo "ERROR: missing package: $pkg"
728 exit 1 716 exit 1
729 fi 717 fi
730 local pkg_nopool=$(echo "$pkg_full" | sed "s/^pool\///")
731 local sha256sum=$(grep -A 4 " ${pkg}\$" "$input_file" | \ 718 local sha256sum=$(grep -A 4 " ${pkg}\$" "$input_file" | \
732 grep ^SHA256: | sed 's/^SHA256: //') 719 grep ^SHA256: | sed 's/^SHA256: //')
733 if [ "${#sha256sum}" -ne "64" ]; then 720 if [ "${#sha256sum}" -ne "64" ]; then
734 echo "Bad sha256sum from Packages" 721 echo "Bad sha256sum from Packages"
735 exit 1 722 exit 1
736 fi 723 fi
737 echo $pkg_nopool $sha256sum >> "$output_file" 724 echo $pkg_full $sha256sum >> "$output_file"
738 done 725 done
739 # sort -o does an in-place sort of this file 726 # sort -o does an in-place sort of this file
740 sort "$output_file" -o "$output_file" 727 sort "$output_file" -o "$output_file"
741 } 728 }
742 729
743 #@ 730 #@
744 #@ UpdatePackageListsAmd64 731 #@ UpdatePackageListsAmd64
745 #@ 732 #@
746 #@ Regenerate the package lists such that they contain an up-to-date 733 #@ Regenerate the package lists such that they contain an up-to-date
747 #@ list of URLs within the Debian archive. (For amd64) 734 #@ list of URLs within the Debian archive. (For amd64)
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 echo " $0 help" 859 echo " $0 help"
873 exit 1 860 exit 1
874 else 861 else
875 ChangeDirectory 862 ChangeDirectory
876 if echo $1 | grep -qs --regexp='\(^Print\)\|\(All$\)'; then 863 if echo $1 | grep -qs --regexp='\(^Print\)\|\(All$\)'; then
877 "$@" 864 "$@"
878 else 865 else
879 RunCommand "$@" 866 RunCommand "$@"
880 fi 867 fi
881 fi 868 fi
OLDNEW
« no previous file with comments | « build/linux/sysroot_scripts/debian-archive-jessie-stable.gpg ('k') | build/linux/sysroot_scripts/sysroot-creator-jessie.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698