Browse code

Add basic Makefile

There are a couple of targets in here that some might find useful in
doing DevStack testing in multiple remote VMs.

There are some of the usual boring targets too, like stack and unstack,
that do exactly what you would expect.

Change-Id: I7974cac4cc527bacf6f183ac1f344428b05f2fdc

Dean Troyer authored on 2015/03/29 00:14:47
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,104 @@
0
+# DevStack Makefile of Sanity
1
+
2
+# Interesting targets:
3
+# ds-remote - Create a Git remote for use by ds-push and ds-pull targets
4
+#             DS_REMOTE_URL must be set on the command line
5
+#
6
+# ds-push - Merge a list of branches taken from .ds-test and push them
7
+#           to the ds-remote repo in ds-test branch
8
+#
9
+# ds-pull - Pull the remote ds-test branch into a fresh local branch
10
+#
11
+# refresh - Performs a sequence of unstack, refresh and stack
12
+
13
+# Duplicated from stackrc for now
14
+DEST=/opt/stack
15
+WHEELHOUSE=$(DEST)/.wheelhouse
16
+
17
+all:
18
+	echo "This just saved you from a terrible mistake!"
19
+
20
+# Do Some Work
21
+stack:
22
+	./stack.sh
23
+
24
+unstack:
25
+	./unstack.sh
26
+
27
+wheels:
28
+	WHEELHOUSE=$(WHEELHOUSE) tools/build-wheels.sh
29
+
30
+docs:
31
+	tox -edocs
32
+
33
+# Just run the shocco source formatting build
34
+docs-build:
35
+	INSTALL_SHOCCO=True tools/build_docs.sh
36
+
37
+# Just run the Sphinx docs build
38
+docs-rst:
39
+	python setup.py build_sphinx
40
+
41
+# Run the bashate test
42
+bashate:
43
+	tox -ebashate
44
+
45
+# Run the function tests
46
+test:
47
+	tests/test_ini_config.sh
48
+	tests/test_meta_config.sh
49
+	tests/test_ip.sh
50
+	tests/test_refs.sh
51
+
52
+# Spiff up the place a bit
53
+clean:
54
+	./clean.sh
55
+	rm -rf accrc doc/build test*-e *.egg-info
56
+
57
+# Clean out the cache too
58
+realclean: clean
59
+	rm -rf files/cirros*.tar.gz files/Fedora*.qcow2 $(WHEELHOUSE)
60
+
61
+# Repo stuffs
62
+
63
+pull:
64
+	git pull
65
+
66
+
67
+# These repo targets are used to maintain a branch in a remote repo that
68
+# consists of one or more local branches merged and pushed to the remote.
69
+# This is most useful for iterative testing on multiple or remote servers
70
+# while keeping the working repo local.
71
+#
72
+# It requires:
73
+# * a remote pointing to a remote repo, often GitHub is used for this
74
+# * a branch name to be used on the remote
75
+# * a local file containing the list of local branches to be merged into
76
+#   the remote branch
77
+
78
+GIT_REMOTE_NAME=ds-test
79
+GIT_REMOTE_BRANCH=ds-test
80
+
81
+# Push the current branch to a remote named ds-test
82
+ds-push:
83
+	git checkout master
84
+	git branch -D $(GIT_REMOTE_BRANCH) || true
85
+	git checkout -b $(GIT_REMOTE_BRANCH)
86
+	for i in $(shell cat .$(GIT_REMOTE_BRANCH) | grep -v "^#" | grep "[^ ]"); do \
87
+	  git merge --no-edit $$i; \
88
+	done
89
+	git push -f $(GIT_REMOTE_NAME) HEAD:$(GIT_REMOTE_BRANCH)
90
+
91
+# Pull the ds-test branch
92
+ds-pull:
93
+	git checkout master
94
+	git branch -D $(GIT_REMOTE_BRANCH) || true
95
+	git pull $(GIT_REMOTE_NAME) $(GIT_REMOTE_BRANCH)
96
+	git checkout $(GIT_REMOTE_BRANCH)
97
+
98
+# Add the remote - set DS_REMOTE_URL=htps://example.com/ on the command line
99
+ds-remote:
100
+	git remote add $(GIT_REMOTE_NAME) $(DS_REMOTE_URL)
101
+
102
+# Refresh the current DevStack checkout nd re-initialize
103
+refresh: unstack ds-pull stack