[pve-devel] [PATCH ha-manager 08/12] build: restructure packaging

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Sep 28 12:48:55 CEST 2018


introduce libpve-ha-common-perl which contains all the perl modules
shared by pve-ha-manager and pve-ha-simulator.

rework build structure to properly use dpkg-buildpackage and
debian/*.install files.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 Makefile                                     | 17 ++-----------
 src/Makefile                                 |  9 ++-----
 src/PVE/HA/Makefile                          | 13 +++-------
 src/PVE/HA/Resources/Makefile                |  5 ----
 src/PVE/HA/Sim/Makefile                      |  6 ++---
 src/PVE/HA/Sim/Resources/Makefile            |  4 +--
 src/PVE/Makefile                             |  6 -----
 changelog.Debian => debian/changelog         |  0
 debian/control                               | 26 ++++++++++++++++++++
 debian/libpve-ha-common-perl.install         | 10 ++++++++
 debian/pve-ha-manager.install                | 23 ++++++++++++++++++
 debian/{triggers => pve-ha-manager.triggers} |  0
 debian/pve-ha-simulator.install              |  2 ++
 simdebian/compat                             |  1 -
 simdebian/control                            | 14 -----------
 simdebian/copyright                          | 16 ------------
 simdebian/rules                              | 20 ---------------
 src/pve-ha-simulator                         |  2 +-
 18 files changed, 74 insertions(+), 100 deletions(-)
 rename changelog.Debian => debian/changelog (100%)
 create mode 100644 debian/libpve-ha-common-perl.install
 create mode 100644 debian/pve-ha-manager.install
 rename debian/{triggers => pve-ha-manager.triggers} (100%)
 create mode 100644 debian/pve-ha-simulator.install
 delete mode 100644 simdebian/compat
 delete mode 100644 simdebian/control
 delete mode 100644 simdebian/copyright
 delete mode 100755 simdebian/rules

diff --git a/Makefile b/Makefile
index b406f3f..1bf41fa 100644
--- a/Makefile
+++ b/Makefile
@@ -17,19 +17,6 @@ all: deb
 dinstall: $(DEB) $(SIMDEB)
 	dpkg -i ${DEB} ${SIMDEB}
 
-
-.PHONY: simdeb
-simdeb: ${SIMDEB}
-${SIMDEB}:
-	rm -rf build
-	mkdir build
-	rsync -a src/ build
-	rsync -a simdebian/ build/debian
-	cp changelog.Debian build/debian/changelog
-	echo "git clone git://git.proxmox.com/git/pve-ha-manager.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
-	cd build; dpkg-buildpackage -rfakeroot -b -us -uc
-	lintian ${SIMDEB}
-
 .PHONY: deb
 deb: ${DEB} ${SIMDEB}
 ${DEB}:
@@ -37,10 +24,10 @@ ${DEB}:
 	mkdir build
 	rsync -a src/ build
 	rsync -a debian/ build/debian
-	cp changelog.Debian build/debian/changelog
 	echo "git clone git://git.proxmox.com/git/pve-ha-manager.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
-	cd build; dpkg-buildpackage -rfakeroot -b -us -uc
+	cd build; dpkg-buildpackage -b -us -uc
 	lintian ${DEB}
+	lintian ${SIMDEB}
 
 .PHONY: clean
 clean:
diff --git a/src/Makefile b/src/Makefile
index f70f06d..00a3f5c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -34,7 +34,7 @@ watchdog-mux: watchdog-mux.c
 	gcc watchdog-mux.c -o watchdog-mux -Wall -Wl,-z,relro
 
 .PHONY: install
-install: watchdog-mux pve-ha-crm pve-ha-lrm ha-manager.1 pve-ha-crm.8 pve-ha-lrm.8 ha-manager.bash-completion pve-ha-lrm.bash-completion pve-ha-crm.bash-completion
+install: watchdog-mux pve-ha-crm pve-ha-lrm ha-manager.1 pve-ha-crm.8 pve-ha-lrm.8 ha-manager.bash-completion pve-ha-lrm.bash-completion pve-ha-crm.bash-completion pve-ha-simulator
 	PVE_GENERATING_DOCS=1 perl -I. -T -e "use PVE::Service::pve_ha_crm; PVE::Service::pve_ha_crm->verify_api();"
 	PVE_GENERATING_DOCS=1 perl -I. -T -e "use PVE::Service::pve_ha_lrm; PVE::Service::pve_ha_lrm->verify_api();"
 	PVE_GENERATING_DOCS=1 perl -I. -T -e "use PVE::CLI::ha_manager; PVE::CLI::ha_manager->verify_api();"
@@ -43,6 +43,7 @@ install: watchdog-mux pve-ha-crm pve-ha-lrm ha-manager.1 pve-ha-crm.8 pve-ha-lrm
 	install -m 0755 pve-ha-lrm ${DESTDIR}${SBINDIR}
 	install -m 0755 ha-manager ${DESTDIR}${SBINDIR}
 	install -m 0755 watchdog-mux ${DESTDIR}${SBINDIR}
+	install -m 0755 pve-ha-simulator ${DESTDIR}${SBINDIR}
 	install -m 0644 -D pve-ha-crm.bash-completion ${DESTDIR}${BASHCOMPLDIR}/pve-ha-crm
 	install -m 0644 -D pve-ha-lrm.bash-completion ${DESTDIR}${BASHCOMPLDIR}/pve-ha-lrm
 	install -m 0644 -D ha-manager.bash-completion ${DESTDIR}${BASHCOMPLDIR}/ha-manager
@@ -56,12 +57,6 @@ install: watchdog-mux pve-ha-crm pve-ha-lrm ha-manager.1 pve-ha-crm.8 pve-ha-lrm
 	install -m 0644 ha-manager.1 ${DESTDIR}/${MAN1DIR}
 	gzip -9 ${DESTDIR}/${MAN1DIR}/ha-manager.1
 
-.PHONY: installsim
-installsim: pve-ha-simulator
-	install -d ${DESTDIR}${SBINDIR}
-	install -m 0755 pve-ha-simulator ${DESTDIR}${SBINDIR}
-	make -C PVE PERLDIR=${PREFIX}/share/${SIMPACKAGE} installsim
-
 .PHONY: test
 test: 
 	make -C test test
diff --git a/src/PVE/HA/Makefile b/src/PVE/HA/Makefile
index 313e6b0..6fbd9bc 100644
--- a/src/PVE/HA/Makefile
+++ b/src/PVE/HA/Makefile
@@ -1,17 +1,10 @@
-SIM_SOURCES=CRM.pm Env.pm Groups.pm Resources.pm LRM.pm Manager.pm \
+SOURCES=Config.pm CRM.pm Env.pm Groups.pm Resources.pm LRM.pm Manager.pm \
 	NodeStatus.pm Tools.pm FenceConfig.pm Fence.pm
 
-SOURCES=${SIM_SOURCES} Config.pm
+SUBDIRS=Resources Env Sim
 
 .PHONY: install
 install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA
 	for i in ${SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/$$i; done
-	make -C Resources install
-	make -C Env install
-
-.PHONY: installsim
-installsim:
-	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA
-	for i in ${SIM_SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/$$i; done
-	make -C Sim installsim
+	for i in ${SUBDIRS}; do make -C $$i install; done
diff --git a/src/PVE/HA/Resources/Makefile b/src/PVE/HA/Resources/Makefile
index ea840a7..28fbb55 100644
--- a/src/PVE/HA/Resources/Makefile
+++ b/src/PVE/HA/Resources/Makefile
@@ -4,8 +4,3 @@ SOURCES=PVEVM.pm PVECT.pm
 install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Resources
 	for i in ${SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Resources/$$i; done
-
-.PHONY: installsim
-installsim:
-	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Resources
-	for i in ${SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Resources/$$i; done
diff --git a/src/PVE/HA/Sim/Makefile b/src/PVE/HA/Sim/Makefile
index 793f142..cb8feff 100644
--- a/src/PVE/HA/Sim/Makefile
+++ b/src/PVE/HA/Sim/Makefile
@@ -1,7 +1,7 @@
 SOURCES=Env.pm Hardware.pm TestEnv.pm TestHardware.pm RTEnv.pm RTHardware.pm Resources.pm
 
-.PHONY: installsim
-installsim:
+.PHONY: install
+install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Sim
 	for i in ${SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Sim/$$i; done
-	make -C Resources installsim
+	make -C Resources install
diff --git a/src/PVE/HA/Sim/Resources/Makefile b/src/PVE/HA/Sim/Resources/Makefile
index b15a846..bfbb08e 100644
--- a/src/PVE/HA/Sim/Resources/Makefile
+++ b/src/PVE/HA/Sim/Resources/Makefile
@@ -1,6 +1,6 @@
 SOURCES=VirtVM.pm VirtCT.pm VirtFail.pm
 
-.PHONY: installsim
-installsim:
+.PHONY: install
+install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE/HA/Sim/Resources
 	for i in ${SOURCES}; do install -D -m 0644 $$i ${DESTDIR}${PERLDIR}/PVE/HA/Sim/Resources/$$i; done
diff --git a/src/PVE/Makefile b/src/PVE/Makefile
index b57dd06..45c3de4 100644
--- a/src/PVE/Makefile
+++ b/src/PVE/Makefile
@@ -1,4 +1,3 @@
-
 .PHONY: install
 install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE
@@ -6,8 +5,3 @@ install:
 	make -C API2 install
 	make -C CLI install
 	make -C Service install
-
-.PHONY: installsim
-installsim:
-	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE
-	make -C HA installsim
diff --git a/changelog.Debian b/debian/changelog
similarity index 100%
rename from changelog.Debian
rename to debian/changelog
diff --git a/debian/control b/debian/control
index 1758e73..97f684d 100644
--- a/debian/control
+++ b/debian/control
@@ -17,6 +17,7 @@ Section: perl
 Priority: optional
 Architecture: any
 Depends: libpve-common-perl,
+         libpve-ha-common-perl,
          pve-cluster (>= 3.0-17),
          qemu-server,
          systemd,
@@ -26,3 +27,28 @@ Depends: libpve-common-perl,
 Conflicts: watchdog,
 Description: Proxmox VE HA Manager
  HA Manager Proxmox VE.
+
+Package: pve-ha-simulator
+Section: perl
+Priority: optional
+Architecture: all
+Depends: libglib-perl,
+         libgtk3-perl,
+         libpve-common-perl,
+         libpve-ha-common-perl,
+         ${misc:Depends},
+         ${perl:Depends},
+Description: Proxmox VE HA Simulator
+ This is a simple GUI to simulate the behavior of a Proxmox VE HA cluster.
+
+Package: libpve-ha-common-perl
+Section: perl
+Priority: optional
+Architecture: any
+Breaks: pve-ha-manager (<= 2.0-5),
+Replaces: pve-ha-manager (<= 2.0-5),
+Depends: libdigest-perl-md5-perl,
+         libjson-perl,
+         libpve-common-perl,
+Description: Files shared by Proxmox VE HA Manager and Simulator
+ This package contains the shared library modules used by Proxmox VE HA Manager and Simulator.
diff --git a/debian/libpve-ha-common-perl.install b/debian/libpve-ha-common-perl.install
new file mode 100644
index 0000000..505fa14
--- /dev/null
+++ b/debian/libpve-ha-common-perl.install
@@ -0,0 +1,10 @@
+/usr/share/perl5/PVE/HA/CRM.pm
+/usr/share/perl5/PVE/HA/Env.pm
+/usr/share/perl5/PVE/HA/Fence.pm
+/usr/share/perl5/PVE/HA/FenceConfig.pm
+/usr/share/perl5/PVE/HA/Groups.pm
+/usr/share/perl5/PVE/HA/LRM.pm
+/usr/share/perl5/PVE/HA/Manager.pm
+/usr/share/perl5/PVE/HA/NodeStatus.pm
+/usr/share/perl5/PVE/HA/Resources.pm
+/usr/share/perl5/PVE/HA/Tools.pm
diff --git a/debian/pve-ha-manager.install b/debian/pve-ha-manager.install
new file mode 100644
index 0000000..5da4709
--- /dev/null
+++ b/debian/pve-ha-manager.install
@@ -0,0 +1,23 @@
+/usr/sbin/ha-manager
+/usr/sbin/pve-ha-crm
+/usr/sbin/pve-ha-lrm
+/usr/sbin/watchdog-mux
+/usr/share/bash-completion/completions/ha-manager
+/usr/share/bash-completion/completions/pve-ha-crm
+/usr/share/bash-completion/completions/pve-ha-lrm
+/usr/share/man
+/usr/share/man/man1
+/usr/share/man/man1/ha-manager.1.gz
+/usr/share/man/man8
+/usr/share/man/man8/pve-ha-crm.8.gz
+/usr/share/man/man8/pve-ha-lrm.8.gz
+/usr/share/perl5/PVE/API2/HA/Groups.pm
+/usr/share/perl5/PVE/API2/HA/Resources.pm
+/usr/share/perl5/PVE/API2/HA/Status.pm
+/usr/share/perl5/PVE/CLI/ha_manager.pm
+/usr/share/perl5/PVE/HA/Config.pm
+/usr/share/perl5/PVE/HA/Env/PVE2.pm
+/usr/share/perl5/PVE/HA/Resources/PVECT.pm
+/usr/share/perl5/PVE/HA/Resources/PVEVM.pm
+/usr/share/perl5/PVE/Service/pve_ha_crm.pm
+/usr/share/perl5/PVE/Service/pve_ha_lrm.pm
diff --git a/debian/triggers b/debian/pve-ha-manager.triggers
similarity index 100%
rename from debian/triggers
rename to debian/pve-ha-manager.triggers
diff --git a/debian/pve-ha-simulator.install b/debian/pve-ha-simulator.install
new file mode 100644
index 0000000..717368a
--- /dev/null
+++ b/debian/pve-ha-simulator.install
@@ -0,0 +1,2 @@
+/usr/sbin/pve-ha-simulator
+/usr/share/perl5/PVE/HA/Sim/*
diff --git a/simdebian/compat b/simdebian/compat
deleted file mode 100644
index ec63514..0000000
--- a/simdebian/compat
+++ /dev/null
@@ -1 +0,0 @@
-9
diff --git a/simdebian/control b/simdebian/control
deleted file mode 100644
index 5b692a7..0000000
--- a/simdebian/control
+++ /dev/null
@@ -1,14 +0,0 @@
-Source: pve-ha-manager
-Section: perl
-Priority: extra
-Maintainer: Proxmox Support Team <support at proxmox.com>
-Build-Depends: debhelper (>= 7.0.50~), libpve-common-perl, libglib-perl, libgtk3-perl
-Standards-Version: 3.8.4
-
-Package: pve-ha-simulator
-Section: perl
-Priority: optional
-Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends}, libpve-common-perl, libglib-perl, libgtk3-perl
-Description: Proxmox VE HA Simulator
- This is a simple GUI to simulate the behavior of a Proxmox VE HA cluster.
diff --git a/simdebian/copyright b/simdebian/copyright
deleted file mode 100644
index 3ef2e85..0000000
--- a/simdebian/copyright
+++ /dev/null
@@ -1,16 +0,0 @@
-Copyright (C) 2015 Proxmox Server Solutions GmbH
-
-This software is written by Proxmox Server Solutions GmbH <support at proxmox.com>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU Affero General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU Affero General Public License for more details.
-
-You should have received a copy of the GNU Affero General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
diff --git a/simdebian/rules b/simdebian/rules
deleted file mode 100755
index 4a6f1c9..0000000
--- a/simdebian/rules
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/make -f
-# -*- makefile -*-
-# Sample debian/rules that uses debhelper.
-# This file was originally written by Joey Hess and Craig Small.
-# As a special exception, when this file is copied by dh-make into a
-# dh-make output file, you may use that output file without restriction.
-# This special exception was added by Craig Small in version 0.37 of dh-make.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-%:
-	dh $@
-
-override_dh_auto_test:
-
-
-override_dh_auto_install:
-
-	make DESTDIR=$$(pwd)/debian/pve-ha-simulator installsim
diff --git a/src/pve-ha-simulator b/src/pve-ha-simulator
index 004471c..4e46986 100755
--- a/src/pve-ha-simulator
+++ b/src/pve-ha-simulator
@@ -2,7 +2,7 @@
 
 use strict;
 use warnings;
-use lib '/usr/share/pve-ha-simulator';
+
 use Getopt::Long;
 use JSON;
 
-- 
2.19.0





More information about the pve-devel mailing list