#69 creating rpm out of go-pkg
Closed 8 months ago by led0nk. Opened 8 months ago by led0nk.

Hey guys,
I'm new to rpm-package-building and especially with golang, so i'm sorry if i'm asking dumb questions..

At first a achieved to create a rpm-package of my GitHub-Repository providing Packit (used service) with a pre-made archive, which includes vendor-files.
Now I'd like to achieve a solution without providing vendor-files, which was just an idea since i read about the go-rpm-macros.
I'm not quite sure if I correctly understood it, but for me it seems reasonable to use %generate_buildrequires followed by %go_generate_buildrequires to list my dependencies for building the binary.

But whenever I'm running packit with my .spec-file I keep getting this error:

Executing(%generate_buildrequires): /bin/sh -e /var/tmp/rpm-tmp.kZ8p2R
+ umask 022
+ cd /builddir/build/BUILD
+ cd ark-clusterinfo-0.1.0
+ GOPATH=/builddir/build/BUILD/ark-clusterinfo-0.1.0/_build:/usr/share/gocode
+ GO111MODULE=off
+ golist --imported --package-path github.com/led0nk/ark-clusterinfo --template 'golang({{.}})\n' --with-tests --skip-self
cannot find package "github.com/led0nk/ark-clusterinfo" in any of:
    /usr/lib/golang/src/github.com/led0nk/ark-clusterinfo (from $GOROOT)
    /builddir/build/BUILD/ark-clusterinfo-0.1.0/_build/src/github.com/led0nk/ark-clusterinfo (from $GOPATH)
    /usr/share/gocode/src/github.com/led0nk/ark-clusterinfo

Does someone have any clue on what's going wrong here?

Here is my .spec-file:

https://github.com/led0nk/ark-clusterinfo/blob/1db8c54b5e7dee1029ba1b65a4f93174c55c65a0/ark-clusterinfo.spec


Easiest way to generate and maintain a specfile is using go2rpm:

$ go2rpm -q https://github.com/led0nk/ark-clusterinfo
golang-github-led0nk-ark-clusterinfo.spec

If you prefer to create & maintain the spec manually you can check what the generated spec is doing.

I would suggest to close the ticket and move the discussion to the golang-list in Fedora or the Fedora Golang room in Matrix.

Also, be aware that for an unvednored build there are some dependencies missing in Fedora:

No match for argument: golang(github.com/FlowingSPDG/go-steam)
No match for argument: golang(github.com/a-h/templ)
No match for argument: golang(github.com/bwmarrin/discordgo)
No match for argument: golang(github.com/samber/slog-http)

I would suggest to close the ticket and move the discussion to the golang-list in Fedora or the Fedora Golang room in Matrix.

Okay, I'll close this ticket for now. But first thanks for the tip with go2rpm, i wasn't aware of it.

Also, be aware that for an unvednored build there are some dependencies missing in Fedora:

Yes I'm totally aware of it, thats what i'm trying to solve / work around, so that I don't have to provide the vendordocs. But it seems like, there is no other way than providing the vendor docs into the tarball, which get's used for the build.

Metadata Update from @led0nk:
- Issue status updated to: Closed (was: Open)

8 months ago

I would suggest to close the ticket and move the discussion to the golang-list in Fedora or the Fedora Golang room in Matrix.

Okay, I'll close this ticket for now. But first thanks for the tip with go2rpm, i wasn't aware of it.

Also, be aware that for an unvednored build there are some dependencies missing in Fedora:

Yes I'm totally aware of it, thats what i'm trying to solve / work around, so that I don't have to provide the vendordocs. But it seems like, there is no other way than providing the vendor docs into the tarball, which get's used for the build.

Are you aware of this capability from the go-rpm-macro library:

%files
%license vendor/modules.txt

In the %files section of the spec file add the vendor/modules.txt file to the %license tag. This will autogenerate into the spec file all of the bundled Provides from the ./vendor directory. E.g.:100:
Provides: bundled(golang(github.com/aws/aws-sdk-go)) = f831d5a0822a1ad72420ab18c6269bca1ddaf490

Log in to comment on this ticket.

Metadata