[NSIS 7/7] packaging: add Makefile, spec file, jenkins automation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Allow 'make dist'.

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

VERSION moved from the nsis file to the Makefile and will be maintained
there.

Some Makefile variables (format: PARAM (valid values) [default]):
MODE (SPICE,OVIRT) [SPICE] - its value is passed as a define to makensis
DISPLAYED_VERSION () [$VERSION] - what's written to the registry
INSTALLER () [depends on MODE] - installer filename without .exe ext
UNINSTALLER () [depends on MODE] - uninstaller filename without .exe ext

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.

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

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

Change-Id: I0d651065697d962d4e351ffc1b7274c8eb37cb22
Signed-off-by: Sandro Bonazzola <sbonazzo@xxxxxxxxxx>
Signed-off-by: Yedidyah Bar David <didi@xxxxxxxxxx>
---
 Makefile                            | 100 ++++++++++++++++++++++++++++++++++++
 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                |  31 +++++++----
 10 files changed, 259 insertions(+), 9 deletions(-)
 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..44716f2
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,100 @@
+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
+
+ifeq ($(MODE),SPICE)
+INSTALLER=spice-guest-tools-$(VERSION)
+UNINSTALLER=Uninstall spice-guest-tools
+else
+ifeq ($(MODE),OVIRT)
+INSTALLER=ovirt-guest-tools-setup
+UNINSTALLER=Uninstall ovirt-guest-tools-setup
+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
+
+# ovirt-install targets
+OVIRT_NAME=ovirt-wgt-installer
+OVIRT_DATA_DIR=$(DATAROOT_DIR)/$(OVIRT_NAME)
+OVIRT_DATA_DIR_ISO=$(DATAROOT_DIR)/$(OVIRT_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) \
+		-DINSTALLER=$(INSTALLER) \
+		-D'UNINSTALLER=$(UNINSTALLER)' \
+		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-ovirt: installer
+	mkdir -p $(DESTDIR)$(OVIRT_DATA_DIR) $(DESTDIR)$(OVIRT_DATA_DIR_ISO)
+	cp $(INSTALLER).exe $(DESTDIR)$(OVIRT_DATA_DIR)
+	cp -a bin drivers $(DESTDIR)$(OVIRT_DATA_DIR_ISO)
+
+# TODO add install-spice targets?
+
+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..1d79c41
--- /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@xxxxxxxxxx>
+
+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-ovirt 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@xxxxxxxxxx> 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@xxxxxxxxxx> 0.9.1-2
+- Updated oVirt Guest Agent
+
+* Wed Oct 08 2014 Lev Veyde <lveyde@xxxxxxxxxx> 0.9.1-1
+- Initial version
diff --git a/win-guest-tools.nsis b/win-guest-tools.nsis
index b2b06a7..a2c148b 100644
--- a/win-guest-tools.nsis
+++ b/win-guest-tools.nsis
@@ -41,13 +41,11 @@ SetCompressor /SOLID lzma
 !include "x64.nsh"
 
 !ifdef SPICE
-!define FILENAME "spice-guest-tools"
 !define NAME "SPICE Guest Tools"
 !define PUBLISHER "The SPICE Project"
 !define REGKEYNAME "SpiceGuestTools"
 !define URL "http://spice-space.org";
 !else ifdef OVIRT
-!define FILENAME "ovirt-guest-tools-setup"
 !define NAME "oVirt Guest Tools"
 !define PUBLISHER "The oVirt Project"
 !define REGKEYNAME "oVirtGuestTools"
@@ -55,11 +53,26 @@ SetCompressor /SOLID lzma
 !else
 !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
+
+!ifndef INSTALLER
+!error "-DINSTALLER=<installer> should be passed to makensis"
+!endif
+
+!ifndef UNINSTALLER
+!error "-DUNINSTALLER=<uninstaller> should be passed to makensis"
+!endif
 
 Name "${NAME}"
 Caption "${NAME} Installer"
-OutFile "${FILENAME}-${VERSION}.exe"
+OutFile "${INSTALLER}.exe"
 InstallDir "$PROGRAMFILES\${NAME}"
 BrandingText ""
 
@@ -185,15 +198,15 @@ Section "install"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGKEYNAME}" \
                  "DisplayName" "${NAME}"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGKEYNAME}" \
-                 "DisplayVersion" "${VERSION}"
+                 "DisplayVersion" "${DISPLAYED_VERSION}"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGKEYNAME}" \
                  "Publisher" "${PUBLISHER}"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGKEYNAME}" \
                  "URLInfoAbout" "${URL}"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGKEYNAME}" \
-                 "UninstallString" "$\"$INSTDIR\Uninstall ${FILENAME}$\""
+                 "UninstallString" "$\"$INSTDIR\${UNINSTALLER}$\""
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGKEYNAME}" \
-                 "QuietUninstallString" "$\"$INSTDIR\Uninstall ${FILENAME}$\" /S"
+                 "QuietUninstallString" "$\"$INSTDIR\${UNINSTALLER}$\" /S"
   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGKEYNAME}" \
                  "NoModify" "1"
   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REGKEYNAME}" \
@@ -211,7 +224,7 @@ Section "Uninstall"
   SetOutPath "$TEMP"
 
   Delete /rebootok "$INSTDIR\version.txt"
-  Delete /rebootok "$INSTDIR\Uninstall ${FILENAME}.exe"
+  Delete /rebootok "$INSTDIR\${UNINSTALLER}.exe"
   Delete /rebootok "$INSTDIR\32\vdagent.exe"
   Delete /rebootok "$INSTDIR\32\vdservice.exe"
   RMDir /rebootok "$INSTDIR\32"
@@ -229,7 +242,7 @@ Section "Uninstall"
 SectionEnd
 
 Section -post
-  WriteUninstaller "$INSTDIR\Uninstall ${FILENAME}.exe"
+  WriteUninstaller "$INSTDIR\${UNINSTALLER}.exe"
 SectionEnd
 
 Function .onInit
-- 
2.1.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]