[cmake-developers] [CPack] CPackDeb and fakeroot

Eric Noulard eric.noulard at gmail.com
Tue Aug 25 18:45:00 EDT 2015


2015-08-25 23:52 GMT+02:00 Raffi Enficiaud <raffi.enficiaud at mines-paris.org>
:

> Le 25/08/15 16:48, Eric Noulard a écrit :
>
>> I would suggest checking (in CPackDeb generator code) whether if CPack
>> has been called in a fakerootED environment. This can be done by
>> checking whether if "FAKEROOTKEY" env var is defined or not.
>> If fakeroot is already in action then one should not call fakeroot again
>> (whatever the fakerootED user is).
>>
>
> Hmmm, unfortunately it does not work. This variable does not exist on the
> fakerooted shell. I think there is no "good" way to detect that we are in a
> fakerooted environment because their purpose is to mimic the commands as if
> the real root user is entering them (and introspection should not be
> possible by design).
>

You are right the design of fakeroot is to mimic...

I tested it using

 erk at capitaine:tmp$ fakeroot bash
root at capitaine:tmp# echo $FAKEROOTKEY
489393277

but it does not seem to be set when fakerooting a simple command (outside a
shell).


> I see two technical solutions:
> - either using the system tar: this would not work in the case of cross
> compilation (and in some circumstances only) but would work in the other
> case. I believe that all the debian packaging tools are just using the
> system provided tar, so this should closely mimic the debian-packaging
> machinery better,
>

Cross-compiling is one thing, cross packaging is another.
I think trying to cross-package is a very hard task (unless you simply
create a bare archive (tar, zip, etc...)

- or using a CPACK variable to avoid having fakeroot executed
>

seems awkward to disable black magic with another black magic spell.


>
> I see several workarounds/hacks:
> - executing with fakeroot in cpack first and in case of failure falling
> back to run tar without fakeroot
> - detect if the current user is root already
>

Detecting if user is already root doesn't seems to be such a big hack
it should even be robust as well and should be a 2 line modfication
in CPackDeb.cmake protecting it even detecting FAKEROOT alltogether.


-- 
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150826/b5100ef9/attachment-0001.html>


More information about the cmake-developers mailing list