[Scons-users] RPM build errors: File must begin with "/": target2/file1

Dirk Bächle tshortik at gmx.de
Sun Jul 3 11:12:39 EDT 2016


Hello Alejandro,

and thanks for your question about the Install() and Package() methods.

Am 30.06.2016 um 09:55 schrieb Alejandro.Olivares-Marin at t-systems.com:
> Hello everybody,
> I am learning how to build RPMs on Read Hat using SCons but I cannot 
> get a good generated SPECS file for rpmbuild.
> My test is as simple as:
> $ cat SConstruct
> env = Environment(tools=['default', 'packaging'])
> env.Install(directory='~/rpmRepo/tmp', 
> source=['~/rpmRepo/source/file1', '~/source/file2'], 
> target='~/rpmRepo/target')
> env.Package( NAME           = 'foo',
>              VERSION        = '1.2.3',
>              PACKAGEVERSION = 0,
>              PACKAGETYPE    = 'rpm',
>              LICENSE        = 'gpl',
>              SUMMARY        = 'balalalalal',
>              DESCRIPTION    = 'this should be really really long',
>              X_RPM_GROUP    = 'Application/fu',
>              SOURCE_URL     = 'http://foo.org/foo-1.2.3.tar.gz'
>         )

The problem with your current approach is, that the "target" directory 
of your Install() method is located within the folder tree that SCons 
"sees". In other words "~/rpmRepo/target" is a subfolder of "~/rpmRepo" 
where your top-level SConstruct file is.
Like this, SCons will always automatically shorten the path string 
"~/rpmRepo/target/file1" to the relative path "target/file1". This 
doesn't work well with the Package() method of course, as you experienced.
But for packages it is reasonable to expect absolute path specifications 
that follow the basic Unix/Linux conventions and are attached to folders 
like "/usr" or "/bin" which always exist. Your package would definitely 
crash on any other system than your own, because "~/rpmRepo/target" 
wouldn't exist there.

When specifying an absolute path which is outside of the current SCons 
tree, your example works fine. Please find an updated version of your 
SConstruct with my modifications. You have to call it like this:

   scons ~/rpmrepo/target .

Hope this helps you a little further.

Best regards,

Dirk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20160703/6b1c00e7/attachment.html>


More information about the Scons-users mailing list