Setting tag myplc-5.3-5
[myplc.git] / myplc.spec
index 50fa1bf..5567fcb 100644 (file)
@@ -1,20 +1,14 @@
-#
-# $Id$
-#
-%define url $URL$
-
 %define name myplc
-%define version 4.3
-%define taglevel 36
+%define version 5.3
+%define taglevel 5
 
 %define release %{taglevel}%{?pldistro:.%{pldistro}}%{?date:.%{date}}
+%global python_sitearch        %( python -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)" )
 
-Summary: PlanetLab Central (PLC) Portable Installation
 Name: %{name}
 Version: %{version}
 Release: %{release}
 License: PlanetLab
-Group: Applications/Systems
 Source0: %{name}-%{version}.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
 BuildArch: noarch
@@ -22,11 +16,75 @@ BuildArch: noarch
 Vendor: PlanetLab
 Packager: PlanetLab Central <support@planet-lab.org>
 Distribution: PlanetLab %{plrelease}
-URL: %(echo %{url} | cut -d ' ' -f 2)
+URL: %{SCMURL}
+
+%define nodefamily %{pldistro}-%{distroname}-%{_arch}
+
+
+####################### myplc - mostly a meta-package
+Summary: PlanetLab Central (PLC) Portable Installation
+Group: Applications/Systems
+
+# planetlab stuff
+Requires: myplc-docs
+Requires: myplc-release
+Requires: myplc-core
+Requires: createrepo
+Requires: bootmanager
+Requires: bootcd-%{nodefamily}
+Requires: bootcd-initscripts
+Requires: nodeimage-%{nodefamily}
+Requires: nodeconfig
+Requires: nodeyum
+Requires: www-register-wizard
+
+
+# starting with f16 we depend on this new rpm
+%if "%{distro}" == "Fedora" && %{distrorelease} >= 16
+Requires: rpm-sign
+%endif
+
+
+%description
+MyPLC is a complete PlanetLab Central (PLC) portable installation.
+The default installation consists of a web server, an XML-RPC API
+server, a boot server, and a database server: the core components of
+PLC. The installation may be customized through a graphical
+interface. All PLC services are started up and shut down through a
+single System V init script.
+
+
+####################### myplc-core
+# Warning: it appears that Requires should come here
+# BEFORE the %description thingy
+
+%package core
+
+Summary: core contents of myplc with API + db + www UI
+
+# as much as possible, requires should have gone
+# with the individual packages, but well
+Requires: myplc-config
+Requires: plcapi
+Requires: plewww
+
+# this technically is a plcapi dependency
+# but it's simpler here for chosing which
+%if "%{distro}" == "Fedora" && %{distrorelease} >= 29
+Requires: python2-mod_wsgi
+%else
+Requires: mod_wsgi
+%endif
+
+# this technically is a plewww dependency
+# starting with f27 we depend on this new rpm
+%if "%{distro}" == "Fedora" && %{distrorelease} >= 27
+Requires: php-fpm
+%endif
 
-# as much as possible, requires should go in the subpackages specfile
+Requires: redhat-lsb
 Requires: bzip2
-Requires: tar 
+Requires: tar
 Requires: less
 Requires: sendmail
 Requires: sendmail-cf
@@ -36,10 +94,8 @@ Requires: php-pgsql
 Requires: curl
 Requires: rsync
 Requires: python-devel
-Requires: vixie-cron
-Requires: yum
-Requires: PyXML
-Requires: createrepo
+Requires: dnf
+#Requires: PyXML
 Requires: cpio
 Requires: wget
 Requires: php
@@ -51,33 +107,27 @@ Requires: vim-minimal
 Requires: findutils
 Requires: xmlsec1
 Requires: xmlsec1-openssl
-# planetlab stuff
-Requires: bootmanager
-Requires: bootcd-%{pldistro}-%{_arch}
-Requires: PLCWWW
-Requires: www-register-wizard
-Requires: nodeconfig
-Requires: PLCAPI
-Requires: pcucontrol
-Requires: bootstrapfs-%{pldistro}-%{_arch}
-Requires: myplc-docs
-Requires: myplc-release
+Requires: ed
+Requires: cronie
 
-# argh - ugly - we might wish to use something from build/config.%{pldistro} instead
-%if "%{pldistro}" == "onelab"
-Requires: dummynet_image
-%endif
 
-%define debug_package %{nil}
+%description core
+The core of myplc is about its API + database + web interface.
+Installing this will not require any node-oriented
+package, like bootcd, nodeimage, or bootmanager.
+
+####################### myplc-config
+
+%package config
+
+Summary: PlanetLab Central (PLC) configuration python module
+Group: Applications/Systems
+Requires: python
+
+%description config
+This package provides the Python module to configure MyPLC.
+
 
-%description
-MyPLC is a complete PlanetLab Central (PLC) portable installation
-contained within a chroot jail. The default installation consists of a
-web server, an XML-RPC API server, a boot server, and a database
-server: the core components of PLC. The installation may be customized
-through a graphical interface. All PLC services are started up and
-shut down through a single System V init script installed in the host
-system.
 
 %prep
 %setup -q
@@ -85,25 +135,61 @@ system.
 %build
 
 %install
-pushd MyPLC
 rm -rf $RPM_BUILD_ROOT
-./build.sh %{pldistro} $RPM_BUILD_ROOT
-popd
+
+# Install configuration scripts
+echo "* Installing plc_config.py in " ${PYTHON_SITEARCH}
+PYTHON_SITEARCH=`python -c 'from distutils.sysconfig import get_python_lib; print get_python_lib(1)'`
+install -D -m 755 plc_config.py ${RPM_BUILD_ROOT}/${PYTHON_SITEARCH}/plc_config.py
+
+echo "* Installing scripts in /usr/bin"
+mkdir -p ${RPM_BUILD_ROOT}/usr/bin
+rsync -av --exclude .svn bin/ ${RPM_BUILD_ROOT}/usr/bin/
+(cd $RPM_BUILD_ROOT/usr/bin; ln -s mtail.py mtail)
+chmod 755 ${RPM_BUILD_ROOT}/usr/bin/*
+
+# Install initscript
+echo "* Installing plc initscript"
+install -D -m 755 systemd/plc-ctl ${RPM_BUILD_ROOT}/usr/bin/plc-ctl
+install -D -m 644 systemd/plc.service ${RPM_BUILD_ROOT}/usr/lib/systemd/system/plc.service
+
+# Install initscripts
+echo "* Installing plc.d initscripts"
+find plc.d | cpio -p -d -u ${RPM_BUILD_ROOT}/etc/
+chmod 755 ${RPM_BUILD_ROOT}/etc/plc.d/*
+
+# Install db-config.d files
+echo "* Installing db-config.d files"
+mkdir -p ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d
+cp db-config.d/* ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d
+chmod 444 ${RPM_BUILD_ROOT}/etc/planetlab/db-config.d/*
+
+# Extra scripts (mostly for mail and dns) not installed by myplc by default.  Used in production
+echo "* Installing scripts in /etc/support-scripts"
+mkdir -p ${RPM_BUILD_ROOT}/etc/support-scripts
+cp support-scripts/* ${RPM_BUILD_ROOT}/etc/support-scripts
+chmod 444 ${RPM_BUILD_ROOT}/etc/support-scripts/*
+
+# copy initscripts to etc/plc_sliceinitscripts
+mkdir -p ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts
+cp plc_sliceinitscripts/* ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts
+chmod 444 ${RPM_BUILD_ROOT}/etc/plc_sliceinitscripts/*
+
+# Install configuration file
+echo "* myplc: Installing configuration file"
+install -D -m 444 plc_config.dtd ${RPM_BUILD_ROOT}/etc/planetlab/plc_config.dtd
+sed -e "s,@PLDISTRO@,%{pldistro},g" -e "s,@FCDISTRO@,%{distroname},g" -e "s,@ARCH@,%{_arch},g" \
+    default_config.xml > ${RPM_BUILD_ROOT}/etc/planetlab/default_config.xml
+chmod 444 ${RPM_BUILD_ROOT}/etc/planetlab/default_config.xml
+
+echo "* Installing bashrc convenience"
+install -D -m 644 bashrc ${RPM_BUILD_ROOT}/usr/share/myplc/bashrc
+
+# yumgroups.xml and yum repo : let noderepo handle that
 
 %clean
 rm -rf $RPM_BUILD_ROOT
 
-# If run under sudo
-if [ -n "$SUDO_USER" ] ; then
-    # Allow user to delete the build directory
-    chown -h -R $SUDO_USER .
-    # Some temporary cdroot files like /var/empty/sshd and
-    # /usr/bin/sudo get created with non-readable permissions.
-    find . -not -perm +0600 -exec chmod u+rw {} \;
-    # Allow user to delete the built RPM(s)
-    [ -d %{_rpmdir}/noarch ] && chown -h -R $SUDO_USER %{_rpmdir}/noarch
-fi
-
 %pre
 if [ -x %{_sysconfdir}/init.d/plc ] ; then
     %{_sysconfdir}/init.d/plc stop
@@ -140,14 +226,12 @@ if [ $1 -gt 0 ] ; then
 fi
 
 %post
-if [ -x /sbin/chkconfig ] ; then
-    /sbin/chkconfig --add plc
-    /sbin/chkconfig plc on
-fi
-pushd /usr/share/myplc &> /dev/null
-python plc_config.py build
-python plc_config.py install
-popd &> /dev/null
+systemctl enable plc
+
+%if "%{distro}" == "Fedora" && %{distrorelease} >= 27
+systemctl enable php-fpm
+systemctl start  php-fpm
+%endif
 
 %triggerpostun -- %{name}
 # 0 = erase, 1 = upgrade
@@ -161,42 +245,199 @@ if [ $1 -gt 0 ] ; then
            fi
        fi
     done
-fi    
+fi
 
 %preun
 # 0 = erase, 1 = upgrade
 if [ $1 -eq 0 ] ; then
     %{_sysconfdir}/init.d/plc stop
-    if [ -x /sbin/chkconfig ] ; then
-        /sbin/chkconfig plc off
-       /sbin/chkconfig --del plc
-    fi
+    systemctl disable plc
 fi
 
+
 %files
+/usr/share/myplc/bashrc
+
+%files core
 %defattr(-,root,root,-)
-# Host startup script and configuration file
-/etc/init.d/plc
+/usr/lib/systemd/system/plc.service
+/usr/bin/plc-ctl
 /etc/plc.d
 /etc/planetlab
-/etc/plc_sliceinitscripts/sirius
-/etc/support-scripts/gen_aliases.py*
-/etc/support-scripts/renew_reminder.py*
-/etc/support-scripts/renew_reminder_logrotate
-/usr/bin/plc-config
+/etc/plc_sliceinitscripts
+/etc/support-scripts
+# keep a detailed list, to avoid duplicate of plc-config,
+# that belongs to the myplc-config rpm
 /usr/bin/plc-config-tty
 /usr/bin/db-config
 /usr/bin/dns-config
+/usr/bin/refresh-peer.py*
+/usr/bin/mtail.py*
+/usr/bin/mtail
 /usr/bin/plc-map.py*
 /usr/bin/plc-kml.py*
-/usr/bin/refresh-peer.py*
 /usr/bin/clean-empty-dirs.py*
-/usr/bin/mtail.py*
 /usr/bin/plc-check-ssl-peering.py*
 /usr/bin/plc-orphan-accounts.py*
-/usr/share/myplc
+/usr/bin/spot-aliens.py*
+/usr/bin/check-hrns.py*
+/usr/bin/check-vsys-defaults.py*
+/usr/bin/spot-dup-accounts.sh
+
+
+%files config
+%defattr(-,root,root,-)
+/usr/bin/plc-config
+%{python_sitearch}/plc_config.py*
+
 
 %changelog
+* Mon Jan 07 2019 Thierry Parmentelat <thierry.parmentelat@inria.fr> - myplc-5.3-5
+- last version suitable for f27/f29 with python2
+- packaging is split up, one more rpm named 'myplc-core' is produced,
+- that covers the infrastructure side only (without bootcds and nodeimages and all node-oriented material)
+- no more init file, one systemd service only, that leverages new /usr/bin/plc-ctl
+- more robust config for httpd and php-fpm and php
+
+* Sun Jul 16 2017 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.3-4
+- takes care of creating plcapi log file
+
+* Wed Feb 18 2015 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.3-3
+- tweaked renew_reminder for federation
+
+* Fri Mar 21 2014 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.3-2
+- tweaks in check-hrns.py
+- do not require PyXML any more
+
+* Tue Dec 10 2013 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.3-1
+- review check-hrns for plcapi-5.3
+- add PLC_HRN_ROOT in usual plc-config-tty's settings
+
+* Thu Oct 10 2013 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.2-5
+- reduce the scope of check-hrns.py script, now that the SFA layer handles this natively
+- add an rpm-sign dependency on feedora>=16
+
+* Fri Jun 28 2013 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.2-4
+- drop PLC_OMF_XMPP_{USER,PASSWORD} from config
+
+* Tue Apr 23 2013 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.2-3
+- plc.d/gpg now does not rm /dev/random but preserves it
+- this is because libvirt won't let us run mknod
+
+* Wed Apr 10 2013 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.2-2
+- fix typo in check-hrns - used to print 'host' while dealing with persons
+
+* Thu Mar 07 2013 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.2-1
+- supports httpd config for either mod_python (preferred) or mod_wsgi
+- requires mod_wsgi on f18 only, otherwise mod_python
+- supports httpd config for apache 2.4 (f18)
+- new config variable PLC_FLAVOUR_VIRT_MAP to set 'virt' from fcdistro
+
+* Wed Dec 19 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.1-6
+- bugfix in check-vsys-defaults.py
+
+* Wed Dec 19 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.1-5
+- define open_basedir in php.ini to stop confidentiality leak
+- new utility slice_ssh_keys.py for showing sliver keys (OMF interop)
+- new config setting PLC_VSYS_DEFAULTS for vsys tags granted to all
+- new utilities check-hrns.py and check-vsys-defaults.py
+
+* Fri Aug 31 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.1-4
+- set TimeoutSec to 300 in plc.service
+- remove ref to deprecated svn $URL$ in db-config usage
+
+* Mon Jul 09 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.1-3
+- expose mtail.py as simply mtail
+
+* Mon May 07 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.1-2
+- plc-kml.py now has support for nodegroups
+
+* Mon Apr 16 2012 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.1-1
+- use nodeimage package instead of deprecated bootstrapfs
+- has systemd-friendly startup script
+- plc_reload moved to functions/ - no more service plc reload
+- no svn keywords anymore
+
+* Mon Sep 26 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-19
+- new maintenance/monitoring script spot-aliens to look for glitches in refreshpeer+sfa
+
+* Tue Jun 07 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-18
+- new settings for myslice (comon&tophat) and monitor (db)
+- removed mentions of chroot in description
+- can redo myplc-docs on broken f12-latex
+- set short_open_tag in php.ini
+- fixes in gen-sites-xml (is that still used ?)
+- partial-repo.sh has moved to 'build' where it more belongs
+- tweaks in convenience tool 'mtail'
+
+* Tue Mar 22 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-17
+- fixed changelog, no change from 5.0-16
+
+* Mon Mar 21 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-16
+- requires ed for the plc.d/packages step
+- sirius initscript to handle stop and restart
+
+* Fri Feb 04 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-15
+- ignore steps in db-config.d if they have a '.' or '~' in their name
+
+* Wed Jan 26 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-14
+- can redo myplc-docs without the doc for monitor
+
+* Mon Jan 24 2011 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-13
+- no semantic change - just fixed specfile for git URL
+
+* Wed Dec 01 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-12
+- needed for plcapi-5.0-19, i.e. tag permissions based on roles
+
+* Mon Oct 04 2010 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - myplc-5.0-11
+- add missing files to rpm package
+
+* Mon Oct 04 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-10
+- mtail.py -s for SFA
+- spot-aliesm.py is a utility script for sanity checks of the PLC db when running refreshpeer+sfa
+
+* Thu Jul 15 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-9
+- avoid duplication of the plc-config binary in both myplc and myplc-config rpms
+
+* Mon Jul 12 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - myplc-5.0-8
+- plc-config-tty now has a validator on booleans
+- e.g. entering 'True' now is rejected rather than silently recording 'false'
+
+* Tue Jul 06 2010 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - MyPLC-5.0-7
+- disable mod_wsgi
+
+* Mon Jul 05 2010 Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - MyPLC-5.0-6
+- module name changes
+- start wsgi support
+
+* Tue Jun 22 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-5.0-5
+- new setting PLC_RESERVATION_GRANULARITY
+
+* Wed May 12 2010 Talip Baris Metin <Talip-Baris.Metin@sophia.inria.fr> - MyPLC-5.0-4
+- * partial-repo.sh script
+- * preserve key along with certificates
+
+* Fri Apr 02 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-5.0-3
+- set date.timezone to GMT if not set in php.ini for php-5.3 / fedora12
+
+* Fri Mar 12 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-5.0-2
+- legacy scripts gen-sites-xml & gen-static-content back in (sigh)
+- new OMF category in the config
+- create the drl system slice
+
+* Fri Jan 29 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-5.0-1
+- first working version of 5.0:
+- pld.c/, db-config.d/ and nodeconfig/ scripts should now sit in the module they belong to
+- nodefamily is 3-fold with pldistro-fcdistro-arch
+- new PLC_FLAVOUR config category
+- reviewed module layout
+- cleaned up old chroot-related build stuff (does not need the build module when building anymore)
+
+* Sat Jan 09 2010 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.3-37
+- support for fedora 12
+- new package myplc-config for use by sfa
+- drupal user registration turned off
+
 * Thu Dec 31 2009 Marc Fiuczynski <mef@cs.princeton.edu> - MyPLC-4.3-36
 - - fix to make sure when API, BOOT, MONITOR are on the same
 - machine as WWW that the SSL key,cert for WWW takes precedence.
@@ -287,7 +528,7 @@ fi
 - - Fix /etc/init.d/plc to have command usage show up on the tty rather
 - than the log file
 - - Fix db-config to be a bit more cautious when
-- /etc/planetlab/db-config.d doesn't exist
+- /etc/planetlab/db-config.d doesn''t exist
 - - Clean up db-config approach to ignore .bak, *~, .rpm{save,new}, and
 - .orig files.
 - - Refactor generic plc-config-tty code into plc_config.py.
@@ -361,22 +602,22 @@ fi
 - figures in doc package
 
 * Fri May 09 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-11
-- no more doc packaged outside of myplc-docs - doc/ cleaned up 
+- no more doc packaged outside of myplc-docs - doc/ cleaned up
 - chroot packaging does not have docs anymore
 - 'cvs' and 'dev' not required from myplc-native anymore
 - cosmetic change in kml output
 
 * Thu May 08 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-10
 - defaults for *_IP conf vars now void, expect more accurate /etc/hosts
-- gethostbyname uses python rather than perl (hope this shrinks deps) 
+- gethostbyname uses python rather than perl (hope this shrinks deps)
 - doc: reviewed myplc doc - deprecated everything related to myplc-devel
 - doc: packaging doc in myplc-native (myplc&PLCAPI) & removed target files from svn
-- make sync now works towards vserver-based myplc only 
+- make sync now works towards vserver-based myplc only
 
 * Mon May 05 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - MyPLC-4.2-9
-- 
+-
 - added vsys 'pfmount' script to the default netflow slice attributes.
-- 
+-
 
 * Thu Apr 24 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-8
 - plc.d/bootcd step altered for handling legacy bootcd smooth migration
@@ -391,10 +632,10 @@ fi
 - resolv file in /etc/resolv.conf, not plc_resolv.conf
 - improved sirius script
 - remove the 'driver' node-network-setting that was unused, and new 'Multihome' category
-- expires more properly set 
+- expires more properly set
 
 * Mon Apr 07 2008 Stephen Soltesz <soltesz@cs.princeton.edu> - MyPLC-4.2-4 MyPLC-4.2-5
-- 
+-
 
 * Wed Mar 26 2008 Thierry Parmentelat <thierry.parmentelat@sophia.inria.fr> - MyPLC-4.2-3 MyPLC-4.2-4
 - renew_reminder script moved to support-scripts/
@@ -417,4 +658,4 @@ fi
 * Fri Aug 31 2007 Marc E. Fiuczynski <mef@CS.Princeton.EDU>
 - initial build.
 
-%define module_current_branch 4.2
+%define module_current_branch 4.3