[Spice-devel] [PATCH usbclerk] Fix version scheme for MSI upgrade

Marc-André Lureau marcandre.lureau at gmail.com
Tue Nov 12 10:50:20 PST 2013


Use a major.minor.(micro << 8 + build) version scheme, following
virt-viewer practice.

The component guid can be removed, msitools generate a stable one, based
on component location.
---
 Makefile.am     |  6 +++---
 configure.ac    | 22 ++++++++++++++++++++--
 usbclerk.wxs.in |  8 ++++----
 3 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e44c1b7..2c453d7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,11 +19,11 @@ deps.txt:
 
 MANUFACTURER = The Spice Project
 
-usbclerk-$(WIXL_ARCH)-$(VERSION).msi: usbclerk.wxs deps.txt all
+usbclerk-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi: usbclerk.wxs deps.txt all
 	$(AM_V_GEN)MANUFACTURER="$(MANUFACTURER)" wixl --arch $(WIXL_ARCH) -o $@ $<
 
-msi: usbclerk-$(WIXL_ARCH)-$(VERSION).msi
+msi: usbclerk-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi
 
-CLEANFILES = usbclerk-$(WIXL_ARCH)-$(VERSION).msi
+CLEANFILES = usbclerk-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi
 
 .PHONY: msi
diff --git a/configure.ac b/configure.ac
index b59d81b..e5f8dd8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
-AC_INIT([usbclerk], [0.0.1.1],
+AC_INIT([usbclerk], [0.3.3],
         [spice-devel at lists.freedesktop.org])
-AC_PREREQ([2.64])
+AC_PREREQ([2.63])
 
 AC_CONFIG_MACRO_DIR([m4])
 AM_CONFIG_HEADER([config.h])
@@ -26,6 +26,24 @@ USBCLERK_DEPS="libwdi libusbredirparser-0.5 >= 0.6"
 PKG_CHECK_MODULES(USBCLERK, $USBCLERK_DEPS)
 LIBWDI_LIBS=`$PKG_CONFIG --static --libs $USBCLERK_DEPS`
 
+AC_ARG_WITH([buildid],
+  AS_HELP_STRING([--with-buildid=id], [Set additional build version details]))
+AC_DEFINE_UNQUOTED([BUILDID], "$with_buildid", [Build version details])
+if test "x$with_buildid" != x; then
+  AC_SUBST([BUILDID], "-$with_buildid")
+fi
+
+major=`echo $PACKAGE_VERSION | cut -d. -f1`
+minor=`echo $PACKAGE_VERSION | cut -d. -f2`
+micro=`echo $PACKAGE_VERSION | cut -d. -f3`
+buildid=`echo $with_buildid | cut -d. -f1`
+if test "x$buildid" = x; then
+  buildid=0
+fi
+build=`expr $micro \* 256 + $buildid`
+WINDOWS_PRODUCTVERSION="$major.$minor.$build"
+AC_SUBST([WINDOWS_PRODUCTVERSION])
+
 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
 
 AC_OUTPUT([
diff --git a/usbclerk.wxs.in b/usbclerk.wxs.in
index 93fb192..845afbf 100644
--- a/usbclerk.wxs.in
+++ b/usbclerk.wxs.in
@@ -2,7 +2,7 @@
 
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
 
-  <?define Version = "@VERSION@"?>
+  <?define Version = "@WINDOWS_PRODUCTVERSION@"?>
   <?define UpgradeCode = "4a2c31e6-b10b-4c56-be28-c1ac35f5c52e"?>
   <?define Arch = "@WIXL_ARCH@"?>
   <?if $(var.Arch) = "x64"?>
@@ -15,7 +15,7 @@
       <?define Win64 = "no"?>
   <?endif?>
 
-  <Product Id="*" Name="USB Clerk ($(var.ArchString))"
+  <Product Id="*" Name="USBClerk @VERSION@@BUILDID@ ($(var.ArchString))"
            Manufacturer="$(env.MANUFACTURER)"
            Version="$(var.Version)" UpgradeCode="$(var.UpgradeCode)"
            Language="1033">
@@ -49,7 +49,7 @@
     <Directory Id="TARGETDIR" Name="SourceDir">
       <Directory Id="$(var.ArchProgramFilesFolder)">
         <Directory Id="INSTALLDIR" Name="USBClerk">
-          <Component Id="CUSBClerk" Guid="e99861f7-524c-4107-860d-27f866072e53">
+          <Component Id="CUSBClerk" Guid="*">
             <File Id='usbclerkexe' Name='usbclerk.exe' DiskId='1' Source='usbclerk.exe' KeyPath='yes'/>
             <ServiceInstall Id="USBClerkServiceInstall"
                             Name="USBClerk"
@@ -67,7 +67,7 @@
                             Remove="uninstall"
                             Wait="yes"/>
           </Component>
-          <Component Id="CDepsTxt" Guid="be86cc16-bf4d-11e2-bbde-0024d71e178c">
+          <Component Id="CDepsTxt" Guid="*">
             <File Id='depstxt' Name='deps.txt' DiskId='1' Source='deps.txt' KeyPath='yes'/>
           </Component>
         </Directory>
-- 
1.8.3.1



More information about the Spice-devel mailing list