Revision e8230860

b/Makefile.am
1
# Ganeti makefile
2
# - Indent with tabs only.
3
# - Keep files sorted; one line per file.
4
# - Directories in lib/ must have their own *dir variable (see hypervisor).
5
# - All directories must be listed DIRS.
6
# - Use autogen.sh to generate Makefile.in and configure script
7

  
8
# Automake doesn't export these variables before version 1.10.
9
abs_top_builddir = @abs_top_builddir@
10
abs_top_srcdir = @abs_top_srcdir@
11

  
1 12
ACLOCAL_AMFLAGS = -I autotools
13
DOCBOOK_WRAPPER = $(top_srcdir)/autotools/docbook-wrapper
14
REPLACE_VARS_SED = autotools/replace_vars.sed
15

  
16
hypervisordir = $(pkgpythondir)/hypervisor
17
toolsdir = $(pkglibdir)/tools
18
docdir = $(datadir)/doc/$(PACKAGE)
19

  
20
DIRS = \
21
	autotools \
22
	daemons \
23
	devel \
24
	doc \
25
	doc/examples \
26
	lib \
27
	lib/hypervisor \
28
	man \
29
	qa \
30
	qa/hooks \
31
	scripts \
32
	test \
33
	test/data \
34
	tools
35

  
36
CLEANFILES = \
37
	autotools/replace_vars.sed \
38
	devel/upload \
39
	doc/*.html \
40
	doc/*.in \
41
	doc/*.pdf \
42
	doc/examples/ganeti.initd \
43
	doc/examples/ganeti.cron \
44
	lib/*.py[co] \
45
	lib/hypervisor/*.py[co] \
46
	man/*.[78] \
47
	man/*.in \
48
	qa/*.py[co] \
49
	qa/hooks/*.py[co] \
50
	test/*.py[co] \
51
	stamp-directories \
52
	$(nodist_pkgpython_PYTHON)
53

  
54
nodist_pkgpython_PYTHON = \
55
	lib/_autoconf.py
56

  
57
pkgpython_PYTHON = \
58
	lib/__init__.py \
59
	lib/backend.py \
60
	lib/bdev.py \
61
	lib/bootstrap.py \
62
	lib/cli.py \
63
	lib/cmdlib.py \
64
	lib/config.py \
65
	lib/constants.py \
66
	lib/errors.py \
67
	lib/jqueue.py \
68
	lib/locking.py \
69
	lib/logger.py \
70
	lib/luxi.py \
71
	lib/mcpu.py \
72
	lib/objects.py \
73
	lib/opcodes.py \
74
	lib/rpc.py \
75
	lib/serializer.py \
76
	lib/ssconf.py \
77
	lib/ssh.py \
78
	lib/utils.py
79

  
80
hypervisor_PYTHON = \
81
	lib/hypervisor/__init__.py \
82
	lib/hypervisor/hv_base.py \
83
	lib/hypervisor/hv_fake.py \
84
	lib/hypervisor/hv_xen.py
85

  
86
docsgml = \
87
	doc/hooks.sgml \
88
	doc/install.sgml \
89
	doc/admin.sgml \
90
	doc/iallocator.sgml
91

  
92
doc_DATA = \
93
	$(patsubst %.sgml,%.html,$(docsgml)) \
94
	$(patsubst %.sgml,%.pdf,$(docsgml))
95

  
96
dist_sbin_SCRIPTS = \
97
	daemons/ganeti-noded \
98
	daemons/ganeti-watcher \
99
	daemons/ganeti-master \
100
	daemons/ganeti-masterd \
101
	scripts/gnt-backup \
102
	scripts/gnt-cluster \
103
	scripts/gnt-debug \
104
	scripts/gnt-instance \
105
	scripts/gnt-job \
106
	scripts/gnt-node \
107
	scripts/gnt-os
108

  
109
dist_tools_SCRIPTS = \
110
	tools/burnin \
111
	tools/cfgshell \
112
	tools/cfgupgrade \
113
	tools/lvmstrap
114

  
115
EXTRA_DIST = \
116
	NEWS \
117
	DEVNOTES \
118
	autotools/docbook-wrapper \
119
	devel/upload.in \
120
	$(docsgml) \
121
	doc/examples/ganeti.initd.in \
122
	doc/examples/ganeti.cron.in \
123
	doc/examples/dumb-allocator \
124
	qa/hooks/datehook.py \
125
	qa/hooks/loghook.py \
126
	test/testutils.py \
127
	test/mocks.py \
128
	$(dist_TESTS) \
129
	$(TEST_FILES) \
130
	man/footer.sgml \
131
	$(mansgml) \
132
	qa/ganeti-qa.py \
133
	qa/qa-sample.yaml \
134
	qa/qa_cluster.py \
135
	qa/qa_config.py \
136
	qa/qa_daemon.py \
137
	qa/qa_env.py \
138
	qa/qa_error.py \
139
	qa/qa_instance.py \
140
	qa/qa_node.py \
141
	qa/qa_os.py \
142
	qa/qa_other.py \
143
	qa/qa_tags.py \
144
	qa/qa_utils.py
145

  
146
man_MANS = \
147
	man/ganeti.7 \
148
	man/ganeti-master.8 \
149
	man/ganeti-noded.8 \
150
	man/ganeti-os-interface.7 \
151
	man/ganeti-watcher.8 \
152
	man/gnt-backup.8 \
153
	man/gnt-cluster.8 \
154
	man/gnt-instance.8 \
155
	man/gnt-node.8 \
156
	man/gnt-os.8
157

  
158
maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
159
mansgml = $(patsubst %.in,%.sgml,$(maninput))
160

  
161
TEST_FILES = \
162
	test/data/bdev-both.txt \
163
	test/data/bdev-disk.txt \
164
	test/data/bdev-net.txt \
165
	test/data/proc_drbd8.txt
166

  
167
dist_TESTS = \
168
	test/ganeti.config_unittest.py \
169
	test/ganeti.hooks_unittest.py \
170
	test/ganeti.utils_unittest.py \
171
	test/ganeti.bdev_unittest.py \
172
	test/ganeti.ssh_unittest.py \
173
	test/ganeti.locking_unittest.py \
174
	test/ganeti.constants_unittest.py
175

  
176
nodist_TESTS =
177

  
178
TESTS = $(dist_TESTS) $(nodist_TESTS)
179

  
180
TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
181

  
2 182

  
3
SUBDIRS = man lib scripts daemons doc test tools qa devel
4
EXTRA_DIST = NEWS DEVNOTES
183
all-local: stamp-directories lib/_autoconf.py devel/upload \
184
	doc/examples/ganeti.initd doc/examples/ganeti.cron
185

  
186
devel/upload: devel/upload.in stamp-directories $(REPLACE_VARS_SED)
187
	sed -f $(REPLACE_VARS_SED) < $< > $@
188
	chmod u+x $@
189

  
190
doc/examples/ganeti.%: doc/examples/ganeti.%.in stamp-directories \
191
		$(REPLACE_VARS_SED)
192
	sed -f $(REPLACE_VARS_SED) < $< > $@
193

  
194
doc/%.in: doc/%.sgml stamp-directories $(REPLACE_VARS_SED)
195
	sed -f $(REPLACE_VARS_SED) < $< > $@
196

  
197
man/%.in: man/%.sgml stamp-directories $(REPLACE_VARS_SED)
198
	sed -f $(REPLACE_VARS_SED) < $< > $@
199

  
200
doc/%.pdf: doc/%.in $(DOCBOOK_WRAPPER)
201
	$(DOCBOOK_WRAPPER) $< $@
202

  
203
doc/%.html: doc/%.in $(DOCBOOK_WRAPPER)
204
	$(DOCBOOK_WRAPPER) $< $@
205

  
206
man/%.7: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
207
	$(DOCBOOK_WRAPPER) $< $@
208

  
209
man/%.8: man/%.in man/footer.sgml $(DOCBOOK_WRAPPER)
210
	$(DOCBOOK_WRAPPER) $< $@
211

  
212
man/footer.sgml $(TESTS): srclinks
213

  
214
$(TESTS): ganeti
215

  
216
lib/_autoconf.py: Makefile stamp-directories
217
	set -e; \
218
	{ echo '# This file is automatically generated, do not edit!'; \
219
	  echo '#'; \
220
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
221
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
222
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
223
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
224
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
225
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
226
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
227
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
228
	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
229
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
230
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
231
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
232
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
233
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
234
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
235
	} > $@
236

  
237
$(REPLACE_VARS_SED): Makefile stamp-directories
238
	set -e; \
239
	{ echo 's#@PREFIX@#$(prefix)#g'; \
240
	  echo 's#@SYSCONFDIR@#$(sysconfdir)#g'; \
241
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
242
	  echo 's#@SBINDIR@#$(sbindir)#g'; \
243
	  echo 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g'; \
244
	  echo 's#@LOCALSTATEDIR@#$(localstatedir)#g'; \
245
	  echo 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g'; \
246
	  echo 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g'; \
247
	} > $@
248

  
249
# We need to create symlinks because "make distcheck" will not install Python
250
# files when building.
251
#.PHONY: srclinks
252
srclinks: stamp-directories
253
	set -e; \
254
	for i in man/footer.sgml $(pkgpython_PYTHON) $(hypervisor_PYTHON); do \
255
		if test ! -f $$i -a -f $(abs_top_srcdir)/$$i; then \
256
			$(LN_S) $(abs_top_srcdir)/$$i $$i; \
257
		fi; \
258
	done
5 259

  
6 260
.PHONY: ganeti
7 261
ganeti:
8 262
	cd $(top_builddir) && rm -f $@ && $(LN_S) lib $@
9 263

  
10
pre-check: ganeti
11
	$(MAKE) -C lib $@
12
	$(MAKE) -C lib/hypervisor $@
13

  
14 264
# a dist hook rule for catching revision control directories
15 265
distcheck-hook:
16 266
	if find $(top_distdir) | grep -F -e '.svn' -e '.git'; then \
......
18 268
		exit 1; \
19 269
	fi
20 270

  
21
# custom rules
22
depgraph: depgraph.png
23

  
24
depgraph.png: depgraph.dot
25
	dot -Tpng -o $@ $<
26

  
27
depgraph.ps: depgraph.dot
28
	dot -Tps -o $@ $<
29

  
30
depgraph.dot: ganeti/*.py
31
	pylint.python2.4 --indent-string '  ' --rcfile=/dev/null \
32
	  --reports y --int-import-graph $@ --persistent n ganeti >/dev/null
33

  
34 271
install-exec-local:
35
	@mkdir_p@ "$(DESTDIR)${localstatedir}/lib/ganeti" \
272
	@mkdir_p@ -- "$(DESTDIR)${localstatedir}/lib/ganeti" \
36 273
	  "$(DESTDIR)${localstatedir}/log/ganeti" \
37 274
	  "$(DESTDIR)${localstatedir}/run/ganeti"
275

  
276
stamp-directories: Makefile
277
	@mkdir_p@ $(DIRS)
278
	touch $@
279

  
280
# vim: set noet :
b/autotools/docbook-wrapper
1
#!/bin/sh
2

  
3
set -e
4

  
5
input="${1}"
6
output="${2}"
7

  
8
case "${output}" in
9
  *.pdf) cmd=docbook2pdf ;;
10
  *.html) cmd='docbook2html --nochunks' ;;
11
  *.7|*.8) cmd=docbook2man ;;
12
  *)
13
    echo "Unknown filetype: ${output}" >&2
14
    exit 1
15
  ;;
16
esac
17

  
18
tmpdir=`mktemp -d`
19
trap "rm -rf ${tmpdir}" EXIT
20

  
21
if ! ( cd `dirname ${input}` &&
22
       ${cmd} -o ${tmpdir} `basename "${input}"` >/dev/null; )
23
then
24
  echo "Building ${output} failed." >&2
25
  exit 1
26
fi;
27

  
28
mv "${tmpdir}/`basename "${output}"`" "${output}"
29

  
30
# Needed for make to recognize output file
31
touch "${output}"
b/configure.ac
111 111
  AC_MSG_WARN([docbook2man not found.])
112 112
fi
113 113

  
114
AC_CONFIG_FILES([
115
  Makefile
116
  daemons/Makefile
117
  devel/Makefile
118
  doc/Makefile
119
  doc/examples/Makefile
120
  lib/Makefile
121
  lib/hypervisor/Makefile
122
  man/Makefile
123
  qa/Makefile
124
  qa/hooks/Makefile
125
  scripts/Makefile
126
  test/Makefile
127
  tools/Makefile
128
])
114
AC_CONFIG_FILES([ Makefile ])
129 115

  
130 116
AC_OUTPUT
/dev/null
1
dist_sbin_SCRIPTS = ganeti-noded ganeti-watcher ganeti-master ganeti-masterd
/dev/null
1
EXTRA_DIST = upload.in
2
CLEANFILES = upload
3

  
4
all-local: upload
5
upload: upload.in
6
	sed \
7
	  -e 's#@PREFIX@#$(prefix)#g' \
8
	< $< > $@
9
	chmod u+x $@
/dev/null
1
docdir = $(datadir)/doc/$(PACKAGE)
2

  
3
SUBDIRS = examples
4
dist_doc_DATA = \
5
  hooks.html hooks.pdf \
6
  install.html install.pdf \
7
  admin.html admin.pdf \
8
  iallocator.html iallocator.pdf
9

  
10
EXTRA_DIST = hooks.sgml install.sgml admin.sgml iallocator.sgml
11
MAINTAINERCLEANFILES = *.html *.pdf
12

  
13
%.sgmltmp: %.sgml
14
	sed -e 's#@GANETI_VERSION@#$(PACKAGE_VERSION)#g' < $< > $@
15

  
16
%.html: %.sgmltmp
17
	docbook2html --nochunks $< || rm -f $@
18

  
19
%.pdf: %.sgmltmp
20
	docbook2pdf $< || rm -f $@
/dev/null
1
EXTRA_DIST = ganeti.initd.in ganeti.cron.in dumb-allocator
2
CLEANFILES = $(nodist_EXTRA_DATA)
3

  
4
nodist_EXTRA_DATA = ganeti.initd ganeti.cron
5

  
6
all-local: ganeti.initd ganeti.cron
7
ganeti.%: ganeti.%.in Makefile
8
	sed \
9
	  -e "s#@PREFIX@#$(prefix)#g" \
10
	  -e "s#@SYSCONFDIR@#$(sysconfdir)#g" \
11
	  -e "s#@LOCALSTATEDIR@#$(localstatedir)#g" \
12
	  -e "s#@SBINDIR@#$(sbindir)#g" \
13
	< $< > $@
/dev/null
1
CLEANFILES = $(nodist_pkgpython_PYTHON) *.py[oc]
2
SUBDIRS = hypervisor
3

  
4
nodist_pkgpython_PYTHON = _autoconf.py
5
pkgpython_PYTHON = __init__.py backend.py cli.py cmdlib.py config.py \
6
	objects.py errors.py logger.py ssh.py utils.py rpc.py \
7
	bdev.py opcodes.py mcpu.py constants.py \
8
	ssconf.py locking.py luxi.py jqueue.py serializer.py \
9
	bootstrap.py
10
python_files = $(pkgpython_PYTHON)
11

  
12
all-local: _autoconf.py
13

  
14
_autoconf.py: Makefile
15
	{ echo '# This file is automatically generated, do not edit!'; \
16
	  echo '#'; \
17
	  echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
18
	  echo "VERSION_MAJOR = '$(VERSION_MAJOR)'"; \
19
	  echo "VERSION_MINOR = '$(VERSION_MINOR)'"; \
20
	  echo "VERSION_REVISION = '$(VERSION_REVISION)'"; \
21
	  echo "VERSION_SUFFIX = '$(VERSION_SUFFIX)'"; \
22
	  echo "VERSION_FULL = '$(VERSION_FULL)'"; \
23
	  echo "LOCALSTATEDIR = '$(localstatedir)'"; \
24
	  echo "SYSCONFDIR = '$(sysconfdir)'"; \
25
	  echo "SSH_INITD_SCRIPT = '$(SSH_INITD_SCRIPT)'"; \
26
	  echo "EXPORT_DIR = '$(EXPORT_DIR)'"; \
27
	  echo "OS_SEARCH_PATH = [$(OS_SEARCH_PATH)]"; \
28
	  echo "XEN_KERNEL = '$(XEN_KERNEL)'"; \
29
	  echo "XEN_INITRD = '$(XEN_INITRD)'"; \
30
	  echo "FILE_STORAGE_DIR = '$(FILE_STORAGE_DIR)'"; \
31
	  echo "IALLOCATOR_SEARCH_PATH = [$(IALLOCATOR_SEARCH_PATH)]"; \
32
	} > $@
33

  
34
include $(srcdir)/Makefile.libcommon
/dev/null
1
CLEANFILES = *.py[oc]
2

  
3
hypervisordir = $(pkgpythondir)/hypervisor
4
hypervisor_PYTHON = __init__.py hv_base.py hv_fake.py hv_xen.py
5
python_files = $(hypervisor_PYTHON)
6

  
7
include $(srcdir)/../Makefile.libcommon
/dev/null
1
# Build man pages
2

  
3
man_MANS = ganeti.7 ganeti-os-interface.7 gnt-cluster.8 gnt-node.8 gnt-os.8 \
4
	   gnt-instance.8 ganeti-noded.8 ganeti-watcher.8 gnt-backup.8 \
5
	   ganeti-master.8
6

  
7
maninput = $(patsubst %.7,%.in,$(patsubst %.8,%.in,$(man_MANS)))
8

  
9
EXTRA_DIST = ganeti-os-interface.sgml gnt-cluster.sgml gnt-node.sgml \
10
	     ganeti-watcher.sgml ganeti.sgml gnt-instance.sgml gnt-os.sgml \
11
	     gnt-backup.sgml ganeti-noded.sgml ganeti-master.sgml \
12
	     footer.sgml $(maninput)
13
CLEANFILES = *.[78]
14
MAINTAINERCLEANFILES = $(maninput)
15

  
16
# Wrapper around docbook2man to control the output's filename
17
%.in: %.sgml footer.sgml
18
	tmpdir=`mktemp -d "./manbuildXXXXXX"` && \
19
	docbook2man -o "$$tmpdir" $< && \
20
	ok= && \
21
	for check in `basename $< .sgml`.{7,8}; do \
22
		if test -f "$$tmpdir/$$check"; then \
23
			mv "$$tmpdir/$$check" $@ && \
24
			ok=1 && \
25
			break; \
26
		fi; \
27
	done; \
28
	if test -z "$$ok"; then \
29
		echo "Building $@ failed."; \
30
		exit 1; \
31
	fi; \
32
	rm -rf "$$tmpdir"
33

  
34
%.7 %.8: %.in Makefile
35
	sed -e 's#@LOCALSTATEDIR@#$(localstatedir)#g' \
36
	    -e 's#@CUSTOM_XEN_KERNEL@#$(XEN_KERNEL)#g' \
37
	    -e 's#@CUSTOM_XEN_INITRD@#$(XEN_INITRD)#g' \
38
	    < $< > $@
/dev/null
1
SUBDIRS = hooks
2
EXTRA_DIST = ganeti-qa.py qa-sample.yaml \
3
	qa_cluster.py \
4
	qa_config.py \
5
	qa_daemon.py \
6
	qa_env.py \
7
	qa_error.py \
8
	qa_instance.py \
9
	qa_node.py \
10
	qa_os.py \
11
	qa_other.py \
12
	qa_tags.py \
13
	qa_utils.py
14
CLEANFILES = *.py[co]
/dev/null
1
EXTRA_DIST = datehook.py loghook.py
2
CLEANFILES = *.py[co]
/dev/null
1
dist_sbin_SCRIPTS = gnt-instance gnt-cluster gnt-node gnt-os gnt-backup gnt-debug gnt-job
/dev/null
1
TESTS = \
2
  ganeti.config_unittest.py \
3
  ganeti.hooks_unittest.py \
4
  ganeti.utils_unittest.py \
5
  ganeti.bdev_unittest.py \
6
  ganeti.ssh_unittest.py \
7
  ganeti.locking_unittest.py \
8
  ganeti.constants_unittest.py
9

  
10
TESTS_ENVIRONMENT = PYTHONPATH=.:$(top_builddir)
11

  
12
check-am: do-pre-check
13

  
14
do-pre-check:
15
	$(MAKE) -C $(top_builddir) pre-check
16

  
17
EXTRA_DIST = $(TESTS) testutils.py mocks.py $(wildcard data/*.txt)
18
CLEANFILES = *.py[co]
b/test/ganeti.bdev_unittest.py
51 51

  
52 52
    prefix = os.environ.get("srcdir", None)
53 53
    if prefix:
54
      name = prefix + "/" + name
54
      name = prefix + "/test/" + name
55 55
    fh = open(name, "r")
56 56
    try:
57 57
      data = fh.read()
......
59 59
      fh.close()
60 60
    return data
61 61

  
62

  
63 62
  @staticmethod
64 63
  def _has_net(data, local, remote):
65 64
    """Check network connection parameters"""
......
115 114

  
116 115
  def setUp(self):
117 116
    """Read in txt data"""
118
    proc_data = "data/proc_drbd8.txt"
117
    proc_data = "test/data/proc_drbd8.txt"
119 118
    prefix = os.environ.get("srcdir", None)
120 119
    if prefix:
121 120
      proc_data = prefix + "/" + proc_data
/dev/null
1
toolsdir = $(pkglibdir)/tools
2
dist_tools_SCRIPTS = lvmstrap burnin cfgshell cfgupgrade

Also available in: Unified diff