%files/%doc buildroot path prefixed

Spec and _service files are here Show home:infirit2 / blueman-git - openSUSE Build Service

I am attempting to use obs_scm without any tar or recompress service. I got the build running by running %setupwith the arguments -q -n %_sourcedir/%name-%version -T -D. Now when I want to install files the buildroot is prefixed to the proper file paths for the files listed in %doc. How do I stop the buildroot path being prefixed? Or what I am missing here?

The proper file path for CHANGELOG.md is /home/abuild/rpmbuild/SOURCES/blueman-2.5.git.1750957498.0c9b506d/CHANGELOG.md

[   41s] Executing(%doc): /usr/bin/bash -e /var/tmp/rpm-tmp.1PKaqX
[   41s] + umask 022
[   41s] + cd /home/abuild/rpmbuild/BUILD/blueman-2.5.git.1750957498.0c9b506d-build
[   41s] + cd /home/abuild/rpmbuild/SOURCES/blueman-2.5.git.1750957498.0c9b506d
[   41s] + DOCDIR=/home/abuild/rpmbuild/BUILD/blueman-2.5.git.1750957498.0c9b506d-build/BUILDROOT/usr/share/doc/packages/blueman
[   41s] + export LC_ALL=C.UTF-8
[   41s] + LC_ALL=C.UTF-8
[   41s] + export DOCDIR
[   41s] + /usr/bin/mkdir -p /home/abuild/rpmbuild/BUILD/blueman-2.5.git.1750957498.0c9b506d-build/BUILDROOT/usr/share/doc/packages/blueman
[   41s] + cp -pr /home/abuild/rpmbuild/BUILD/blueman-2.5.git.1750957498.0c9b506d-build/home/abuild/rpmbuild/SOURCES/blueman-2.5.git.1750957498.0c9b506d/CHANGELOG.md /home/abuild/rpmbuild/BUILD/blueman-2.5.git.1750957498.0c9b506d-build/BUILDROOT/usr/share/doc/packages/blueman
[   41s] cp: cannot stat '/home/abuild/rpmbuild/BUILD/blueman-2.5.git.1750957498.0c9b506d-build/home/abuild/rpmbuild/SOURCES/blueman-2.5.git.1750957498.0c9b506d/CHANGELOG.md': No such file or directory

Do not use absolute paths in setup -n. The %_sourcedir expands to the absolute path while argument to the setup -n is expected to be subdirectory of the %_builddir. Building appears to work because rpm basically does

cd %_builddir
cd %buildsubdir

before starting build so you land in the “correct” directory.

[   21s] + cd /home/abuild/rpmbuild/BUILD/blueman-2.5.git.1750957498.0c9b506-build
[   21s] + cd /home/abuild/rpmbuild/BUILD/blueman-2.5.git.1750957498.0c9b506-build
[   21s] + cd /home/abuild/rpmbuild/SOURCES/blueman-2.5.git.1750957498.0c9b506

But %doc macro expects filenames under %_builddir/%buildsubdir and that fails.

You apparently attempt to cheat RPM by building outside of the build directory RPM prepares. I suppose you can pull it off by linking your actual build directory into the correct build directory.

1 Like

This is how the best practices suggest it should be done User Guide | How to integrate external SCM sources. But as I now have experienced this is broken and most likely why most folks on the internet suggest to just have obs generate a tar file and have rpmbuild use that :expressionless:.

Thanks for the explanation why it’s prefixing this path.

I’ve now gone ahead and made obs generate a tar file and now things work as they should. Build Log for Package blueman-git (Project home:infirit2) - openSUSE Build Service

That’s a very good example of “generic documentation which was only tested in some limited use cases”. Sure, this example will work as long as you do not use %doc.

You still may consider filing an RPM issue because the behavior of RPM is not consistent. It really should apply the same rules everywhere or fail the %setup invocation right away if absolute paths are not allowed here.

And raising an issue for the Open Build Service makes sense as well. If _service invocation is intended to replace %setup, it should put sources in the same location as %setup would.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.