All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix consistency of PYTHONLIBDIR variable
@ 2017-06-26 16:46 bigon
  2017-06-26 19:37 ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: bigon @ 2017-06-26 16:46 UTC (permalink / raw)
  To: selinux

From: Laurent Bigonville <bigon@bigon.be>

PYTHONLIBDIR is currently not consistant, at one place it's influanced
by DESTDIR an at another one it's not.

Fix this and make it consistant
---
 python/semanage/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/python/semanage/Makefile b/python/semanage/Makefile
index 60c36a3a..132162bc 100644
--- a/python/semanage/Makefile
+++ b/python/semanage/Makefile
@@ -5,8 +5,8 @@ PREFIX ?= $(DESTDIR)/usr
 LIBDIR ?= $(PREFIX)/lib
 SBINDIR ?= $(PREFIX)/sbin
 MANDIR = $(PREFIX)/share/man
-PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])')
-PYTHONLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
+PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig import *; print(get_python_lib(1))")
+PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)
 BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-completion/completions
 
 TARGETS=semanage
@@ -20,8 +20,8 @@ install: all
 	-mkdir -p $(SBINDIR)
 	install -m 755 semanage $(SBINDIR)
 	install -m 644 *.8 $(MANDIR)/man8
-	test -d $(PYTHONLIBDIR)/site-packages || install -m 755 -d $(PYTHONLIBDIR)/site-packages
-	install -m 755 seobject.py $(PYTHONLIBDIR)/site-packages
+	test -d $(PACKAGEDIR) || install -m 755 -d $(PACKAGEDIR)
+	install -m 755 seobject.py $(PACKAGEDIR)
 	-mkdir -p $(BASHCOMPLETIONDIR)
 	install -m 644 $(BASHCOMPLETIONS) $(BASHCOMPLETIONDIR)/semanage
 
-- 
2.13.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix consistency of PYTHONLIBDIR variable
  2017-06-26 16:46 [PATCH] Fix consistency of PYTHONLIBDIR variable bigon
@ 2017-06-26 19:37 ` Stephen Smalley
  2017-06-26 21:58   ` Laurent Bigonville
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Smalley @ 2017-06-26 19:37 UTC (permalink / raw)
  To: bigon, selinux

On Mon, 2017-06-26 at 18:46 +0200, bigon@debian.org wrote:
> From: Laurent Bigonville <bigon@bigon.be>
> 
> PYTHONLIBDIR is currently not consistant, at one place it's
> influanced
> by DESTDIR an at another one it's not.
> 
> Fix this and make it consistant

Seems like it is influenced by DESTDIR before and after this change
(before, PYTHONLIBDIR is defined relative to LIBDIR which is defined
relative to PREFIX which is define relative to DESTDIR).

If I do a make DESTDIR=/path/to/foo install before and after this
change (with an empty /path/to/foo before each run), the only
difference is that it moves from $(DESTDIR)/usr/lib/pythonM.N/site-
packages to $(DESTDIR)/usr/lib64/pythonM.N/site-packages.

This makes it consistent with sepolgen but inconsistent with sepolicy,
which is installed to usr/lib, not usr/lib64.

So, I'm unclear on whether this is an improvement.

> ---
>  python/semanage/Makefile | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/python/semanage/Makefile b/python/semanage/Makefile
> index 60c36a3a..132162bc 100644
> --- a/python/semanage/Makefile
> +++ b/python/semanage/Makefile
> @@ -5,8 +5,8 @@ PREFIX ?= $(DESTDIR)/usr
>  LIBDIR ?= $(PREFIX)/lib
>  SBINDIR ?= $(PREFIX)/sbin
>  MANDIR = $(PREFIX)/share/man
> -PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" %
> sys.version_info[0:2])')
> -PYTHONLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
> +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig
> import *; print(get_python_lib(1))")
> +PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)
>  BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-
> completion/completions
>  
>  TARGETS=semanage
> @@ -20,8 +20,8 @@ install: all
>  	-mkdir -p $(SBINDIR)
>  	install -m 755 semanage $(SBINDIR)
>  	install -m 644 *.8 $(MANDIR)/man8
> -	test -d $(PYTHONLIBDIR)/site-packages || install -m 755 -d
> $(PYTHONLIBDIR)/site-packages
> -	install -m 755 seobject.py $(PYTHONLIBDIR)/site-packages
> +	test -d $(PACKAGEDIR) || install -m 755 -d $(PACKAGEDIR)
> +	install -m 755 seobject.py $(PACKAGEDIR)
>  	-mkdir -p $(BASHCOMPLETIONDIR)
>  	install -m 644 $(BASHCOMPLETIONS)
> $(BASHCOMPLETIONDIR)/semanage
>  

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix consistency of PYTHONLIBDIR variable
  2017-06-26 19:37 ` Stephen Smalley
@ 2017-06-26 21:58   ` Laurent Bigonville
  2017-06-28 13:22     ` Stephen Smalley
  0 siblings, 1 reply; 4+ messages in thread
From: Laurent Bigonville @ 2017-06-26 21:58 UTC (permalink / raw)
  To: Stephen Smalley, selinux

Le 26/06/17 à 21:37, Stephen Smalley a écrit :
> On Mon, 2017-06-26 at 18:46 +0200, bigon@debian.org wrote:
>> From: Laurent Bigonville <bigon@bigon.be>
>>
>> PYTHONLIBDIR is currently not consistant, at one place it's
>> influanced
>> by DESTDIR an at another one it's not.
>>
>> Fix this and make it consistant
> Seems like it is influenced by DESTDIR before and after this change
> (before, PYTHONLIBDIR is defined relative to LIBDIR which is defined
> relative to PREFIX which is define relative to DESTDIR).
>
> If I do a make DESTDIR=/path/to/foo install before and after this
> change (with an empty /path/to/foo before each run), the only
> difference is that it moves from $(DESTDIR)/usr/lib/pythonM.N/site-
> packages to $(DESTDIR)/usr/lib64/pythonM.N/site-packages.
>
> This makes it consistent with sepolgen but inconsistent with sepolicy,
> which is installed to usr/lib, not usr/lib64.
>
> So, I'm unclear on whether this is an improvement.

With the debian build system, LIBDIR is set to 
$(DESTDIR)/usr/lib/<arch-triplet> this means that PYTHONLIBDIR will end 
up as $(DESTDIR)/usr/lib/<arch-triplet>/python/<version>.

If I override PYTHONLIBDIR to $(DESTDIR)/usr/lib/python/<version> I ends 
up with sepolicy being installed in 
$(DESTDIR)/$(DESTDIR)/usr/lib/<arch-triplet>/python/<version> which is 
not what I want either

>
>> ---
>>   python/semanage/Makefile | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/python/semanage/Makefile b/python/semanage/Makefile
>> index 60c36a3a..132162bc 100644
>> --- a/python/semanage/Makefile
>> +++ b/python/semanage/Makefile
>> @@ -5,8 +5,8 @@ PREFIX ?= $(DESTDIR)/usr
>>   LIBDIR ?= $(PREFIX)/lib
>>   SBINDIR ?= $(PREFIX)/sbin
>>   MANDIR = $(PREFIX)/share/man
>> -PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" %
>> sys.version_info[0:2])')
>> -PYTHONLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
>> +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig
>> import *; print(get_python_lib(1))")
>> +PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)
>>   BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-
>> completion/completions
>>   
>>   TARGETS=semanage
>> @@ -20,8 +20,8 @@ install: all
>>   	-mkdir -p $(SBINDIR)
>>   	install -m 755 semanage $(SBINDIR)
>>   	install -m 644 *.8 $(MANDIR)/man8
>> -	test -d $(PYTHONLIBDIR)/site-packages || install -m 755 -d
>> $(PYTHONLIBDIR)/site-packages
>> -	install -m 755 seobject.py $(PYTHONLIBDIR)/site-packages
>> +	test -d $(PACKAGEDIR) || install -m 755 -d $(PACKAGEDIR)
>> +	install -m 755 seobject.py $(PACKAGEDIR)
>>   	-mkdir -p $(BASHCOMPLETIONDIR)
>>   	install -m 644 $(BASHCOMPLETIONS)
>> $(BASHCOMPLETIONDIR)/semanage
>>   

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix consistency of PYTHONLIBDIR variable
  2017-06-26 21:58   ` Laurent Bigonville
@ 2017-06-28 13:22     ` Stephen Smalley
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Smalley @ 2017-06-28 13:22 UTC (permalink / raw)
  To: Laurent Bigonville, selinux

On Mon, 2017-06-26 at 23:58 +0200, Laurent Bigonville wrote:
> Le 26/06/17 à 21:37, Stephen Smalley a écrit :
> > On Mon, 2017-06-26 at 18:46 +0200, bigon@debian.org wrote:
> > > From: Laurent Bigonville <bigon@bigon.be>
> > > 
> > > PYTHONLIBDIR is currently not consistant, at one place it's
> > > influanced
> > > by DESTDIR an at another one it's not.
> > > 
> > > Fix this and make it consistant
> > 
> > Seems like it is influenced by DESTDIR before and after this change
> > (before, PYTHONLIBDIR is defined relative to LIBDIR which is
> > defined
> > relative to PREFIX which is define relative to DESTDIR).
> > 
> > If I do a make DESTDIR=/path/to/foo install before and after this
> > change (with an empty /path/to/foo before each run), the only
> > difference is that it moves from $(DESTDIR)/usr/lib/pythonM.N/site-
> > packages to $(DESTDIR)/usr/lib64/pythonM.N/site-packages.
> > 
> > This makes it consistent with sepolgen but inconsistent with
> > sepolicy,
> > which is installed to usr/lib, not usr/lib64.
> > 
> > So, I'm unclear on whether this is an improvement.
> 
> With the debian build system, LIBDIR is set to 
> $(DESTDIR)/usr/lib/<arch-triplet> this means that PYTHONLIBDIR will
> end 
> up as $(DESTDIR)/usr/lib/<arch-triplet>/python/<version>.
> 
> If I override PYTHONLIBDIR to $(DESTDIR)/usr/lib/python/<version> I
> ends 
> up with sepolicy being installed in 
> $(DESTDIR)/$(DESTDIR)/usr/lib/<arch-triplet>/python/<version> which
> is 
> not what I want either

Ok, if you really want this change, please re-submit with a Signed-off-
by line.

> 
> > 
> > > ---
> > >   python/semanage/Makefile | 8 ++++----
> > >   1 file changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/python/semanage/Makefile b/python/semanage/Makefile
> > > index 60c36a3a..132162bc 100644
> > > --- a/python/semanage/Makefile
> > > +++ b/python/semanage/Makefile
> > > @@ -5,8 +5,8 @@ PREFIX ?= $(DESTDIR)/usr
> > >   LIBDIR ?= $(PREFIX)/lib
> > >   SBINDIR ?= $(PREFIX)/sbin
> > >   MANDIR = $(PREFIX)/share/man
> > > -PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d"
> > > %
> > > sys.version_info[0:2])')
> > > -PYTHONLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
> > > +PYTHONLIBDIR ?= $(shell $(PYTHON) -c "from distutils.sysconfig
> > > import *; print(get_python_lib(1))")
> > > +PACKAGEDIR ?= $(DESTDIR)/$(PYTHONLIBDIR)
> > >   BASHCOMPLETIONDIR ?= $(DESTDIR)/usr/share/bash-
> > > completion/completions
> > >   
> > >   TARGETS=semanage
> > > @@ -20,8 +20,8 @@ install: all
> > >   	-mkdir -p $(SBINDIR)
> > >   	install -m 755 semanage $(SBINDIR)
> > >   	install -m 644 *.8 $(MANDIR)/man8
> > > -	test -d $(PYTHONLIBDIR)/site-packages || install -m 755
> > > -d
> > > $(PYTHONLIBDIR)/site-packages
> > > -	install -m 755 seobject.py $(PYTHONLIBDIR)/site-packages
> > > +	test -d $(PACKAGEDIR) || install -m 755 -d $(PACKAGEDIR)
> > > +	install -m 755 seobject.py $(PACKAGEDIR)
> > >   	-mkdir -p $(BASHCOMPLETIONDIR)
> > >   	install -m 644 $(BASHCOMPLETIONS)
> > > $(BASHCOMPLETIONDIR)/semanage
> > >   

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-28 13:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26 16:46 [PATCH] Fix consistency of PYTHONLIBDIR variable bigon
2017-06-26 19:37 ` Stephen Smalley
2017-06-26 21:58   ` Laurent Bigonville
2017-06-28 13:22     ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.