Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: rpmbuild/rpmspec do not expand macros before checking subpackages #672

Closed
eclipseo opened this issue Apr 17, 2019 · 6 comments
Closed

Comments

@eclipseo
Copy link

In Golang packaging (Fedora), the -devel subpackages are computed by a Lua macro called gopkg.

In rpm 4.14.2, if I try to rpmbuild the SPEC containing such macros and a scriptlet, I get:

error: line 41: %pretrans devel -p <lua>
: package golang-github-hashicorp-cleanhttp-devel does not exist

Similarly if I run rpmspec -P on the SPEC, the macros are not expanded:

%description

Convenience utilities for acquiring "clean" http.Transport and http.Client
structs

%gopkg

%prep
%goprep

However in EPEL7, with rpm 4.11.3, it works fine: srpm is built and rpmspec -P expands the macros:

Convenience utilities for acquiring "clean" http.Transport and http.Client
structs



%package     -n golang-github-hashicorp-cleanhttp-devel
Summary:        Convenience utilities for "clean" http.Transport and http.Client structs
BuildRequires:  go-rpm-macros
BuildArch:      noarch

%description -n golang-github-hashicorp-cleanhttp-devel
Convenience utilities for acquiring "clean" http.Transport and http.Client
structs

This package contains the source code needed for building packages that
reference the following Go import paths:
 – github.com/hashicorp/go-cleanhttp





%prep
%setup -q -n go-cleanhttp-0.5.1


rm -fr         "/builddir/build/BUILD/go-cleanhttp-0.5.1/vendor"
if [[ ! -e            "/builddir/build/BUILD/go-cleanhttp-0.5.1/_build/bin" ]] ; then
  install -m 0755 -vd "/builddir/build/BUILD/go-cleanhttp-0.5.1/_build/bin"
  export GOPATH="/builddir/build/BUILD/go-cleanhttp-0.5.1/_build:${GOPATH:+${GOPATH}:}/usr/share/gocode"
fi
if [[ ! -e                      "/builddir/build/BUILD/go-cleanhttp-0.5.1/_build/src/github.com/hashicorp/go-cleanhttp" ]] ; then
  install -m 0755 -vd "$(dirname /builddir/build/BUILD/go-cleanhttp-0.5.1/_build/src/github.com/hashicorp/go-cleanhttp)"
  ln -fs "/builddir/build/BUILD/go-cleanhttp-0.5.1"       "/builddir/build/BUILD/go-cleanhttp-0.5.1/_build/src/github.com/hashicorp/go-cleanhttp"
fi
cd                              "/builddir/build/BUILD/go-cleanhttp-0.5.1/_build/src/github.com/hashicorp/go-cleanhttp"

Something has changed between 4.11.3 and 4.14.2 that makes the macros not being expanded.

@ignatenkobrain
Copy link
Contributor

Can you provide full spec?

@eclipseo
Copy link
Author

eclipseo commented Apr 17, 2019

SPEC will only work with macros-ng enabled and installed:
https://copr.fedorainfracloud.org/coprs/nim/macros-ng/

# Generated by go2rpm
%bcond_without check

# https://github.com/hashicorp/go-cleanhttp
%global goipath         github.com/hashicorp/go-cleanhttp
Version:                0.5.1

%gometa

%global common_description %{expand:
Convenience utilities for acquiring "clean" http.Transport and http.Client
structs}

%global golicenses      LICENSE
%global godocs          README.md

Name:           %{goname}
Release:        2%{?dist}
Summary:        Convenience utilities for "clean" http.Transport and http.Client structs

# Upstream license specification: MPL-2.0
License:        MPLv2.0
URL:            %{gourl}
Source0:        %{gosource}

%description
%{common_description}

%gopkg

%prep
%goprep

%install
%gopkginstall

# Remove in F33
# Remove erroneous glide.lock folder
%pretrans devel -p <lua>
path = "%{gopath}/src/%{goipath}/glide.lock"
st = posix.stat(path)
if st and st.type == "directory" then
  os.remove(path)
end

%if %{with check}
%check
%gocheck
%endif

%gopkgfiles

%changelog
* Wed Apr 17 16:38:07 CEST 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.5.1-2
- Update to new macros

* Sun Mar 24 22:32:06 CET 2019 Robert-André Mauchin <zebob.m@gmail.com> - 0.5.1-1
- Release 0.5.1 (#1690719)

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.13.git5df5ddc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Tue Oct 23 2018 Nicolas Mailhot <nim@fedoraproject.org> - 0-0.12.git5df5ddc
- redhat-rpm-config-123 triggers bugs in gosetup, remove it from Go spec files as it’s just an alias
- https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/RWD5YATAYAFWKIDZBB7EB6N5DAO4ZKFM/

* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.11.git5df5ddc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 12 2018 Jan Chaloupka <jchaloup@redhat.com> - 0-0.10.git5df5ddc
- Upload glide files

* Wed Feb 28 2018 Jan Chaloupka <jchaloup@redhat.com> - 0-0.9.20151022git5df5ddc
- Autogenerate some parts using the new macros

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.8.git5df5ddc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.7.git5df5ddc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.6.git5df5ddc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.5.git5df5ddc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.4.git5df5ddc
- https://fedoraproject.org/wiki/Changes/golang1.7

* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0-0.3.git5df5ddc
- https://fedoraproject.org/wiki/Changes/golang1.6

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0-0.2.git5df5ddc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jan 06 2016 jchaloup <jchaloup@redhat.com> - 0-0.1.git5df5ddc
- First package for Fedora

@eclipseo
Copy link
Author

4.13.0.2 works.

@eclipseo
Copy link
Author

4.14.0 works.

@eclipseo
Copy link
Author

Interestingly rpm 4.14.2.1 works in a F27 chroot I tested, so the issue might come from somewhere else.

@eclipseo
Copy link
Author

I've been very stupid and lost much time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants