Merge lp:~bac/launchpad/cleanish into lp:launchpad

Proposed by Brad Crittenden on 2012-05-25
Status: Merged
Approved by: Brad Crittenden on 2012-05-25
Approved revision: no longer in the source branch.
Merged at revision: 15311
Proposed branch: lp:~bac/launchpad/cleanish
Merge into: lp:launchpad
Diff against target: 65 lines (+16/-5)
1 file modified
Makefile (+16/-5)
To merge this branch: bzr merge lp:~bac/launchpad/cleanish
Reviewer Review Type Date Requested Status
Gary Poster (community) 2012-05-25 Approve on 2012-05-25
Review via email: mp+107385@code.launchpad.net

Commit Message

Add new makefile target to clean but not remove /var/tmp/bazaar.launchpad.dev

Description of the Change

= Summary =

Complete removal of /var/tmp/bazaar.launchpad.dev can cause problems
in environments where the machine goes up and down a lot, thus causing
Apache to bounce. If that directory does not exist when Apache comes
up it will be recreated by root with the wrong permissions.

== Proposed fix ==

Create a new cleaning target that simply removes the contents of that
directory but not the directory itself.

A more aggressive approach would be to make this change to the
existing 'clean' target but since we don't want to cause any
unforeseen problems we have left the behavior of that target as is.

== Pre-implementation notes ==

Props to Graham and Gary for helping to track down this spawn of
Satan.

== Tests ==

N/A

== Demo and Q/A ==

N/A

= Launchpad lint =

Checking for conflicts and issues in changed files.

Linting changed files:
  Makefile

./Makefile
     202: Line exceeds 80 characters.

To post a comment you must log in.
Gary Poster (gary) wrote :

Thank you!

Please file a bug for the longer term issue of bug 1004088: our tests should pass without an Apache configuration. Then convert the comment in line 27ff to be an XXX, referencing the new bug and noting that, once that new bug is fixed, parallel testing ought to be able to switch to using make inplace rather than make install and then this make target can be collapsed once again into a single "clean" target.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile'
2--- Makefile 2012-05-16 15:45:33 +0000
3+++ Makefile 2012-05-25 14:22:18 +0000
4@@ -137,13 +137,15 @@
5 pagetests: build
6 env PYTHONPATH=$(PYTHONPATH) bin/test test_pages
7
8-inplace: build combobuild logs clean_logs
9+codehosting-dir:
10 mkdir -p $(CODEHOSTING_ROOT)/mirrors
11 mkdir -p $(CODEHOSTING_ROOT)/config
12 mkdir -p /var/tmp/bzrsync
13 touch $(CODEHOSTING_ROOT)/rewrite.log
14 chmod 777 $(CODEHOSTING_ROOT)/rewrite.log
15 touch $(CODEHOSTING_ROOT)/config/launchpad-lookup.txt
16+
17+inplace: build combobuild logs clean_logs codehosting-dir
18 if [ -d /srv/launchpad.dev ]; then \
19 ln -sfn $(WD)/build/js $(CONVOY_ROOT); \
20 fi
21@@ -398,7 +400,14 @@
22 $(RM) -r lib/mailman
23 endif
24
25-clean: clean_js clean_mailman clean_buildout clean_logs
26+lxc-clean: clean_js clean_mailman clean_buildout clean_logs
27+ # XXX: BradCrittenden 2012-05-25 bug=1004514:
28+ # It is important for parallel tests inside LXC that the
29+ # $(CODEHOSTING_ROOT) directory not be completely removed.
30+ # This target removes its contents but not the directory and
31+ # it does everything expected from a clean target. When the
32+ # referenced bug is fixed, this target may be reunited with
33+ # the 'clean' target.
34 $(MAKE) -C sourcecode/pygettextpo clean
35 # XXX gary 2009-11-16 bug 483782
36 # The pygettextpo Makefile should have this next line in it for its make
37@@ -413,7 +422,7 @@
38 -print0 | xargs -r0 $(RM)
39 $(RM) -r lib/subvertpy/*.so
40 $(RM) -r $(LP_BUILT_JS_ROOT)/*
41- $(RM) -r $(CODEHOSTING_ROOT)
42+ $(RM) -r $(CODEHOSTING_ROOT)/*
43 $(RM) -r $(APIDOC_DIR)
44 $(RM) -r $(APIDOC_DIR).tmp
45 $(RM) -r build
46@@ -438,6 +447,8 @@
47 $(RM) -r /var/tmp/launchpad_mailqueue; \
48 fi
49
50+clean: lxc-clean
51+ $(RM) -r $(CODEHOSTING_ROOT)
52
53 realclean: clean
54 $(RM) TAGS tags
55@@ -470,8 +481,8 @@
56 -e 's,%LISTEN_ADDRESS%,$(LISTEN_ADDRESS),' \
57 configs/development/local-launchpad-apache > \
58 /etc/apache2/sites-available/local-launchpad
59- touch /var/tmp/bazaar.launchpad.dev/rewrite.log
60- chown -R $(SUDO_UID):$(SUDO_GID) /var/tmp/bazaar.launchpad.dev
61+ touch $(CODEHOSTING_ROOT)/rewrite.log
62+ chown -R $(SUDO_UID):$(SUDO_GID) $(CODEHOSTING_ROOT)
63 if [ ! -d /srv/launchpad.dev ]; then \
64 mkdir /srv/launchpad.dev; \
65 chown $(SUDO_UID):$(SUDO_GID) /srv/launchpad.dev; \