Mailinglist Archive: opensuse-packaging (129 mails)

< Previous Next >
Re: [opensuse-packaging] 'osc build' fails @ RPM error: "file not found". spec file's BuildRoot:/%{buildroot} ignored, files instead installed under 'build-root' from ~/.oscrc.


On Sun, Apr 26, 2015, at 05:28 AM, Jan Engelhardt wrote:

Subject : Re: [opensuse-packaging] 'osc build' fails @ RPM error: "file not
found". spec file's BuildRoot:/%{buildroot} ignored, files
instead installed under 'build-root' from ~/.oscrc.

Yes, the spec file BuildRoot is ignored in modern RPM - rpm will
use a sane default so you don't have to.

Secondly, buildroot inside ~/.oscrc specifies the chroot osc will use,
not the rpm-level "BuildRoot". That will be in addition.

Thanks for the hints. It clarified chroot. The 'file not found' issue, for
me, remains.

Apparently

@.spec "BuildRoot" -> unused
@.oscrc "build-root" != rpm-level "BuildRoot"
@.oscrc "build-root" == OSC chroot dir

Parameter naming used could certainly be less confusing ...

The default in ~/.oscrc

#build-root = /var/tmp/build-root/%(repo)s-%(arch)s

is easily modified, and, as mentioned, correctly defines the chroot location.;
nothing in the ./<package>.spec affects the chroot.

Thanks, that clears that up.

As for the actual BuildRoot ...

The docs at

https://en.opensuse.org/openSUSE:Specfile_guidelines
...
Metadata Tags
The BuildRoot tag should always be used, even if newer
rpms override it anyway. The preferred path is
%{_tmppath}/%{name}-%{version}-build.
...

hint at the possibility of rpm override. Also raises the question of why it
"always" needs to be added if it's completely overridden & ignored.

Removing

BuildRoot: ...

from the <package>.spec results in NO error or warning on exec of 'osc build
...'

I've now setup my local osc env as

obs workspace: /usr/local/src/obs_workspace
@ ~/.oscrc
build-root = /usr/local/src/obs_workspace/build-chroot/%(package)s
packagecachedir = /usr/local/src/obs_workspace/build-packagecache

With that, the package I'm working on is found @

/usr/local/src/obs_workspace/home:pgnd:pgnd-stack/cryptodev-linux
cryptodev-linux-1428749261.da73010.tar.gz
cryptodev-linux.spec
_service

Exec of 'osc build ...' now reports

[ 0s] Using
BUILD_ROOT=/usr/local/src/obs_workspace/build-chroot//usr/local/src/obs_workspace/home:pgnd:pgnd-stack/cryptodev-linux/cryptodev-linux

It appears %(package)s expands as

/path/to/obs/workspace/home:<user>:<project>/<package>/<package>

(1) "<package>/<package>" seems wrong
(2) The prepended '/path/to/obs/workspace' seems completely unncessary

I'd hope %(package)s would expand simply as

<package>

so that, as provided as example in ~/.oscrc, the form

/srv/oscbuild/%(repo)s-%(arch)s-%(project)s-%(package)s

would NOT expand to

[ 0s] Using BUILD_ROOT=

/usr/local/src/obs_workspace/build-chroot/openSUSE_13.2-x86_64-home:pgnd:pgnd-stack-/usr/local/src/obs_workspace/home:pgnd:pgnd-stack/cryptodev-linux/cryptodev-linux

but to a more sane


/usr/local/src/obs_workspace/build-chroot/openSUSE_13.2-x86_64-home:pgnd:pgnd-stack-cryptodev-linux

Simply avoiding that confusion for the moment, ~/.oscrc

- build-root = /usr/local/src/obs_workspace/build-chroot/%(package)s
+ build-root = /usr/local/src/obs_workspace/build-chroot/%(project)s

returns

[ 0s] Using BUILD_ROOT=
/usr/local/src/obs_workspace/build-chroot/home:pgnd:pgnd-stack

which is more manageable. That's sorted, for now.

With the setup above, and a .spec, unchanged from above, of

%prep
%setup -q -n %{name}-%{version}
make clean

%build
gcc -v
export CXXFLAGS+=" -std=c++11"
make V=1 %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root)
/usr/include/crypto/cryptodev.h

exec of 'osc build ...' fails

...
[ 47s] Processing files: cryptodev-linux-1428749261.da73010-0.x86_64
[ 47s] error: File not found:
/usr/src/packages/BUILDROOT/cryptodev-linux-1428749261.da73010-0.x86_64/usr/include/crypto/cryptodev.h
[ 47s]
[ 47s]
[ 47s] RPM build errors:
[ 47s] File not found:
/usr/src/packages/BUILDROOT/cryptodev-linux-1428749261.da73010-0.x86_64/usr/include/crypto/cryptodev.h

The buildroot was:
/usr/local/src/obs_workspace/build-chroot/home:pgnd:pgnd-stack

This error appears INsensitive to 'make DESTDIR=...' above. If

- make DESTDIR=%{buildroot} install
+ make install

exec still fails with the identical

[ 42s] Processing files: cryptodev-linux-1428749261.da73010-0.x86_64
[ 42s] error: File not found:
/usr/src/packages/BUILDROOT/cryptodev-linux-1428749261.da73010-0.x86_64/usr/include/crypto/cryptodev.h
[ 42s]
[ 42s]
[ 42s] RPM build errors:
[ 42s] File not found:
/usr/src/packages/BUILDROOT/cryptodev-linux-1428749261.da73010-0.x86_64/usr/include/crypto/cryptodev.h

The buildroot was:
/usr/local/src/obs_workspace/build-chroot/home:pgnd:pgnd-stack

The OP'd question remains,

(1) What in the spec file needs to change so that the build process finds the
built file in the correct buildroot?
--
To unsubscribe, e-mail: opensuse-packaging+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: opensuse-packaging+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups
References