All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libselinux: versioned ruby pkg-config and query vendorarchdir properly
@ 2016-10-02  4:15 Jason Zaman
  2016-10-02  4:15 ` [PATCH 2/2] libselinux: query for python site-packages dir directly Jason Zaman
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Zaman @ 2016-10-02  4:15 UTC (permalink / raw)
  To: selinux

Gentoo and Arch have pkg-config entries for "ruby-$(RUBYLIBVER)" but not
for "ruby". Check if that exists first then fall back to plain ruby if
it does not.

The ruby install paths were incorrect. Fedora 20 installed to
/usr/lib64/ruby/vendor_ruby/, Arch needs it to be vendor_ruby as well,
site_ruby does not work. Thanks to Nicolas Iooss for the correct way to
query for the path.

Signed-off-by: Jason Zaman <jason@perfinion.com>
---
 libselinux/src/Makefile | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 7169230..f9e3de1 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -16,9 +16,8 @@ PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_i
 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
 PYLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
 RUBYLIBVER ?= $(shell $(RUBY) -e 'print RUBY_VERSION.split(".")[0..1].join(".")')
-RUBYPLATFORM ?= $(shell $(RUBY) -e 'print RUBY_PLATFORM')
-RUBYINC ?= $(shell $(PKG_CONFIG) --cflags ruby)
-RUBYINSTALL ?= $(LIBDIR)/ruby/site_ruby/$(RUBYLIBVER)/$(RUBYPLATFORM)
+RUBYINC ?= $(shell $(PKG_CONFIG) --exists ruby-$(RUBYLIBVER) && $(PKG_CONFIG) --cflags ruby-$(RUBYLIBVER) || $(PKG_CONFIG) --cflags ruby)
+RUBYINSTALL ?= $(DESTDIR)$(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
 LIBBASE ?= $(shell basename $(LIBDIR))
 
 VERSION = $(shell cat ../VERSION)
-- 
2.7.3

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

* [PATCH 2/2] libselinux: query for python site-packages dir directly
  2016-10-02  4:15 [PATCH 1/2] libselinux: versioned ruby pkg-config and query vendorarchdir properly Jason Zaman
@ 2016-10-02  4:15 ` Jason Zaman
  2016-10-03 13:35   ` Stephen Smalley
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Zaman @ 2016-10-02  4:15 UTC (permalink / raw)
  To: selinux

instead of building the path manually which is more error prone

Signed-off-by: Jason Zaman <jason@perfinion.com>
---
 libselinux/src/Makefile | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index f9e3de1..13501cd 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -12,9 +12,8 @@ PREFIX ?= $(DESTDIR)/usr
 LIBDIR ?= $(PREFIX)/lib
 SHLIBDIR ?= $(DESTDIR)/lib
 INCLUDEDIR ?= $(PREFIX)/include
-PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])')
 PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
-PYLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
+PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
 RUBYLIBVER ?= $(shell $(RUBY) -e 'print RUBY_VERSION.split(".")[0..1].join(".")')
 RUBYINC ?= $(shell $(PKG_CONFIG) --exists ruby-$(RUBYLIBVER) && $(PKG_CONFIG) --cflags ruby-$(RUBYLIBVER) || $(PKG_CONFIG) --cflags ruby)
 RUBYINSTALL ?= $(DESTDIR)$(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
@@ -160,10 +159,10 @@ install: all
 	ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
 
 install-pywrap: pywrap
-	test -d $(PYLIBDIR)/site-packages/selinux || install -m 755 -d $(PYLIBDIR)/site-packages/selinux
-	install -m 755 $(SWIGSO) $(PYLIBDIR)/site-packages/_selinux.so
-	install -m 755 $(AUDIT2WHYSO) $(PYLIBDIR)/site-packages/selinux/audit2why.so
-	install -m 644 $(SWIGPYOUT) $(PYLIBDIR)/site-packages/selinux/__init__.py
+	test -d $(PYSITEDIR)/selinux || install -m 755 -d $(PYSITEDIR)/selinux
+	install -m 755 $(SWIGSO) $(PYSITEDIR)/_selinux.so
+	install -m 755 $(AUDIT2WHYSO) $(PYSITEDIR)/selinux/audit2why.so
+	install -m 644 $(SWIGPYOUT) $(PYSITEDIR)/selinux/__init__.py
 
 install-rubywrap: rubywrap
 	test -d $(RUBYINSTALL) || install -m 755 -d $(RUBYINSTALL) 
-- 
2.7.3

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

* Re: [PATCH 2/2] libselinux: query for python site-packages dir directly
  2016-10-02  4:15 ` [PATCH 2/2] libselinux: query for python site-packages dir directly Jason Zaman
@ 2016-10-03 13:35   ` Stephen Smalley
  2016-10-03 20:10     ` Nicolas Iooss
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Smalley @ 2016-10-03 13:35 UTC (permalink / raw)
  To: Jason Zaman, selinux

On 10/02/2016 12:15 AM, Jason Zaman wrote:
> instead of building the path manually which is more error prone

Thanks, applied both.  I guess the only question I have is whether a)
this same change ought to be applied to all other Makefiles (e.g.
libsemanage, policycoreutils), and b) could this break any existing
build recipes that relied on setting PYLIBDIR.  Doesn't appear that
Fedora spec files do so, but not sure about other distribution packages.

> 
> Signed-off-by: Jason Zaman <jason@perfinion.com>
> ---
>  libselinux/src/Makefile | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index f9e3de1..13501cd 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -12,9 +12,8 @@ PREFIX ?= $(DESTDIR)/usr
>  LIBDIR ?= $(PREFIX)/lib
>  SHLIBDIR ?= $(DESTDIR)/lib
>  INCLUDEDIR ?= $(PREFIX)/include
> -PYLIBVER ?= $(shell $(PYTHON) -c 'import sys;print("python%d.%d" % sys.version_info[0:2])')
>  PYINC ?= $(shell $(PKG_CONFIG) --cflags $(PYPREFIX))
> -PYLIBDIR ?= $(LIBDIR)/$(PYLIBVER)
> +PYSITEDIR ?= $(DESTDIR)$(shell $(PYTHON) -c 'import site; print(site.getsitepackages()[0])')
>  RUBYLIBVER ?= $(shell $(RUBY) -e 'print RUBY_VERSION.split(".")[0..1].join(".")')
>  RUBYINC ?= $(shell $(PKG_CONFIG) --exists ruby-$(RUBYLIBVER) && $(PKG_CONFIG) --cflags ruby-$(RUBYLIBVER) || $(PKG_CONFIG) --cflags ruby)
>  RUBYINSTALL ?= $(DESTDIR)$(shell $(RUBY) -e 'puts RbConfig::CONFIG["vendorarchdir"]')
> @@ -160,10 +159,10 @@ install: all
>  	ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
>  
>  install-pywrap: pywrap
> -	test -d $(PYLIBDIR)/site-packages/selinux || install -m 755 -d $(PYLIBDIR)/site-packages/selinux
> -	install -m 755 $(SWIGSO) $(PYLIBDIR)/site-packages/_selinux.so
> -	install -m 755 $(AUDIT2WHYSO) $(PYLIBDIR)/site-packages/selinux/audit2why.so
> -	install -m 644 $(SWIGPYOUT) $(PYLIBDIR)/site-packages/selinux/__init__.py
> +	test -d $(PYSITEDIR)/selinux || install -m 755 -d $(PYSITEDIR)/selinux
> +	install -m 755 $(SWIGSO) $(PYSITEDIR)/_selinux.so
> +	install -m 755 $(AUDIT2WHYSO) $(PYSITEDIR)/selinux/audit2why.so
> +	install -m 644 $(SWIGPYOUT) $(PYSITEDIR)/selinux/__init__.py
>  
>  install-rubywrap: rubywrap
>  	test -d $(RUBYINSTALL) || install -m 755 -d $(RUBYINSTALL) 
> 

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

* Re: [PATCH 2/2] libselinux: query for python site-packages dir directly
  2016-10-03 13:35   ` Stephen Smalley
@ 2016-10-03 20:10     ` Nicolas Iooss
  2016-10-04 14:23       ` Stephen Smalley
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Iooss @ 2016-10-03 20:10 UTC (permalink / raw)
  To: Stephen Smalley, Jason Zaman, selinux

On 03/10/16 15:35, Stephen Smalley wrote:
> On 10/02/2016 12:15 AM, Jason Zaman wrote:
>> instead of building the path manually which is more error prone
> 
> Thanks, applied both.  I guess the only question I have is whether a)
> this same change ought to be applied to all other Makefiles (e.g.
> libsemanage, policycoreutils), and b) could this break any existing
> build recipes that relied on setting PYLIBDIR.  Doesn't appear that
> Fedora spec files do so, but not sure about other distribution packages.

For the second question, ArchLinux packages will not break. I quickly
looked at the Debian packages and it appears libselinux is using
PYLIBDIR [1] but not libsemanage [2]. Also the Debian packages appear to
install the Python module into /usr/lib/python.../dist-packages instead
of the site-packages directory. I am wondering whether this may be
important.

Nicolas

[1]
https://anonscm.debian.org/cgit/selinux/libselinux.git/tree/debian/python.mk
[2] https://anonscm.debian.org/cgit/selinux/libsemanage.git/
[3] https://packages.debian.org/sid/amd64/python3-selinux/filelist
[4] https://packages.debian.org/sid/amd64/python3-semanage/filelist

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

* Re: [PATCH 2/2] libselinux: query for python site-packages dir directly
  2016-10-03 20:10     ` Nicolas Iooss
@ 2016-10-04 14:23       ` Stephen Smalley
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Smalley @ 2016-10-04 14:23 UTC (permalink / raw)
  To: Nicolas Iooss, Jason Zaman, selinux, Laurent Bigonville

On 10/03/2016 04:10 PM, Nicolas Iooss wrote:
> On 03/10/16 15:35, Stephen Smalley wrote:
>> On 10/02/2016 12:15 AM, Jason Zaman wrote:
>>> instead of building the path manually which is more error prone
>>
>> Thanks, applied both.  I guess the only question I have is whether a)
>> this same change ought to be applied to all other Makefiles (e.g.
>> libsemanage, policycoreutils), and b) could this break any existing
>> build recipes that relied on setting PYLIBDIR.  Doesn't appear that
>> Fedora spec files do so, but not sure about other distribution packages.
> 
> For the second question, ArchLinux packages will not break. I quickly
> looked at the Debian packages and it appears libselinux is using
> PYLIBDIR [1] but not libsemanage [2]. Also the Debian packages appear to
> install the Python module into /usr/lib/python.../dist-packages instead
> of the site-packages directory. I am wondering whether this may be
> important.
> 
> Nicolas
> 
> [1]
> https://anonscm.debian.org/cgit/selinux/libselinux.git/tree/debian/python.mk
> [2] https://anonscm.debian.org/cgit/selinux/libsemanage.git/
> [3] https://packages.debian.org/sid/amd64/python3-selinux/filelist
> [4] https://packages.debian.org/sid/amd64/python3-semanage/filelist

(cc Debian selinux maintainer)

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

end of thread, other threads:[~2016-10-04 14:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-02  4:15 [PATCH 1/2] libselinux: versioned ruby pkg-config and query vendorarchdir properly Jason Zaman
2016-10-02  4:15 ` [PATCH 2/2] libselinux: query for python site-packages dir directly Jason Zaman
2016-10-03 13:35   ` Stephen Smalley
2016-10-03 20:10     ` Nicolas Iooss
2016-10-04 14:23       ` 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.