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 this is empty
21 rpmtaglevel:=$(shell rpm -q --specfile sfa.spec --queryformat="%{taglevel}\n" 2> /dev/null | head -1)
22 rpmtaglevel:=$(if $(rpmtaglevel),$(rpmtaglevel),0)
23 VERSIONTAG=$(rpmversion)-$(rpmtaglevel)
24 SCMURL=should-be-redefined-by-specfile
28 version: sfa/util/version.py
29 sfa/util/version.py: sfa/util/version.py.in
30 sed -e "s,@VERSIONTAG@,$(VERSIONTAG),g" -e "s,@SCMURL@,$(SCMURL),g" sfa/util/version.py.in > $@
33 cd xmlbuilder-0.9 && python setup.py install --root=$(DESTDIR) && cd -
36 python setup.py install --root=$(DESTDIR)
37 chmod 444 $(DESTDIR)/etc/sfa/default_config.xml
39 python-clean: version-clean
44 rm -f sfa/util/version.py
46 .PHONY: python version python-install python-clean version-clean xmlbuilder-install
51 # propagate DESTDIR from the specfile
53 $(MAKE) -C wsdl install
58 .PHONY: wsdl wsdl-install wsdl-clean
62 mkdir -p $(DESTDIR)/usr/share/sfa/tests
63 install -m 755 tests/*.py $(DESTDIR)/usr/share/sfa/tests/
66 rm -rf $(DESTDIR)/usr/share/sfa/tests
68 .PHONY: tests-install tests-uninstall
70 ########## refreshing methods package metafile
71 # Metafiles - manage Legacy/ and Accessors by hand
72 init := sfa/methods/__init__.py
79 methods_now := $(sort $(shell fgrep -v '"' sfa/methods/__init__.py 2>/dev/null))
80 # what should be declared
81 methods_paths := $(filter-out %/__init__.py, $(wildcard sfa/methods/*.py))
82 methods_files := $(sort $(notdir $(methods_paths:.py=)))
84 ifneq ($(methods_now),$(methods_files))
85 sfa/methods/__init__.py: force
87 sfa/methods/__init__.py:
88 (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()') > $@
94 find . -type f | egrep -v '/\.git/|/\.svn/|TAGS|~$$|\.(py[co]|doc|html|pdf|png|svg|out|bak|xml|dg)$$' | xargs etags
98 (cd sfa/methods; grep 'def.*call' *.py > SIGNATURES)
102 # 2 forms are supported
103 # (*) if your plc root context has direct ssh access:
104 # make sync PLC=private.one-lab.org
105 # (*) otherwise, entering through the root context
106 # make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr
108 PLCHOST ?= testplc.onelab.eu
112 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
113 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
117 SSHURL:=root@$(PLC):/
118 SSHCOMMAND:=ssh root@$(PLC)
121 LOCAL_RSYNC_EXCLUDES += --exclude '*.pyc'
122 LOCAL_RSYNC_EXCLUDES += --exclude '*.png' --exclude '*.svg' --exclude '*.out'
123 RSYNC_EXCLUDES := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
124 RSYNC_COND_DRY_RUN := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
125 RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) --no-owner $(RSYNC_EXCLUDES)
127 CLIENTS = sfi.py getNodes.py getRecord.py setRecord.py \
128 sfiAddAttribute.py sfiAddSliver.py sfiDeleteAttribute.py sfiDeleteSliver.py sfiListNodes.py \
129 sfiListSlivers.py sfadump.py
131 BINS = ./config/sfa-config-tty ./config/gen-sfa-cm-config.py \
132 ./sfa/importer/sfa-import-plc.py ./sfa/importer/sfa-nuke-plc.py ./sfa/server/sfa-start.py \
133 $(foreach client,$(CLIENTS),./sfa/client/$(client))
137 @echo "sync: You must define, either PLC, or PLCHOST & GUEST, on the command line"
138 @echo " e.g. make sync PLC=private.one-lab.org"
139 @echo " or make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr"
142 +$(RSYNC) ./sfa/ $(SSHURL)/usr/lib\*/python2.\*/site-packages/sfa/
143 +$(RSYNC) ./tests/ $(SSHURL)/root/tests-sfa
144 +$(RSYNC) $(BINS) $(SSHURL)/usr/bin/
145 +$(RSYNC) ./sfa/init.d/sfa $(SSHURL)/etc/init.d/
146 +$(RSYNC) ./config/default_config.xml $(SSHURL)/etc/sfa/
147 $(SSHCOMMAND) exec service sfa restart