Fix ownership issues with client/build-external

When the directory is created during the build process, it is as root.

This prevents us deleting root-owned files inside the directory during make clean.

In client/build/, we get around this because the directory contains a tracked file,
so it's created during git checkout.
We make this the case for build-external by adding a hidden, empty file to track.
This won't fix existing checkouts though, so we also add a fix-up step to make clean.

The use of .gitignore as the empty file to track is taken from
	https://git.wiki.kernel.org/index.php/GitFaq#Can_I_add_empty_directories.3F
Specifically:
	"If you really need a directory to exist in checkouts you should create a file in it.
	.gitignore works well for this purpose"
This commit is contained in:
Mike Lang
2017-01-27 14:57:02 -08:00
parent 5e461cd3ba
commit 02a2dd9d7a
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -174,6 +174,9 @@ ui-build-pkg:
clean:
$(GO) clean ./...
# build-external was accidentially created as owned by root in earlier versions. This is fixed now,
# but we need to fix up old checkouts, since git doesn't track ownership.
if [ "$$(stat -c %%U client/build-external)" == "root" ]; then sudo chown "$$USER:$$USER" client/build-external; fi
# Don't actually rmi the build images - rm'ing the .uptodate files is enough to ensure
# we rebuild the images, and rmi'ing the images causes us to have to redownload a lot of stuff.
# $(SUDO) docker rmi $(SCOPE_UI_BUILD_IMAGE) $(SCOPE_BACKEND_BUILD_IMAGE) >/dev/null 2>&1 || true
+1
View File
@@ -0,0 +1 @@
# this file is only present to force git to create this directory in the working tree