autotools with python: how to implement make uninstall
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > autotools with python: how to implement make uninstall




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    autotools with python: how to implement make uninstall  
Uwe Mayer


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-05 12:47 PM

Hi,

Perhaps you could comment on the following solution I picked in combining
Automake and Python to perform a program installation /uninstallation:

I've written a Python application which uses autoconf and automake for
configuring and building the application. However, automake does a poor job
in installing the application to the correct paths, so I added a line to
the install-data-local hook, to call the Python install routine:

install-data-local:
python setup.py install --root=${DESTDIR} --prefix=${prefix}
--record installed_files.log


The --root= is a general prefix, much like "make DESTDIR=tmp install". The
--prefix= is the same as the ./configure --prefix= option

In order to provide an uninstall mechanisme (in which Pyhon does a poor job)
the --record switch logs all installed files (while removing leading "/"!!)

The uninstall-hook looks like this:

-- snip --
DESTDIR=/

uninstall-local:
perl -n -e '$$ENV{DESTDIR} = "/" unless (exists $$ENV{DESTDIR});
print "$$ENV{DESTDIR}$$_"' <installed_files.log| xargs rm
xargs -n 1 dirname <installed_files.log |uniq | PERL -n -e
'$$ENV{DESTDIR} = "/" unless (exists $$ENV{DESTDIR}); print
"$$ENV{DESTDIR}$$_"' | sort -r |xargs rmdir --ignore-fail-on-non-empty
-- snip --

The first line removes all installed files.
The second line recursively tries to remove the directories if they are
empty.
The DESTDIR above is not available as environment variable (to perl) by
default. Only if "make DESTDIR=<path> install"-type is used.
The inline PERL script prepends the value of DESTDIR (or /) to each line in
the installed_files.log file. I don't quite like this solution yet.

Having this: the following works:
$ ./configure
$ make DESTDIR=tmp install
$ make DESTDIR=tmp uninstall

and:
$ ./configure --prefix=/home/foo
$ make install
$ make uninstall

and combinded:
$ ./configure --prefix=/home/foo
$ make DESTDIR=tmp install
$ make DESTDIR=tmp uninstall

Please comment on the portability, stability, or whatever of this solution
and perhaps provide some suggestions how to improve this.

Thanks
Uwe





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:55 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register