Author: wade
Date: 2007-07-19 13:52:00 -0400 (Thu, 19 Jul 2007)
New Revision: 82313

Modified:
   trunk/release/packaging/do-msvn-tar
   trunk/release/packaging/mktarball
Log:
do-msvn-tar:
mktarball:
-use ssh key directly instead of relying on bb_ssh
-use build_location instead of hardcoding /tmp,
 it puts everything under /tmp/monobuild



Modified: trunk/release/packaging/do-msvn-tar
===================================================================
--- trunk/release/packaging/do-msvn-tar 2007-07-19 17:49:55 UTC (rev 82312)
+++ trunk/release/packaging/do-msvn-tar 2007-07-19 17:52:00 UTC (rev 82313)
@@ -12,21 +12,16 @@
 
 import packaging
 
-HEAD_or_RELEASE = sys.argv[1]
-package = sys.argv[2]
-version = sys.argv[3]
+(HEAD_or_RELEASE, package, version) = sys.argv[1:]
 
-os.chdir('/tmp')
-
 dummy_env = ""
 package_obj = packaging.package(dummy_env, package, inside_jail=True)
 
-if os.path.exists('tarball-creation'):
-       shutil.rmtree('tarball-creation')
+temp_dir = os.getcwd()
+
 os.mkdir('tarball-creation')
 os.chdir('tarball-creation')
 
-
 # Construct subversion path of location we want to create a tarball from
 svn_paths = []
 if HEAD_or_RELEASE == "HEAD":
@@ -51,7 +46,7 @@
 
 # use the key in /usr/share/ximian-build-system/conf/ssh
 # This needs to be exported to the environment
-SVN_SSH = "/usr/bin/bb_ssh"
+SVN_SSH = "ssh -i %s/distro_source_key" % temp_dir
 SVNEXPORT = "svn export -q " + rev_arg
 MONO_ROOT = " svn+ssh://[EMAIL PROTECTED]/source" 
 SVN_PATHS = ":".join(svn_paths)
@@ -101,20 +96,18 @@
 
 get_source = package_obj.get_info_var('get_source')
 
-# pwd: /tmp/tarball-creation
+# pwd: /tmp/monobuild/tarball-creation
 
 ### Execute the source creating functions ###
-def_file = "/tmp/" + package
+def_file = temp_dir + os.sep + package
 
-# Clean up bb_ssh dirs, otherwise, collisions happen, causing svn commands to 
fail
-os.system("rm -Rf /tmp/bb_ssh*")
-
 # get_source
 if get_source:
        print "Command: %s" % get_source
        os.system(get_source)
 else:
-       cache_dir = "/tmp/src_cache/%s/%s" % (package, HEAD_or_RELEASE)
+       # Put cachedir up one level so it will remain through cleanup
+       cache_dir = os.path.abspath( os.path.join(temp_dir, "..", "src_cache", 
package, HEAD_orRELEASE) )
        for path in svn_paths:
                module = os.path.basename(path)
 
@@ -166,23 +159,17 @@
 ### End of source creating functions ###
 
 ### Finish moving things around
-if os.path.exists('/tmp/built-tarball'):
-       shutil.rmtree('/tmp/built-tarball')
-os.mkdir('/tmp/built-tarball')
+os.mkdir(temp_dir + '/built-tarball')
 
 found_source_file = 0
 source_files = glob.glob('*.zip') + glob.glob('*.tar.gz') + 
glob.glob('*.tar.bz2')
 
 if len(source_files) == 1:
-       os.rename(source_files[0], '/tmp/built-tarball/%s' % source_files[0])
+       os.rename(source_files[0], temp_dir + '/built-tarball/%s' % 
source_files[0])
        found_source_file = 1
        print "print source filename..."
        print source_files[0]
 
-# Clean up
-os.chdir('/tmp')
-shutil.rmtree('tarball-creation')
-
 # Propogate exit code
 if not found_source_file:
        sys.exit(1)

Modified: trunk/release/packaging/mktarball
===================================================================
--- trunk/release/packaging/mktarball   2007-07-19 17:49:55 UTC (rev 82312)
+++ trunk/release/packaging/mktarball   2007-07-19 17:52:00 UTC (rev 82313)
@@ -91,17 +91,24 @@
                repo.add_file(HEAD_or_RELEASE, package, version, "failure")
                sys.exit(3)
 
+temp_dir = conf.env_vars['build_location']
 
+# Clean up
+conf.buildenv.execute_command("rm -Rf %s" % temp_dir)
+
 # Copy some files over and execute!
 # Also copy over def_alias files
-files_to_copy = [ 'do-msvn-tar', 'defs/%s' % package] + 
glob.glob('../pyutils/*.py') 
+files_to_copy = [ 'distro_source_key', 'do-msvn-tar', 'defs/%s' % package] + 
glob.glob('../pyutils/*.py') 
 for f in package_obj.get_aliases():
        files_to_copy += ['defs/' + f ]
-conf.buildenv.copy_to(files_to_copy, '/tmp', mode='scp')
+# This command also creates the dest dir
+conf.buildenv.copy_to(files_to_copy, temp_dir, mode='scp')
 
 log_obj.log("Starting to build source dist...\n")
+# they key needs to be owned by the user so ssh doesn't reject the key
+(status, output) = conf.buildenv.execute_command('chown %s 
%s/distro_source_key' % (conf.info['username'], temp_dir), exec_as_root=1)
 (status, output) = conf.buildenv.execute_command('mount /proc &> /dev/null', 
exec_as_root=1)
-(status, output) = conf.buildenv.execute_command('/tmp/do-msvn-tar %s %s %s' % 
(HEAD_or_RELEASE, package, version) )
+(status, output) = conf.buildenv.execute_command('./do-msvn-tar %s %s %s' % 
(HEAD_or_RELEASE, package, version), working_dir=temp_dir)
 
 if status:
         conf.buildenv.unlock_env()
@@ -114,7 +121,7 @@
 
 # Copy file back
 #  Note: the tarball var is expected to have be in this format, ex:  
mono-1.1.13.4.tar.gz
-conf.buildenv.copy_from('/tmp/built-tarball/%s' % tarball, 
package_obj.source_fullpath)
+conf.buildenv.copy_from('%s/built-tarball/%s' % (temp_dir, tarball), 
package_obj.source_fullpath)
 
 # Keep a map of which params produce which tarball
 repo.add_file(HEAD_or_RELEASE, package, version, package_obj.source_relpath + 
os.sep + tarball)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to