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 git to 2.42.0 and consider config.prefix #69

Closed
wants to merge 1 commit into from

Conversation

rnpnr
Copy link
Contributor

@rnpnr rnpnr commented Oct 4, 2023

First commit simply updates git to 2.42.0.

Second commit makes config.prefix apply to some of compiled in
paths. It makes git built here usable if its installed to config.prefix
rather than /.

I omitted the ETC_* paths for now but they could also be modified.

Note: GIT_LOCALE_PATH isn't actually used anywhere so it was dropped.

See #15.

@michaelforney
Copy link
Collaborator

Thanks for the PR!

Update to 2.42 looks great, nice job. git is one of the more involved packages to update, too. I pushed with two tiny changes:

  • Update pkg/git/ver to 2.42.0. This is needed so that the oasis build system will know to update the submodule before trying to build the sources.
  • Update pkg/git/.gitignore to git-manpages-2.42.0.tar.gz. This is just so git status shows outdated distfiles correctly.

Regarding config.prefix, I think there may be a simpler approach. It looks like all of those paths (GIT_*_PATH, DEFAULT_GIT_TEMPLATE_DIR) are used with the system_path() function, which prefixes them with system_prefix().

system_prefix() works in one of two ways, depending on whether RUNTIME_PREFIX is defined. If it is, it looks of the executable path using /proc/self/exe, finding the prefix dynamically similar to a relocatable gcc toolchain, otherwise it uses FALLBACK_RUNTIME_PREFIX. So I think we could do the following:

diff --git a/pkg/git/gen.lua b/pkg/git/gen.lua
index ff45e4333..89239fa90 100644
--- a/pkg/git/gen.lua
+++ b/pkg/git/gen.lua
@@ -31,7 +31,7 @@ build('hooklist', '$outdir/hook-list.h', {
 	'|', '$srcdir/generate-hooklist.sh', '$srcdir/Documentation/githooks.txt'
 })
 
-cc('exec-cmd.c', nil, {cflags=[[$cflags '-DFALLBACK_RUNTIME_PREFIX=""']]})
+cc('exec-cmd.c', nil, {cflags=string.format([[$cflags '-DFALLBACK_RUNTIME_PREFIX="%s"']], config.prefix)})
 cc('common-main.c')
 cc('http.c')
 cc('compat/regex/regex.c', nil, {cflags='$cflags -DGAWK -DNO_MBSUPPORT'})

Perhaps you could test this and see if it works for you? Alternatively, we could enable runtime prefix detection by defining RUNTIME_PREFIX and PROCFS_EXECUTABLE_PATH. What do you think?

from @michaelforney:
> It looks like all of those paths (`GIT_*_PATH`, `DEFAULT_GIT_TEMPLATE_DIR`)
> are used with the `system_path()` function, which prefixes them
> with `system_prefix()`.
>
> `system_prefix()` works in one of two ways, depending on whether
> RUNTIME_PREFIX is defined. If it is, it looks of the executable
> path using `/proc/self/exe`, finding the prefix dynamically similar
> to a relocatable gcc toolchain, otherwise it uses
> `FALLBACK_RUNTIME_PREFIX`.

see oasislinux#15: Support configurable PREFIX
@rnpnr
Copy link
Contributor Author

rnpnr commented Oct 4, 2023

pkg/git/.gitignore & pkg/git/ver

Sorry I definitely thought I included those.

As for config.prefix I can confirm your approach works. I rebased and pushed this branch with only that fix. Feel free to use it or write your own commit if you prefer.

I think FALLBACK_RUNTIME_PREFIX is fine. Since you can't just copy the git binary to another location and expect it to work I think that runtime detection of the prefix is unnecessary. If you didn't need all the files in libexec/git-core to have fully functional git it might be a different story.

@michaelforney
Copy link
Collaborator

Thanks, pushed.

@rnpnr rnpnr deleted the bump-git branch October 5, 2023 03:06
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