Opened 4 years ago

Closed 13 months ago

#16808 closed enhancement (fixed)

Stuck build when building from a git worktree

Reported by: madmax Owned by: bonefish
Priority: normal Milestone: R1/beta5
Component: Build System Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

I get a stuck process running revision=`cat | sed 's/[+-]/_/g'`... while trying to build Haiku in Debian (I don't think it matters) from a git worktree checkout.

I don't grok jam, but my guess is it comes from the PreprocessPackageOrRepositoryInfo1 action being called from PreprocessPackageOrRepositoryInfo rule with an empty revisionFile. revisionFile would come from DetermineHaikuRevision rule, which has one path setting it empty. I'm guessing the git path looks for .git/index, but in the worktree case, .git is a file containing the path to the real .git dir.

I don't know how cumbersome it would be to add the worktree case, but at least the build should continue with a default or empty revision, or maybe fail asking to set HAIKU_REVISION, but not block.

Change History (4)

comment:1 by pulkomandy, 4 years ago

The script in question: https://git.haiku-os.org/haiku/tree/build/scripts/determine_haiku_revision

I see it is indeed called with something inside the .git directory here: https://git.haiku-os.org/haiku/tree/build/jam/FileRules#n383

I don't understand why it needs to do that. Existence of .git should be enough and we should not assume anything about its contents?

It seems you can set HAIKU_REVISION manually in this case (from UserBuildConfig or from the jam command line) and then the script will not be used.

comment:2 by madmax, 4 years ago

As I understand it (basically from the comment in the rule), .git/index is just used to establish a dependency and run the script when the index changes to get the current revision. The script would only really get <haiku-rootdir>haiku-revision, so that it writes the revision name there.

What I'm trying to call attention to is https://git.haiku-os.org/haiku/tree/build/jam/FileRules#n388: if you have not set HAIKU_REVISION and don't have the usual git checkout, the rule returns an empty value, which has bad consequences in other places. In this particular case, catting stdin instead of a revision file (which may not exist or make sense anyway under these conditions) in https://git.haiku-os.org/haiku/tree/build/jam/PackageRules#n138. Now that may be intended, just provide a name and Ctrl-D to continue, but I killed a build twice before looking into why it didn't advance.

comment:3 by pulkomandy, 14 months ago

I have replied in a related change request but now I understand why the jamfile looks at .git/index: it is to detect if the current revision may have changed, and the haiku-revision file needs to be regenerated.

So, the determine_haiku_revision script itself needs no changes, and it's the jam rule that needs to be fixed to do "something" when the .git/index file is not found, or to find the file in a better way.

It would be nice to keep the dependency handling on the git index, because, without that dependency, we would always regenerate the revision file and then needlessly rebuild everything that depends on it.

comment:4 by pulkomandy, 13 months ago

Milestone: UnscheduledR1/beta5
Resolution: fixed
Status: newclosed

Fixed in hrev57367

Note: See TracTickets for help on using tickets.