Skip to contentSkip to conversation

Fix consistency of PYTHONLIBDIR variable

PATCH In review [email protected] 2 participants 4 messages Jun 26, 2017 – Jun 28, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix consistency of PYTHONLIBDIR variable

From: Laurent Bigonville <[email protected]>

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(-)
python/semanage/Makefile +4 -4
index 60c36a3a..132162bc 100644
@@ -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
 
Signature · 1 line
2.13.1
#1 lore raw
Quoted 7 lines · On Mon, 2017-06-26 at 18:46 +0200, [email protected] wrote:

From: Laurent Bigonville <[email protected]>

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.

Quoted 35 lines

---
 python/semanage/Makefile | 8 ++++----

 1 file changed, 4 insertions(+), 4 deletions(-)
python/semanage/Makefile +0 -0
index 60c36a3a..132162bc 100644
@@ -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])')

python/semanage/Makefile +1 -1
-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

python/semanage/Makefile +0 -0
@@ -20,8 +20,8 @@ install: all
  	-mkdir -p $(SBINDIR)
  	install -m 755 semanage $(SBINDIR)

  install -m 644 *.8 $(MANDIR)/man8

python/semanage/Makefile +0 -1
-	test -d $(PYTHONLIBDIR)/site-packages || install -m 755 -d

$(PYTHONLIBDIR)/site-packages

python/semanage/Makefile +2 -1
-	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 lore raw
Quoted 17 lines · Stephen Smalley
Quoted 7 lines · On Mon, 2017-06-26 at 18:46 +0200, [email protected] wrote:

From: Laurent Bigonville <[email protected]>

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.

Quoted 4 lines

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

Quoted 36 lines
Quoted 36 lines
---
  python/semanage/Makefile | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
python/semanage/Makefile +2 -2
index 60c36a3a..132162bc 100644
@@ -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

python/semanage/Makefile +0 -1
@@ -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

python/semanage/Makefile +2 -1
-	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

#3 lore raw
Quoted 31 lines · Laurent Bigonville
Quoted 19 lines · Stephen Smalley
Quoted 7 lines · On Mon, 2017-06-26 at 18:46 +0200, [email protected] wrote:

From: Laurent Bigonville <[email protected]>

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.

Quoted 5 lines

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>.

Quoted 6 lines

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.

Quoted 39 lines
Quoted 39 lines
Quoted 39 lines

---
  python/semanage/Makefile | 8 ++++----

  1 file changed, 4 insertions(+), 4 deletions(-)
python/semanage/Makefile +0 -0
index 60c36a3a..132162bc 100644
@@ -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])')

python/semanage/Makefile +1 -1
-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

python/semanage/Makefile +0 -0
@@ -20,8 +20,8 @@ install: all
   	-mkdir -p $(SBINDIR)
   	install -m 755 semanage $(SBINDIR)

   install -m 644 *.8 $(MANDIR)/man8

python/semanage/Makefile +0 -2
-	test -d $(PYTHONLIBDIR)/site-packages || install -m 755
-d

$(PYTHONLIBDIR)/site-packages

python/semanage/Makefile +2 -1
-	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