uninstall: use --record with setup.py

Submitted by Ruslan Kuprieiev on April 28, 2016, 1:29 p.m.

Details

Message ID 1461850184-11160-1-git-send-email-kupruser@gmail.com
State Rejected
Series "uninstall: use --record with setup.py"
Headers show

Commit Message

Ruslan Kuprieiev April 28, 2016, 1:29 p.m.
--record option allows us to keep track of files that are being
installed by writing them to specified file. We can than use that
file to do proper cleanup on uninstall.

Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
---
 .gitignore   |  1 +
 lib/Makefile | 13 ++++++-------
 2 files changed, 7 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/.gitignore b/.gitignore
index e8c47d5..6136d2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -36,3 +36,4 @@  criu/pie/piegen/piegen
 criu/pie/pie.lds*.S
 criu/protobuf-desc-gen.h
 scripts/build/qemu-user-static/*
+lib/.crit-setup.files
diff --git a/lib/Makefile b/lib/Makefile
index a6ea3f2..1e4857c 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -5,6 +5,10 @@  CRIU_SO			:= libcriu.so
 UAPI_HEADERS		:= c/criu.h ../images/rpc.proto
 
 #
+# File to keep track of files installed by setup.py
+CRIT_SETUP_FILES	:= .crit-setup.files
+
+#
 # C language bindings.
 c/%: ../Makefile.versions
 	$(call msg-gen, $@)
@@ -52,7 +56,7 @@  install: lib-c lib-py ../crit/crit c/criu.pc.in
 	$(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)),' c/criu.pc.in > c/criu.pc
 	$(Q) install -m 644 c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
 	$(E) "  INSTALL " crit
-	$(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
+	$(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX) --record $(CRIT_SETUP_FILES)
 .PHONY: install
 
 uninstall:
@@ -64,10 +68,5 @@  uninstall:
 	$(E) " UNINSTALL" pkgconfig/criu.pc
 	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/pkgconfig/,criu.pc)
 	$(E) " UNINSTALL" crit
-	#
-	# FIXME How to deal with python setup properly?
-	$(Q) $(RM) $(addprefix $(DESTDIR)$(BINDIR)/,crit)
-	$(Q) $(RM) -r $(addprefix $(DESTDIR)$(LIBDIR)/python2.7/site-packages/,pycriu)
-	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/python2.7/site-packages/,crit-0.0.1-py2.7.egg-info)
-#	$(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
+	$(Q) while read -r file; do $(RM) -r "$(DESTDIR)$$file"; done < $(CRIT_SETUP_FILES)
 .PHONY: uninstall

Comments

Cyrill Gorcunov April 28, 2016, 5:04 p.m.
On Thu, Apr 28, 2016 at 04:29:44PM +0300, Ruslan Kuprieiev wrote:
> --record option allows us to keep track of files that are being
> installed by writing them to specified file. We can than use that
> file to do proper cleanup on uninstall.
> 
> Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Dmitry Safonov April 28, 2016, 6:20 p.m.
On 04/28/2016 04:29 PM, Ruslan Kuprieiev wrote:
> --record option allows us to keep track of files that are being
> installed by writing them to specified file. We can than use that
> file to do proper cleanup on uninstall.

Hello Ruslan,

> Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
> ---
>   .gitignore   |  1 +
>   lib/Makefile | 13 ++++++-------
>   2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index e8c47d5..6136d2c 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -36,3 +36,4 @@ criu/pie/piegen/piegen
>   criu/pie/pie.lds*.S
>   criu/protobuf-desc-gen.h
>   scripts/build/qemu-user-static/*
> +lib/.crit-setup.files
> diff --git a/lib/Makefile b/lib/Makefile
> index a6ea3f2..1e4857c 100644
> --- a/lib/Makefile
> +++ b/lib/Makefile
> @@ -5,6 +5,10 @@ CRIU_SO			:= libcriu.so
>   UAPI_HEADERS		:= c/criu.h ../images/rpc.proto
>   
>   #
> +# File to keep track of files installed by setup.py
> +CRIT_SETUP_FILES	:= .crit-setup.files
> +
> +#
>   # C language bindings.
>   c/%: ../Makefile.versions
>   	$(call msg-gen, $@)
> @@ -52,7 +56,7 @@ install: lib-c lib-py ../crit/crit c/criu.pc.in
>   	$(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)),' c/criu.pc.in > c/criu.pc
>   	$(Q) install -m 644 c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
>   	$(E) "  INSTALL " crit
> -	$(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
> +	$(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX) --record $(CRIT_SETUP_FILES)
>   .PHONY: install
>   
>   uninstall:
> @@ -64,10 +68,5 @@ uninstall:
>   	$(E) " UNINSTALL" pkgconfig/criu.pc
>   	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/pkgconfig/,criu.pc)
>   	$(E) " UNINSTALL" crit
> -	#
> -	# FIXME How to deal with python setup properly?
> -	$(Q) $(RM) $(addprefix $(DESTDIR)$(BINDIR)/,crit)
> -	$(Q) $(RM) -r $(addprefix $(DESTDIR)$(LIBDIR)/python2.7/site-packages/,pycriu)
> -	$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/python2.7/site-packages/,crit-0.0.1-py2.7.egg-info)
> -#	$(Q) python ../scripts/crit-setup.py install --root=$(DESTDIR) --prefix=$(PREFIX)
> +	$(Q) while read -r file; do $(RM) -r "$(DESTDIR)$$file"; done < $(CRIT_SETUP_FILES)

I'm a little worried about that rm -r stuff.
Why it's needed here?
I would prefer to use rm without `-r' flag
even if we create folders on install.
Or treat folders some special way with rmdir.

>   .PHONY: uninstall