[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH XTF] Correct the usage of $(DESTDIR) and $(prefix)



On 21/07/16 11:43, Ian Jackson wrote:
> Andrew Cooper writes ("[PATCH XTF] Correct the usage of $(DESTDIR) and 
> $(prefix)"):
>> The GNU coding standards expect $(DESTDIR) to be the root of everything
>> installed, and for prefix to then be added to the path.  This is not how XTF
>> previously behaved.
>>
>> Replace $(PREFIX) with its more common form $(prefix), and rearange 
>> $(DESTDIR)
>> and $(prefix) to match expectation.
> ...
>> -DESTDIR ?= $(ROOT)/dist
>> -PREFIX ?= $(ROOT)
>> -export DESTDIR PREFIX
>> +# $(prefix) defaults to $(ROOT) so development and testing can be done
>> +# straight out of the working tree
>> +prefix  ?= $(ROOT)
> ...
>> +DEST := $(DESTDIR)$(prefix)
> ...
>> -    @mkdir -p $(DESTDIR)
>> -    $(INSTALL_PROGRAM) -p xtf-runner $(DESTDIR)
>> +    @mkdir -p $(DEST)
>> +    $(INSTALL_PROGRAM) -p xtf-runner $(DEST)
> The effect of this is that
>    make prefix=/usr
> will create
>    /usr/xtf-runner
>    /usr/tests/*/test-info.json
> which is not how things would normally be expected work.

XTF doesn't match any standard installable package.  It is some
configuration files and a load of microkernels which are not system
executables.

I build it with prefix=/opt/xtf as that is the only plausible place for
the results to live, per the FHS.  It could certainly be argued that it
should insert its own xtf/ directory rather than relying on prefix to
pass it.

>
> I think to make this work right, you have to do something like
>
>   ifeq ($prefix,)
>    bindir=$(ROOT)
>    xtflibdir=$(ROOT)
>   else
>    bindir=$(prefix)/bin
>    xtflibdir=$(prefix)/lib/xtf
>   endif
>   xtftestsdir=$(xtflibdir)/tests
>   ...
>         $(INSTALL_PROGRAM) -p xtf-runner $(DESTDIR)/$(bindir)
>   ...
>         $(INSTALL_DATA) -p test-info.json $(DESTDIR)/$(xtftestsdir)/$(NAME)

xtf-runner expects to find tests/ in the same directory it resides in,
because otherwise there is no sensible way to find it.

>
> Also it would be more conventional to use $(INSTALL) -d or
> $(INSTALL_DIR) rather than mkdir.

I will make this change.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.