Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-51368

rpmbuild fails due to unsupported rpm.isdefined

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Undefined Undefined
    • rhel-9.5
    • rhel-9.5
    • go-rpm-macros
    • None
    • go-rpm-macros-3.6.0-3.el9
    • No
    • None
    • 1
    • rhel-sst-pt-llvm-rust-go
    • ssg_platform_tools
    • 2
    • False
    • Hide

      None

      Show
      None
    • Yes
    • SST LLVM/Rust/Go Sprint 8
    • Unspecified Release Note Type - Unknown
    • None

      Using latest go-rpm-macros-3.6.0-1.el9, rpmbuild fails to parse an example specfile with due to unsupported function rpm.isdefined, added on rpm 4.17:

      [root@ibm-p9z-18-lp11 gobuild-etcd]# cat etcd.spec 
      Name:		etcd
      Version:	3.4.11
      Release:	1%{?dist}
      Summary:	example of gobuild and gotest usage with etcd
      License: 	GPLv2
      
      # variables required for gometa
      %global goipath         go.etcd.io/etcd
      %global forgeurl https://github.com/etcd-io/etcd
      
      # generate a bunch of variables for the package
      %gometa
      
      Source0:        %{gosource}
      
      BuildRequires: go-rpm-macros go-srpm-macros
      
      %description
      Example of %%gobuild and %%gotest usage with etcd
      
      %prep
      # unpack the archive and setup gopath
      # use -k so we don't delete the vendor tree
      %goprep -k
      
      %build
      go env
      go version
      
      go mod vendor
      
      # specify goipath when building
      %gobuild -o %{gobuilddir}/bin/etcd %{goipath}
      %gobuild -o %{gobuilddir}/bin/etcdctl %{goipath}/etcdctl
      
      %install
      install -m 0755 -vd %{buildroot}%{_bindir}
      install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
      
      %check
      # etcd requires ETCD_UNSUPPORTED_ARCH for aarch64 and s390x
      %ifarch aarch64
      export ETCD_UNSUPPORTED_ARCH=arm64
      %endif
      %ifarch s390x
      export ETCD_UNSUPPORTED_ARCH=s390x
      %endif
      pushd "%{gobuilddir}"
      ./bin/etcd --version
      ./bin/etcdctl version
      popd # gobuilddir
      
      export GOPATH=%{gobuilddir}
      %gotest go.etcd.io/etcd
      
      %files
      %{_bindir}/*
      
      %changelog
      * Fri May 17 2024 John Doe <jdoe@example.com> - 3.4.11-1
      - Initial RPM release
      
      [root@ibm-p9z-18-lp11 gobuild-etcd]# rpmbuild -bp etcd.spec 
      error: lua script failed: /usr/lib/rpm//lua/fedora/srpm/go.lua:72: attempt to call a nil value (field 'isdefined')
      [root@ibm-p9z-18-lp11 gobuild-etcd]# rpm -qa rpm go-rpm-macros
      rpm-4.16.1.3-32.el9.ppc64le
      go-rpm-macros-3.6.0-1.el9.ppc64le
      

      This was not reproducible with previous go-rpm-macros-3.2.0-3.el9.

              asaezmor Alejandro Saez Morollon
              rhn-support-emachado Edjunior Machado
              David Benoit David Benoit
              Edjunior Machado Edjunior Machado
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated:
                Resolved: