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

Unified Diff: src/scripts/install_packages.sh

Issue 548109: Build: allow package lists to be filtered by arch. (Closed)
Patch Set: fixes for review Created 10 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/package_repo/package-list-prod.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/scripts/install_packages.sh
diff --git a/src/scripts/install_packages.sh b/src/scripts/install_packages.sh
index 3043b577939757628505b0ca71bd5434b57bd85f..4c2357624bedad6695e659541ea8d26565b4b344 100755
--- a/src/scripts/install_packages.sh
+++ b/src/scripts/install_packages.sh
@@ -213,13 +213,39 @@ sudo ln -sf /bin/true "${ROOT_FS_DIR}/usr/sbin/update-rc.d"
sudo mount -t proc proc "${ROOT_FS_DIR}/proc"
trap cleanup_rootfs_mounts EXIT
+filter_pkgs() {
+ pkglist="$1"
+ arch="$2"
+
+ # to read list of package + version skipping empty lines and comments, and
+ # convert "foo 1.2-3" to "foo=1.2-3", use:
+ #pkgs="$(grep '^[^#]' "$pkglist" | cut -d ' ' -f 1-2 | sed 's/ /=/')"
+
+ # read list of "package [optional arch list]" skipping empty lines and
+ # comments
+ grep '^[^#]' "$pkglist" | while read pkg archspec; do
+ case "$archspec" in
+ ""|"[$arch "*|"[$arch]"|*" $arch]")
+ echo "$pkg"
+ ;;
+ *"!$arch "*|*"!$arch]")
+ :
+ ;;
+ "["*"!"*"]")
+ echo "$pkg"
+ ;;
+ esac
+ done
+}
+
# Install packages from the given package-lists
PACKAGE_LISTS=$(echo "$FLAGS_package_list" | sed -e 's/,/ /g')
+PKG_LIST_ARCH="$FLAGS_arch"
+if [ "$PKG_LIST_ARCH" = "x86" ]; then
+ PKG_LIST_ARCH="i386"
+fi
for p in $PACKAGE_LISTS; do
- COMPONENTS=$(cat "$p" | \
- sed -e 's/#.*//' | \
- grep -v '^ *$' | \
- sed '/$/{N;s/\n/ /;}')
+ COMPONENTS=$(filter_pkgs "$p" "$PKG_LIST_ARCH")
sudo APT_CONFIG="$APT_CONFIG" DEBIAN_FRONTEND=noninteractive \
ARCH="$FLAGS_arch" apt-get --force-yes install $COMPONENTS
done
« no previous file with comments | « src/package_repo/package-list-prod.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698