Gentoo Archives: gentoo-commits

From: Conrad Kostecki <conikost@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/libselinux/files/
Date: Sat, 27 Feb 2021 15:38:10
Message-Id: 1614440114.a9d90852c5246ec40f4c80eb53692ef86cf8063d.conikost@gentoo
1 commit: a9d90852c5246ec40f4c80eb53692ef86cf8063d
2 Author: Michael Mair-Keimberger <mmk <AT> levelnine <DOT> at>
3 AuthorDate: Mon Feb 22 16:35:18 2021 +0000
4 Commit: Conrad Kostecki <conikost <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 27 15:35:14 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a9d90852
7
8 sys-libs/libselinux: remove unused patch(es)
9
10 Closes: https://github.com/gentoo/gentoo/pull/19601
11 Package-Manager: Portage-3.0.14, Repoman-3.0.2
12 Signed-off-by: Michael Mair-Keimberger <mmk <AT> levelnine.at>
13 Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>
14
15 ...Use-Python-distutils-to-install-SELinux-p.patch | 205 ---------------------
16 1 file changed, 205 deletions(-)
17
18 diff --git a/sys-libs/libselinux/files/0001-libselinux-Use-Python-distutils-to-install-SELinux-p.patch b/sys-libs/libselinux/files/0001-libselinux-Use-Python-distutils-to-install-SELinux-p.patch
19 deleted file mode 100644
20 index 896876a00d6..00000000000
21 --- a/sys-libs/libselinux/files/0001-libselinux-Use-Python-distutils-to-install-SELinux-p.patch
22 +++ /dev/null
23 @@ -1,205 +0,0 @@
24 -From 2efa06857575e4118e91ca250b6b92da68b130d5 Mon Sep 17 00:00:00 2001
25 -From: Petr Lautrbach <plautrba@××××××.com>
26 -Date: Fri, 7 Jun 2019 17:35:44 +0200
27 -Subject: [PATCH] libselinux: Use Python distutils to install SELinux python
28 - bindings
29 -
30 -Follow officially documented way how to build C extension modules using
31 -distutils - https://docs.python.org/3.8/extending/building.html#building
32 -
33 -Fixes:
34 -
35 -- selinux python module fails to load when it's built using SWIG-4.0:
36 -
37 ->>> import selinux
38 -Traceback (most recent call last):
39 - File "<stdin>", line 1, in <module>
40 - File "/usr/lib64/python3.7/site-packages/selinux/__init__.py", line 13, in <module>
41 - from . import _selinux
42 -ImportError: cannot import name '_selinux' from 'selinux' (/usr/lib64/python3.7/site-packages/selinux/__init__.py)
43 -
44 -SWIG-4.0 changed (again?) its behavior so that it uses: from . import _selinux
45 -which looks for _selinux module in the same directory as where __init__.py is -
46 -$(PYLIBDIR)/site-packages/selinux. But _selinux module is installed into
47 -$(PYLIBDIR)/site-packages/ since a9604c30a5e2f ("libselinux: Change the location
48 -of _selinux.so").
49 -
50 -- audit2why python module fails to build with Python 3.8
51 -
52 -cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DOVERRIDE_GETTID=0 -I../include -D_GNU_SOURCE -DDISABLE_RPM -DNO_ANDROID_BACKEND -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -L. -shared -o python-3.8audit2why.so python-3.8audit2why.lo -lselinux -l:libsepol.a -Wl,-soname,audit2why.so,--version-script=audit2why.map,-z,defs
53 -/usr/bin/ld: python-3.8audit2why.lo: in function `finish':
54 -/builddir/build/BUILD/libselinux-2.9/src/audit2why.c:166: undefined reference to `PyArg_ParseTuple'
55 -/usr/bin/ld: python-3.8audit2why.lo: in function `_Py_INCREF':
56 -/usr/include/python3.8/object.h:449: undefined reference to `_Py_NoneStruct'
57 -/usr/bin/ld: /usr/include/python3.8/object.h:449: undefined reference to `_Py_NoneStruct'
58 -/usr/bin/ld: python-3.8audit2why.lo: in function `check_booleans':
59 -/builddir/build/BUILD/libselinux-2.9/src/audit2why.c:84: undefined reference to `PyExc_RuntimeError'
60 -...
61 -
62 -It's related to the following Python change
63 -https://docs.python.org/dev/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
64 -
65 -Python distutils adds correct link options automatically.
66 -
67 -- selinux python module doesn't provide any Python metadata
68 -
69 -When selinux python module was built manually, it didn't provide any metadata.
70 -distutils takes care about that so that selinux Python module is visible for
71 -pip:
72 -
73 -$ pip3 list | grep selinux
74 -selinux 2.9
75 -
76 -Signed-off-by: Petr Lautrbach <plautrba@××××××.com>
77 ----
78 - libselinux/src/.gitignore | 2 +-
79 - libselinux/src/Makefile | 36 ++++++++----------------------------
80 - libselinux/src/setup.py | 24 ++++++++++++++++++++++++
81 - 3 files changed, 33 insertions(+), 29 deletions(-)
82 - create mode 100644 libselinux/src/setup.py
83 -
84 -diff --git libselinux/src/.gitignore libselinux/src/.gitignore
85 -index 4dcc3b3b..428afe5a 100644
86 ---- libselinux/src/.gitignore
87 -+++ libselinux/src/.gitignore
88 -@@ -1,4 +1,4 @@
89 - selinux.py
90 --selinuxswig_wrap.c
91 -+selinuxswig_python_wrap.c
92 - selinuxswig_python_exception.i
93 - selinuxswig_ruby_wrap.c
94 -diff --git libselinux/src/Makefile libselinux/src/Makefile
95 -index e9ed0383..2b1696a0 100644
96 ---- libselinux/src/Makefile
97 -+++ libselinux/src/Makefile
98 -@@ -36,7 +36,7 @@ TARGET=libselinux.so
99 - LIBPC=libselinux.pc
100 - SWIGIF= selinuxswig_python.i selinuxswig_python_exception.i
101 - SWIGRUBYIF= selinuxswig_ruby.i
102 --SWIGCOUT= selinuxswig_wrap.c
103 -+SWIGCOUT= selinuxswig_python_wrap.c
104 - SWIGPYOUT= selinux.py
105 - SWIGRUBYCOUT= selinuxswig_ruby_wrap.c
106 - SWIGLOBJ:= $(patsubst %.c,$(PYPREFIX)%.lo,$(SWIGCOUT))
107 -@@ -55,7 +55,7 @@ ifeq ($(LIBSEPOLA),)
108 - LDLIBS_LIBSEPOLA := -l:libsepol.a
109 - endif
110 -
111 --GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) selinuxswig_python_exception.i
112 -+GENERATED=$(SWIGCOUT) $(SWIGRUBYCOUT) $(SWIGCOUT) selinuxswig_python_exception.i
113 - SRCS= $(filter-out $(GENERATED) audit2why.c, $(sort $(wildcard *.c)))
114 -
115 - MAX_STACK_SIZE=32768
116 -@@ -125,25 +125,18 @@ DISABLE_FLAGS+= -DNO_ANDROID_BACKEND
117 - SRCS:= $(filter-out label_backends_android.c, $(SRCS))
118 - endif
119 -
120 --SWIG = swig -Wall -python -o $(SWIGCOUT) -outdir ./ $(DISABLE_FLAGS)
121 --
122 - SWIGRUBY = swig -Wall -ruby -o $(SWIGRUBYCOUT) -outdir ./ $(DISABLE_FLAGS)
123 -
124 - all: $(LIBA) $(LIBSO) $(LIBPC)
125 -
126 --pywrap: all $(SWIGFILES) $(AUDIT2WHYSO)
127 -+pywrap: all selinuxswig_python_exception.i
128 -+ CFLAGS="$(CFLAGS) $(SWIG_CFLAGS)" $(PYTHON) setup.py build_ext -I $(DESTDIR)$(INCLUDEDIR) -L $(DESTDIR)$(LIBDIR)
129 -
130 - rubywrap: all $(SWIGRUBYSO)
131 -
132 --$(SWIGLOBJ): $(SWIGCOUT)
133 -- $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(PYINC) -fPIC -DSHARED -c -o $@ $<
134 --
135 - $(SWIGRUBYLOBJ): $(SWIGRUBYCOUT)
136 - $(CC) $(CFLAGS) $(SWIG_CFLAGS) $(RUBYINC) -fPIC -DSHARED -c -o $@ $<
137 -
138 --$(SWIGSO): $(SWIGLOBJ)
139 -- $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $< -lselinux $(PYLIBS)
140 --
141 - $(SWIGRUBYSO): $(SWIGRUBYLOBJ)
142 - $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(RUBYLIBS)
143 -
144 -@@ -161,29 +154,15 @@ $(LIBPC): $(LIBPC).in ../VERSION
145 - selinuxswig_python_exception.i: ../include/selinux/selinux.h
146 - bash -e exception.sh > $@ || (rm -f $@ ; false)
147 -
148 --$(AUDIT2WHYLOBJ): audit2why.c
149 -- $(CC) $(filter-out -Werror, $(CFLAGS)) $(PYINC) -fPIC -DSHARED -c -o $@ $<
150 --
151 --$(AUDIT2WHYSO): $(AUDIT2WHYLOBJ) $(LIBSEPOLA)
152 -- $(CC) $(CFLAGS) $(LDFLAGS) -L. -shared -o $@ $^ -lselinux $(LDLIBS_LIBSEPOLA) $(PYLIBS) -Wl,-soname,audit2why.so,--version-script=audit2why.map,-z,defs
153 --
154 - %.o: %.c policy.h
155 - $(CC) $(CFLAGS) $(TLSFLAGS) -c -o $@ $<
156 -
157 - %.lo: %.c policy.h
158 - $(CC) $(CFLAGS) -fPIC -DSHARED -c -o $@ $<
159 -
160 --$(SWIGCOUT): $(SWIGIF)
161 -- $(SWIG) $<
162 --
163 --$(SWIGPYOUT): $(SWIGCOUT)
164 --
165 - $(SWIGRUBYCOUT): $(SWIGRUBYIF)
166 - $(SWIGRUBY) $<
167 -
168 --swigify: $(SWIGIF)
169 -- $(SWIG) $<
170 --
171 - install: all
172 - test -d $(DESTDIR)$(LIBDIR) || install -m 755 -d $(DESTDIR)$(LIBDIR)
173 - install -m 644 $(LIBA) $(DESTDIR)$(LIBDIR)
174 -@@ -194,10 +173,9 @@ install: all
175 - ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
176 -
177 - install-pywrap: pywrap
178 -- test -d $(DESTDIR)$(PYTHONLIBDIR)/selinux || install -m 755 -d $(DESTDIR)$(PYTHONLIBDIR)/selinux
179 -- install -m 755 $(SWIGSO) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
180 -- install -m 755 $(AUDIT2WHYSO) $(DESTDIR)$(PYTHONLIBDIR)/selinux/audit2why$(PYCEXT)
181 -+ $(PYTHON) setup.py install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
182 - install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
183 -+ ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
184 -
185 - install-rubywrap: rubywrap
186 - test -d $(DESTDIR)$(RUBYINSTALL) || install -m 755 -d $(DESTDIR)$(RUBYINSTALL)
187 -@@ -208,6 +186,8 @@ relabel:
188 -
189 - clean-pywrap:
190 - -rm -f $(SWIGLOBJ) $(SWIGSO) $(AUDIT2WHYLOBJ) $(AUDIT2WHYSO)
191 -+ $(PYTHON) setup.py clean
192 -+ -rm -rf build *~ \#* *pyc .#*
193 -
194 - clean-rubywrap:
195 - -rm -f $(SWIGRUBYLOBJ) $(SWIGRUBYSO)
196 -diff --git libselinux/src/setup.py libselinux/src/setup.py
197 -new file mode 100644
198 -index 00000000..4dc03f55
199 ---- /dev/null
200 -+++ libselinux/src/setup.py
201 -@@ -0,0 +1,24 @@
202 -+#!/usr/bin/python3
203 -+
204 -+from distutils.core import Extension, setup
205 -+
206 -+setup(
207 -+ name="selinux",
208 -+ version="2.9",
209 -+ description="SELinux python 3 bindings",
210 -+ author="SELinux Project",
211 -+ author_email="selinux@×××××××××××.org",
212 -+ ext_modules=[
213 -+ Extension('selinux._selinux',
214 -+ sources=['selinuxswig_python.i'],
215 -+ include_dirs=['../include'],
216 -+ library_dirs=['.'],
217 -+ libraries=['selinux']),
218 -+ Extension('selinux.audit2why',
219 -+ sources=['audit2why.c'],
220 -+ include_dirs=['../include'],
221 -+ library_dirs=['.'],
222 -+ libraries=['selinux'],
223 -+ extra_link_args=['-l:libsepol.a', '-Wl,--version-script=audit2why.map'])
224 -+ ],
225 -+)
226 ---
227 -2.21.0
228 -