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

Update Windows installer metadata for wingetcreate #446

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/build-git-installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,19 @@ jobs:
shell: bash
run: |
b=/usr/src/build-extra &&
sed -i -e 's/^\(AppPublisher=\).*/\1The Git Fundamentals Team at GitHub/' $b/installer/install.iss

# Remove '.vfs' from version
version=$(echo ${{ needs.prereqs.outputs.tag_version }} | sed s/.vfs//g) &&
Copy link
Collaborator

@vdye vdye Oct 12, 2021

Choose a reason for hiding this comment

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

Is there a specific reason that .vfs is being removed? If the reason is "AppVersion only handles numeric characters", the filter on allowed version tags would need to be updated as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes - we originally left the vfs in the manifest version numbers, but the winget maintainers requested we change it to align with what's shown in Control Panel:
Screen Shot 2021-10-12 at 11 07 07 AM

Copy link
Collaborator

@vdye vdye Oct 12, 2021

Choose a reason for hiding this comment

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

What was causing the .vfs to be removed from the version as displayed in your screenshot?

It looks like it is specific to .vfs after all? I'd still like to understand where that happens (build-extra?).

I don't see anything calling that substring out in the installer scripts, so it's probably not specific to the .vfs. In that case, we'd want whatever rule parses out the version here to match the rule used by Windows in displaying there.

I'm also going to double-check, but I vaguely remember it including the .vfs when I was testing build-git-installers.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Found it! https://github.com/git-for-windows/build-extra/blob/main/installer/release.sh#L105-L107

sed -e 's/\.[^0-9]*\.[^0-9]*\./\./g' \
	-e 's/\.[^.0-9]*\./\./g' -e 's/\.rc/\./g')"

Copy link
Collaborator

@vdye vdye Oct 12, 2021

Choose a reason for hiding this comment

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

Sorry for the comment spam, but I'm trying to understand what's happening here. Why do you manually need to replace the version at all, if build-extra/installer/release.sh already sets the version in the format you want?

For the rest of the metadata changed here, you're either updating something that's hardcoded to a value we don't want (e.g., AppPublisher=The Git Development Community) or adding something new (e.g. ArchitecturesAllowed=x64). AppVersion doesn't seem to fit either of those.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually went a little ways down the FileVersionInfo.FileVersion path as well - glad I wasn't the only one who thought it was strange.

And I think experimenting with different versions is a good idea. I'll think a bit on the best way to test that - it's a little tricky, given that wingetcreate only seems to accept installer urls, and I'd like to not have to build a dummy installer and do a dummy release for each sample version 😬.

Copy link
Member

Choose a reason for hiding this comment

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

where GetVersionInfo gets its information from

It's from the resources. They are compiled via https://github.com/microsoft/git/blob/vfs-2.32.0/git.rc#L2. The constants are set via the Makefile:

git/Makefile

Lines 2306 to 2310 in bb8d8c3

git.res: git.rc GIT-VERSION-FILE GIT-PREFIX
$(QUIET_RC)$(RC) \
$(join -DMAJOR= -DMINOR= -DMICRO= -DPATCHLEVEL=, $(wordlist 1, 4, \
$(shell echo $(GIT_VERSION) 0 0 0 0 | tr '.a-zA-Z-' ' '))) \
-DGIT_VERSION="\\\"$(GIT_VERSION)\\\"" -i $< -o $@

(The tr call will replace all non-numerical characters by whitespace, then use the first four numbers (padding them with zeroes if there aren't enough to go 'round.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh interesting! Is the change I've added here the way to go then? Or should we make updates in git.rc/Makefile?

Copy link
Collaborator Author

@ldennington ldennington Oct 14, 2021

Choose a reason for hiding this comment

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

(I sadly just realized that my 2 previous comments have been 'pending' for quite some time, which explains why I wasn't getting responses 😬)

Copy link
Member

Choose a reason for hiding this comment

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

Quite honestly, I wonder why the fix is necessary for the version (the Makefile magic should have picked the right version). For my curiosity, what version would you see without your patch, and which version do you see with your patch?


# Replace AppPublisher and AppVersion with correct values
sed -i -e "s/^\(AppPublisher=\).*/\1Microsoft/" $b/installer/install.iss &&
ldennington marked this conversation as resolved.
Show resolved Hide resolved
sed -i -e "s/^\(AppVersion=\).*/\1$version/" $b/installer/install.iss &&

# Add 'ArchitecturesAllowed' and 'LicenseFile' after 'AppVersion'
sed -i -e '/^AppVersion=.*/a\
ArchitecturesAllowed=x64\
LicenseFile={#SourcePath}\\..\\COPYING
' $b/installer/install.iss
- name: Let the installer configure Visual Studio to use the installed Git
shell: bash
run: |
Expand Down