| OLD | NEW |
| 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="curl gunzip" |
| 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 Loading... |
| 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.$$" |
| 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 Loading... |
| 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() { |
| 189 if [ "${PACKAGES_EXT}" = "bz2" ]; then | 185 local src_file="$1" |
| 190 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" | 186 local dst_file="$2" |
| 191 else | 187 local repo="$3" |
| 192 xzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" | 188 gunzip -c "${src_file}" | egrep '^(Package:|Filename:|SHA256:) ' | |
| 193 fi | 189 sed "s|Filename: |Filename: ${repo}|" > "${dst_file}" |
| 194 } | 190 } |
| 195 | 191 |
| 196 GeneratePackageListDist() { | 192 GeneratePackageListDist() { |
| 197 local arch="$1" | 193 local arch="$1" |
| 198 local apt_url="$2" | 194 set -- $2 |
| 199 local dist="$3" | 195 local repo="$1" |
| 200 local repo_name="$4" | 196 local dist="$2" |
| 197 local repo_name="$3" |
| 201 | 198 |
| 202 TMP_PACKAGE_LIST="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}" | 199 TMP_PACKAGE_LIST="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}" |
| 203 local repo_basedir="${apt_url}/dists/${dist}" | 200 local repo_basedir="${repo}/dists/${dist}" |
| 204 local package_list="${BUILD_DIR}/Packages.${dist}_${repo_name}_${arch}.${PACKA
GES_EXT}" | 201 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}" | 202 local package_file_arch="${repo_name}/binary-${arch}/Packages.${PACKAGES_EXT}" |
| 206 local package_list_arch="${repo_basedir}/${package_file_arch}" | 203 local package_list_arch="${repo_basedir}/${package_file_arch}" |
| 207 | 204 |
| 208 DownloadOrCopy "${package_list_arch}" "${package_list}" | 205 DownloadOrCopy "${package_list_arch}" "${package_list}" |
| 209 VerifyPackageListing "${package_file_arch}" "${package_list}" ${dist} | 206 VerifyPackageListing "${package_file_arch}" "${package_list}" ${repo} ${dist} |
| 210 ExtractPackageBz2 "${package_list}" "${TMP_PACKAGE_LIST}" | 207 ExtractPackageGz "${package_list}" "${TMP_PACKAGE_LIST}" ${repo} |
| 211 } | 208 } |
| 212 | 209 |
| 213 GeneratePackageListCommon() { | 210 GeneratePackageListCommon() { |
| 214 local output_file="$1" | 211 local output_file="$1" |
| 215 local arch="$2" | 212 local arch="$2" |
| 216 local apt_url="$3" | 213 local packages="$3" |
| 217 local packages="$4" | |
| 218 | 214 |
| 219 local dists="${DIST} ${DIST_UPDATES:-}" | 215 local dists="${DIST} ${DIST_UPDATES:-}" |
| 220 local repos="main ${REPO_EXTRA:-}" | 216 local repos="main ${REPO_EXTRA:-}" |
| 221 | 217 |
| 222 local list_base="${BUILD_DIR}/Packages.${DIST}_${arch}" | 218 local list_base="${BUILD_DIR}/Packages.${DIST}_${arch}" |
| 223 > "${list_base}" | 219 > "${list_base}" # Create (or truncate) a zero-length file. |
| 224 for dist in ${dists}; do | 220 echo "${APT_SOURCES_LIST}" | while read source; do |
| 225 for repo in ${repos}; do | 221 GeneratePackageListDist "${arch}" "${source}" |
| 226 GeneratePackageListDist "${arch}" "${apt_url}" "${dist}" "${repo}" | 222 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 | 223 done |
| 230 | 224 |
| 231 GeneratePackageList "${list_base}" "${output_file}" "${packages}" | 225 GeneratePackageList "${list_base}" "${output_file}" "${packages}" |
| 232 } | 226 } |
| 233 | 227 |
| 234 GeneratePackageListAmd64() { | 228 GeneratePackageListAmd64() { |
| 235 GeneratePackageListCommon "$1" amd64 ${APT_REPO} "${DEBIAN_PACKAGES} | 229 GeneratePackageListCommon "$1" amd64 "${DEBIAN_PACKAGES} |
| 236 ${DEBIAN_PACKAGES_X86:=} ${DEBIAN_PACKAGES_AMD64:=}" | 230 ${DEBIAN_PACKAGES_X86:=} ${DEBIAN_PACKAGES_AMD64:=}" |
| 237 } | 231 } |
| 238 | 232 |
| 239 GeneratePackageListI386() { | 233 GeneratePackageListI386() { |
| 240 GeneratePackageListCommon "$1" i386 ${APT_REPO} "${DEBIAN_PACKAGES} | 234 GeneratePackageListCommon "$1" i386 "${DEBIAN_PACKAGES} |
| 241 ${DEBIAN_PACKAGES_X86:=}" | 235 ${DEBIAN_PACKAGES_X86:=}" |
| 242 } | 236 } |
| 243 | 237 |
| 244 GeneratePackageListARM() { | 238 GeneratePackageListARM() { |
| 245 GeneratePackageListCommon "$1" armhf ${APT_REPO_ARM:-${APT_REPO}} \ | 239 GeneratePackageListCommon "$1" armhf "${DEBIAN_PACKAGES} |
| 246 "${DEBIAN_PACKAGES} ${DEBIAN_PACKAGES_ARM:=}" | 240 ${DEBIAN_PACKAGES_ARM:=}" |
| 247 } | 241 } |
| 248 | 242 |
| 249 GeneratePackageListARM64() { | 243 GeneratePackageListARM64() { |
| 250 GeneratePackageListCommon "$1" arm64 ${APT_REPO_ARM64:-${APT_REPO}} \ | 244 GeneratePackageListCommon "$1" arm64 "${DEBIAN_PACKAGES} |
| 251 "${DEBIAN_PACKAGES} ${DEBIAN_PACKAGES_ARM64:=}" | 245 ${DEBIAN_PACKAGES_ARM64:=}" |
| 252 } | 246 } |
| 253 | 247 |
| 254 GeneratePackageListMips() { | 248 GeneratePackageListMips() { |
| 255 GeneratePackageListCommon "$1" mipsel ${APT_REPO_MIPS:-${APT_REPO}} \ | 249 GeneratePackageListCommon "$1" mipsel "${DEBIAN_PACKAGES}" |
| 256 "${DEBIAN_PACKAGES}" | |
| 257 } | 250 } |
| 258 | 251 |
| 259 StripChecksumsFromPackageList() { | 252 StripChecksumsFromPackageList() { |
| 260 local package_file="$1" | 253 local package_file="$1" |
| 261 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file" | 254 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file" |
| 262 } | 255 } |
| 263 | 256 |
| 264 VerifyPackageFilesMatch() { | 257 VerifyPackageFilesMatch() { |
| 265 local downloaded_package_file="$1" | 258 local downloaded_package_file="$1" |
| 266 local stored_package_file="$2" | 259 local stored_package_file="$2" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 local file="$1" | 381 local file="$1" |
| 389 local package="${BUILD_DIR}/debian-packages/${file##*/}" | 382 local package="${BUILD_DIR}/debian-packages/${file##*/}" |
| 390 shift | 383 shift |
| 391 local sha256sum="$1" | 384 local sha256sum="$1" |
| 392 shift | 385 shift |
| 393 if [ "${#sha256sum}" -ne "64" ]; then | 386 if [ "${#sha256sum}" -ne "64" ]; then |
| 394 echo "Bad sha256sum from package list" | 387 echo "Bad sha256sum from package list" |
| 395 exit 1 | 388 exit 1 |
| 396 fi | 389 fi |
| 397 | 390 |
| 398 Banner "Installing ${file}" | 391 Banner "Installing $(basename ${file})" |
| 399 DownloadOrCopy ${APT_REPO}/pool/${file} ${package} | 392 DownloadOrCopy ${file} ${package} |
| 400 if [ ! -s "${package}" ] ; then | 393 if [ ! -s "${package}" ] ; then |
| 401 echo | 394 echo |
| 402 echo "ERROR: bad package ${package}" | 395 echo "ERROR: bad package ${package}" |
| 403 exit 1 | 396 exit 1 |
| 404 fi | 397 fi |
| 405 echo "${sha256sum} ${package}" | sha256sum --quiet -c | 398 echo "${sha256sum} ${package}" | sha256sum --quiet -c |
| 406 | 399 |
| 407 SubBanner "Extracting to ${INSTALL_ROOT}" | 400 SubBanner "Extracting to ${INSTALL_ROOT}" |
| 408 dpkg-deb -x ${package} ${INSTALL_ROOT} | 401 dpkg-deb -x ${package} ${INSTALL_ROOT} |
| 409 | 402 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 428 cd ${INSTALL_ROOT} | 421 cd ${INSTALL_ROOT} |
| 429 local libdirs="lib usr/lib" | 422 local libdirs="lib usr/lib" |
| 430 if [ "${ARCH}" != "MIPS" ]; then | 423 if [ "${ARCH}" != "MIPS" ]; then |
| 431 libdirs="${libdirs} lib64" | 424 libdirs="${libdirs} lib64" |
| 432 fi | 425 fi |
| 433 find $libdirs -type l -printf '%p %l\n' | while read link target; do | 426 find $libdirs -type l -printf '%p %l\n' | while read link target; do |
| 434 # skip links with non-absolute paths | 427 # skip links with non-absolute paths |
| 435 echo "${target}" | grep -qs ^/ || continue | 428 echo "${target}" | grep -qs ^/ || continue |
| 436 echo "${link}: ${target}" | 429 echo "${link}: ${target}" |
| 437 case "${link}" in | 430 case "${link}" in |
| 438 usr/lib/gcc/*-linux-gnu/4.*/* | usr/lib/gcc/arm-linux-gnueabihf/4.*/* |\ | 431 usr/lib/gcc/*-linux-gnu/4.*/* | usr/lib/gcc/arm-linux-gnueabihf/4.*/* | \ |
| 439 usr/lib/gcc/aarch64-linux-gnu/4.*/*) | 432 usr/lib/gcc/aarch64-linux-gnu/4.*/*) |
| 440 # Relativize the symlink. | 433 # Relativize the symlink. |
| 441 ln -snfv "../../../../..${target}" "${link}" | 434 ln -snfv "../../../../..${target}" "${link}" |
| 442 ;; | 435 ;; |
| 443 usr/lib/*-linux-gnu/* | usr/lib/arm-linux-gnueabihf/*) | 436 usr/lib/*-linux-gnu/* | usr/lib/arm-linux-gnueabihf/*) |
| 444 # Relativize the symlink. | 437 # Relativize the symlink. |
| 445 ln -snfv "../../..${target}" "${link}" | 438 ln -snfv "../../..${target}" "${link}" |
| 446 ;; | 439 ;; |
| 447 usr/lib/*) | 440 usr/lib/*) |
| 448 # Relativize the symlink. | 441 # Relativize the symlink. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 BuildSysrootARM() { | 506 BuildSysrootARM() { |
| 514 if [ "$HAS_ARCH_ARM" = "0" ]; then | 507 if [ "$HAS_ARCH_ARM" = "0" ]; then |
| 515 return | 508 return |
| 516 fi | 509 fi |
| 517 ClearInstallDir | 510 ClearInstallDir |
| 518 local package_file="$BUILD_DIR/package_with_sha256sum_arm" | 511 local package_file="$BUILD_DIR/package_with_sha256sum_arm" |
| 519 GeneratePackageListARM "$package_file" | 512 GeneratePackageListARM "$package_file" |
| 520 local files_and_sha256sums="$(cat ${package_file})" | 513 local files_and_sha256sums="$(cat ${package_file})" |
| 521 StripChecksumsFromPackageList "$package_file" | 514 StripChecksumsFromPackageList "$package_file" |
| 522 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM" | 515 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM" |
| 523 APT_REPO=${APT_REPO_ARM:=$APT_REPO} | |
| 524 InstallIntoSysroot ${files_and_sha256sums} | 516 InstallIntoSysroot ${files_and_sha256sums} |
| 525 CleanupJailSymlinks | 517 CleanupJailSymlinks |
| 526 HacksAndPatchesARM | 518 HacksAndPatchesARM |
| 527 CreateTarBall | 519 CreateTarBall |
| 528 } | 520 } |
| 529 | 521 |
| 530 #@ | 522 #@ |
| 531 #@ BuildSysrootARM64 | 523 #@ BuildSysrootARM64 |
| 532 #@ | 524 #@ |
| 533 #@ Build everything and package it | 525 #@ Build everything and package it |
| 534 BuildSysrootARM64() { | 526 BuildSysrootARM64() { |
| 535 if [ "$HAS_ARCH_ARM64" = "0" ]; then | 527 if [ "$HAS_ARCH_ARM64" = "0" ]; then |
| 536 return | 528 return |
| 537 fi | 529 fi |
| 538 ClearInstallDir | 530 ClearInstallDir |
| 539 local package_file="$BUILD_DIR/package_with_sha256sum_arm64" | 531 local package_file="$BUILD_DIR/package_with_sha256sum_arm64" |
| 540 GeneratePackageListARM64 "$package_file" | 532 GeneratePackageListARM64 "$package_file" |
| 541 local files_and_sha256sums="$(cat ${package_file})" | 533 local files_and_sha256sums="$(cat ${package_file})" |
| 542 StripChecksumsFromPackageList "$package_file" | 534 StripChecksumsFromPackageList "$package_file" |
| 543 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM64" | 535 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_ARM64" |
| 544 APT_REPO=${APT_REPO_ARM64:=$APT_REPO} | |
| 545 InstallIntoSysroot ${files_and_sha256sums} | 536 InstallIntoSysroot ${files_and_sha256sums} |
| 546 CleanupJailSymlinks | 537 CleanupJailSymlinks |
| 547 HacksAndPatchesARM64 | 538 HacksAndPatchesARM64 |
| 548 CreateTarBall | 539 CreateTarBall |
| 549 } | 540 } |
| 550 | 541 |
| 551 | 542 |
| 552 #@ | 543 #@ |
| 553 #@ BuildSysrootMips | 544 #@ BuildSysrootMips |
| 554 #@ | 545 #@ |
| 555 #@ Build everything and package it | 546 #@ Build everything and package it |
| 556 BuildSysrootMips() { | 547 BuildSysrootMips() { |
| 557 if [ "$HAS_ARCH_MIPS" = "0" ]; then | 548 if [ "$HAS_ARCH_MIPS" = "0" ]; then |
| 558 return | 549 return |
| 559 fi | 550 fi |
| 560 ClearInstallDir | 551 ClearInstallDir |
| 561 local package_file="$BUILD_DIR/package_with_sha256sum_mips" | 552 local package_file="$BUILD_DIR/package_with_sha256sum_mips" |
| 562 GeneratePackageListMips "$package_file" | 553 GeneratePackageListMips "$package_file" |
| 563 local files_and_sha256sums="$(cat ${package_file})" | 554 local files_and_sha256sums="$(cat ${package_file})" |
| 564 StripChecksumsFromPackageList "$package_file" | 555 StripChecksumsFromPackageList "$package_file" |
| 565 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_MIPS" | 556 VerifyPackageFilesMatch "$package_file" "$DEBIAN_DEP_LIST_MIPS" |
| 566 APT_REPO=${APT_REPO_MIPS:=$APT_REPO} | |
| 567 InstallIntoSysroot ${files_and_sha256sums} | 557 InstallIntoSysroot ${files_and_sha256sums} |
| 568 CleanupJailSymlinks | 558 CleanupJailSymlinks |
| 569 HacksAndPatchesMips | 559 HacksAndPatchesMips |
| 570 CreateTarBall | 560 CreateTarBall |
| 571 } | 561 } |
| 572 | 562 |
| 573 #@ | 563 #@ |
| 574 #@ BuildSysrootAll | 564 #@ BuildSysrootAll |
| 575 #@ | 565 #@ |
| 576 #@ Build sysroot images for all architectures | 566 #@ Build sysroot images for all architectures |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 } | 660 } |
| 671 | 661 |
| 672 # | 662 # |
| 673 # VerifyPackageListing | 663 # VerifyPackageListing |
| 674 # | 664 # |
| 675 # Verifies the downloaded Packages.bz2 file has the right checksums. | 665 # Verifies the downloaded Packages.bz2 file has the right checksums. |
| 676 # | 666 # |
| 677 VerifyPackageListing() { | 667 VerifyPackageListing() { |
| 678 local file_path="$1" | 668 local file_path="$1" |
| 679 local output_file="$2" | 669 local output_file="$2" |
| 680 local dist="$3" | 670 local repo="$3" |
| 671 local dist="$4" |
| 681 | 672 |
| 682 local repo_basedir="${APT_REPO}/dists/${dist}" | 673 local repo_basedir="${repo}/dists/${dist}" |
| 683 local release_list="${repo_basedir}/${RELEASE_FILE}" | 674 local release_list="${repo_basedir}/${RELEASE_FILE}" |
| 684 local release_list_gpg="${repo_basedir}/${RELEASE_FILE_GPG}" | 675 local release_list_gpg="${repo_basedir}/${RELEASE_FILE_GPG}" |
| 685 | 676 |
| 686 local release_file="${BUILD_DIR}/${dist}-${RELEASE_FILE}" | 677 local release_file="${BUILD_DIR}/${dist}-${RELEASE_FILE}" |
| 687 local release_file_gpg="${BUILD_DIR}/${dist}-${RELEASE_FILE_GPG}" | 678 local release_file_gpg="${BUILD_DIR}/${dist}-${RELEASE_FILE_GPG}" |
| 688 | 679 |
| 689 CheckForDebianGPGKeyring | 680 CheckForDebianGPGKeyring |
| 690 | 681 |
| 691 DownloadOrCopy ${release_list} ${release_file} | 682 DownloadOrCopy ${release_list} ${release_file} |
| 692 DownloadOrCopy ${release_list_gpg} ${release_file_gpg} | 683 DownloadOrCopy ${release_list_gpg} ${release_file_gpg} |
| (...skipping 22 matching lines...) Expand all Loading... |
| 715 # | 706 # |
| 716 GeneratePackageList() { | 707 GeneratePackageList() { |
| 717 local input_file="$1" | 708 local input_file="$1" |
| 718 local output_file="$2" | 709 local output_file="$2" |
| 719 echo "Updating: ${output_file} from ${input_file}" | 710 echo "Updating: ${output_file} from ${input_file}" |
| 720 /bin/rm -f "${output_file}" | 711 /bin/rm -f "${output_file}" |
| 721 shift | 712 shift |
| 722 shift | 713 shift |
| 723 for pkg in $@ ; do | 714 for pkg in $@ ; do |
| 724 local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \ | 715 local pkg_full=$(grep -A 1 " ${pkg}\$" "$input_file" | \ |
| 725 egrep -o "pool/.*") | 716 egrep "pool/.*" | sed 's/.*Filename: //') |
| 726 if [ -z "${pkg_full}" ]; then | 717 if [ -z "${pkg_full}" ]; then |
| 727 echo "ERROR: missing package: $pkg" | 718 echo "ERROR: missing package: $pkg" |
| 728 exit 1 | 719 exit 1 |
| 729 fi | 720 fi |
| 730 local pkg_nopool=$(echo "$pkg_full" | sed "s/^pool\///") | |
| 731 local sha256sum=$(grep -A 4 " ${pkg}\$" "$input_file" | \ | 721 local sha256sum=$(grep -A 4 " ${pkg}\$" "$input_file" | \ |
| 732 grep ^SHA256: | sed 's/^SHA256: //') | 722 grep ^SHA256: | sed 's/^SHA256: //') |
| 733 if [ "${#sha256sum}" -ne "64" ]; then | 723 if [ "${#sha256sum}" -ne "64" ]; then |
| 734 echo "Bad sha256sum from Packages" | 724 echo "Bad sha256sum from Packages" |
| 735 exit 1 | 725 exit 1 |
| 736 fi | 726 fi |
| 737 echo $pkg_nopool $sha256sum >> "$output_file" | 727 echo $pkg_full $sha256sum >> "$output_file" |
| 738 done | 728 done |
| 739 # sort -o does an in-place sort of this file | 729 # sort -o does an in-place sort of this file |
| 740 sort "$output_file" -o "$output_file" | 730 sort "$output_file" -o "$output_file" |
| 741 } | 731 } |
| 742 | 732 |
| 743 #@ | 733 #@ |
| 744 #@ UpdatePackageListsAmd64 | 734 #@ UpdatePackageListsAmd64 |
| 745 #@ | 735 #@ |
| 746 #@ Regenerate the package lists such that they contain an up-to-date | 736 #@ Regenerate the package lists such that they contain an up-to-date |
| 747 #@ list of URLs within the Debian archive. (For amd64) | 737 #@ list of URLs within the Debian archive. (For amd64) |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 echo " $0 help" | 862 echo " $0 help" |
| 873 exit 1 | 863 exit 1 |
| 874 else | 864 else |
| 875 ChangeDirectory | 865 ChangeDirectory |
| 876 if echo $1 | grep -qs --regexp='\(^Print\)\|\(All$\)'; then | 866 if echo $1 | grep -qs --regexp='\(^Print\)\|\(All$\)'; then |
| 877 "$@" | 867 "$@" |
| 878 else | 868 else |
| 879 RunCommand "$@" | 869 RunCommand "$@" |
| 880 fi | 870 fi |
| 881 fi | 871 fi |
| OLD | NEW |