Turns out I got my first hard package with packaging forgejo.
-
Turns out I got my first hard package with packaging forgejo.
https://code.forgejo.org/f3/gof3
Go fails to find the .go files reliably during building. This seems to be connected to the "hack" the Makefile is doing to find the sources.
Is using a Makefile for some reason to build the package.
And it seems to be doing some weird things with finding the sources and building the package.
Building the package from source with make build version 3.0.0 from 7 months ago and not version 3.10.1 that is latest.Hopefully some solution can be found tomorrow. More go toolchain reading awaits
https://code.forgejo.org/f3/gof3/src/branch/main/Makefile#L23
-
@msavoritias if you get stuck and need a hand, LMK. It doesn't actually appear to be using the Makefile to find the Go sources for the build, FWIW, it's just listing them as dependencies so Make knows when to update the binaries. Go is still building in the standard way and discovering the source files itself, so it shouldn't matter if GO_FILES isn't working on your system if it's a clean build (if not, you may have to remove the existing build first).
-
Sam Whitedreplied to Sam Whited last edited by [email protected]
@msavoritias oops, your post had a "view more" that I didn't notice. WRT the version number, it's just pulling that from Git and it's working fine for me as you'd expect, are you sure you have the main branch checked out (where the tags are) and it's up to date?
*EDIT:* oops, no, I see what yu're saying, if I do f3-cli --version it shows the wrong one. I took another look and they're just setting it incorrectly in the makefile, it is building the correct version though.
-
Yeah Im sure. freshly cloned
~/mutable/Engineering/Out of Tree/gof3$ git pull
Already up to date.
~/mutable/Engineering/Out of Tree/gof3$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
~/mutable/Engineering/Out of Tree/gof3$ make f3-cli
go build -tags 'netgo osusergo' -ldflags '-extldflags -static -s -w -X "main.Version=3.10.1+4-g5c2f910"' -o f3-cli code.forgejo.org/f3/gof3/v3/main
~/mutable/Engineering/Out of Tree/gof3$ ./f3-cli -v
F3 version 3.0.0
~/mutable/Engineering/Out of Tree/gof3$ -
Thanks. At least i know i dont have to bother with Make now.
The question now is why doesnt go find the .go files. -
@msavoritias What error is it giving you? This looks pretty standard, I can't imagine it missing something?
-
@sam
Ah wait. it reports 3.0 but it is actually 3.10
Go is weird oO Either way it seems to be building the correct version at least. -
Sam Whitedreplied to MSavoritias last edited by [email protected]
@msavoritias It's not a Go thing, sorry, updated the previous post so you probably missed it. I realized what you were seeing a moment after posting it. They just aren't setting the correct version variable, someone has changed the code since this build script has been written so it's listing the default version and never being updated at build time.
-
Its giving me this:
cannot find package "code.forgejo.org/f3/gof3/v3" in any of:
/gnu/store/frcrrrgipa932054cabmkifkfzc0lm2y-go-1.22.7/lib/go/src/code.forgejo.org/f3/gof3/v3 (from $GOROOT)
/tmp/guix-build-go-code-forgejo-org-f3-gof3-3.10.1.drv-0/src/code.forgejo.org/f3/gof3/v3 (from $GOPATH) -
@msavoritias What version of Go? That looks like you might be building with a very old version or something that's no longer supported, it shouldn't be looking in either of those places. Are you just running Make or are you doing your own build line (if so, what does that look like too)? And are you in the directory with the package, or building from some other working directory with "make -C" or go build /whatever/path?
-
@msavoritias oh, sorry, and last one, if that /tmp/ directory from the error is where you have the project, how did you get it there? It's weird to me that it has a v3 on the end (it shouldn't matter to the build, it doesn't care what the directory is called, I'm just trying to figure out if some weird custom cloning method broke something)
-
Well thing is if the paths are:
(arguments
(list
#:go go-1.22
#:import-path "code.forgejo.org/f3/gof3"
#:unpack-path "code.forgejo.org/f3/gof3"))
it says:
package code.forgejo.org/f3/gof3: no Go files in /tmp/guix-build-go-code-forgejo-org-f3-gof3-3.10.1.drv-0/src/code.forgejo.org/f3/gof3So the first one has to be v3. at least that gets me closer. maybe the second one is wrong
-
@msavoritias gotcha; Go 1.22 should be fine. I don't know how whatever that packager is works, but the import-path is a Go thing and it definitely has to include the v3. Where it's unpacked shouldn't matter, so that's probably not the issue.
-
@msavoritias Did I misunderstand, is that error coming from your packaging system or from Go itself? (the one about not being able to find the package)?
-
Looking further into this I think its Go or more specifically the repo. git cloning the repo again and running go build to build the project with go gives me:
~/mutable/Engineering/Out of Tree/gof3$ ls
api/ cmd/ f3/ f3-cli forges/ go.mod go.sum internal/ LICENSE logger/ main/ Makefile options/ README.md tests/ tree/ util/
~/mutable/Engineering/Out of Tree/gof3$ go build
no Go files in /home//mutable/Engineering/Out of Tree/gof3So that is the issue guix has. which the makefile "hacks" around
-
Sam Whitedreplied to MSavoritias last edited by [email protected]
@msavoritias oh yah, you can't just run Go build. The entry point is in the main directory in this project (why? I have no idea.) so you'd need go build -o f3-cli ./main or similar.
-
That worked
Thank you very much for your help! -
@msavoritias Glad I could help! I meant to say too and forgot: if you want to correctly set the version, change that "-X main.Version" line in the Makefile to:
-X "code.forgejo.org/f3/gof3/v3/cmd.Version=$(VERSION)"
They do have a main.Version, but it appears to be old dead code they forgot about. They're using the one in cmd. Specifying the full module and package path just makes it so it won't break if they change the import names around later.