All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] libselinux: Ignore installed when installing python bindings to DESTDIR
@ 2022-12-22  6:44 Jason Zaman
  2022-12-22  6:44 ` [PATCH 2/2] python: Ignore installed when installing " Jason Zaman
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jason Zaman @ 2022-12-22  6:44 UTC (permalink / raw)
  To: selinux; +Cc: Jason Zaman

When the python bindings are installed to a destdir with pip install
--prefix= --root=, pip tries to uninstall the existing root-owned
package and fails

Fixes:
running build_ext
python3 -m pip install --prefix=/usr `test -n "/tmp/selinux-release//build-master" && echo --root /tmp/selinux-release//build-master`  .
Processing /tmp/selinux-release/selinux-master/libselinux/src
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: selinux
  Building wheel for selinux (setup.py) ... done
  Created wheel for selinux: filename=selinux-3.4-cp310-cp310-linux_x86_64.whl size=725511 sha256=b35e9cdb2a6efce389eeece45446826b4ac6b41f81fdc128893f947036f27e8e
  Stored in directory: /tmp/pip-ephem-wheel-cache-kemjh99e/wheels/ca/2d/1e/d1ab52426d9add92931471cfa0d2558bcbeed89084af2388c9
Successfully built selinux
Installing collected packages: selinux
  Attempting uninstall: selinux
    Found existing installation: selinux 3.4
    Uninstalling selinux-3.4:
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '__init__.cpython-310.pyc'
Consider using the `--user` option or check the permissions.
---
 libselinux/src/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
index 0f6396ab..70ba063a 100644
--- a/libselinux/src/Makefile
+++ b/libselinux/src/Makefile
@@ -187,7 +187,7 @@ install: all
 	ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
 
 install-pywrap: pywrap
-	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) .
+	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
 	install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
 	ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
 
-- 
2.38.2


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

* [PATCH 2/2] python: Ignore installed when installing to DESTDIR
  2022-12-22  6:44 [PATCH 1/2] libselinux: Ignore installed when installing python bindings to DESTDIR Jason Zaman
@ 2022-12-22  6:44 ` Jason Zaman
  2022-12-22  9:09   ` Petr Lautrbach
  2022-12-22  6:54 ` [PATCH 1/2] libselinux: Ignore installed when installing python bindings " Jason Zaman
  2022-12-22  9:09 ` Petr Lautrbach
  2 siblings, 1 reply; 5+ messages in thread
From: Jason Zaman @ 2022-12-22  6:44 UTC (permalink / raw)
  To: selinux; +Cc: Jason Zaman

When installing to a destdir with pip install --prefix= --root=, pip tries to
uninstall the existing root-owned package and fails

Fixes:
python3 -m pip install --prefix=/usr `test -n "/tmp/selinux-release//build-master" && echo --root /tmp/selinux-release//build-master`  .
Processing /tmp/selinux-release/selinux-master/python/sepolicy
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: sepolicy
  Building wheel for sepolicy (setup.py) ... done
  Created wheel for sepolicy: filename=sepolicy-3.4-py3-none-any.whl size=1663564 sha256=229546db123e7d84613d190d49c192291b1a4f7f2a037657b39283b04ac391a4
  Stored in directory: /tmp/pip-ephem-wheel-cache-50r2x4cn/wheels/b2/9e/63/6a6212a84d65a709923228719d065ed34e66a90c7fed01e8cf
Successfully built sepolicy
Installing collected packages: sepolicy
  Attempting uninstall: sepolicy
    Found existing installation: sepolicy 3.4
    Uninstalling sepolicy-3.4:
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: 'generate.py'
Consider using the `--user` option or check the permissions.
---
 python/sepolicy/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/sepolicy/Makefile b/python/sepolicy/Makefile
index 57a2e55e..4e9e93d0 100644
--- a/python/sepolicy/Makefile
+++ b/python/sepolicy/Makefile
@@ -27,7 +27,7 @@ test:
 	@$(PYTHON) test_sepolicy.py -v
 
 install:
-	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) .
+	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
 	[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
 	install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy
 	(cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen)
-- 
2.38.2


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

* Re: [PATCH 1/2] libselinux: Ignore installed when installing python bindings to DESTDIR
  2022-12-22  6:44 [PATCH 1/2] libselinux: Ignore installed when installing python bindings to DESTDIR Jason Zaman
  2022-12-22  6:44 ` [PATCH 2/2] python: Ignore installed when installing " Jason Zaman
@ 2022-12-22  6:54 ` Jason Zaman
  2022-12-22  9:09 ` Petr Lautrbach
  2 siblings, 0 replies; 5+ messages in thread
From: Jason Zaman @ 2022-12-22  6:54 UTC (permalink / raw)
  To: selinux

On Wed, Dec 21, 2022 at 10:44:51PM -0800, Jason Zaman wrote:
> When the python bindings are installed to a destdir with pip install
> --prefix= --root=, pip tries to uninstall the existing root-owned
> package and fails
> 
> Fixes:
> running build_ext
> python3 -m pip install --prefix=/usr `test -n "/tmp/selinux-release//build-master" && echo --root /tmp/selinux-release//build-master`  .
> Processing /tmp/selinux-release/selinux-master/libselinux/src
>   Preparing metadata (setup.py) ... done
> Building wheels for collected packages: selinux
>   Building wheel for selinux (setup.py) ... done
>   Created wheel for selinux: filename=selinux-3.4-cp310-cp310-linux_x86_64.whl size=725511 sha256=b35e9cdb2a6efce389eeece45446826b4ac6b41f81fdc128893f947036f27e8e
>   Stored in directory: /tmp/pip-ephem-wheel-cache-kemjh99e/wheels/ca/2d/1e/d1ab52426d9add92931471cfa0d2558bcbeed89084af2388c9
> Successfully built selinux
> Installing collected packages: selinux
>   Attempting uninstall: selinux
>     Found existing installation: selinux 3.4
>     Uninstalling selinux-3.4:
> ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '__init__.cpython-310.pyc'
> Consider using the `--user` option or check the permissions.
> ---
>  libselinux/src/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index 0f6396ab..70ba063a 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -187,7 +187,7 @@ install: all
>  	ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
>  
>  install-pywrap: pywrap
> -	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) .
> +	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
>  	install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py

I ran into this when preparing the 3.5-rc1 release and testing a full
rebuild.
I also forgot to add my signed-off-by. If someone Ack's this, then I
will update with the ack+SoB and push this when I do the release. :)

Wkr,
Jason

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

* Re: [PATCH 1/2] libselinux: Ignore installed when installing python bindings to DESTDIR
  2022-12-22  6:44 [PATCH 1/2] libselinux: Ignore installed when installing python bindings to DESTDIR Jason Zaman
  2022-12-22  6:44 ` [PATCH 2/2] python: Ignore installed when installing " Jason Zaman
  2022-12-22  6:54 ` [PATCH 1/2] libselinux: Ignore installed when installing python bindings " Jason Zaman
@ 2022-12-22  9:09 ` Petr Lautrbach
  2 siblings, 0 replies; 5+ messages in thread
From: Petr Lautrbach @ 2022-12-22  9:09 UTC (permalink / raw)
  To: Jason Zaman, selinux; +Cc: Jason Zaman

Jason Zaman <jason@perfinion.com> writes:

> When the python bindings are installed to a destdir with pip install
> --prefix= --root=, pip tries to uninstall the existing root-owned
> package and fails
>
> Fixes:
> running build_ext
> python3 -m pip install --prefix=/usr `test -n "/tmp/selinux-release//build-master" && echo --root /tmp/selinux-release//build-master`  .
> Processing /tmp/selinux-release/selinux-master/libselinux/src
>   Preparing metadata (setup.py) ... done
> Building wheels for collected packages: selinux
>   Building wheel for selinux (setup.py) ... done
>   Created wheel for selinux: filename=selinux-3.4-cp310-cp310-linux_x86_64.whl size=725511 sha256=b35e9cdb2a6efce389eeece45446826b4ac6b41f81fdc128893f947036f27e8e
>   Stored in directory: /tmp/pip-ephem-wheel-cache-kemjh99e/wheels/ca/2d/1e/d1ab52426d9add92931471cfa0d2558bcbeed89084af2388c9
> Successfully built selinux
> Installing collected packages: selinux
>   Attempting uninstall: selinux
>     Found existing installation: selinux 3.4
>     Uninstalling selinux-3.4:
> ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: '__init__.cpython-310.pyc'
> Consider using the `--user` option or check the permissions.


Acked-by: Petr Lautrbach <lautrbach@redhat.com>

> ---
>  libselinux/src/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libselinux/src/Makefile b/libselinux/src/Makefile
> index 0f6396ab..70ba063a 100644
> --- a/libselinux/src/Makefile
> +++ b/libselinux/src/Makefile
> @@ -187,7 +187,7 @@ install: all
>  	ln -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
>  
>  install-pywrap: pywrap
> -	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) .
> +	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
>  	install -m 644 $(SWIGPYOUT) $(DESTDIR)$(PYTHONLIBDIR)/selinux/__init__.py
>  	ln -sf --relative $(DESTDIR)$(PYTHONLIBDIR)/selinux/_selinux$(PYCEXT) $(DESTDIR)$(PYTHONLIBDIR)/_selinux$(PYCEXT)
>  
> -- 
> 2.38.2


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

* Re: [PATCH 2/2] python: Ignore installed when installing to DESTDIR
  2022-12-22  6:44 ` [PATCH 2/2] python: Ignore installed when installing " Jason Zaman
@ 2022-12-22  9:09   ` Petr Lautrbach
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Lautrbach @ 2022-12-22  9:09 UTC (permalink / raw)
  To: Jason Zaman, selinux; +Cc: Jason Zaman

Jason Zaman <jason@perfinion.com> writes:

> When installing to a destdir with pip install --prefix= --root=, pip tries to
> uninstall the existing root-owned package and fails
>
> Fixes:
> python3 -m pip install --prefix=/usr `test -n "/tmp/selinux-release//build-master" && echo --root /tmp/selinux-release//build-master`  .
> Processing /tmp/selinux-release/selinux-master/python/sepolicy
>   Preparing metadata (setup.py) ... done
> Building wheels for collected packages: sepolicy
>   Building wheel for sepolicy (setup.py) ... done
>   Created wheel for sepolicy: filename=sepolicy-3.4-py3-none-any.whl size=1663564 sha256=229546db123e7d84613d190d49c192291b1a4f7f2a037657b39283b04ac391a4
>   Stored in directory: /tmp/pip-ephem-wheel-cache-50r2x4cn/wheels/b2/9e/63/6a6212a84d65a709923228719d065ed34e66a90c7fed01e8cf
> Successfully built sepolicy
> Installing collected packages: sepolicy
>   Attempting uninstall: sepolicy
>     Found existing installation: sepolicy 3.4
>     Uninstalling sepolicy-3.4:
> ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: 'generate.py'
> Consider using the `--user` option or check the permissions.


Acked-by: Petr Lautrbach <lautrbach@redhat.com>


> ---
>  python/sepolicy/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/python/sepolicy/Makefile b/python/sepolicy/Makefile
> index 57a2e55e..4e9e93d0 100644
> --- a/python/sepolicy/Makefile
> +++ b/python/sepolicy/Makefile
> @@ -27,7 +27,7 @@ test:
>  	@$(PYTHON) test_sepolicy.py -v
>  
>  install:
> -	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` $(PYTHON_SETUP_ARGS) .
> +	$(PYTHON) -m pip install --prefix=$(PREFIX) `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --ignore-installed --no-deps` $(PYTHON_SETUP_ARGS) .
>  	[ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR)
>  	install -m 755 sepolicy.py $(DESTDIR)$(BINDIR)/sepolicy
>  	(cd $(DESTDIR)$(BINDIR); ln -sf sepolicy sepolgen)
> -- 
> 2.38.2


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

end of thread, other threads:[~2022-12-22  9:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-22  6:44 [PATCH 1/2] libselinux: Ignore installed when installing python bindings to DESTDIR Jason Zaman
2022-12-22  6:44 ` [PATCH 2/2] python: Ignore installed when installing " Jason Zaman
2022-12-22  9:09   ` Petr Lautrbach
2022-12-22  6:54 ` [PATCH 1/2] libselinux: Ignore installed when installing python bindings " Jason Zaman
2022-12-22  9:09 ` Petr Lautrbach

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.