-
Notifications
You must be signed in to change notification settings - Fork 3
Allow manual GIT_BUILT_FROM_COMMIT
specification for installer
#8
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
Allow manual GIT_BUILT_FROM_COMMIT
specification for installer
#8
Conversation
I feel like maybe you paused writing here, then forgot to resume?
Excellent! |
sudo installer -verbose -pkg $pkgpath -target / | ||
|
||
# Show build options | ||
git version --build-options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need to manually verify this output, but that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couldn't we automate this? Have the build step write an additional artifact with the OID and then test it here.
Might not be worth the trouble (you know my love of all things yml...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Should be pretty straightforward to implement, and it makes it clearer when something goes wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, you can make it an output variable. It is slightly convoluted because you will have to have two output variables (the test-install
job can only access the outputs of another job, not of another job's step), see e.g. https://github.com/git/git/blob/v2.34.1/.github/workflows/main.yml#L36, https://github.com/git/git/blob/v2.34.1/.github/workflows/main.yml#L11-L12, and https://github.com/git/git/blob/v2.34.1/.github/workflows/main.yml#L81.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took a bit of experimentation, but this is now working!
Sorry about that, description updated! |
Makefile
Outdated
@@ -63,7 +64,7 @@ XML_CATALOG_FILES=$(shell bin/find-file /usr/local/etc/xml/catalog) | |||
BUILD_CODE := intel-$(ARCH_CODE)-$(OSX_CODE) | |||
BUILD_DIR := build/$(BUILD_CODE) | |||
DESTDIR := $(PWD)/stage/git-$(BUILD_CODE)-$(VERSION) | |||
SUBMAKE := $(MAKE) C_INCLUDE_PATH="$(C_INCLUDE_PATH)" CPLUS_INCLUDE_PATH="$(CPLUS_INCLUDE_PATH)" LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" TARGET_FLAGS="$(TARGET_FLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" NO_GETTEXT=1 NO_DARWIN_PORTS=1 prefix=$(GIT_PREFIX) DESTDIR=$(DESTDIR) | |||
SUBMAKE := $(MAKE) C_INCLUDE_PATH="$(C_INCLUDE_PATH)" CPLUS_INCLUDE_PATH="$(CPLUS_INCLUDE_PATH)" LD_LIBRARY_PATH="$(LD_LIBRARY_PATH)" TARGET_FLAGS="$(TARGET_FLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" NO_GETTEXT=1 NO_DARWIN_PORTS=1 prefix=$(GIT_PREFIX) GIT_BUILT_FROM_COMMIT=$(GIT_BUILT_FROM_COMMIT) DESTDIR=$(DESTDIR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if we should have DQuotes around the new value. (and maybe the $(GIT_PREFIX) too.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try it and, assuming nothing weird happens (like the quotes showing up in git version --build-options
), update this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't see any issues - updated!
Use GIT_BUILT_FROM_COMMIT specified as argument to `make` when building `git`. By default, the value is empty. Signed-off-by: Victoria Dye <[email protected]>
347fbab
to
58b6593
Compare
Set `GIT_BUILT_FROM_COMMIT` in the `osx-installer.yml` workflow from the git repository cloned for build. Additionally, install the built installer and verify the built-from commit hash appears properly in `git version --build-options`. Signed-off-by: Victoria Dye <[email protected]>
58b6593
to
09b51b4
Compare
if (find ./stage/git-*/usr/local/git/bin/scalar); then | ||
echo "::set-output name=with_scalar::true" | ||
else | ||
echo "::set-output name=with_scalar::false" | ||
fi | ||
|
||
# Set build commit hash | ||
echo "::set-output name=commit_hash::$(git -C git rev-parse -q --verify HEAD 2>/dev/null)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that this is the commit ID we want git config --build-options
to show? I had expected something like this appended after line 85:
echo "::set-output name=commit_hash::$GIT_BUILT_FROM_COMMIT"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is mostly an attempt to keep the sources of the "actual" and "expected" commit hash values as separate as possible. By pulling the "expected" commit hash directly from git rev-parse
, the validation later will confirm both that 1) the dist
archive was built with the correct commit hash, and 2) that commit hash was properly embedded into the resulting installer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough!
@@ -55,6 +55,7 @@ LDFLAGS := $(TARGET_FLAGS) $(ARCH_FLAGS_${ARCH_CODE}) | |||
BAK_FOLDER := $(shell date +%s) | |||
PREFIX := /usr/local | |||
GIT_PREFIX := $(PREFIX)/git | |||
GIT_BUILT_FROM_COMMIT := |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that really work? I thought that :=
overrides whatever was specified on the command-line, and we would need ?=
here. But then, any uninitialized variable VAR
would see $(VAR)
interpolated to the empty string, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does! According to the documentation, a command line-defined variable overrides all simply (:=
) and recursively (=
) expanded assignments. As a result, this initializes GIT_BUILT_FROM_COMMIT
as an empty string only if it isn't specified on the command line.
Related: microsoft/git#472
Changes
GIT_BUILT_FROM_COMMIT
asmake
variable when building the MacOS installer packagegit version --build-options
Testing
git
Makefile): https://github.com/vdye/git_osx_installer/actions/runs/1531273864