#4 Issues building golang source package on EL7
Closed 4 years ago by nim. Opened 5 years ago by mooz.

I'm trying to build a golang package for EL7 but I'm unable to create a SRPM from a spec file after installing the go RPM macros. I'm receiving the below error:

rpmbuild -bs golang-github-jedisct1-clocksmith.spec                                                                                                                                      
error: Bad file: /home/test/rpmbuild/SOURCES/%{archivename}.%{archiveext}: No such file or directory

RPM build errors:
    Bad file: /home/test/rpmbuild/SOURCES/%{archivename}.%{archiveext}: No such file or directory

I thought maybe the issue was caused by the macros.forge file not being included in the latest EL7 build of redhat-rpm-config (as mentioned at https://fedoraproject.org/wiki/More_Go_packaging#Testing_the_proposal) but trying to copy the file over from a later Fedora release didn't change the behavior.

Not too familiar with the entire process on Go packaging, is there something I'm missing?


It's kind of hard to diagnose without the spec file and build logs, but basically there have been a lot of fixing and rewriting in the months since the wiki page was written. Macro usage is still the same but the code itself has changed and moved a bit.

That means using them on EL7 takes a bit more work than copying a single file.

If you want to play with the code the latest implementation is in this copr. It still needs redhat-rpm-macro changes before merging in fedora-devel but it works and is fully documented here

Pretty much the same code works for EL7, we're using it extensively internally. But the macro packaging is a bit trickier and the current version is not published right now. I can push it to a copr next week if you're interested. More usage and review is always good.

rpmbuild doesn't appear to want to give me any verbosity, I ran it with the --showrc flag and it looks to be stopping at the forgesource if statement below:

-- All the Go packaging automation relies on goipath being set
local goipath = rpm.expand("%{?goipath}")
if (goipath == "") then
  rpm.expand("%{error:Please set the Go import path in the “goipath” variable before calling “gometa”!}")
end
-- Compute and set spec variables
if (forgeurl ~= "") then
  rpm.expand("%forgemeta %{?-v} %{?-i} %{?-s} %{?-p} -u " .. forgeurl .. "\n")
  safeset("gourl", forgeurl)
else
  safeset("gourl", "https://" .. goipath)
  rpm.expand("%forgemeta %{?-v} %{?-i} -s     %{?-p} -u %{gourl}\n")
end
if (rpm.expand("%{?forgesource}") ~= "") then
  safeset("gosource", "%{forgesource}")
else
  safeset("gosource", "%{gourl}/%{archivename}.%{archiveext}")
end
safeset("goname", "%gorpmname %{goipath}")
rpm.define("gosetup %forgesetup")

I'm currently using the specfile from the latest Fedora koji build of golang-github-jedisct1-clocksmith.

I took a look at your patch for redhat-rpm-config and it would seem to patch it against EL7 would need a little work since the patch is primarily against a Fedora build (not sure if that's what you meant by your last paragraph). I wasn't able to build the package in your copr on a mostly stock EL7 rpmbuild environment. But yes, whenever you get the time I'll be happy to test it again later.

Yes that's what I meant by a little tricky. The changes are not big or scary but they are spread over several packages that call one another, it's easier to publish a copr with all the small changes than try to walk you through it manually.

Now the result works as well in EL7 and in devel, there are no backport regressions, but I can't promise it will be in EPEL soonish, it requires a lot of Fedora admin work before that can happen.

Even the Fedora devel part requires buy-in to execute the cleanup plan. Mainly, lots of changes and fixes that accumulated in the last year that need someone to step in to review the result.

So, the whole Go tooling update and cleanup is now finished in rawhide.

The corresponding tooling port to EL7 is here:
https://copr.fedorainfracloud.org/coprs/nim/macros-ng/builds/

(lightly tested, but it should handle all the divergences between rawhide and EL7)

I'm not sure I have enough karma and energy left to get in merged officially EL7-side. The process Fedora-side was already exhausting.

If that's of interest to someone, the maintainers to lobby are the epel-rpm-macro and golang ones.

Closing, since the root cause is actually the same as issue #2

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

4 years ago

Can understand the exhaustion.. thanks for the efforts. Was able to build a source RPM fine after installing the macros.

Login to comment on this ticket.

Metadata