[Spice-devel] [NSIS 2/2] packaging: add Makefile, spec file, jenkins automation

Yedidyah Bar David didi at redhat.com
Mon Oct 26 03:35:29 PDT 2015


Allow 'make dist'.

Allow building the spice installer and building/installing the ovirt
installer.

Move VERSION maintenance from the nsis file to the Makefile.

Allow passing DISPLAYED_VERSION to make.

Allow passing MODE to make to choose between the two installers -
SPICE (default) or OVIRT.

Some of the code in the Makefile was copied and adapted from
ovirt-wgt-installer.spec. The spec file itself was also copied here and
adapted, and will be removed [1] from its current location.

[1] https://gerrit.ovirt.org/47432

Add jenkins.ovirt.org automation.

Change all '/usr/share/artifacts' to '/usr/share', see also:

https://gerrit.ovirt.org/45833 - spice-nsis aka ovirt-wgt
https://gerrit.ovirt.org/47460 - ovirt-wgt-toolchain
https://gerrit.ovirt.org/47461 - ovirt-guest-agent

Change-Id: I0d651065697d962d4e351ffc1b7274c8eb37cb22
Signed-off-by: Sandro Bonazzola <sbonazzo at redhat.com>
Signed-off-by: Yedidyah Bar David <didi at redhat.com>
---
 Makefile                            | 101 ++++++++++++++++++++++++++++++++++++
 automation/README.md                |   8 +++
 automation/build-artifacts.packages |  10 ++++
 automation/build-artifacts.repos    |   2 +
 automation/build-artifacts.sh       |  21 ++++++++
 automation/check-patch.packages     |  10 ++++
 automation/check-patch.repos        |   2 +
 automation/check-patch.sh           |  21 ++++++++
 ovirt-wgt-installer.spec            |  63 ++++++++++++++++++++++
 win-guest-tools.nsis                |   5 +-
 10 files changed, 242 insertions(+), 1 deletion(-)
 create mode 100644 Makefile
 create mode 100644 automation/README.md
 create mode 100644 automation/build-artifacts.packages
 create mode 100644 automation/build-artifacts.repos
 create mode 100755 automation/build-artifacts.sh
 create mode 100644 automation/check-patch.packages
 create mode 100644 automation/check-patch.repos
 create mode 100755 automation/check-patch.sh
 create mode 100644 ovirt-wgt-installer.spec

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b81e76f
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,101 @@
+NAME=spice-nsis
+VERSION=0.103
+DISPLAYED_VERSION=$(VERSION)
+ARCHIVE=$(NAME)-$(VERSION).tar.gz
+
+# set to OVIRT to build the ovirt guest tools installer
+MODE=SPICE
+
+# Note: If you want to change the UN/INSTALLER name, you
+# have to edit also the nsis source.
+ifeq ($(MODE),SPICE)
+INSTALLER=spice-guest-tools-$(VERSION)
+UNINSTALLER=Uninstall spice-guest-tools
+EXE_VERSION=-$(VERSION)
+INSTALL_NAME=spice-wgt-installer
+else
+ifeq ($(MODE),OVIRT)
+INSTALLER=ovirt-guest-tools-setup
+UNINSTALLER=Uninstall ovirt-guest-tools-setup
+EXE_VERSION=
+INSTALL_NAME=ovirt-wgt-installer
+else
+$(error Please set MODE to one of SPICE or OVIRT, not [$(MODE)])
+endif
+endif
+
+# common dependencies/sources
+MINGW32BIN=/usr/i686-w64-mingw32/sys-root/mingw/bin
+MINGW64BIN=/usr/x86_64-w64-mingw32/sys-root/mingw/bin
+VIRTIOWINDRIVERS=/usr/share/virtio-win-drivers
+QXLDRIVER=/usr/share/spice-qxl
+
+# ovirt dependencies/sources
+OVIRTGA=/usr/share/ovirt-guest-agent-windows
+VCREDIST=/usr/share/vcredist-x86/vcredist_x86.exe
+
+# Common definitions for targets
+PREFIX=/usr/local
+DATAROOT_DIR=$(PREFIX)/share
+
+# install targets
+INSTALL_DATA_DIR=$(DATAROOT_DIR)/$(INSTALL_NAME)
+INSTALL_DATA_DIR_ISO=$(DATAROOT_DIR)/$(INSTALL_NAME)-iso
+
+all: copy-files installer
+
+copy-files: common-files extra-files
+
+# Note that the installer does not depend here on the copied files,
+# so that 'make install-*' will not have to recreate it.
+# that's the "lazy" way. The correct way would have been to (automatically)
+# add dependencies here per each external file we copy.
+# If you do update one of the dependencies (say one of the drivers),
+# run 'make clean' before trying again to build.
+installer: $(INSTALLER).exe
+
+$(INSTALLER).exe: win-guest-tools.nsis
+	makensis \
+		-DVERSION=$(VERSION) \
+		-D$(MODE) \
+		-DDISPLAYED_VERSION=$(DISPLAYED_VERSION) \
+		-DEXE_VERSION=$(EXE_VERSION) \
+		win-guest-tools.nsis
+
+common-files:
+	mkdir -p bin/vdagent_x86 bin/vdagent_x64
+	mkdir -p drivers/virtio drivers/qxl
+	cp $(MINGW32BIN)/vdagent.exe bin/vdagent_x86/
+	cp $(MINGW32BIN)/vdservice.exe bin/vdagent_x86/
+	cp $(MINGW64BIN)/vdagent.exe bin/vdagent_x64/
+	cp $(MINGW64BIN)/vdservice.exe bin/vdagent_x64/
+	cp -a $(VIRTIOWINDRIVERS)/* drivers/virtio/
+	cp -a $(QXLDRIVER)/* drivers/qxl/
+
+# Extra files:
+
+ifeq ($(MODE),SPICE)
+extra-files:
+	: TODO: Add here spice-specific files if any
+else
+ifeq ($(MODE),OVIRT)
+extra-files:
+	cp $(OVIRTGA)/OVirtGuestService.exe bin/
+	cp $(OVIRTGA)/default.ini bin/
+	cp $(OVIRTGA)/default-logger.ini bin/
+	cp $(OVIRTGA)/ovirt-guest-agent.ini bin/
+	cp $(VCREDIST) bin/
+endif
+endif
+
+install: installer
+	mkdir -p $(DESTDIR)$(INSTALL_DATA_DIR) $(DESTDIR)$(INSTALL_DATA_DIR_ISO)
+	cp $(INSTALLER).exe $(DESTDIR)$(INSTALL_DATA_DIR)
+	cp -a $(INSTALLER).exe bin drivers $(DESTDIR)$(INSTALL_DATA_DIR_ISO)
+
+clean:
+	rm -rf *.exe bin drivers
+
+dist:
+	git archive --prefix $(NAME)/ --format=tar.gz HEAD -o $(ARCHIVE)
+
diff --git a/automation/README.md b/automation/README.md
new file mode 100644
index 0000000..1b6a399
--- /dev/null
+++ b/automation/README.md
@@ -0,0 +1,8 @@
+Continuous Integration Scripts
+==============================
+
+This directory contains scripts for Continuous Integration provided by
+[oVirt Jenkins](http://jenkins.ovirt.org/)
+system and follows the standard defined in
+[Build and test standards](http://www.ovirt.org/CI/Build_and_test_standards)
+wiki page.
diff --git a/automation/build-artifacts.packages b/automation/build-artifacts.packages
new file mode 100644
index 0000000..f6b7897
--- /dev/null
+++ b/automation/build-artifacts.packages
@@ -0,0 +1,10 @@
+make
+mingw32-nsis
+mingw32-spice-vdagent
+mingw64-spice-vdagent
+ovirt-guest-agent-windows
+vcredist-x86
+virtio-win-drivers
+spice-qxl
+nsis-simple-service-plugin
+git
diff --git a/automation/build-artifacts.repos b/automation/build-artifacts.repos
new file mode 100644
index 0000000..a31e01a
--- /dev/null
+++ b/automation/build-artifacts.repos
@@ -0,0 +1,2 @@
+ovirt-master-snapshot,http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/$distro
+ovirt-master-snapshot-static,http://resources.ovirt.org/pub/ovirt-master-snapshot-static/rpm/$distro
diff --git a/automation/build-artifacts.sh b/automation/build-artifacts.sh
new file mode 100755
index 0000000..ad7c292
--- /dev/null
+++ b/automation/build-artifacts.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -xe
+[[ -d exported-artifacts ]] \
+|| mkdir -p exported-artifacts
+
+[[ -d tmp.repos ]] \
+|| mkdir -p tmp.repos
+
+SUFFIX=".$(date -u +%Y%m%d%H%M%S).git$(git rev-parse --short HEAD)"
+
+make dist
+yum-builddep ovirt-wgt-installer.spec
+rpmbuild \
+    -D "_topdir $PWD/tmp.repos" \
+    -D "release_suffix ${SUFFIX}" \
+    -ta spice-nsis-*.tar.gz
+
+mv *.tar.gz exported-artifacts
+find \
+    "$PWD/tmp.repos" \
+    -iname \*.rpm \
+    -exec mv {} exported-artifacts/ \;
diff --git a/automation/check-patch.packages b/automation/check-patch.packages
new file mode 100644
index 0000000..f6b7897
--- /dev/null
+++ b/automation/check-patch.packages
@@ -0,0 +1,10 @@
+make
+mingw32-nsis
+mingw32-spice-vdagent
+mingw64-spice-vdagent
+ovirt-guest-agent-windows
+vcredist-x86
+virtio-win-drivers
+spice-qxl
+nsis-simple-service-plugin
+git
diff --git a/automation/check-patch.repos b/automation/check-patch.repos
new file mode 100644
index 0000000..a31e01a
--- /dev/null
+++ b/automation/check-patch.repos
@@ -0,0 +1,2 @@
+ovirt-master-snapshot,http://resources.ovirt.org/pub/ovirt-master-snapshot/rpm/$distro
+ovirt-master-snapshot-static,http://resources.ovirt.org/pub/ovirt-master-snapshot-static/rpm/$distro
diff --git a/automation/check-patch.sh b/automation/check-patch.sh
new file mode 100755
index 0000000..ad7c292
--- /dev/null
+++ b/automation/check-patch.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -xe
+[[ -d exported-artifacts ]] \
+|| mkdir -p exported-artifacts
+
+[[ -d tmp.repos ]] \
+|| mkdir -p tmp.repos
+
+SUFFIX=".$(date -u +%Y%m%d%H%M%S).git$(git rev-parse --short HEAD)"
+
+make dist
+yum-builddep ovirt-wgt-installer.spec
+rpmbuild \
+    -D "_topdir $PWD/tmp.repos" \
+    -D "release_suffix ${SUFFIX}" \
+    -ta spice-nsis-*.tar.gz
+
+mv *.tar.gz exported-artifacts
+find \
+    "$PWD/tmp.repos" \
+    -iname \*.rpm \
+    -exec mv {} exported-artifacts/ \;
diff --git a/ovirt-wgt-installer.spec b/ovirt-wgt-installer.spec
new file mode 100644
index 0000000..6012f54
--- /dev/null
+++ b/ovirt-wgt-installer.spec
@@ -0,0 +1,63 @@
+Name:		ovirt-wgt-installer
+Version:	3.6.0
+Release:	0.2_master%{?release_suffix}%{?dist}
+Summary:	oVirt Windows Guest Tools Installer
+License:	GPLv2 and GPLv2+ and ASL 2.0 and Zlib and MIT and Python and Platform SDK Redistributable EULA and Microsoft DDK Redistributable EULA
+Source:		http://resources.ovirt.org/pub/ovirt-3.6-snapshot/src/ovirt-wgt/spice-nsis-0.103.tar.gz
+URL:		http://www.ovirt.org/Features/oVirt_Windows_Guest_Tools
+BuildArch:	noarch
+Packager:	Lev Veyde <lveyde at redhat.com>
+
+BuildRequires:	mingw32-nsis >= 2.46
+BuildRequires:	mingw32-spice-vdagent >= 0.7.3
+BuildRequires:	mingw64-spice-vdagent >= 0.7.3
+BuildRequires:	ovirt-guest-agent-windows
+BuildRequires:	vcredist-x86
+BuildRequires:	virtio-win-drivers
+BuildRequires:	spice-qxl
+BuildRequires:	nsis-simple-service-plugin
+
+%description
+oVirt Windows Guest Tools installer.
+The installer includes VirtIO-Win drivers, Spice QXL drivers, as well as oVirt and Spice Guest Agents.
+
+%global make_common_opts \\\
+	PREFIX=%{_prefix} \\\
+	MODE=OVIRT \\\
+	DISPLAYED_VERSION='%{version}-%{release}'
+
+%prep
+%setup -n spice-nsis -q
+
+%build
+
+make %{make_common_opts}
+
+%install
+
+make %{make_common_opts} install DESTDIR="%{buildroot}"
+
+%files
+%{_datadir}/%{name}/ovirt-guest-tools-setup.exe
+
+%package iso
+Summary: RPM wrapper for %{name}
+
+%description iso
+A package wrapping %{name} to provide dependency features.
+
+%files iso
+%{_datadir}/%{name}-iso
+
+%changelog
+* Tue Oct 20 2015 Yedidyah Bar David <didi at redhat.com> 3.6.0-0.2
+- merged into upstream git repo spice-nsis
+- separated Makefile out of the spec file
+- dropped "artifacts" from all paths
+- added jenkins automation
+
+* Mon Nov 24 2014 Lev Veyde <lveyde at redhat.com> 0.9.1-2
+- Updated oVirt Guest Agent
+
+* Wed Oct 08 2014 Lev Veyde <lveyde at redhat.com> 0.9.1-1
+- Initial version
diff --git a/win-guest-tools.nsis b/win-guest-tools.nsis
index 4e34d2e..1a25d89 100644
--- a/win-guest-tools.nsis
+++ b/win-guest-tools.nsis
@@ -59,7 +59,10 @@ SetCompressor /SOLID lzma
 !error "OVIRT or SPICE symbol should passed to makensis with the -D flag"
 !endif
 
-!define VERSION "0.103"
+!ifndef VERSION
+!error "-DVERSION=<version> should be passed to makensis, see Makefile"
+!endif
+
 !ifndef DISPLAYED_VERSION
 !define DISPLAYED_VERSION "${VERSION}"
 !endif
-- 
2.1.4



More information about the Spice-devel mailing list