[Qbs] Qbs and debian packaging

Christian Kandeler christian.kandeler at qt.io
Fri Dec 22 13:15:28 CET 2017


On Fri, 22 Dec 2017 11:01:53 +0000
Wookey <wookey at wookware.org> wrote:

> On 2017-12-21 09:40 +0100, Christian Kandeler wrote:
> > On Thu, 21 Dec 2017 04:35:34 +0000
> > Wookey <wookey at wookware.org> wrote:
> >   
> > > You suggested   
> > > > qbs build --no-install modules.qbs.installRoot:debian/tmp
> > > > qbs install --no-build modules.qbs.installRoot:debian/tmp    
> > > However this breaks the build, because nothing gets installed into debian/tmp.  
> > 
> > Works for me. Which version of qbs is this?  
> 
> 1.8.1

Hm, ok. May just be a bug in that version. 

> One other thing that is an issue for debian:
> 
> qbs clean doesn't actually clean out all it's files, indeed it'll
> create one. It always leaves a $(PWD)/default/default.bg (or whatever
> build-dir name is in use). The debian build notices this new binary
> file added to the source tree and complains. A clean comand is
> supposed to clean out generated files, not generate more :-)
> 
> Is there a way to stop this behaviour?

If it really creates that file, then there was no build directory to begin with (this is an error from 1.10 on, btw). The .bg file is the build graph which contains all the meta data about the project, so it cannot be removed. Compare to "make clean", which does not remove the Makefile either. 
I suppose we could add a "distclean" equivalent, e.g.:
$ qbs clean --wipe # simply removes the build dir

> I am using this command:
> qbs clean --settings-dir /tmp profile:deb qbs-build
> which makes a qbs-build/qbs-build.bg

... if you haven't built the project before in that directory. Otherwise, the file has already existed.

> and also doesn't actually remove all the files in qbs-build. It
> removes the built binaries and the .o files but not the directories
> they were assembled in.

If the directories are empty, they should be removed as well. If that does not happen for you and you can reproduce the behavior with the current release, please file a bug report.

> I have to do an 'rm -r qbs-build' anyway. Does the qbs clean command
> actually do anything else significant (e.g. in the settings dir) or
> should I just skip it and use 'rm -r qbs-build' ?

For your purpose, rm is the right tool. qbs clean is more relevant to the development cycle, where you want to keep the meta data (though it should hardly ever be needed).

> And finally, running tests.
> 
> A debian build runs build-time tests after building, but before installing the
> files into the package location.  
> 
> Should I expect 'qbs run' to run a test program that needs a library,
> after being built, or does it also have to be installed? Qbs knows
> where it built the library, so it seems that it should be able to find
> it, I can't put my own LD_PRELOAD in because Qbs has used some magic
> directory ID to put it in which I don't know. 
> 
> How is this expected to work?

The run command does not currently consider library dependencies (but it will in qbs 1.11). 

> currently my test-case has a product for the library and a
> 'dewalls-test' product for the test binary. But
> 
>         qbs run --settings-dir /tmp --no-build -p dewalls-test \
>            modules.qbs.installRoot:$(PWD)/debian/tmp \
>            project.libDir:lib/$(DEB_HOST_MULTIARCH) \
>            profile:deb qbs-build
> 
> only works if the package is actually installed on the build system,
> otherwise the library is not found:

Right, but setting LD_LIBRARY_PATH to <install root>/lib should do the trick there, I suppose.
Also, since tests are not typically installed, I wonder why they can't simply use rpaths.


Christian



More information about the Qbs mailing list