← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:byte-compile-scripts-pythonpath into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:byte-compile-scripts-pythonpath into launchpad:master.

Commit message:
Byte-compile scripts/_pythonpath.py before copying Apache config

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/406764

Otherwise we can end up with `scripts/__pycache__` being owned by root due to Apache byte-compiling `scripts/_pythonpath.py` in the process of loading `scripts/branch-rewrite.py`, causing problems for buildbot and perhaps other things.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:byte-compile-scripts-pythonpath into launchpad:master.
diff --git a/Makefile b/Makefile
index 7575fbc..e670a90 100644
--- a/Makefile
+++ b/Makefile
@@ -482,6 +482,9 @@ copy-certificates:
 	cp configs/$(LPCONFIG)/launchpad.key /etc/apache2/ssl/
 
 copy-apache-config: codehosting-dir
+	# Byte-compile scripts/_pythonpath.py first, otherwise Apache may do
+	# so as root and cause permission problems.
+	$(PY) -m py_compile scripts/_pythonpath.py
 	# We insert the absolute path to the branch-rewrite script
 	# into the Apache config as we copy the file into position.
 	set -e; \