Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

installer: Fix version of installer and installed file #235

Merged
merged 1 commit into from
Mar 6, 2019

Conversation

r1walz
Copy link
Contributor

@r1walz r1walz commented Mar 1, 2019

As reported by @JJClements, the File version and Product version of the installer and installed binary were not the same. They are set by the installer/release.sh and by using sdk build (installer | git-and-installer) commands, which created this discrepancy.

Closes: git-for-windows/git#1797

@@ -74,7 +74,7 @@ PrivilegesRequired=none
UninstallDisplayIcon={app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
#ifndef COMPILE_FROM_IDE
#if Pos('-',APP_VERSION)>0
VersionInfoVersion={#Copy(APP_VERSION,1,Pos('-',APP_VERSION)-1)}
VersionInfoVersion=GetFileVersion('{#MINGW_BITNESS}\bin\git.exe')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that this is executed? I could imagine that the APP_VERSION constant is defined somehow without a dash...

Copy link
Contributor Author

@r1walz r1walz Mar 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. But APP_VERSION is defined through installer/release.sh, right? Anyway, this was just to make you remember what you said (which I think is not the correct approach). According to your words that day, you are actually changing the version of the installer, according to what (binary) is provided with git-sdk, instead of giving it the version what user wants (through installer/release.sh).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, the wish was for the file version in the properties of the installer executable to match the file version in the properties of the included git.exe, and I kind of agree...

And yes, APP_VERSION is defined in config.iss that is written by installer/release.sh. But is it not also used for the installer's window title? IOW APP_VERSION is used, but we may not want to use it for the file version of the .exe.

If you change this so that VersionInfoVersion is defined independently from APP_VERSION, but using GetFileVersion() instead, does it work?

Copy link
Contributor Author

@r1walz r1walz Mar 1, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But is it not also used for the installer's window title?

Yes, ofc, it is used for window's title and other stuff (regedit). But won't it be a bad UX if user sees different versions, I mean, on title bar and installer/installed bin? What was the intended use of APP_VERSION again? Can't we change the version of file while packing?

If you change this so that VersionInfoVersion is defined independently from APP_VERSION, but using GetFileVersion() instead, does it work?

I can make GetFileVersion() work, but again, it will face the formentioned problem. Also how can we generate git-sdk using git-sdk? (basically mingw64\bin\git.exe)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file version is limited to four numbers separated by dots, IIUC, the version displayed in the window title is free form. So it can be a lot more expressive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dscho my main concern here is UX, I mean if we are showing some different version on the title bar and installing some other version then this is bad(I know that we'll not be shipping such installer but yeah :P).

I'm making it to change the VersionInfoVersion to match the binary included and I guess we shall not be needing the conditional here because then we will get the same problematic installer when using sdk build (installer|git-and-installer) or installer/release.sh <version-string>?

#if Pos('-',APP_VERSION)>0
VersionInfoVersion={#Copy(APP_VERSION,1,Pos('-',APP_VERSION)-1)}
#else
VersionInfoVersion={#APP_VERSION}
#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@r1walz r1walz changed the title [WIP] installer: Fix version of installer and installed file installer: Fix version of installer and installed file Mar 2, 2019
@r1walz
Copy link
Contributor Author

r1walz commented Mar 4, 2019

@dscho can you please review this?

Copy link
Member

@dscho dscho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we simplify this further? Have you tested and verified that it works?

#define FILE_VERSION GetFileVersion(SourcePath+"\..\..\..\..\" \
+MINGW_BITNESS+"\bin\git.exe")
#define PROD_VERSION GetStringFileInfo(SourcePath+"\..\..\..\..\" \
+MINGW_BITNESS+"\bin\git.exe", "ProductVersion")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use ExpandConstant('{#SourceDir}') (or something similar to make use of SourceDir) for both arms, making them identical, i.e. you can move the definition of FILE_VERSION and PROD_VERSION out of the conditional?

@r1walz
Copy link
Contributor Author

r1walz commented Mar 5, 2019

Could we simplify this further? Have you tested and verified that it works?

I'll see if we can simplify it further ... Yes, I've verified and it works according to my understandings.

@dscho
Copy link
Member

dscho commented Mar 5, 2019

I'll see if we can simplify it further

To be clear: I think there is no need to put those #defines of FILE_VERSION and PROD_VERSION into that if ... else ... because I think they should be defined identically, using the SourceDir value, outside that if ... else ....

@r1walz
Copy link
Contributor Author

r1walz commented Mar 6, 2019

@dscho I tried changing the code, but it gave error undeclared identifier ExpandConstant, any views?

@dscho
Copy link
Member

dscho commented Mar 6, 2019

I tried changing the code, but it gave error undeclared identifier ExpandConstant

As discussed on IRC, we'll try to use #define SOURCE_DIR instead, as it is apparently impossible to use an InnoSetup constant to define a pre-processor constant.

@r1walz r1walz force-pushed the version-fix branch 2 times, most recently from fecd672 to ed65f19 Compare March 6, 2019 12:17
@r1walz
Copy link
Contributor Author

r1walz commented Mar 6, 2019

Yes, I've tested it, and it works!

@r1walz
Copy link
Contributor Author

r1walz commented Mar 6, 2019

Yes, I agree this is prettier.

As reported by @JJClements, the File version and Product version of the
installer and installer binary were not the same. They are set by the
`installer/release.sh` and by using `sdk build (installer |
git-and-installer)` commands, which created this discrepancy.

Create two macros, `FILE_VERSION` and `PROD_VERSION` to store File and
Product version of the included binary and copy it to the installer
file.

Closes: git-for-windows/git#1797
Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
@dscho dscho merged commit 2e879f7 into git-for-windows:master Mar 6, 2019
@dscho
Copy link
Member

dscho commented Mar 6, 2019

Excellent, thank you so much!

dscho added a commit that referenced this pull request Mar 6, 2019
The file/product version stored in the installer's `.exe`
file [now matches the version of the included `git.exe`
file's](#235).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
r1walz added a commit to r1walz/git-patches that referenced this pull request Jul 2, 2019
r1walz added a commit to r1walz/git-patches that referenced this pull request Aug 20, 2019
r1walz added a commit to r1walz/git-patches that referenced this pull request Aug 20, 2019
r1walz added a commit to r1walz/git-patches that referenced this pull request Aug 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants