Hi,
I'm trying to package ipp-usb project (https://github.com/OpenPrinting/ipp-usb) which is written in Go. I generated spec file via go2rpm, but several files from source tarball which supposed to be packaged is not packaged e.g. systemd unit file ipp-usb.service or udev rule file 71-ipp-usb.rules.
I managed to package those files with following install command e.g.:
install -m 0644 -vp %{gobuilddir}/src/github.com/OpenPrinting/ipp-usb/systemd-udev/*.rules %{buildroot}%{_udevrulesdir}
but '%{gobuilddir}/src/github.com/OpenPrinting/ipp-usb' is quite ugly - is there a predefined golang macro for such path? Or a best practice?
Thank you in advance,
Zdenek
Hi Zdenek,
On Mon, 31 Aug 2020 at 12:11, Zdenek Dohnal zdohnal@redhat.com wrote:
Hi,
I'm trying to package ipp-usb project (https://github.com/OpenPrinting/ipp-usb) which is written in Go. I generated spec file via go2rpm, but several files from source tarball which supposed to be packaged is not packaged e.g. systemd unit file ipp-usb.service or udev rule file 71-ipp-usb.rules.
I managed to package those files with following install command e.g.:
install -m 0644 -vp %{gobuilddir}/src/github.com/OpenPrinting/ipp-usb/systemd-udev/*.rules %{buildroot}%{_udevrulesdir}
but '%{gobuilddir}/src/github.com/OpenPrinting/ipp-usb' is quite ugly - is there a predefined golang macro for such path? Or a best practice?
Well, you should have %{goname} defined at the top that matches at least part of that. But you shouldn't need it, as that should be the current directory, so just
install -m 0644 -vp systemd-udev/*.rules %{buildroot}%{_udevrulesdir}
should work.
Thank you in advance,
Zdenek
-- Zdenek Dohnal Software Engineer Red Hat Czech - Brno TPB-C
devel mailing list -- devel@lists.fedoraproject.org To unsubscribe send an email to devel-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/devel@lists.fedoraproject.org
Le 2020-08-31 18:08, Zdenek Dohnal a écrit :
Hi,
I'm trying to package ipp-usb project (https://github.com/OpenPrinting/ipp-usb) which is written in Go. I generated spec file via go2rpm, but several files from source tarball which supposed to be packaged is not packaged e.g. systemd unit file ipp-usb.service or udev rule file 71-ipp-usb.rules.
I managed to package those files with following install command e.g.:
install -m 0644 -vp %{gobuilddir}/src/github.com/OpenPrinting/ipp-usb/systemd-udev/*.rules %{buildroot}%{_udevrulesdir}
but '%{gobuilddir}/src/github.com/OpenPrinting/ipp-usb' is quite ugly - is there a predefined golang macro for such path? Or a best practice?
You do not need that at all in most of the spec, the usual workdir is the root of the upstream zip. The complex path you posted is (painfully) symlinked to keep go tools happy in GOPATH mode, anything which is not a "go foo" execution can happily ignore it and just work from the current directory. But if you do need an absolute file path or already changed dir somewhere else '%{gobuilddir}/src/%{goipath}' is likely to be close to what you want.
The next gen of Fedora Go tooling will be both simpler and more complex.
Simpler because in Go module mode we can drop completely the horrific mandatory root dir renaming to url, adding a src prefix. So in most cases we will just work from the archive root like other languages, without playing brittle directory symlinking games.
More complex because upstream Go modules permit submoduling, so submodule roots will be buried deep inside the expanded archive tree.
Regards,