Closed blitz closed 4 years ago
This is not just a problem for the depot but also for any other files generated by goa.
The easiest fix is probably to instruct goa to place the var directory at another (writeable) location outside the src directory. With the minor fix https://github.com/nfeske/goa/commit/73f7b40af02687927d301177d0e9cde3482c34ea in place, this can be done by either using the --common-var-dir argument, e.g.,
goa run --common-var-dir /tmp/var
or by defining the common var directory in a .goarc file:
set common_var_dir /tmp/var
Thanks for the quick response!
I'm not quite sure we are talking about the same problem here. My problem is that goa populates the default depot config from wherever it is installed. If that happens to be read-only the new var/depot/nfeske/
will also be read-only, because the copy operation preserves the file and directory modes. Afterwards we fail to create files in the read-only directories created by goa.
For me, it seems that the best solution is to populate depot from the templates shipped with goa as cp --no-preserve=all
would do.
I can give this a shot and try implementing this in tcl, but I fear it's going to be horrible. :-)
Now I get it. Thanks for the clarification. The problem is just the inheritance of the read-only attribute. That's funny. It would be good to find a clean Tcl way to doing this.
Sorry for the somewhat confused initial description. It was late...
I'm working around it like this. Seems to work.
diff --git a/bin/goa b/bin/goa
index a5c23ae..d7f8882 100755
--- a/bin/goa
+++ b/bin/goa
@@ -356,6 +356,10 @@ proc prepare_depot_with_archives { archive_list } {
# create default depot local to the project at var/depot/
file mkdir [file dirname $depot_dir]
file copy [file join $tool_dir default_depot] $depot_dir
+
+ # Copy preserves attributes, so we might have created
+ # read-only files.
+ exec chmod -R +w $depot_dir
}
# create list of depot users without duplicates
This issue should be fixed by https://github.com/nfeske/goa/commit/adbcf8bdfdaca6cafddd008de681cd2b39ead134, which uses Tcl builtin functions.
When trying to run
goa build
for the first time, it tries to copy the default depot into the source directory. If goa was installed in a read-only location, the resulting files will also be read-only. This issue came up during packaging of goa.The reason is that gpg cannot create the key in the read-only directories goa created:
This can be hotfixed by running
chmod -R +w var
.The real fix seems to be fixing this Tcl code:
Unfortunately, my Tcl skills are zero. :(