[pve-devel] [PATCH v2 ha-manager 2/4] build: restructure packaging

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Oct 5 20:46:21 CEST 2018


use dpkg-buildpackage and debhelper properly, add missing dependencies and
embed used perl modules from libpve-common-perl to make pve-ha-simulator
standalone.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
Note: the pve-common embedding could of course be expanded (e.g. including a
comment stating from which version, etc.pp.)

 Makefile                                     | 17 ++--------
 src/Makefile                                 | 10 ++----
 src/PVE/HA/Makefile                          |  2 +-
 src/PVE/HA/Resources/Makefile                |  5 ---
 src/PVE/HA/Sim/Makefile                      |  6 ++--
 src/PVE/HA/Sim/Resources/Makefile            |  4 +--
 src/PVE/Makefile                             |  1 -
 changelog.Debian => debian/changelog         |  0
 debian/control                               | 21 +++++++++++-
 debian/pve-ha-manager.install                | 34 ++++++++++++++++++++
 debian/{triggers => pve-ha-manager.triggers} |  0
 debian/pve-ha-simulator.install              |  2 ++
 debian/rules                                 | 14 ++++++++
 simdebian/compat                             |  1 -
 simdebian/control                            | 14 --------
 simdebian/copyright                          | 16 ---------
 simdebian/rules                              | 20 ------------
 17 files changed, 81 insertions(+), 86 deletions(-)
 rename changelog.Debian => debian/changelog (100%)
 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..d34d47e 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,10 +43,12 @@ 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
 	make -C PVE install
+	make -C PVE PERLDIR=${PREFIX}/share/${SIMPACKAGE} installsim
 	install -d ${DESTDIR}/${MAN8DIR}
 	install -m 0644 pve-ha-crm.8 ${DESTDIR}/${MAN8DIR}
 	gzip -9 ${DESTDIR}/${MAN8DIR}/pve-ha-crm.8
@@ -56,12 +58,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..c366f6c 100644
--- a/src/PVE/HA/Makefile
+++ b/src/PVE/HA/Makefile
@@ -14,4 +14,4 @@ install:
 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
+	make -C Sim install
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..7da9fed 100644
--- a/src/PVE/Makefile
+++ b/src/PVE/Makefile
@@ -1,4 +1,3 @@
-
 .PHONY: install
 install:
 	install -d -m 0755 ${DESTDIR}${PERLDIR}/PVE
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..ddd4d15 100644
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,8 @@ Package: pve-ha-manager
 Section: perl
 Priority: optional
 Architecture: any
-Depends: libpve-common-perl,
+Depends: libjson-perl,
+         libpve-common-perl,
          pve-cluster (>= 3.0-17),
          qemu-server,
          systemd,
@@ -26,3 +27,21 @@ 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: libclone-perl,
+         libdevel-cycle-perl,
+         libfilesys-df-perl,
+         libglib-perl,
+         libgtk3-perl,
+         libjson-perl,
+         libnet-ip-perl,
+         libstring-shellquote-perl,
+         liburi-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.
diff --git a/debian/pve-ha-manager.install b/debian/pve-ha-manager.install
new file mode 100644
index 0000000..7a3f13d
--- /dev/null
+++ b/debian/pve-ha-manager.install
@@ -0,0 +1,34 @@
+/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/CRM.pm
+/usr/share/perl5/PVE/HA/Config.pm
+/usr/share/perl5/PVE/HA/Config.pm
+/usr/share/perl5/PVE/HA/Env.pm
+/usr/share/perl5/PVE/HA/Env/PVE2.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/Resources/PVECT.pm
+/usr/share/perl5/PVE/HA/Resources/PVEVM.pm
+/usr/share/perl5/PVE/HA/Tools.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..4948a77
--- /dev/null
+++ b/debian/pve-ha-simulator.install
@@ -0,0 +1,2 @@
+/usr/sbin/pve-ha-simulator
+/usr/share/pve-ha-simulator/PVE
diff --git a/debian/rules b/debian/rules
index 468631f..b215911 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,6 +12,20 @@
 %:
 	dh $@ --with=systemd
 
+override_dh_install:
+	# embed copies of libpve-common-perl files needed by simulator
+	install -d -m 0755 debian/tmp/usr/share/pve-ha-simulator/PVE
+	install -m 0644 \
+		/usr/share/perl5/PVE/Exception.pm \
+		/usr/share/perl5/PVE/JSONSchema.pm \
+		/usr/share/perl5/PVE/ProcFSTools.pm \
+		/usr/share/perl5/PVE/SafeSyslog.pm \
+		/usr/share/perl5/PVE/SectionConfig.pm \
+		/usr/share/perl5/PVE/Syscall.pm \
+		/usr/share/perl5/PVE/Tools.pm \
+		debian/tmp/usr/share/pve-ha-simulator/PVE/
+	dh_install --fail-missing
+
 # dh_systemd_enable watchdog-mux despite it being static to get it installed in
 # the correct location/package without manual intervention
 override_dh_systemd_enable:
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
-- 
2.19.0





More information about the pve-devel mailing list