a little nicer wrt pep8
[sfa.git] / Makefile
index 45add83..90e70de 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,15 @@
 #
-## (Re)builds Python metafile (__init__.py) 
-# 
+## (Re)builds Python metafile (__init__.py)
+#
 # overwritten by the specfile
 DESTDIR="/"
 PREFIX=/usr
 ##########
-all: python wsdl 
+all: python
 
-install: python-install wsdl-install tests-install
+install: python-install tests-install
 
-clean: python-clean wsdl-clean 
+clean: python-clean
 
 uninstall: python-uninstall tests-uninstall
 
@@ -25,68 +25,26 @@ SCMURL=git://git.onelab.eu/sfa.git
 
 python: version
 
-version: sfa/util/version.py 
+version: sfa/util/version.py
 sfa/util/version.py: sfa/util/version.py.in force
        sed -e "s,@VERSIONTAG@,$(VERSIONTAG),g" -e "s,@SCMURL@,$(SCMURL),g" sfa/util/version.py.in > $@
 
 # postinstall steps - various cleanups and tweaks for a nicer rpm
 python-install:
-       python setup.py install --prefix=$(PREFIX) --root=$(DESTDIR)
+       python3 setup.py install --prefix=$(PREFIX) --root=$(DESTDIR)
        chmod 444 $(DESTDIR)/etc/sfa/default_config.xml
        rm -rf $(DESTDIR)/usr/lib*/python*/site-packages/*egg-info
        rm -rf $(DESTDIR)/usr/lib*/python*/site-packages/sfa/storage/migrations
        (cd $(DESTDIR)/usr/bin ; ln -s sfi.py sfi; ln -s sfascan.py sfascan; ln -s sfaadmin.py sfaadmin)
 
 python-clean: version-clean
-       python setup.py clean
+       python3 setup.py clean
 #      rm $(init)
 
 version-clean:
        rm -f sfa/util/version.py
 
-.PHONY: python version python-install python-clean version-clean 
-##########
-wsdl: 
-       $(MAKE) -C wsdl 
-
-# propagate DESTDIR from the specfile
-wsdl-install:
-       $(MAKE) -C wsdl install 
-
-wsdl-clean:
-       $(MAKE) -C wsdl clean
-
-.PHONY: wsdl wsdl-install wsdl-clean
-
-######################################## debian packaging
-# The 'debian' target is called from the build with the following variables set 
-# (see build/Makefile and target_debian)
-# (.) RPMTARBALL
-# (.) RPMVERSION
-# (.) RPMRELEASE
-# (.) RPMNAME
-#
-PROJECT=$(RPMNAME)
-DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
-DEBTARBALL=../$(PROJECT)_$(DEBVERSION).orig.tar.bz2
-
-DATE=$(shell date -u +"%a, %d %b %Y %T")
-
-debian: debian/changelog debian.source debian.package
-
-debian/changelog: debian/changelog.in
-       sed -e "s|@VERSION@|$(DEBVERSION)|" -e "s|@DATE@|$(DATE)|" debian/changelog.in > debian/changelog
-
-debian.source: force 
-       rsync -a $(RPMTARBALL) $(DEBTARBALL)
-
-debian.package:
-       debuild -uc -us -b 
-
-debian.clean:
-       $(MAKE) -f debian/rules clean
-       rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
-       find . -name '*.pyc' -delete
+.PHONY: python version python-install python-clean version-clean
 
 ##########
 tests-install:
@@ -100,7 +58,7 @@ tests-uninstall:
 
 ########## refreshing methods package metafile
 # Metafiles - manage Legacy/ and Accessors by hand
-init := sfa/methods/__init__.py 
+init := sfa/methods/__init__.py
 
 index: $(init)
 
@@ -115,7 +73,7 @@ methods_files := $(sort $(notdir $(methods_paths:.py=)))
 ifneq ($(methods_now),$(methods_files))
 sfa/methods/__init__.py: force
 endif
-sfa/methods/__init__.py: 
+sfa/methods/__init__.py:
        (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()') > $@
 
 force:
@@ -123,12 +81,12 @@ force:
 ##########
 # a lot of stuff in the working dir is just noise
 files:
-       @find . -type f | egrep -v '^\./\.|/\.git/|/\.svn/|TAGS|AA-|~$$|egg-info|\.(py[co]|doc|html|pdf|png|svg|out|bak|dg|pickle)$$' 
+       @find . -type f | egrep -v '^\./\.|/\.git/|/\.svn/|TAGS|AA-|~$$|egg-info|\.(py[co]|doc|html|pdf|png|svg|out|bak|dg|pickle)$$'
 
 git-files:
-       @git ls-files | grep -v '\.doc$$'
+       @git ls-files | egrep -v '\.(doc|html|pdf)$$'
 
-tags:  
+tags:
        $(MAKE) git-files | xargs etags
 
 .PHONY: files tags
@@ -149,19 +107,19 @@ PYPI_TARBALL_TOPDIR=/build/sfa
 # and I could not find out why
 # so I went for the manual method instead
 # there also was a web dialog prompting for a zip file that would
-# be used to initialize the project's home dir but this too 
+# be used to initialize the project's home dir but this too
 # did not seem to work the way I was trying to use it, so ...
 
 # this target is still helpful to produce the readme in html from README.md
 index.zip index.html: README.md
-       python readme.py
+       python3 readme.py
 
 # I need to run this on my mac as my pypi
 # run git pull first as this often comes afet a module-tag
 # we need to re-run make so the version is right
 git_pypi: git pypi
 
-git: 
+git:
        git pull
        $(MAKE) version
 
@@ -169,7 +127,7 @@ git:
 pypi: index.html
        setup.py sdist upload -r $(PYPI_TARGET)
        ssh $(PYPI_TARBALL_HOST) mkdir -p $(PYPI_TARBALL_TOPDIR)/$(VERSIONTAG)
-       rsync -av dist/sfa-$(VERSIONTAG).tar.gz $(PYPI_TARBALL_HOST):$(PYPI_TARBALL_TOPDIR)/$(VERSIONTAG)
+       rsync -ai dist/sfa-$(VERSIONTAG).tar.gz $(PYPI_TARBALL_HOST):$(PYPI_TARBALL_TOPDIR)/$(VERSIONTAG)
 
 # cleanup
 clean: readme-clean
@@ -200,7 +158,7 @@ endif
 endif
 endif
 
-synccheck: 
+synccheck:
 ifeq (,$(SSHURL))
        @echo "sync: I need more info from the command line, e.g."
        @echo "  make sync PLC=boot.planetlab.eu"
@@ -209,44 +167,44 @@ ifeq (,$(SSHURL))
        @exit 1
 endif
 
-LOCAL_RSYNC_EXCLUDES   += --exclude '*.pyc' 
+LOCAL_RSYNC_EXCLUDES   += --exclude '*.pyc'
 LOCAL_RSYNC_EXCLUDES   += --exclude '*.png' --exclude '*.svg' --exclude '*.out'
 RSYNC_EXCLUDES         := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
 RSYNC_COND_DRY_RUN     := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
-RSYNC                  := rsync -a -v $(RSYNC_COND_DRY_RUN) --no-owner $(RSYNC_EXCLUDES)
+RSYNC                  := rsync -ai $(RSYNC_COND_DRY_RUN) --no-owner $(RSYNC_EXCLUDES)
 
 CLIENTS = $(shell ls clientbin/*.py)
 
-BINS = ./config/sfa-config-tty ./config/gen-sfa-cm-config.py \
-       ./sfa/server/sfa-start.py \
-       ./clientbin/sfaadmin.py \
+BINS = ./config/sfa-config-tty ./systemd/sfa-setup.sh \
+       ./sfa/server/sfa-start.py ./clientbin/sfaadmin.py keyconvert/keyconvert.py \
        $(CLIENTS)
 
 synclib: synccheck
-       +$(RSYNC) --relative ./sfa/ --exclude migrations $(SSHURL)/usr/lib\*/python2.\*/site-packages/
-synclibdeb: synccheck
-       +$(RSYNC) --relative ./sfa/ --exclude migrations $(SSHURL)/usr/share/pyshared/
+       +$(RSYNC) --relative ./sfa/ --exclude migrations $(SSHURL)/usr/lib\*/python3.\*/site-packages/
 syncmigrations:
        +$(RSYNC) ./sfa/storage/migrations/versions/*.py $(SSHURL)/usr/share/sfa/migrations/versions/
 syncbin: synccheck
        +$(RSYNC)  $(BINS) $(SSHURL)/usr/bin/
-syncinit: synccheck
-       +$(RSYNC) ./init.d/sfa  $(SSHURL)/etc/init.d/
+syncservices: synccheck
+       +$(RSYNC) ./systemd/*.service  $(SSHURL)/lib/systemd/system
+       +$(RSYNC) ./systemd/sfa-setup.sh  $(SSHURL)/usr/bin
 syncconfig:
        +$(RSYNC) ./config/default_config.xml $(SSHURL)/etc/sfa/
 synctest: synccheck
        +$(RSYNC) ./tests/ $(SSHURL)/root/tests-sfa
 syncrestart: synccheck
        -$(SSHCOMMAND) systemctl --system daemon-reload
-       $(SSHCOMMAND) service sfa restart
+       $(SSHCOMMAND) systemctl restart sfa-db
+       $(SSHCOMMAND) systemctl restart sfa-aggregate
+       $(SSHCOMMAND) systemctl restart sfa-registry
 
 syncmig:
        +$(RSYNC) ./sfa/storage/migrations $(SSHURL)/usr/share/sfa/
 
 
 # full-fledged
-sync: synclib syncbin syncinit syncconfig syncrestart
-syncdeb: synclibdeb syncbin syncinit syncconfig syncrestart
+sync: synclib syncbin syncservices syncconfig syncrestart
+syncdeb: synclibdeb syncbin syncservices syncconfig syncrestart
 # 99% of the time this is enough
 syncfast: synclib syncrestart
 
@@ -258,11 +216,11 @@ sfa/examples/miniclient.py \
 sfa/__init__.py \
 sfa/client/{sfaserverproxy,sfaclientlib,__init__}.py \
 sfa/trust/{certificate,__init__}.py \
-sfa/util/{sfalogging,faults,genicode,enumeration,__init__}.py 
+sfa/util/{sfalogging,faults,genicode,enumeration,__init__}.py
 
-clientlibsync: 
+clientlibsync:
        @[ -d "$(CLIENTLIBTARGET)" ] || { echo "You need to set the make variable CLIENTLIBTARGET"; exit 1; }
-       rsync -av --relative $(CLIENTLIBFILES) $(CLIENTLIBTARGET)
+       rsync -ai --relative $(CLIENTLIBFILES) $(CLIENTLIBTARGET)
 
 #################### convenience, for debugging only
 # make +foo : prints the value of $(foo)