Bug 2049514 - go-rpm-macros: %goworkdir is set incorrectly if use %gopkgfiles in the middle of the spec
Summary: go-rpm-macros: %goworkdir is set incorrectly if use %gopkgfiles in the middle...
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: go-rpm-macros
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Nicolas Mailhot
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-02-02 11:24 UTC by Mikhail Novosyolov
Modified: 2022-02-02 20:29 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-02 20:29:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Mikhail Novosyolov 2022-02-02 11:24:24 UTC
I have made the following spec:

#-------------------------------
%global goipath github.com/OpenPrinting/goipp
%global golicenses LICENSE
%global godocs README.md index.md

Summary:	IPP core protocol in pure Go (RFC 8010)
Name:		golang-github-openprinting-goipp
Group:		Development/Other
License:	BSD
Version:	1.0.0
Release:	1
Url:		https://github.com/OpenPrinting/goipp
Source0:	https://github.com/OpenPrinting/goipp/archive/refs/tags/v%{version}.tar.gz?/goipp-%{version}.tar.gz
BuildRequires:	go-srpm-macros
%gometa

%description
Package goipp implements the IPP core protocol in pure Go (RFC 8010).

%gopkg
%gopkgfiles

%prep
%goprep

%install
%gopkginstall

%check
%gocheck
#----------------------------------

I build it using go-rpm-macros 3.0.15 and get an error:
Could not open %files file /tmp/abf/rpmbuild/BUILD/goipp-1.0.0/tmp/abf/rpmbuild/BUILD/goipp-1.0.0/golang-github-openprinting-goipp-devel.file-list: no such file or directory

This files does exist but %_builddir is duplicated in the path to it.

No I put %gopkgfiles into the end of the spec above instead of its current place. And this error goes away!

I can't understand why this happens...

Comment 1 Maxwell G 2022-02-02 20:29:23 UTC
Your specfile is in the wrong order. `%gopkgfiles` should be at the end of the specfile, as it relies on values that are defined in `%gopkginstall`. You should use go2rpm[2] or consult the examples in the Golang Packaging Guidelines[1] to generate a properly formatted specfile. Besides the misplaced `%gopkgfiles`, there are a couple other problems with your specfile.

[1]: https://docs.fedoraproject.org/en-US/packaging-guidelines/Golang/
[2]: https://pagure.io/GoSIG/go2rpm

Thanks,
Maxwell


Note You need to log in before you can comment on or make changes to this bug.