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-trusty.sh). Its up to the parent scripts | 6 # scripts (e.g. sysroot-creator-trusty.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=trusty | 9 # DIST=trusty |
10 # APT_REPO=http://archive.ubuntu.com/ubuntu | 10 # APT_REPO=http://archive.ubuntu.com/ubuntu |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 echo "error: KEYRING_FILE not defined" | 42 echo "error: KEYRING_FILE not defined" |
43 exit 1 | 43 exit 1 |
44 fi | 44 fi |
45 | 45 |
46 if [ -z "${DEBIAN_PACKAGES:-}" ]; then | 46 if [ -z "${DEBIAN_PACKAGES:-}" ]; then |
47 echo "error: DEBIAN_PACKAGES not defined" | 47 echo "error: DEBIAN_PACKAGES not defined" |
48 exit 1 | 48 exit 1 |
49 fi | 49 fi |
50 | 50 |
51 readonly REPO_BASEDIR="${APT_REPO}/dists/${DIST}" | 51 readonly REPO_BASEDIR="${APT_REPO}/dists/${DIST}" |
52 readonly REPO_BASEDIR_ARM=${REPO_BASEDIR_ARM:=$REPO_BASEDIR} | |
53 readonly REPO_BASEDIR_ARM64=${REPO_BASEDIR_ARM64:=$REPO_BASEDIR} | |
54 readonly REPO_BASEDIR_MIPS=${REPO_BASEDIR_MIPS:=$REPO_BASEDIR} | |
55 | 52 |
56 readonly HAS_ARCH_AMD64=${HAS_ARCH_AMD64:=0} | 53 readonly HAS_ARCH_AMD64=${HAS_ARCH_AMD64:=0} |
57 readonly HAS_ARCH_I386=${HAS_ARCH_I386:=0} | 54 readonly HAS_ARCH_I386=${HAS_ARCH_I386:=0} |
58 readonly HAS_ARCH_ARM=${HAS_ARCH_ARM:=0} | 55 readonly HAS_ARCH_ARM=${HAS_ARCH_ARM:=0} |
59 readonly HAS_ARCH_ARM64=${HAS_ARCH_ARM64:=0} | 56 readonly HAS_ARCH_ARM64=${HAS_ARCH_ARM64:=0} |
60 readonly HAS_ARCH_MIPS=${HAS_ARCH_MIPS:=0} | 57 readonly HAS_ARCH_MIPS=${HAS_ARCH_MIPS:=0} |
61 | 58 |
62 readonly REQUIRED_TOOLS="wget" | 59 readonly REQUIRED_TOOLS="wget" |
63 | 60 |
64 ###################################################################### | 61 ###################################################################### |
65 # Package Config | 62 # Package Config |
66 ###################################################################### | 63 ###################################################################### |
67 | 64 |
68 PACKAGES_EXT=${PACKAGES_EXT:-bz2} | 65 PACKAGES_EXT=${PACKAGES_EXT:-bz2} |
69 readonly RELEASE_FILE="Release" | 66 readonly RELEASE_FILE="Release" |
70 readonly RELEASE_FILE_GPG="Release.gpg" | 67 readonly RELEASE_FILE_GPG="Release.gpg" |
71 readonly RELEASE_LIST="${REPO_BASEDIR}/${RELEASE_FILE}" | 68 readonly RELEASE_LIST="${REPO_BASEDIR}/${RELEASE_FILE}" |
72 readonly RELEASE_LIST_GPG="${REPO_BASEDIR}/${RELEASE_FILE_GPG}" | 69 readonly RELEASE_LIST_GPG="${REPO_BASEDIR}/${RELEASE_FILE_GPG}" |
73 readonly PACKAGE_FILE_AMD64="main/binary-amd64/Packages.${PACKAGES_EXT}" | |
74 readonly PACKAGE_FILE_I386="main/binary-i386/Packages.${PACKAGES_EXT}" | |
75 readonly PACKAGE_FILE_ARM="main/binary-armhf/Packages.${PACKAGES_EXT}" | |
76 readonly PACKAGE_FILE_ARM64="main/binary-arm64/Packages.${PACKAGES_EXT}" | |
77 readonly PACKAGE_FILE_MIPS="main/binary-mipsel/Packages.${PACKAGES_EXT}" | |
78 readonly PACKAGE_LIST_AMD64="${REPO_BASEDIR}/${PACKAGE_FILE_AMD64}" | |
79 readonly PACKAGE_LIST_I386="${REPO_BASEDIR}/${PACKAGE_FILE_I386}" | |
80 readonly PACKAGE_LIST_ARM="${REPO_BASEDIR_ARM}/${PACKAGE_FILE_ARM}" | |
81 readonly PACKAGE_LIST_ARM64="${REPO_BASEDIR_ARM64}/${PACKAGE_FILE_ARM64}" | |
82 readonly PACKAGE_LIST_MIPS="${REPO_BASEDIR_MIPS}/${PACKAGE_FILE_MIPS}" | |
83 | 70 |
84 readonly DEBIAN_DEP_LIST_AMD64="packagelist.${DIST}.amd64" | 71 readonly DEBIAN_DEP_LIST_AMD64="packagelist.${DIST}.amd64" |
85 readonly DEBIAN_DEP_LIST_I386="packagelist.${DIST}.i386" | 72 readonly DEBIAN_DEP_LIST_I386="packagelist.${DIST}.i386" |
86 readonly DEBIAN_DEP_LIST_ARM="packagelist.${DIST}.arm" | 73 readonly DEBIAN_DEP_LIST_ARM="packagelist.${DIST}.arm" |
87 readonly DEBIAN_DEP_LIST_ARM64="packagelist.${DIST}.arm64" | 74 readonly DEBIAN_DEP_LIST_ARM64="packagelist.${DIST}.arm64" |
88 readonly DEBIAN_DEP_LIST_MIPS="packagelist.${DIST}.mipsel" | 75 readonly DEBIAN_DEP_LIST_MIPS="packagelist.${DIST}.mipsel" |
89 | 76 |
90 ###################################################################### | 77 ###################################################################### |
91 # Helper | 78 # Helper |
92 ###################################################################### | 79 ###################################################################### |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 } | 186 } |
200 | 187 |
201 ExtractPackageBz2() { | 188 ExtractPackageBz2() { |
202 if [ "${PACKAGES_EXT}" = "bz2" ]; then | 189 if [ "${PACKAGES_EXT}" = "bz2" ]; then |
203 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" | 190 bzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" |
204 else | 191 else |
205 xzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" | 192 xzcat "$1" | egrep '^(Package:|Filename:|SHA256:) ' > "$2" |
206 fi | 193 fi |
207 } | 194 } |
208 | 195 |
| 196 GeneratePackageListCommon() { |
| 197 local output_file="$1" |
| 198 local arch="$2" |
| 199 local apt_repo="$3" |
| 200 local packages="$4" |
| 201 |
| 202 local repo_basedir="${apt_repo}/dists/${DIST}" |
| 203 local package_list="${BUILD_DIR}/Packages.${DIST}_${arch}.${PACKAGES_EXT}" |
| 204 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_${arch}" |
| 205 local package_file_arch="main/binary-${arch}/Packages.${PACKAGES_EXT}" |
| 206 local package_list_arch="${repo_basedir}/${package_file_arch}" |
| 207 |
| 208 DownloadOrCopy "${package_list_arch}" "${package_list}" |
| 209 VerifyPackageListing "${package_file_arch}" "${package_list}" |
| 210 ExtractPackageBz2 "$package_list" "$tmp_package_list" |
| 211 GeneratePackageList "$tmp_package_list" "$output_file" "${packages}" |
| 212 } |
| 213 |
209 GeneratePackageListAmd64() { | 214 GeneratePackageListAmd64() { |
210 local output_file="$1" | 215 GeneratePackageListCommon "$1" amd64 ${APT_REPO} "${DEBIAN_PACKAGES} |
211 local package_list="${BUILD_DIR}/Packages.${DIST}_amd64.${PACKAGES_EXT}" | |
212 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_amd64" | |
213 DownloadOrCopy "${PACKAGE_LIST_AMD64}" "${package_list}" | |
214 VerifyPackageListing "${PACKAGE_FILE_AMD64}" "${package_list}" | |
215 ExtractPackageBz2 "$package_list" "$tmp_package_list" | |
216 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} | |
217 ${DEBIAN_PACKAGES_X86:=} ${DEBIAN_PACKAGES_AMD64:=}" | 216 ${DEBIAN_PACKAGES_X86:=} ${DEBIAN_PACKAGES_AMD64:=}" |
218 } | 217 } |
219 | 218 |
220 GeneratePackageListI386() { | 219 GeneratePackageListI386() { |
221 local output_file="$1" | 220 GeneratePackageListCommon "$1" i386 ${APT_REPO} "${DEBIAN_PACKAGES} |
222 local package_list="${BUILD_DIR}/Packages.${DIST}_i386.${PACKAGES_EXT}" | |
223 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_amd64" | |
224 DownloadOrCopy "${PACKAGE_LIST_I386}" "${package_list}" | |
225 VerifyPackageListing "${PACKAGE_FILE_I386}" "${package_list}" | |
226 ExtractPackageBz2 "$package_list" "$tmp_package_list" | |
227 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} | |
228 ${DEBIAN_PACKAGES_X86:=}" | 221 ${DEBIAN_PACKAGES_X86:=}" |
229 } | 222 } |
230 | 223 |
231 GeneratePackageListARM() { | 224 GeneratePackageListARM() { |
232 local output_file="$1" | 225 GeneratePackageListCommon "$1" armhf ${APT_REPO_ARM:-${APT_REPO}} \ |
233 local package_list="${BUILD_DIR}/Packages.${DIST}_arm.${PACKAGES_EXT}" | 226 "${DEBIAN_PACKAGES} ${DEBIAN_PACKAGES_ARM:=}" |
234 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_arm" | |
235 DownloadOrCopy "${PACKAGE_LIST_ARM}" "${package_list}" | |
236 VerifyPackageListing "${PACKAGE_FILE_ARM}" "${package_list}" | |
237 ExtractPackageBz2 "$package_list" "$tmp_package_list" | |
238 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} | |
239 ${DEBIAN_PACKAGES_ARM:=}" | |
240 } | 227 } |
241 | 228 |
242 GeneratePackageListARM64() { | 229 GeneratePackageListARM64() { |
243 local output_file="$1" | 230 GeneratePackageListCommon "$1" arm64 ${APT_REPO_ARM64:-${APT_REPO}} \ |
244 local package_list="${BUILD_DIR}/Packages.${DIST}_arm64.${PACKAGES_EXT}" | 231 "${DEBIAN_PACKAGES} ${DEBIAN_PACKAGES_ARM64:=}" |
245 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_arm64" | |
246 DownloadOrCopy "${PACKAGE_LIST_ARM64}" "${package_list}" | |
247 VerifyPackageListing "${PACKAGE_FILE_ARM64}" "${package_list}" | |
248 ExtractPackageBz2 "$package_list" "$tmp_package_list" | |
249 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES} | |
250 ${DEBIAN_PACKAGES_ARM64:=}" | |
251 } | 232 } |
252 | 233 |
253 GeneratePackageListMips() { | 234 GeneratePackageListMips() { |
254 local output_file="$1" | 235 GeneratePackageListCommon "$1" mipsel ${APT_REPO_MIPS:-${APT_REPO}} \ |
255 local package_list="${BUILD_DIR}/Packages.${DIST}_mips.${PACKAGES_EXT}" | 236 "${DEBIAN_PACKAGES}" |
256 local tmp_package_list="${BUILD_DIR}/Packages.${DIST}_mips" | |
257 DownloadOrCopy "${PACKAGE_LIST_MIPS}" "${package_list}" | |
258 VerifyPackageListing "${PACKAGE_FILE_MIPS}" "${package_list}" | |
259 ExtractPackageBz2 "$package_list" "$tmp_package_list" | |
260 GeneratePackageList "$tmp_package_list" "$output_file" "${DEBIAN_PACKAGES}" | |
261 } | 237 } |
262 | 238 |
263 StripChecksumsFromPackageList() { | 239 StripChecksumsFromPackageList() { |
264 local package_file="$1" | 240 local package_file="$1" |
265 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file" | 241 sed -i 's/ [a-f0-9]\{64\}$//' "$package_file" |
266 } | 242 } |
267 | 243 |
268 VerifyPackageFilesMatch() { | 244 VerifyPackageFilesMatch() { |
269 local downloaded_package_file="$1" | 245 local downloaded_package_file="$1" |
270 local stored_package_file="$2" | 246 local stored_package_file="$2" |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 return | 753 return |
778 fi | 754 fi |
779 GeneratePackageListARM "$DEBIAN_DEP_LIST_ARM" | 755 GeneratePackageListARM "$DEBIAN_DEP_LIST_ARM" |
780 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_ARM" | 756 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_ARM" |
781 } | 757 } |
782 | 758 |
783 #@ | 759 #@ |
784 #@ UpdatePackageListsARM64 | 760 #@ UpdatePackageListsARM64 |
785 #@ | 761 #@ |
786 #@ Regenerate the package lists such that they contain an up-to-date | 762 #@ Regenerate the package lists such that they contain an up-to-date |
787 #@ list of URLs within the Debian archive. (For arm) | 763 #@ list of URLs within the Debian archive. (For arm64) |
788 UpdatePackageListsARM64() { | 764 UpdatePackageListsARM64() { |
789 if [ "$HAS_ARCH_ARM64" = "0" ]; then | 765 if [ "$HAS_ARCH_ARM64" = "0" ]; then |
790 return | 766 return |
791 fi | 767 fi |
792 GeneratePackageListARM64 "$DEBIAN_DEP_LIST_ARM64" | 768 GeneratePackageListARM64 "$DEBIAN_DEP_LIST_ARM64" |
793 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_ARM64" | 769 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_ARM64" |
794 } | 770 } |
795 | 771 |
796 #@ | 772 #@ |
797 #@ UpdatePackageListsMips | 773 #@ UpdatePackageListsMips |
798 #@ | 774 #@ |
799 #@ Regenerate the package lists such that they contain an up-to-date | 775 #@ Regenerate the package lists such that they contain an up-to-date |
800 #@ list of URLs within the Debian archive. (For arm) | 776 #@ list of URLs within the Debian archive. (For mips) |
801 UpdatePackageListsMips() { | 777 UpdatePackageListsMips() { |
802 if [ "$HAS_ARCH_MIPS" = "0" ]; then | 778 if [ "$HAS_ARCH_MIPS" = "0" ]; then |
803 return | 779 return |
804 fi | 780 fi |
805 GeneratePackageListMips "$DEBIAN_DEP_LIST_MIPS" | 781 GeneratePackageListMips "$DEBIAN_DEP_LIST_MIPS" |
806 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_MIPS" | 782 StripChecksumsFromPackageList "$DEBIAN_DEP_LIST_MIPS" |
807 } | 783 } |
808 | 784 |
809 #@ | 785 #@ |
810 #@ UpdatePackageListsAll | 786 #@ UpdatePackageListsAll |
(...skipping 24 matching lines...) Expand all Loading... |
835 echo " $0 help" | 811 echo " $0 help" |
836 exit 1 | 812 exit 1 |
837 else | 813 else |
838 ChangeDirectory | 814 ChangeDirectory |
839 if echo $1 | grep -qs "All$"; then | 815 if echo $1 | grep -qs "All$"; then |
840 "$@" | 816 "$@" |
841 else | 817 else |
842 RunCommand "$@" | 818 RunCommand "$@" |
843 fi | 819 fi |
844 fi | 820 fi |
OLD | NEW |