for python3: specfile and makefile, taking this chance for some overdue cleanups
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 28 Dec 2018 21:48:13 +0000 (22:48 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Fri, 28 Dec 2018 21:48:13 +0000 (22:48 +0100)
Makefile
nodemanager.spec

index 190cad2..0b29c84 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -12,6 +12,8 @@ bindir := /usr/bin
 initdir=/etc/rc.d/init.d
 systemddir := /usr/lib/systemd/system
 
+PYTHON = python3
+
 # call with either WITH_SYSTEMD=true or WITH_INIT=true
 # otherwise we try to guess some reasonable default
 ifeq "$(WITH_INIT)$(WITH_SYSTEMD)" ""
@@ -23,7 +25,7 @@ endif
 endif
 ####################
 all: forward_api_calls
-       python setup.py build
+       $(PYTHON) setup.py build
 
 forward_api_calls: forward_api_calls.c
        $(CC) -Wall -Os -o $@ $?
@@ -31,18 +33,18 @@ forward_api_calls: forward_api_calls.c
 
 #################### install
 install: install-miscell install-startup
-       python setup.py install \
+       $(PYTHON) setup.py install \
                --install-purelib=$(DESTDIR)/$(datadir)/NodeManager \
                --install-platlib=$(DESTDIR)/$(datadir)/NodeManager \
                --install-scripts=$(DESTDIR)/$(bindir)
 
 # might be better in setup.py ?
 # NOTE: the sliver-initscripts/ and sliver-systemd stuff, being, well, for slivers,
-# need to ship on all nodes regardless of WITH_INIT and WITH_SYSTEMD that 
+# need to ship on all nodes regardless of WITH_INIT and WITH_SYSTEMD that
 # impacts how nodemanager itself gets started
 install-miscell:
        install -d -m 755 $(DESTDIR)/var/lib/nodemanager
-       install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager 
+       install -D -m 644 /dev/null $(DESTDIR)/etc/sysconfig/nodemanager
        install -D -m 444 README $(DESTDIR)/$(datadir)/NodeManager/README
        install -D -m 644 logrotate/nodemanager $(DESTDIR)/etc/logrotate.d/nodemanager
        mkdir -p $(DESTDIR)/$(datadir)/NodeManager/sliver-initscripts
@@ -71,40 +73,11 @@ install-systemd:
 
 #################### clean
 clean:
-       python setup.py clean
+       $(PYTHON) setup.py clean
        rm -f forward_api_calls *.pyc build
 
 .PHONY: all install clean
 
-#################### debian-related
-# This is called from the build with the following variables set 
-# (see build/Makefile and target_debian)
-# (.) RPMTARBALL
-# (.) RPMVERSION
-# (.) RPMRELEASE
-# (.) RPMNAME
-DEBVERSION=$(RPMVERSION).$(RPMRELEASE)
-DEBTARBALL=../$(RPMNAME)_$(DEBVERSION).orig.tar.bz2
-DATE=$(shell date -u +"%a, %d %b %Y %T")
-force:
-
-debian: DESTDIR=debian/tmp
-debian: forward_api_calls install 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 --set-envvar PREFIX=/usr -uc -us -b
-
-debian.clean:
-       $(MAKE) -f debian/rules clean
-       rm -rf build/ MANIFEST ../*.tar.gz ../*.dsc ../*.build
-       find . -name '*.pyc' -delete
-
 ################################################## devel-oriented
 tags:
        git ls-files | xargs etags
@@ -125,7 +98,7 @@ tags:
 # and then just run
 # $ make sync
 
-LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc' 
+LOCAL_RSYNC_EXCLUDES   := --exclude '*.pyc'
 RSYNC_EXCLUDES         := --exclude .git  --exclude .svn --exclude '*~' --exclude TAGS $(LOCAL_RSYNC_EXCLUDES)
 RSYNC_COND_DRY_RUN     := $(if $(findstring n,$(MAKEFLAGS)),--dry-run,)
 RSYNC                  := rsync -e "ssh -i $(NODE).key.rsa" -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES)
index 8345af1..99feae6 100644 (file)
 %define _unpackaged_files_terminate_build      0
 
 ##############################
-# use initscripts or systemd unit files to start installed services
-%if "%{distro}" == "Fedora" && "%{distrorelease}" >= "18"
+# only systemd unit files to start installed services
 %define make_options WITH_SYSTEMD=true
-%define initdir /usr/lib/systemd/system
+%define systemddir /usr/lib/systemd/system
 %define build_lxc 1
-%else
-%define make_options WITH_INIT=true
-%define initdir %{_initrddir}
-%define build_vs 1
-%endif
 
 ##############################
 Summary: PlanetLab Node Manager Library
@@ -43,14 +37,12 @@ URL: %{SCMURL}
 #BuildArch: noarch
 
 # make sure we can invoke systemctl in post install script
-%if "%{initdir}" != "%{_initrddir}"
 Requires: systemd
-%endif
 
 # Uses function decorators
-Requires: python >= 2.7
+Requires: python3
 # connecting PLC
-Requires: python-pycurl
+Requires: python3-pycurl
 # Signed tickets
 Requires: gnupg
 # sioc/plnet
@@ -84,22 +76,6 @@ rm -rf $RPM_BUILD_ROOT
 
 ##############################
 %post
-########## traditional init
-%if "%{initdir}" == "%{_initrddir}"
-##########
-chkconfig --add conf_files
-chkconfig conf_files on
-chkconfig --add nm
-chkconfig nm on
-chkconfig --add fuse-pl
-chkconfig fuse-pl on
-if [ "$PL_BOOTCD" != "1" ] ; then
-    service nm restart
-    service fuse-pl restart
-fi
-##########
-%else
-########## systemd
 systemctl enable nm.service
 systemctl enable conf_files.service
 # empty
@@ -108,33 +84,15 @@ if [ "$PL_BOOTCD" != "1" ] ; then
     systemctl restart nm.service
 #    systemctl restart fuse-pl.service
 fi
-##########
-%endif
 
 ##############################
 %preun
 # 0 = erase, 1 = upgrade
-########## traditional init
-%if "%{initdir}" == "%{_initrddir}"
-##########
-if [ $1 -eq 0 ] ; then
-    chkconfig fuse-pl off
-    chkconfig --del fuse-pl
-    chkconfig nm off
-    chkconfig --del nm
-    chkconfig conf_files off
-    chkconfig --del conf_files
-fi
-##########
-%else
-########## systemd
 if [ $1 -eq 0 ] ; then
 #    systemctl disable fuse-pl.service
     systemctl disable conf_files.service
     systemctl disable nm.service
 fi
-##########
-%endif
 
 ##############################
 %clean
@@ -179,7 +137,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/NodeManager/sliver-initscripts/
 %{_datadir}/NodeManager/sliver-systemd/
 %{_bindir}/forward_api_calls
-%{initdir}/
+%{systemddir}/
 %{_sysconfdir}/logrotate.d/nodemanager
 /var/lib/nodemanager/
 %config(noreplace) /etc/sysconfig/nodemanager
@@ -192,9 +150,9 @@ Summary: PlanetLab Node Manager Plugin for lxc nodes
 Group: System Environment/Daemons
 # we use libvirt
 Requires: libvirt
-Requires: libvirt-python
+Requires: python3-libvirt
 # cgroups.py needs this
-Requires: python-inotify
+Requires: python3-inotify
 # the common package for nodemanager
 Requires: nodemanager-lib = %{version}
 # the lxc-specific tools for using slice images
@@ -223,7 +181,7 @@ Group: System Environment/Daemons
 
 # old name, when all came as a single package with vserver wired in
 Obsoletes: NodeManager
-# for nodeupdate 
+# for nodeupdate
 Provides: nodemanager
 
 # our interface to the vserver patch
@@ -700,5 +658,5 @@ nodemanager-vs provides the vserver code for the PlanetLab Node Manager.
 * Wed Oct 03 2007 Faiyaz Ahmed <faiyaza@cs.princeton.edu> .
 - Switched to SVN.
 
-* Mon Nov 13 2006 Mark Huang <mlhuang@paris.CS.Princeton.EDU> - 
+* Mon Nov 13 2006 Mark Huang <mlhuang@paris.CS.Princeton.EDU> -
 - Initial build.