Build works locally but not in copr no target or makefile found

Hi,
I have a non standard package that untars to the current directory. Otherwise the build is a very simple make, then make install. This works fine locally. I have also build with mock and this also suceeds. In my spec file I have:

%prep
%setup -c

%build
make

%install
%make_install

My local log has this at the build phase:

+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.rRXlL2
+ umask 022
+ cd /home/bkelly/rpmbuild/BUILD
+ cd sommelier-0.20
+ make
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
wayland-scanner client-header < xdg-shell-unstable-v6.xml > xdg-shell-unstable-v6-client-protocol.h
wayland-scanner server-header < xdg-shell-unstable-v6.xml > xdg-shell-unstable-v6-server-protocol.h

But in copr it fails with:

-rw-rw-r-- mockbuilder/mockbuilder    307 2019-07-16 11:17 sommelier-0.20/sommelier-x@.service.in
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.tVSiiI
+ umask 022
+ cd /builddir/build/BUILD
+ cd sommelier-0.20
+ make
make: *** No targets specified and no makefile found.  Stop.
error: Bad exit status from /var/tmp/rpm-tmp.tVSiiI (%build)

Thanks for any suggestions.

I know it’s been a month, but…

Given the git mentions, I’m guessing something in the extracted directory uses network access to retrieve additional files, or something like that. In a copr build environment that won’t be allowed.

Best thing to do would be to test locally in mock, which emulates the build server environment. Install mock and have it build from your SRPM with mock --rebuild package-ver.srpm to test in a sandboxed build environment.

You can use mock --shell to explore the sandbox, your build files will be in /builddir/build/BUILD just like in copr.

What happens if you create an empty Git repository? Will the local build fail as well?

%build
git init
git commit -m X --allow-empty
make

If yes, then something in the build system reacts to the presence of the fake Git repository created by COPR.