Hi all,
I'm new to Go SIG. There are some Go apps that I'm interested in packaging and I'm learning about it.
One of these packages is `doctl`, the official cli for DigitalOcean, but I'm having problems with the result.
I'm able to build it using mock or copr, but the generated binary is detected as `ar archive` by `file`, strip complains during %install phase and result rpm is not usable.
- Spec file[1]: https://github.com/mikelolasagasti/doctl/blob/main/doctl.spec
Simple go2rpm with minor changes. Requires also `golang-github-natefinch-pie` that is available in the same repo, rest of dependencies are available in rawhide and F35.
- Copr build log[2]: https://download.copr.fedorainfracloud.org/results/mikelo2/doctl/fedora-rawh...
(...) /usr/bin/strip: /builddir/build/BUILDROOT/doctl-1.64.0-1.fc36.x86_64/usr/bin/doctl(__.PKGDEF): Unable to recognise the format of file: file format not recognized /usr/bin/strip: /builddir/build/BUILDROOT/doctl-1.64.0-1.fc36.x86_64/usr/bin/doctl(_go_.o): Unable to recognise the format of file: file format not recognized (...)
- rpmlint:
$ rpmlint result/doctl-1.64.0-1.fc36.x86_64.rpm doctl.x86_64: E: script-without-shebang /usr/bin/doctl doctl.x86_64: E: wrong-script-end-of-line-encoding /usr/bin/doctl doctl.x86_64: W: no-manual-page-for-binary doctl
- file:
<mock-chroot> sh-5.1# cd /builddir/build/BUILDROOT/doctl-1.64.0-1.fc36.x86_64/usr/bin/ <mock-chroot> sh-5.1# file doctl doctl:
I was able to find another spec[3] https://bugzilla.redhat.com/show_bug.cgi?id=1821902 that is having the same issue, but not a solution.
Any idea on how to troubleshoot this?
Kind regards, Mikel
[1] https://github.com/mikelolasagasti/doctl/blob/main/doctl.spec [2] https://download.copr.fedorainfracloud.org/results/mikelo2/doctl/fedora-rawh... [3] https://bugzilla.redhat.com/show_bug.cgi?id=1821902
I think you need to append "/cmd/doctl" to your %{goipath} line on line 72:
%build %gobuild -o %{gobuilddir}/cmd/doctl %{goipath}/cmd/doctl
The way your %gobuild line reads to me today is that it's building the Go *package* github.com/digitalocean/doctl. You want to build the executable github.com/digitalocean/doctl/cmd/doctl.
Note, I did not test this to see if it compiles. It just looks that way to me.
Hope this helps!
~link
On Sun, Sep 5 2021 at 11:13:10 AM +0200, Mikel Olasagasti mikel@olasagasti.info wrote:
Hi all,
I'm new to Go SIG. There are some Go apps that I'm interested in packaging and I'm learning about it.
One of these packages is `doctl`, the official cli for DigitalOcean, but I'm having problems with the result.
I'm able to build it using mock or copr, but the generated binary is detected as `ar archive` by `file`, strip complains during %install phase and result rpm is not usable.
- Spec file[1]:
https://github.com/mikelolasagasti/doctl/blob/main/doctl.spec
Simple go2rpm with minor changes. Requires also `golang-github-natefinch-pie` that is available in the same repo, rest of dependencies are available in rawhide and F35.
- Copr build log[2]:
https://download.copr.fedorainfracloud.org/results/mikelo2/doctl/fedora-rawh...
(...) /usr/bin/strip: /builddir/build/BUILDROOT/doctl-1.64.0-1.fc36.x86_64/usr/bin/doctl(__.PKGDEF): Unable to recognise the format of file: file format not recognized /usr/bin/strip: /builddir/build/BUILDROOT/doctl-1.64.0-1.fc36.x86_64/usr/bin/doctl(_go_.o): Unable to recognise the format of file: file format not recognized (...)
- rpmlint:
$ rpmlint result/doctl-1.64.0-1.fc36.x86_64.rpm doctl.x86_64: E: script-without-shebang /usr/bin/doctl doctl.x86_64: E: wrong-script-end-of-line-encoding /usr/bin/doctl doctl.x86_64: W: no-manual-page-for-binary doctl
- file:
<mock-chroot> sh-5.1# cd /builddir/build/BUILDROOT/doctl-1.64.0-1.fc36.x86_64/usr/bin/ <mock-chroot> sh-5.1# file doctl doctl:
I was able to find another spec[3] https://bugzilla.redhat.com/show_bug.cgi?id=1821902 that is having the same issue, but not a solution.
Any idea on how to troubleshoot this?
Kind regards, Mikel
[1] https://github.com/mikelolasagasti/doctl/blob/main/doctl.spec [2] https://download.copr.fedorainfracloud.org/results/mikelo2/doctl/fedora-rawh... [3] https://bugzilla.redhat.com/show_bug.cgi?id=1821902 _______________________________________________ golang mailing list -- golang@lists.fedoraproject.org To unsubscribe send an email to golang-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/golang@lists.fedoraproject.org Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure
golang@lists.fedoraproject.org