2 ## (Re)builds Python metafile (__init__.py)
4 # overwritten by the specfile
10 install: python-install wsdl-install xmlbuilder-install tests-install
12 clean: python-clean wsdl-clean
14 uninstall: python-uninstall tests-uninstall
16 .PHONY: all install clean uninstall
19 rpmversion:=$(shell rpm -q --specfile sfa.spec --queryformat="%{version}\n" | head -1)
20 # somehow %{taglevel} is empty, turns out %{release} has what we want
21 rpmtaglevel:=$(shell rpm -q --specfile sfa.spec --queryformat="%{release}\n" 2> /dev/null | head -1)
22 VERSIONTAG=$(rpmversion)-$(rpmtaglevel)
23 SCMURL=should-be-redefined-by-specfile
27 version: sfa/util/version.py
28 sfa/util/version.py: sfa/util/version.py.in
29 sed -e "s,@VERSIONTAG@,$(VERSIONTAG),g" -e "s,@SCMURL@,$(SCMURL),g" sfa/util/version.py.in > $@
32 cd xmlbuilder-0.9 && python setup.py install --root=$(DESTDIR) && cd -
35 python setup.py install --root=$(DESTDIR)
36 chmod 444 $(DESTDIR)/etc/sfa/default_config.xml
38 python-clean: version-clean
43 rm -f sfa/util/version.py
45 .PHONY: python version python-install python-clean version-clean xmlbuilder-install
50 # propagate DESTDIR from the specfile
52 $(MAKE) -C wsdl install
57 .PHONY: wsdl wsdl-install wsdl-clean
61 mkdir -p $(DESTDIR)/usr/share/sfa/tests
62 install -m 755 tests/*.py $(DESTDIR)/usr/share/sfa/tests/
65 rm -rf $(DESTDIR)/usr/share/sfa/tests
67 .PHONY: tests-install tests-uninstall
69 ########## refreshing methods package metafile
70 # Metafiles - manage Legacy/ and Accessors by hand
71 init := sfa/methods/__init__.py
78 methods_now := $(sort $(shell fgrep -v '"' sfa/methods/__init__.py 2>/dev/null))
79 # what should be declared
80 methods_paths := $(filter-out %/__init__.py, $(wildcard sfa/methods/*.py))
81 methods_files := $(sort $(notdir $(methods_paths:.py=)))
83 ifneq ($(methods_now),$(methods_files))
84 sfa/methods/__init__.py: force
86 sfa/methods/__init__.py:
87 (echo '## Please use make index to update this file' ; echo 'all = """' ; cd sfa/methods; ls -1 *.py | grep -v __init__ | sed -e 's,.py$$,,' ; echo '""".split()') > $@
93 find . -type f | egrep -v '/\.git/|/\.svn/|TAGS|~$$|\.(py[co]|doc|html|pdf|png|svg|out|bak|xml|dg)$$' | xargs etags
97 (cd sfa/methods; grep 'def.*call' *.py > SIGNATURES)
101 # 2 forms are supported
102 # (*) if your plc root context has direct ssh access:
103 # make sync PLC=private.one-lab.org
104 # (*) otherwise, entering through the root context
105 # make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr
107 PLCHOST ?= testplc.onelab.eu
111 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
112 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
116 SSHURL:=root@$(PLC):/
117 SSHCOMMAND:=ssh root@$(PLC)
120 LOCAL_RSYNC_EXCLUDES += --exclude '*.pyc'
121 LOCAL_RSYNC_EXCLUDES += --exclude '*.png' --exclude '*.svg' --exclude '*.out'
122 RSYNC_EXCLUDES := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
123 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
124 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) --no-owner $(RSYNC_EXCLUDES)
126 CLIENTS = sfi.py getNodes.py getRecord.py setRecord.py \
127 sfiAddAttribute.py sfiAddSliver.py sfiDeleteAttribute.py sfiDeleteSliver.py sfiListNodes.py \
128 sfiListSlivers.py sfadump.py
130 BINS = ./config/sfa-config-tty ./config/gen-sfa-cm-config.py \
131 ./sfa/importer/sfa-import-plc.py ./sfa/importer/sfa-nuke-plc.py ./sfa/server/sfa-start.py \
132 $(foreach client,$(CLIENTS),./sfa/client/$(client))
136 @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line"
137 @echo " e.g. make sync PLC=private.one-lab.org"
138 @echo " or make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr"
141 +$(RSYNC) ./sfa/ $(SSHURL)/usr/lib\*/python2.\*/site-packages/sfa/
142 +$(RSYNC) ./tests/ $(SSHURL)/root/tests-sfa
143 +$(RSYNC) $(BINS) $(SSHURL)/usr/bin/
144 +$(RSYNC) ./sfa/init.d/sfa $(SSHURL)/etc/init.d/
145 +$(RSYNC) ./config/default_config.xml $(SSHURL)/etc/sfa/
146 $(SSHCOMMAND) exec service sfa restart