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

Subprojects update fails for all Git wraps with revision = 'head' #12730

Closed
amyspark opened this issue Jan 12, 2024 · 4 comments · Fixed by #13840
Closed

Subprojects update fails for all Git wraps with revision = 'head' #12730

amyspark opened this issue Jan 12, 2024 · 4 comments · Fixed by #13840

Comments

@amyspark
Copy link
Contributor

Describe the bug

As per https://mesonbuild.com/Wrap-dependency-system-manual.html#specific-to-vcsbased-wraps, we can use head to tell Meson to always use the latest commit when checking a subproject out:

revision - name of the revision to checkout. Must be either: a valid value (such as a git tag) for the VCS's checkout command, or (for git) head to track upstream's default branch. Required.

However, if one issues a meson subprojects update after a build,

heads_refmap = '+refs/heads/*:refs/remotes/origin/*'
tags_refmap = '+refs/tags/*:refs/tags/*'
self.git_output(['fetch', '--refmap', heads_refmap, '--refmap', tags_refmap, 'origin', revision])

this block will instead cause all updates to fail with the following error:

Updating faac...
  -> Could not fetch revision head in deps/faac
fatal: couldn't find remote ref head
Git command failed: ['C:\\Program Files\\Git\\cmd\\git.EXE', 'fetch', '--refmap', '+refs/heads/*:refs/remotes/origin/*', '--refmap', '+refs/tags/*:refs/tags/*', 'origin', 'head']
(repeats for all the below deps...)
WARNING: Please check logs above as command failed in some subprojects which could have been left in conflict state: faac, faad2, flac, lame, libid3tag, libmad, libmpc, libopusenc, mp4v2, ogg, optimfrog-win-x64, opus, substrate, vorbis, wavpack, zlib

This is really simple to fix: just uppercase revision if head prior to issuing the Git call above:

                heads_refmap = '+refs/heads/*:refs/remotes/origin/*'
                tags_refmap = '+refs/tags/*:refs/tags/*'
                if revision == 'head':
                    revision = revision.upper()
                self.git_output(['fetch', '--refmap', heads_refmap, '--refmap', tags_refmap, 'origin', revision])

To Reproduce

Clone and initialise https://github.com/dragonCodecs/libAudio, then manually switch any of the above deps to an older commit.

Expected behavior

Meson should be able to update these wraps.

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? No
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) Windows 10 22H2
  • what Python version are you using e.g. 3.8.0 3.10.7
  • what meson --version 1.3.1
  • what ninja --version if it's a Ninja build 1.10.2
@bruchar1
Copy link
Member

Isn't it rather a documentation issue? Shouldn't revision in the wrap file be HEAD instead?

@amyspark
Copy link
Contributor Author

@bruchar1 Tests also use the same convention (Git revision value in lowercase), they don't show up as broken because updating is not tested:

@bruchar1
Copy link
Member

That's a good point. I have no strong opinion about which approach is the best. I will let meson developers decide of this.

@andy5995
Copy link
Contributor

andy5995 commented Nov 3, 2024

I've opened #13840 to fix this.

Because git is case-sensitive about HEAD, my opinion is that the meson code should not convert the case, and the docs and wraps should use "HEAD" not "head".

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 a pull request may close this issue.

3 participants