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

Conversation

ldennington
Copy link
Collaborator

Overview

This change sets up the infrastructure for microsoft/git to support deployments to microsoft/winget-pkgs via wingetcreate. Specifically, it modifies the build-git-installers workflow to update build-extra's install.iss file with the correct metadata for microsoft/git, as outlined in https://github.com/github/git-fundamentals/issues/700.

Testing

Extracted the updated task (Update installer metadata for microsoft/git) and completed a successful test run in the ldennington/git fork.

Associated work items

#699
#700

@ldennington ldennington self-assigned this Oct 12, 2021
Copy link
Collaborator

@vdye vdye left a comment

Choose a reason for hiding this comment

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

Overall, looks good! I can't really judge how this fits in with wingetcreate (e.g., if anything is missing), so my questions revolve around only the fields added/modified here.

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?

.github/workflows/build-git-installers.yml Outdated Show resolved Hide resolved
.github/workflows/build-git-installers.yml Show resolved Hide resolved
@ldennington ldennington force-pushed the update-metadata branch 2 times, most recently from 0a8d40c to 7293a2d Compare October 12, 2021 18:33
@ldennington
Copy link
Collaborator Author

Since there have been a few updates, I've issued another test run here:

https://github.com/ldennington/git/runs/3874230850?check_suite_focus=true


# Add 'ArchitecturesAllowed' and 'LicenseFile' after 'AppVersion'
sed -i -e '/^AppVersion=.*/a\
ArchitecturesAllowed=x64 \
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ArchitecturesAllowed=x64 \
ArchitecturesAllowed=x64\

Updating installer metadata to align with the specification outlined in
github/git-fundamentals#700 in preparation for
using `wingetcreate` to publish releases to microsoft/winget-pkgs.
@ldennington
Copy link
Collaborator Author

The wingetcreate team has recommended using wingetcreate update instead of wingetcreate add when we publish manifests (in fact, it is our only option since wingetcreate add doesn't have a non-interactive mode 😞). Since the only metadata wingetcreate update looks at is installer type and architecture, these changes are no longer necessary, so closing out this PR. Apologies for the confusion.

@ldennington ldennington closed this Nov 2, 2021
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.

4 participants