コード例 #1
0
    def load_configured_info(self):

        # Default environment
        self.env_vars = {}
        # Make a copy
        for k, v in config.env_vars.iteritems():
            self.env_vars[k] = v

        # Pull out all vars in the distro conf file
        conf_info = shell_parse.parse_file(self.conf_file)
        # Copy info from conf file into structure we've been building
        for k, v in conf_info.iteritems():
            self.info[k] = v

        # Keys that are required
        for key in []:
            if not self.info.has_key(key):
                print "conf file must contain: %s" % key
                sys.exit(1)

        # Allow override from the conf file
        for key in self.env_vars.keys():
            if self.info.has_key(key):
                self.env_vars[key] = self.info[key]

        # allow override or config from self.env
        if self.info.has_key('env'):
            for i in self.info['env'].split(','):
                k, v = i.split('=')
                self.env_vars[k] = v
            # remove it from info now that it's been added to env_vars
            self.info.pop('env')
コード例 #2
0
ファイル: packaging.py プロジェクト: akoeplinger/release
	def load_configured_info(self):

		# Default environment
		self.env_vars = {}
		# Make a copy
		for k, v in config.env_vars.iteritems():
			self.env_vars[k] = v

		# Pull out all vars in the distro conf file
		conf_info = shell_parse.parse_file(self.conf_file)
		# Copy info from conf file into structure we've been building
		for k, v in conf_info.iteritems():
			self.info[k] = v

		# Keys that are required
		for key in []:
			if not self.info.has_key(key):
				print "conf file must contain: %s" % key
				sys.exit(1)

		# Allow override from the conf file
		for key in self.env_vars.keys():
			if self.info.has_key(key):
				self.env_vars[key] = self.info[key]

		# allow override or config from self.env
		if self.info.has_key('env'):
			for i in self.info['env'].split(','):
				k, v = i.split('=')
				self.env_vars[k] = v
			# remove it from info now that it's been added to env_vars
			self.info.pop('env')
コード例 #3
0
    def __init__(self, bundle_name=""):
        """Args: optional: bundle_name, pointing to a file in packaging/bundles
		If this is blank, the BUNDLE environment var will be checked with the bundle name
		If this is blank, no version selection will be used."""

        self.info = {}
        self.version_map = {}
        self.bundle_name = bundle_name
        self.version_map_exists = False

        if self.bundle_name == "" and os.environ.has_key('BUNDLE'):
            self.bundle_name = os.environ['BUNDLE']

        if self.bundle_name != "":
            self.info = shell_parse.parse_file(config.packaging_dir + os.sep +
                                               "bundles" + os.sep +
                                               self.bundle_name)
            if self.info.has_key('versions'):
                # Can't do this because shell string vars can't have the '-' char...
                #self.version_map = shell_parse.parse_string("\n".join(self.info['versions']))
                self.version_map = {}

                # Note: this ingores single and double quotes around the value
                #  This was copied from shell_parse, but changed so that a var is .* instead of \w*
                for match in re.compile('^\s*(.*?)=["\']?([^\(].*?)["\']?$',
                                        re.S | re.M).finditer("\n".join(
                                            self.info['versions'])):
                    # Weird hack... (easier than fixing the reg...)
                    if match.group(2) == '"':
                        value = ""
                    else:
                        value = match.group(2)
                    self.version_map[match.group(1)] = value

                self.version_map_exists = True

            # Make sure bundle contains minimum data
            for key in "bundle_urlname archive_version".split():
                if not self.info.has_key(key):
                    print "Required key (%s) not found in bundle config file" % key
                    sys.exit(1)
        else:
            #print "No bundle specified.  Using latest version of packages..."
            pass
コード例 #4
0
ファイル: packaging.py プロジェクト: akoeplinger/release
	def __init__(self, bundle_name=""):
		"""Args: optional: bundle_name, pointing to a file in packaging/bundles
		If this is blank, the BUNDLE environment var will be checked with the bundle name
		If this is blank, no version selection will be used."""

		self.info = {}
		self.version_map = {}
		self.bundle_name = bundle_name
		self.version_map_exists = False

		if self.bundle_name == "" and os.environ.has_key('BUNDLE'):
			self.bundle_name = os.environ['BUNDLE']

		if self.bundle_name != "":
			self.info = shell_parse.parse_file(config.packaging_dir + os.sep + "bundles" + os.sep + self.bundle_name)
			if self.info.has_key('versions'):
				# Can't do this because shell string vars can't have the '-' char...
				#self.version_map = shell_parse.parse_string("\n".join(self.info['versions']))
				self.version_map = {}

				# Note: this ingores single and double quotes around the value
				#  This was copied from shell_parse, but changed so that a var is .* instead of \w*
				for match in re.compile('^\s*(.*?)=["\']?([^\(].*?)["\']?$', re.S | re.M).finditer("\n".join(self.info['versions'])):
					# Weird hack... (easier than fixing the reg...)
					if match.group(2) == '"':
						value = ""
					else:   value = match.group(2)
					self.version_map[match.group(1)] = value

				self.version_map_exists = True

			# Make sure bundle contains minimum data
			for key in "bundle_urlname archive_version".split():
				if not self.info.has_key(key):
					print "Required key (%s) not found in bundle config file" % key
					sys.exit(1)
		else:
			#print "No bundle specified.  Using latest version of packages..."
			pass
コード例 #5
0
ファイル: packaging.py プロジェクト: akoeplinger/release
	def __init__(self, package_env, name, bundle_obj="", bundle_name="", source_basepath="", package_basepath="", inside_jail=False, HEAD_or_RELEASE="", create_dirs=True):
		"""Args: buildconf object, string name of a file in packaging/defs.
		source/package_basepath: full path to where packages are.  Can be overridden (used for web publishing)
		inside_jail: this packaging module is used in release/pyutils and /tmp.  If it's in /tmp, that means we're inside the jail
		   and there are certain things we shouldn't do.
		"""

		self.package_env = package_env
		self.name = name
		self.source_basepath = source_basepath
		self.package_basepath = package_basepath
		self.inside_jail = inside_jail
		self.create_dirs = create_dirs

		# Default to use the file in the current dir, otherwise look in the defs dir
		#  (This change was for do-msvn tar)
		if os.path.exists(name) and os.path.isfile(name):
			self.def_file = name
		else:
			self.def_file = os.path.join(config.packaging_dir, "defs", name)

		if not os.path.exists(self.def_file):
			print "package.__init__(): File not found: %s" % self.def_file
			sys.exit(1)

		self.info = shell_parse.parse_file(self.def_file)

		# Shell config hack to properly populate USE_HOSTS 
		if self.info['USE_HOSTS'] == ['${BUILD_HOSTS[@]}']:
			self.info['USE_HOSTS'] = self.info['BUILD_HOSTS']

		# Handle bundle
		if bundle_obj and bundle_name:
			print "Cannot pass bundle_obj and bundle_name to package constructor"
			sys.exit(1)
		# Prioritize bundle obj, and then bundle_name, the 'bundle' from def file, and then resort to an empty bundl
		if bundle_obj:
			self.bundle_obj = bundle_obj
		# Remember, if bundle_name is empty, the BUNDLE var will be used
		#  and if BUNDLE env var is empty, as well as bundle_name, bundle_obj.version_map_exists = False
		elif bundle_name:
			self.bundle_obj = bundle(bundle_name=bundle_name)
		# Check to see if the bundle file exists... (if it doesn't, we may be in a jail, or the config file info is wrong)
		elif self.info.has_key('bundle') and os.path.exists(os.path.join(config.packaging_dir, 'bundles', self.info['bundle'])):
			self.bundle_obj = bundle(bundle_name=self.info['bundle'])
		else:
			self.bundle_obj = bundle(bundle_name="")

		# What's passed in overrides the bundle conf
		if HEAD_or_RELEASE:
			self.HEAD_or_RELEASE = HEAD_or_RELEASE
		elif self.bundle_obj.info.has_key('HEAD_or_RELEASE'):
			self.HEAD_or_RELEASE = self.bundle_obj.info['HEAD_or_RELEASE']
		else:
			self.HEAD_or_RELEASE = "RELEASE"

		# if we have a build env
		if self.package_env:
			self.destroot = self.execute_function('get_destroot', 'DEST_ROOT')

		self.setup_paths()

		# Initialize for later... (for caching)
		self.version = ""
		self.versions = []
		self.latest_version = ""
		self.source_filename = ""
コード例 #6
0
    def __init__(self,
                 package_env,
                 name,
                 bundle_obj="",
                 bundle_name="",
                 source_basepath="",
                 package_basepath="",
                 inside_jail=False,
                 HEAD_or_RELEASE="",
                 create_dirs=True):
        """Args: buildconf object, string name of a file in packaging/defs.
		source/package_basepath: full path to where packages are.  Can be overridden (used for web publishing)
		inside_jail: this packaging module is used in release/pyutils and /tmp.  If it's in /tmp, that means we're inside the jail
		   and there are certain things we shouldn't do.
		"""

        self.package_env = package_env
        self.name = name
        self.source_basepath = source_basepath
        self.package_basepath = package_basepath
        self.inside_jail = inside_jail
        self.create_dirs = create_dirs

        # Default to use the file in the current dir, otherwise look in the defs dir
        #  (This change was for do-msvn tar)
        if os.path.exists(name) and os.path.isfile(name):
            self.def_file = name
        else:
            self.def_file = os.path.join(config.packaging_dir, "defs", name)

        if not os.path.exists(self.def_file):
            print "package.__init__(): File not found: %s" % self.def_file
            sys.exit(1)

        self.info = shell_parse.parse_file(self.def_file)

        # Shell config hack to properly populate USE_HOSTS
        if self.info['USE_HOSTS'] == ['${BUILD_HOSTS[@]}']:
            self.info['USE_HOSTS'] = self.info['BUILD_HOSTS']

        # Handle bundle
        if bundle_obj and bundle_name:
            print "Cannot pass bundle_obj and bundle_name to package constructor"
            sys.exit(1)
        # Prioritize bundle obj, and then bundle_name, the 'bundle' from def file, and then resort to an empty bundl
        if bundle_obj:
            self.bundle_obj = bundle_obj
        # Remember, if bundle_name is empty, the BUNDLE var will be used
        #  and if BUNDLE env var is empty, as well as bundle_name, bundle_obj.version_map_exists = False
        elif bundle_name:
            self.bundle_obj = bundle(bundle_name=bundle_name)
        # Check to see if the bundle file exists... (if it doesn't, we may be in a jail, or the config file info is wrong)
        elif self.info.has_key('bundle') and os.path.exists(
                os.path.join(config.packaging_dir, 'bundles',
                             self.info['bundle'])):
            self.bundle_obj = bundle(bundle_name=self.info['bundle'])
        else:
            self.bundle_obj = bundle(bundle_name="")

        # What's passed in overrides the bundle conf
        if HEAD_or_RELEASE:
            self.HEAD_or_RELEASE = HEAD_or_RELEASE
        elif self.bundle_obj.info.has_key('HEAD_or_RELEASE'):
            self.HEAD_or_RELEASE = self.bundle_obj.info['HEAD_or_RELEASE']
        else:
            self.HEAD_or_RELEASE = "RELEASE"

        # if we have a build env
        if self.package_env:
            self.destroot = self.execute_function('get_destroot', 'DEST_ROOT')

        self.setup_paths()

        # Initialize for later... (for caching)
        self.version = ""
        self.versions = []
        self.latest_version = ""
        self.source_filename = ""
コード例 #7
0
#!/usr/bin/env python

import sys

sys.path += [".."]

import packaging
import shell_parse

#env = packaging.buildenv('sles-9-x86_64')
env = packaging.buildenv('win-4-i386')
print env.info

#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 "---------------------------------------------------------------------"