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
18 VERSIONTAG=should-be-redefined-by-specfile
19 SCMURL=should-be-redefined-by-specfile
24 version: sfa/util/version.py
25 sfa/util/version.py: sfa/util/version.py.in
26 sed -e "s,@VERSIONTAG@,$(VERSIONTAG),g" -e "s,@SCMURL@,$(SCMURL),g" sfa/util/version.py.in > $@
29 cd xmlbuilder-0.9 && python setup.py install --root=$(DESTDIR) && cd -
32 python setup.py install --root=$(DESTDIR)
33 chmod 444 $(DESTDIR)/etc/sfa/default_config.xml
35 python-clean: version-clean
40 rm -f sfa/util/version.py
42 .PHONY: python version python-install python-clean version-clean xmlbuilder-install
47 # propagate DESTDIR from the specfile
49 $(MAKE) -C wsdl install
54 .PHONY: wsdl wsdl-install wsdl-clean
58 mkdir -p $(DESTDIR)/usr/share/sfa/tests
59 install -m 755 tests/*.py $(DESTDIR)/usr/share/sfa/tests/
62 rm -rf $(DESTDIR)/usr/share/sfa/tests
64 .PHONY: tests-install tests-uninstall
66 ########## refreshing methods package metafile
67 # Metafiles - manage Legacy/ and Accessors by hand
68 init := sfa/methods/__init__.py
75 methods_now := $(sort $(shell fgrep -v '"' sfa/methods/__init__.py 2>/dev/null))
76 # what should be declared
77 methods_paths := $(filter-out %/__init__.py, $(wildcard sfa/methods/*.py))
78 methods_files := $(sort $(notdir $(methods_paths:.py=)))
80 ifneq ($(methods_now),$(methods_files))
81 sfa/methods/__init__.py: force
83 sfa/methods/__init__.py:
84 (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()') > $@
90 find . -type f | egrep -v '/\.git/|/\.svn/|TAGS|\.py[co]$$|\.doc$$|\.html$$|\.pdf$$|~$$' | xargs etags
94 (cd sfa/methods; grep 'def.*call' *.py > SIGNATURES)
98 # 2 forms are supported
99 # (*) if your plc root context has direct ssh access:
100 # make sync PLC=private.one-lab.org
101 # (*) otherwise, entering through the root context
102 # make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr
104 PLCHOST ?= testplc.onelab.eu
108 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
109 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
113 SSHURL:=root@$(PLC):/
114 SSHCOMMAND:=ssh root@$(PLC)
117 LOCAL_RSYNC_EXCLUDES := --exclude '*.pyc'
118 RSYNC_EXCLUDES := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
119 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
120 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) --no-owner $(RSYNC_EXCLUDES)
122 BINS = ./config/sfa-config-tty ./config/gen-sfa-cm-config.py \
123 ./sfa/plc/sfa-import-plc.py ./sfa/plc/sfa-nuke-plc.py ./sfa/server/sfa-server.py \
124 ./sfa/client/sfi.py ./sfa/client/getNodes.py ./sfa/client/getRecord.py \
125 ./sfa/client/setRecord.py ./sfa/client/sfadump.py
129 @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line"
130 @echo " e.g. make sync PLC=private.one-lab.org"
131 @echo " or make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr"
134 +$(RSYNC) ./sfa/ $(SSHURL)/usr/lib\*/python2.\*/site-packages/sfa/
135 +$(RSYNC) ./tests/ $(SSHURL)/root/tests-sfa
136 +$(RSYNC) $(BINS) $(SSHURL)/usr/bin
137 $(SSHCOMMAND) exec service sfa restart