diff mbox

[ovs-dev,1/4] datapath-windows: Force driver version to depend on a variable

Message ID 20161206025818.5140-2-aserdean@cloudbasesolutions.com
State Accepted
Delegated to: Guru Shetty
Headers show

Commit Message

Alin Serdean Dec. 6, 2016, 2:58 a.m. UTC
The following components use Windows driver information:
-	System (inf file); used during device installation
-	Resource file (rc file); used by applications when looking over the driver
    file(sys)

Currently we have the following for the driver version number:
-	(inf file) generated value from the build timestamp
-	(rc file) predefined value

This patch forces both files to depend on a variable: '$(Version)'.
This is a predefined variable from Visual Studio.

To achieve the above we change the current project settings used by the
'stampinf' utility and we define a new preprocessor value named
'VersionWithCommas' (which is obtained by replacing all
'.' with ',' from $(Version) ).
Certain values from the resource file are expected to use ',' instead of '.' .

The resource file has been updated to use the new values when generating
information about the driver (sys).

The variable '$(Version' can be changed from the command line via the
'msbuild' utility.

Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
---
 datapath-windows/ovsext/ovsext.rc      | 11 ++++++-----
 datapath-windows/ovsext/ovsext.vcxproj | 19 ++++++++++++++++++-
 2 files changed, 24 insertions(+), 6 deletions(-)

Comments

Sairam Venugopal Dec. 8, 2016, 11:19 p.m. UTC | #1
Thanks for sending this out.


On 12/5/16, 6:58 PM, "Alin Serdean" <aserdean@cloudbasesolutions.com>
wrote:

>The following components use Windows driver information:
>-	System (inf file); used during device installation
>-	Resource file (rc file); used by applications when looking over the
>driver
>    file(sys)
>
>Currently we have the following for the driver version number:
>-	(inf file) generated value from the build timestamp
>-	(rc file) predefined value
>
>This patch forces both files to depend on a variable: '$(Version)'.
>This is a predefined variable from Visual Studio.
>
>To achieve the above we change the current project settings used by the
>'stampinf' utility and we define a new preprocessor value named
>'VersionWithCommas' (which is obtained by replacing all
>'.' with ',' from $(Version) ).
>Certain values from the resource file are expected to use ',' instead of
>'.' .
>
>The resource file has been updated to use the new values when generating
>information about the driver (sys).
>
>The variable '$(Version' can be changed from the command line via the
>'msbuild' utility.
>
>Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
>---
> datapath-windows/ovsext/ovsext.rc      | 11 ++++++-----
> datapath-windows/ovsext/ovsext.vcxproj | 19 ++++++++++++++++++-
> 2 files changed, 24 insertions(+), 6 deletions(-)
>
>diff --git a/datapath-windows/ovsext/ovsext.rc
>b/datapath-windows/ovsext/ovsext.rc
>index 0b92e2e..578367d 100644
>--- a/datapath-windows/ovsext/ovsext.rc
>+++ b/datapath-windows/ovsext/ovsext.rc
>@@ -8,14 +8,15 @@
> LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
> #pragma code_page(1252)
> 
>+#define STR(x)                          #x
> 
>//////////////////////////////////////////////////////////////////////////
>///
> //
> // Version
> //
> 
> VS_VERSION_INFO VERSIONINFO
>- FILEVERSION 6,3,9600,17298
>- PRODUCTVERSION 6,3,9600,17298
>+ FILEVERSION VersionWithCommas
>+ PRODUCTVERSION VersionWithCommas
>  FILEFLAGSMASK 0x3fL
> #ifdef _DEBUG
>  FILEFLAGS 0x9L
>@@ -32,12 +33,12 @@ BEGIN
>         BEGIN
>             VALUE "CompanyName", "Open vSwitch"
>             VALUE "FileDescription", "Open vSwitch Extension"
>-            VALUE "FileVersion", "6.3.9600.17298"
>+            VALUE "FileVersion", STR(Version)
>             VALUE "InternalName", "OVSExt.SYS"
>             VALUE "LegalCopyright", "Licensed under the Apache License,
>Version 2.0 (the ""License"")"
>             VALUE "OriginalFilename", "OVSExt.SYS"
>-            VALUE "ProductName", "Open vSwitch 8/8.1 DDK driver"
>-            VALUE "ProductVersion", "6.3.9600.17298"
>+            VALUE "ProductName", "Open vSwitch"
>+            VALUE "ProductVersion", STR(Version)
>         END
>     END
>     BLOCK "VarFileInfo"
>diff --git a/datapath-windows/ovsext/ovsext.vcxproj
>b/datapath-windows/ovsext/ovsext.vcxproj
>index 77530fd..dc0d2db 100644
>--- a/datapath-windows/ovsext/ovsext.vcxproj
>+++ b/datapath-windows/ovsext/ovsext.vcxproj
>@@ -174,6 +174,18 @@
>       <MultiProcessorCompilation
>Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Debug|x64'">true</MultiProcessorCompilation>
>       <MultiProcessorCompilation
>Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Release|x64'">true</MultiProcessorCompilation>
>     </ClCompile>
>+    <Inf>
>+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8
>Debug|x64'">$(Version)</TimeStamp>
>+    </Inf>
>+    <Inf>
>+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Debug|x64'">$(Version)</TimeStamp>
>+    </Inf>
>+    <Inf>
>+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8
>Release|x64'">$(Version)</TimeStamp>
>+    </Inf>
>+    <Inf>
>+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Release|x64'">$(Version)</TimeStamp>
>+    </Inf>
>   </ItemDefinitionGroup>
>   <ItemGroup>
>     <ClCompile Include="Actions.c" />
>@@ -212,7 +224,12 @@
>     <ClCompile Include="Util.c" />
>     <ClCompile Include="Vport.c" />
>     <ClCompile Include="Vxlan.c" />
>-    <ResourceCompile Include="ovsext.rc" />
>+    <ResourceCompile Include="ovsext.rc">
>+      <PreprocessorDefinitions
>Condition="'$(Configuration)|$(Platform)'=='Win8
>Release|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1;VersionWithC
>ommas=$(Version.Replace('.',','))</PreprocessorDefinitions>
>+      <PreprocessorDefinitions
>Condition="'$(Configuration)|$(Platform)'=='Win8
>Debug|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1;VersionWithCom
>mas=$(Version.Replace('.',','))</PreprocessorDefinitions>
>+      <PreprocessorDefinitions
>Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Release|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1;VersionWithC
>ommas=$(Version.Replace('.',','))</PreprocessorDefinitions>
>+      <PreprocessorDefinitions
>Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Debug|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1;VersionWithCom
>mas=$(Version.Replace('.',','))</PreprocessorDefinitions>
>+    </ResourceCompile>
>   </ItemGroup>
>   <ItemGroup>
>     <Inf Exclude="@(Inf)" Include="*.inf" />
>-- 
>2.10.2.windows.1
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_
>mailman_listinfo_ovs-2Ddev&d=DgICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Z6vowHUOjP5
>ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo&m=lD77IS846RCT1HY3xivbqDpv9md7-xwT03OaBza
>bGvE&s=uHuKmtnr6McdMnEcgTRWuISVR9Vn-mvG0iRTTLFHDyI&e=
Sairam Venugopal Dec. 8, 2016, 11:20 p.m. UTC | #2
Thanks for sending this out.

Acked-by: Sairam Venugopal <vsairam@vmware.com>



On 12/5/16, 6:58 PM, "Alin Serdean" <aserdean@cloudbasesolutions.com>
wrote:

>The following components use Windows driver information:
>-	System (inf file); used during device installation
>-	Resource file (rc file); used by applications when looking over the
>driver
>    file(sys)
>
>Currently we have the following for the driver version number:
>-	(inf file) generated value from the build timestamp
>-	(rc file) predefined value
>
>This patch forces both files to depend on a variable: '$(Version)'.
>This is a predefined variable from Visual Studio.
>
>To achieve the above we change the current project settings used by the
>'stampinf' utility and we define a new preprocessor value named
>'VersionWithCommas' (which is obtained by replacing all
>'.' with ',' from $(Version) ).
>Certain values from the resource file are expected to use ',' instead of
>'.' .
>
>The resource file has been updated to use the new values when generating
>information about the driver (sys).
>
>The variable '$(Version' can be changed from the command line via the
>'msbuild' utility.
>
>Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
>---
> datapath-windows/ovsext/ovsext.rc      | 11 ++++++-----
> datapath-windows/ovsext/ovsext.vcxproj | 19 ++++++++++++++++++-
> 2 files changed, 24 insertions(+), 6 deletions(-)
>
>diff --git a/datapath-windows/ovsext/ovsext.rc
>b/datapath-windows/ovsext/ovsext.rc
>index 0b92e2e..578367d 100644
>--- a/datapath-windows/ovsext/ovsext.rc
>+++ b/datapath-windows/ovsext/ovsext.rc
>@@ -8,14 +8,15 @@
> LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
> #pragma code_page(1252)
> 
>+#define STR(x)                          #x
> 
>//////////////////////////////////////////////////////////////////////////
>///
> //
> // Version
> //
> 
> VS_VERSION_INFO VERSIONINFO
>- FILEVERSION 6,3,9600,17298
>- PRODUCTVERSION 6,3,9600,17298
>+ FILEVERSION VersionWithCommas
>+ PRODUCTVERSION VersionWithCommas
>  FILEFLAGSMASK 0x3fL
> #ifdef _DEBUG
>  FILEFLAGS 0x9L
>@@ -32,12 +33,12 @@ BEGIN
>         BEGIN
>             VALUE "CompanyName", "Open vSwitch"
>             VALUE "FileDescription", "Open vSwitch Extension"
>-            VALUE "FileVersion", "6.3.9600.17298"
>+            VALUE "FileVersion", STR(Version)
>             VALUE "InternalName", "OVSExt.SYS"
>             VALUE "LegalCopyright", "Licensed under the Apache License,
>Version 2.0 (the ""License"")"
>             VALUE "OriginalFilename", "OVSExt.SYS"
>-            VALUE "ProductName", "Open vSwitch 8/8.1 DDK driver"
>-            VALUE "ProductVersion", "6.3.9600.17298"
>+            VALUE "ProductName", "Open vSwitch"
>+            VALUE "ProductVersion", STR(Version)
>         END
>     END
>     BLOCK "VarFileInfo"
>diff --git a/datapath-windows/ovsext/ovsext.vcxproj
>b/datapath-windows/ovsext/ovsext.vcxproj
>index 77530fd..dc0d2db 100644
>--- a/datapath-windows/ovsext/ovsext.vcxproj
>+++ b/datapath-windows/ovsext/ovsext.vcxproj
>@@ -174,6 +174,18 @@
>       <MultiProcessorCompilation
>Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Debug|x64'">true</MultiProcessorCompilation>
>       <MultiProcessorCompilation
>Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Release|x64'">true</MultiProcessorCompilation>
>     </ClCompile>
>+    <Inf>
>+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8
>Debug|x64'">$(Version)</TimeStamp>
>+    </Inf>
>+    <Inf>
>+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Debug|x64'">$(Version)</TimeStamp>
>+    </Inf>
>+    <Inf>
>+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8
>Release|x64'">$(Version)</TimeStamp>
>+    </Inf>
>+    <Inf>
>+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Release|x64'">$(Version)</TimeStamp>
>+    </Inf>
>   </ItemDefinitionGroup>
>   <ItemGroup>
>     <ClCompile Include="Actions.c" />
>@@ -212,7 +224,12 @@
>     <ClCompile Include="Util.c" />
>     <ClCompile Include="Vport.c" />
>     <ClCompile Include="Vxlan.c" />
>-    <ResourceCompile Include="ovsext.rc" />
>+    <ResourceCompile Include="ovsext.rc">
>+      <PreprocessorDefinitions
>Condition="'$(Configuration)|$(Platform)'=='Win8
>Release|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1;VersionWithC
>ommas=$(Version.Replace('.',','))</PreprocessorDefinitions>
>+      <PreprocessorDefinitions
>Condition="'$(Configuration)|$(Platform)'=='Win8
>Debug|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1;VersionWithCom
>mas=$(Version.Replace('.',','))</PreprocessorDefinitions>
>+      <PreprocessorDefinitions
>Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Release|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1;VersionWithC
>ommas=$(Version.Replace('.',','))</PreprocessorDefinitions>
>+      <PreprocessorDefinitions
>Condition="'$(Configuration)|$(Platform)'=='Win8.1
>Debug|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1;VersionWithCom
>mas=$(Version.Replace('.',','))</PreprocessorDefinitions>
>+    </ResourceCompile>
>   </ItemGroup>
>   <ItemGroup>
>     <Inf Exclude="@(Inf)" Include="*.inf" />
>-- 
>2.10.2.windows.1
>_______________________________________________
>dev mailing list
>dev@openvswitch.org
>https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_
>mailman_listinfo_ovs-2Ddev&d=DgICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Z6vowHUOjP5
>ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo&m=lD77IS846RCT1HY3xivbqDpv9md7-xwT03OaBza
>bGvE&s=uHuKmtnr6McdMnEcgTRWuISVR9Vn-mvG0iRTTLFHDyI&e=
diff mbox

Patch

diff --git a/datapath-windows/ovsext/ovsext.rc b/datapath-windows/ovsext/ovsext.rc
index 0b92e2e..578367d 100644
--- a/datapath-windows/ovsext/ovsext.rc
+++ b/datapath-windows/ovsext/ovsext.rc
@@ -8,14 +8,15 @@ 
 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 #pragma code_page(1252)
 
+#define STR(x)                          #x
 /////////////////////////////////////////////////////////////////////////////
 //
 // Version
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 6,3,9600,17298
- PRODUCTVERSION 6,3,9600,17298
+ FILEVERSION VersionWithCommas
+ PRODUCTVERSION VersionWithCommas
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x9L
@@ -32,12 +33,12 @@  BEGIN
         BEGIN
             VALUE "CompanyName", "Open vSwitch"
             VALUE "FileDescription", "Open vSwitch Extension"
-            VALUE "FileVersion", "6.3.9600.17298"
+            VALUE "FileVersion", STR(Version)
             VALUE "InternalName", "OVSExt.SYS"
             VALUE "LegalCopyright", "Licensed under the Apache License, Version 2.0 (the ""License"")"
             VALUE "OriginalFilename", "OVSExt.SYS"
-            VALUE "ProductName", "Open vSwitch 8/8.1 DDK driver"
-            VALUE "ProductVersion", "6.3.9600.17298"
+            VALUE "ProductName", "Open vSwitch"
+            VALUE "ProductVersion", STR(Version)
         END
     END
     BLOCK "VarFileInfo"
diff --git a/datapath-windows/ovsext/ovsext.vcxproj b/datapath-windows/ovsext/ovsext.vcxproj
index 77530fd..dc0d2db 100644
--- a/datapath-windows/ovsext/ovsext.vcxproj
+++ b/datapath-windows/ovsext/ovsext.vcxproj
@@ -174,6 +174,18 @@ 
       <MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|x64'">true</MultiProcessorCompilation>
       <MultiProcessorCompilation Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|x64'">true</MultiProcessorCompilation>
     </ClCompile>
+    <Inf>
+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">$(Version)</TimeStamp>
+    </Inf>
+    <Inf>
+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|x64'">$(Version)</TimeStamp>
+    </Inf>
+    <Inf>
+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">$(Version)</TimeStamp>
+    </Inf>
+    <Inf>
+      <TimeStamp Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|x64'">$(Version)</TimeStamp>
+    </Inf>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="Actions.c" />
@@ -212,7 +224,12 @@ 
     <ClCompile Include="Util.c" />
     <ClCompile Include="Vport.c" />
     <ClCompile Include="Vxlan.c" />
-    <ResourceCompile Include="ovsext.rc" />
+    <ResourceCompile Include="ovsext.rc">
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win8 Release|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1;VersionWithCommas=$(Version.Replace('.',','))</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win8 Debug|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS630=1;VersionWithCommas=$(Version.Replace('.',','))</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1;VersionWithCommas=$(Version.Replace('.',','))</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|x64'">%(PreprocessorDefinitions);NDIS_WDM=1;NDIS640=1;VersionWithCommas=$(Version.Replace('.',','))</PreprocessorDefinitions>
+    </ResourceCompile>
   </ItemGroup>
   <ItemGroup>
     <Inf Exclude="@(Inf)" Include="*.inf" />