build_image: clean up /usr/include better
We currently install a lot of stuff into /usr/include. Many are empty
dirs (because we mask out header files), but a few things still get in
there because they don't use the standard "*.h" naming convention.
BUG=None
TEST=`./build_image` produced an image that had a lot less stuff in /usr/include
TEST=`cbuildbot {x86,amd64}-generic-full` worked
Change-Id: I7c2bee2f6a248ecb4f37e503240e9004999afe7e
Reviewed-on: https://gerrit.chromium.org/gerrit/44381
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: David James <davidjames@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/build_library/base_image_util.sh b/build_library/base_image_util.sh
index 98f3e90..9a263bb 100755
--- a/build_library/base_image_util.sh
+++ b/build_library/base_image_util.sh
@@ -252,6 +252,12 @@
# create /usr/local or /var on host (already exist on target).
setup_symlinks_on_root "/usr/local" "/var" "${stateful_fs_dir}"
+ # Our masking of files will implicitly leave behind a bunch of empty
+ # dirs. We can't differentiate between empty dirs we want and empty
+ # dirs we don't care about, so just prune ones we know are OK.
+ sudo find "${root_fs_dir}/usr/include" -depth -type d -exec rmdir {} + \
+ 2>/dev/null || :
+
# Zero rootfs free space to make it more compressible so auto-update
# payloads become smaller
zero_free_space "${root_fs_dir}"
diff --git a/common.sh b/common.sh
index 78a0cc3..34b6cb6 100644
--- a/common.sh
+++ b/common.sh
@@ -398,6 +398,8 @@
/lib/rc
/usr/bin/Xnest
/usr/bin/Xvfb
+ /usr/include/nspr/*
+ /usr/include/X11/*
/usr/lib/debug
/usr/lib/gcc
/usr/lib*/pkgconfig