Author: wade
Date: 2006-06-17 01:53:46 -0400 (Sat, 17 Jun 2006)
New Revision: 61818

Modified:
   trunk/release/packaging/build
   trunk/release/packaging/defs/mono-1.1.13
   trunk/release/packaging/defs/mono-1.1.7
   trunk/release/packaging/defs/mono-1.1.8
   trunk/release/packaging/do-zip-build
   trunk/release/pyutils/packaging.py
   trunk/release/pyutils/shell_parse.py
   trunk/release/pyutils/tests/test_parse.py
   trunk/release/pyutils/utils.py
   trunk/release/website/mk-repos.py
Log:
rename source_package_path_name to def_alias.  This will
reduce duplication in def files (ex: mono and mono-1.1.13)

utils.py:
-create dest dir for get_url if it doesn't exist

shell_parse.py:
-fix function parsing to allow {} inside function

do-zip-build:
-convert to python in order to allow for def_alias,
 where def file is checked for data, and if it's missing,
 the alias file is checked

-source_package_path_name="mono"
+def_alias="mono"



Modified: trunk/release/packaging/build
===================================================================
--- trunk/release/packaging/build       2006-06-17 00:05:19 UTC (rev 61817)
+++ trunk/release/packaging/build       2006-06-17 05:53:46 UTC (rev 61818)
@@ -148,8 +148,8 @@
 # Update step: Add link to mktarball log
 # Check for package aliases
 repo = datastore.source_file_repo()
-if package.info.has_key('source_package_path_name'):
-       alias = package.info['source_package_path_name']
+if package.info.has_key('def_alias'):
+       alias = package.info['def_alias']
 else:  alias = ""
 logfile = repo.get_log_file(source_file, package_name_alias=alias)
 
@@ -206,7 +206,7 @@
 
 # Files for zip build system and build command
 if build_env.info['USE_ZIP_PKG']:
-       files_to_copy += ['do-zip-build', '../conf/%s/*.patch' % package_name, 
'defs/%s' % package_name]
+       files_to_copy += ['do-zip-build', '../pyutils/shell_parse.py', 
'../conf/%s/*.patch' % package_name, 'defs/%s' % package_name, 'defs/' + alias ]
        build_command = '%s/do-zip-build %s %s %s %s' % (build_location, 
revision, package_name, distro, version)
        remote_src_dir = "%s/scratch/%s" % (build_location, build_dir)
        step_env_pre_cmd = ". %s/build_deps/env.sh; " % build_location

Modified: trunk/release/packaging/defs/mono-1.1.13
===================================================================
--- trunk/release/packaging/defs/mono-1.1.13    2006-06-17 00:05:19 UTC (rev 
61817)
+++ trunk/release/packaging/defs/mono-1.1.13    2006-06-17 05:53:46 UTC (rev 
61818)
@@ -1,6 +1,6 @@
 web_index=1
 
-source_package_path_name="mono"
+def_alias="mono"
 bundle="1.1.13"
 
 BUILD_HOSTS=(

Modified: trunk/release/packaging/defs/mono-1.1.7
===================================================================
--- trunk/release/packaging/defs/mono-1.1.7     2006-06-17 00:05:19 UTC (rev 
61817)
+++ trunk/release/packaging/defs/mono-1.1.7     2006-06-17 05:53:46 UTC (rev 
61818)
@@ -1,6 +1,6 @@
 web_index=2
 
-source_package_path_name="mono"
+def_alias="mono"
 bundle="1.1.7"
 
 BUILD_HOSTS=(

Modified: trunk/release/packaging/defs/mono-1.1.8
===================================================================
--- trunk/release/packaging/defs/mono-1.1.8     2006-06-17 00:05:19 UTC (rev 
61817)
+++ trunk/release/packaging/defs/mono-1.1.8     2006-06-17 05:53:46 UTC (rev 
61818)
@@ -1,6 +1,6 @@
 web_index=3
 
-source_package_path_name="mono"
+def_alias="mono"
 
 BUILD_HOSTS=(
         redhat-9-i386

Modified: trunk/release/packaging/do-zip-build
===================================================================
--- trunk/release/packaging/do-zip-build        2006-06-17 00:05:19 UTC (rev 
61817)
+++ trunk/release/packaging/do-zip-build        2006-06-17 05:53:46 UTC (rev 
61818)
@@ -1,78 +1,100 @@
-#!/usr/bin/env bash
+#!/usr/bin/env python
 
-rev=$1
-package=$2
-distro=$3
-version=$4
+import sys
+import shutil
+import os
+import glob
+import re
+import distutils.dir_util
 
-rm -rf /tmp/builder/built-packages     || exit 1
-cd /tmp && rm -rf scratch              || exit 1
-rm -rf install                                 || exit 1
-mkdir scratch && cd scratch            || exit 1
+import shell_parse
 
-mv ../$package .
-mv ../*.tar.gz .
-mv ../*.zip .
-mv ../*.patch .
+rev = sys.argv[1]
+package = sys.argv[2]
+distro = sys.argv[3]
+version = sys.argv[4]
 
-tarball=`ls *.tar.gz`
-use_zip=0
+for d in [ '/tmp/builder/built-packages', '/tmp/scratch', '/tmp/install' ]:
+       if os.path.exists(d):
+               shutil.rmtree(d)
 
-if [ x == x$tarball ] ; then
-       tarball=`ls *.zip`
-       use_zip=1
-fi
+os.mkdir('/tmp/scratch')
+os.chdir('/tmp/scratch')
 
-arch=${distro#*-*-}
+zip_sources = glob.glob('../*.zip')
+tar_gz_sources = glob.glob('../*.tar.gz')
+tar_bz2_sources = glob.glob('../*.tar.bz2')
+patches = glob.glob('../*.patch')
+patches.sort()
 
-if [ $use_zip -eq 0 ] ; then
+for f in zip_sources + tar_gz_sources + tar_bz2_sources + patches + ['../' + 
package]:
+       shutil.move(f, '.')
 
-       component_name_ver=${tarball//\.tar\.gz/}
+# Load def info
+pack_def = shell_parse.parse_file(package)
 
-       if [ -e /usr/local/bin/tar ] ; then
-               # This is for the solaris 8 machine
-               TAR=/usr/local/bin/tar
-       elif [ -e /usr/sfw/bin/gtar ] ; then
-               # This is for the solaris 10 box
-               TAR=/usr/sfw/bin/gtar
-       else
-               TAR=tar
-       fi
+# Find type of source
+if zip_sources:
+       command = "unzip -q %s" % os.path.basename(zip_sources[0])
+elif tar_gz_sources:
+       command = "gzip -dc %s | tar -x " % os.path.basename(tar_gz_sources[0])
+elif tar_bz2_sources:
+       command = "bzip2 -dc %s | tar -x " % 
os.path.basename(tar_bz2_sources[0])
 
-       $TAR -zxf *.tar.gz                      || exit 1
+current_files = os.listdir('.')
 
-       # Why wasn't this used? failed unpacking??
-       #gzip -dc *.tar.gz | tar -xf -          || exit 1
+# Extract source
+if(os.system(command)):
+       print 'Failed unpacking source: ' + command + filename
+       sys.exit(1)
 
-else
-       component_name_ver=${tarball//\.zip/}
-       unzip -q *.zip                          || exit 1
-fi
+new_files = os.listdir('.')
 
-cd $component_name_ver
+# Difference (set command)
+#  (Would use sets, but they are new in ... python 2.4?)
+for f in new_files:
+       if not current_files.count(f):
+               source_dir = f
 
-# Load environment for deps
-. /tmp/build_deps/env.sh
+arch = re.compile('.*?-.*?-').sub("", distro) 
 
-# Call the function for this destroot
-. /tmp/scratch/$package
+os.chdir(source_dir)
 
-# Apply patches (if the def file has USE_PATCHES in it)
-if [ x$USE_PATCHES == "x1" ] ; then
-       for i in `ls  ../*.patch | sort -n` ; do
-               patch -p1 < $i                  || exit 1
-       done
-fi
+# Apply patches if this package defines it
+if pack_def.has_key('USE_PATCHES') and pack_def['USE_PATCHES'] == "1":
+       for patch in patches:
+               if(os.system("patch -p1 < " + patch)):
+                       print "Failed applying patch: " + 
os.path.basename(patch)
+                       sys.exit(1)
 
-DISTRO_UNDERSCORES=${distro//-/_}
-${DISTRO_UNDERSCORES}_ZIP_BUILD || exit 1
+# This is because bash can't have hyphens in var names
+shell_snipet_name = distro.replace("-", "_") + "_ZIP_BUILD"
+
+# If this pack def doesn't have it, try getting it from the alias pack def
+pack2_def_file = ""
+if pack_def.has_key(shell_snipet_name):
+       shell_code = pack_def[shell_snipet_name]
+elif pack_def.has_key('def_alias'):
+       pack2_def_file = '/tmp/' + pack_def['def_alias']
+       pack2_def = shell_parse.parse_file(pack2_def_file)
+       shell_code = pack2_def[shell_snipet_name]
+       shutil.move(pack2_def_file, '..')
+
+
+# set version var, load up environment for deps, and execute build command
+build_command = "export version=%s; . /tmp/build_deps/env.sh ; %s" % (version, 
shell_code)
+
 # TODO:  For some reason the above exit isn't being called on failures
+#  (Still an issue... ?)
+if(os.system(build_command)):
+       print "Build failed..."
+       sys.exit(1)
 
 # Package up the build
-mkdir -p /tmp/builder/built-packages
-cd /tmp/install || exit 1
-zip -yr /tmp/builder/built-packages/$component_name_ver-$rev.$arch.zip *
+os.chdir('/tmp/install')
+distutils.dir_util.mkpath('/tmp/builder/built-packages')
+os.system('zip -yr /tmp/builder/built-packages/%s-%s-%s.%s.zip *' % (package, 
version, rev, arch) )
 # Keep a copy of the "spec" file
-cp /tmp/scratch/$package /tmp/builder/built-packages
+shutil.copy('/tmp/scratch/' + package, '/tmp/builder/built-packages')
+if pack2_def_file: shutil.copy('/tmp/scratch/' + 
os.path.basename(pack2_def_file), '/tmp/builder/built-packages')
 
-

Modified: trunk/release/pyutils/packaging.py
===================================================================
--- trunk/release/pyutils/packaging.py  2006-06-17 00:05:19 UTC (rev 61817)
+++ trunk/release/pyutils/packaging.py  2006-06-17 05:53:46 UTC (rev 61818)
@@ -270,15 +270,15 @@
                                if not os.path.exists(path): 
distutils.dir_util.mkpath(path)
 
                # Create source and package symlinks if the dirs are there, but 
not the symlink
-               if self.info.has_key('source_package_path_name') and 
self.HEAD_or_RELEASE == "RELEASE" and self.create_dirs_links:
-                       print "Link alias: %s" % 
self.info['source_package_path_name']
+               if self.info.has_key('def_alias') and self.HEAD_or_RELEASE == 
"RELEASE" and self.create_dirs_links:
+                       print "Link alias: %s" % self.info['def_alias']
                        for dir in (dirs):
                                if not os.path.islink(dir) and not 
self.inside_jail:
                                        if os.path.exists(dir):
                                                print "%s is not a symbolic 
link (it should be)" % dir
                                                sys.exit(1)
                                        try:
-                                               
os.symlink(self.info['source_package_path_name'], dir)
+                                               
os.symlink(self.info['def_alias'], dir)
                                        except:
                                                print "Error creating symlink: 
%s" % dir
                                                sys.exit(1)
@@ -364,8 +364,8 @@
                                # Cases
                                # 1. version from bundle
                                name = self.name
-                               if 
self.info.has_key('source_package_path_name') and self.HEAD_or_RELEASE == 
"RELEASE":
-                                       name = 
self.info['source_package_path_name']
+                               if self.info.has_key('def_alias') and 
self.HEAD_or_RELEASE == "RELEASE":
+                                       name = self.info['def_alias']
                                if self.bundle_obj.version_map.has_key(name):
                                        self.version = 
self.bundle_obj.version_map[name]
                                # 2. If a package is not listed in bundle, 
print warning and skip

Modified: trunk/release/pyutils/shell_parse.py
===================================================================
--- trunk/release/pyutils/shell_parse.py        2006-06-17 00:05:19 UTC (rev 
61817)
+++ trunk/release/pyutils/shell_parse.py        2006-06-17 05:53:46 UTC (rev 
61818)
@@ -47,7 +47,9 @@
                info[match.group(1)] = items
 
        # get Functions ( func () { } )
-       for match in re.compile('^(\w*?) \(\) {(.*?)}', re.S | 
re.M).finditer(string_no_comments):
+       # Note: because of libgdiplus generating the .pc file which includes { 
and }, the ^} had to be
+       #       added, so just remember that } on a newline always means the 
end of the function
+       for match in re.compile('^(\w*?) \(\) {(.*?)^}', re.S | 
re.M).finditer(string_no_comments):
                info[match.group(1)] = match.group(2)
 
        return info

Modified: trunk/release/pyutils/tests/test_parse.py
===================================================================
--- trunk/release/pyutils/tests/test_parse.py   2006-06-17 00:05:19 UTC (rev 
61817)
+++ trunk/release/pyutils/tests/test_parse.py   2006-06-17 05:53:46 UTC (rev 
61818)
@@ -5,6 +5,7 @@
 sys.path += [".."]
 
 import packaging
+import shell_parse
 
 #env = packaging.buildenv('sles-9-x86_64')
 env = packaging.buildenv('win-4-i386')
@@ -13,3 +14,11 @@
 #pack = packaging.package(env, 'gecko-sharp-2.0')
 pack = packaging.package(env, 'mono')
 print pack.info
+
+print "---------------------------------------------------------------------"
+
+pack_def = shell_parse.parse_file('../../packaging/defs/libgdiplus')
+
+print pack_def['macos_10_ppc_ZIP_BUILD']
+
+print "---------------------------------------------------------------------"

Modified: trunk/release/pyutils/utils.py
===================================================================
--- trunk/release/pyutils/utils.py      2006-06-17 00:05:19 UTC (rev 61817)
+++ trunk/release/pyutils/utils.py      2006-06-17 05:53:46 UTC (rev 61818)
@@ -200,13 +200,15 @@
         return os.path.basename(filename)
 
 # Download url into cache (Don't redownload if file exists)
-def get_url(url,destination):
+def get_url(url, destination):
 
        filename = os.path.basename(url)
 
         # Download if not in cache
         if not os.path.exists(destination + os.sep + filename):
                 print "Downloading: %s ..." % url
+               if not os.path.exists(destination):
+                       distutils.dir_util.mkpath(destination)
                 command = "wget -c %s -O %s" % (url, destination + os.sep + 
filename)
                 #print command
                 (status, output) = launch_process(command, print_output=debug)

Modified: trunk/release/website/mk-repos.py
===================================================================
--- trunk/release/website/mk-repos.py   2006-06-17 00:05:19 UTC (rev 61817)
+++ trunk/release/website/mk-repos.py   2006-06-17 05:53:46 UTC (rev 61818)
@@ -81,7 +81,7 @@
                        pack_obj = packaging.package(distro_obj, 
os.path.basename(pack), bundle_obj=bundle_conf, 
package_basepath=package_src_dir)
 
                        # Only if package is valid on this distro, and it's not 
an 'alias' package (Ex: don't process packages whose pack/source dirs are links 
to others)
-                       if pack_obj.valid_use_platform(distro_obj.name) and not 
pack_obj.info.has_key('source_package_path_name'):
+                       if pack_obj.valid_use_platform(distro_obj.name) and not 
pack_obj.info.has_key('def_alias'):
                                rpms += 
pack_obj.get_files(fail_on_missing=False)
 
                # Get external rpms

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

Reply via email to