[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] Have unsermake call itself by absolute path
From:       Michael Pyne <pynm0001 () comcast ! net>
Date:       2005-07-31 5:30:03
Message-ID: 200507310130.07496.pynm0001 () comcast ! net
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi all,

Attached is a patch to have unsermake call itself in the generated makefiles 
by absolute path instead of just calling 'unsermake'.  This is for operating 
systems like Kubuntu and Gentoo that install sudo with the --secure-path 
option.

What this means is that if the path to unsermake doesn't appear in the secure 
path whitelist when sudo was compiled, users will be unable to install 
unsermake-based packages by using sudo (which is annoying the hell out of 
me. ;)

The solution is to use the absolute path (which is what kdesvn-build does when 
calling make/unsermake install), but if the Makefiles recursively call make 
or unsermake then that doesn't work.

Anyways, this works by changing 'unsermake' to '$(UNSERMAKE)' in the generated 
Makefiles, and also setting UNSERMAKE = /absolute/path/to/unsermake.

Comments/Suggestions about the "correct" way to go about doing this would be 
appreciated, otherwise I intend to commit in about a day or two.

Regards,
 - Michael Pyne

["absolut-unsermake.patch" (text/x-diff)]

Index: __init__.py
===================================================================
--- __init__.py	(revision 438744)
+++ __init__.py	(working copy)
@@ -984,12 +984,18 @@
 			
 	max_children = max_children + max_compile_jobs
 
+	# Register list of file handlers, as well as setting our_path to the
+	# absolute path to unsermake for instances like sudo with --secure-path.
+	# Assumes that one of the module dirs has the unsermake script.
 	handlers = []
 	for sourcedir in moduledirs:
 		files = os.listdir(sourcedir)
 		for l in files:
 			if l.endswith('.um'):
 				handlers.append(os.path.join(sourcedir, l))
+			if l == 'unsermake':
+				utilities.our_path = sourcedir + '/' + l
+
 	handlers.sort()
 	
 	for file in handlers:
Index: amfile.py
===================================================================
--- amfile.py	(revision 438744)
+++ amfile.py	(working copy)
@@ -888,6 +888,7 @@
 						output.append('%s = @%s@\n' % (var, var))
 			output.append("transform = @program_transform_name@\n")
 			output.append("INSTALL = @INSTALL@\n")
+			output.append("UNSERMAKE = %s\n" % (utilities.our_path))
 			
 		phonies = []
 		keys = self.targets.keys()
@@ -916,7 +917,7 @@
 		output.append(".FORWARDS: " + string.join(forwards) + "\n\n")
 		for key in forwards:
 			output.append("%s:\n\t@echo 'WARNING: use unsermake instead of make or use a \
                wrapper script, e.g. makeobj!!!'\n\t%s %s\n\n" %
-						  (key, utilities.our_path, key))
+						  (key, '$(UNSERMAKE)', key))
 
 		output += targets_output
 		


[Attachment #6 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic