Setting tag plcapi-7.1-1
[plcapi.git] / Makefile
index 429cdca..7eb4969 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,17 +21,26 @@ PWD := $(shell pwd)
 all:
        python3 setup.py build
 
-install: install-python install-phpxmlrpc
-
-install-python:
-       python3 setup.py install \
-           --install-purelib=$(DESTDIR)/$(datadir)/plc_api \
-           --install-scripts=$(DESTDIR)/$(datadir)/plc_api \
-           --install-data=$(DESTDIR)/$(datadir)/plc_api
-
-# phpxmlrpc is a git subtree; we just ship all its contents
-# under /usr/share/plc_api/php/phpxmlrpc
-install-phpxmlrpc:
+# do the install sequentially
+# when defining 2 separate targets, that get run in parallel
+# we observe that the rsync for xmlrpc somehow gets erased and
+# we suspect pip install to do some cleanup at the end...
+install:
+       # we mention --upgrade because otherwise
+       # pip install complains the php/ target already exists
+       # and it refuses to put plc_api.php in there
+       pip install --upgrade --target $(DESTDIR)/$(datadir)/plc_api .
+       # it's important that plcsh sits in /usr/share/plc_api
+       # and not under bin/ so that python can find the PLC/ modules
+       mv $(DESTDIR)/$(datadir)/plc_api/bin/plcsh $(DESTDIR)/$(datadir)/plc_api
+       mv $(DESTDIR)/$(datadir)/plc_api/bin/Server.py $(DESTDIR)/$(datadir)/plc_api
+       # the old recipe used to read
+       # python3 setup.py install \
+       #     --install-purelib=$(DESTDIR)/$(datadir)/plc_api \
+       #     --install-scripts=$(DESTDIR)/$(datadir)/plc_api \
+       #     --install-data=$(DESTDIR)/$(datadir)/plc_api
+       # phpxmlrpc is a git subtree; we just ship all its contents
+       # under /usr/share/plc_api/php/phpxmlrpc
        mkdir -p $(DESTDIR)/$(datadir)/plc_api/php/phpxmlrpc/
        rsync --exclude .git -ai php/phpxmlrpc/ $(DESTDIR)/$(datadir)/plc_api/php/phpxmlrpc/
 
@@ -73,9 +82,9 @@ endif
 endif
 
 LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' --exclude Accessors_site.py
-RSYNC_EXCLUDES         := --exclude .svn --exclude .git --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
+RSYNC_EXCLUDES         := --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
 RSYNC_COND_DRY_RUN     := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
-RSYNC                  := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
+RSYNC                  := rsync -ai $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
 
 sync:
 ifeq (,$(SSHURL))
@@ -84,12 +93,11 @@ ifeq (,$(SSHURL))
        @echo "  make sync PLCHOSTLXC=.. GUESTHOSTNAME=.. GUESTNAME=.."
        @exit 1
 else
-       +$(RSYNC) plcsh PLC planetlab5.sql migrations $(SSHURL)/usr/share/plc_api/
+       +$(RSYNC) plcsh PLC planetlab5.sql migrations php $(SSHURL)/usr/share/plc_api/
        +$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
        +$(RSYNC) plc.d/ $(SSHURL)/etc/plc.d/
        +$(RSYNC) apache/plc.wsgi $(SSHURL)/usr/share/plc_api/apache/
-       $(SSHCOMMAND) /etc/plc.d/httpd stop
-       $(SSHCOMMAND) /etc/plc.d/httpd start
+       $(SSHCOMMAND) systemctl restart plc
 endif
 
 #################### convenience, for debugging only