# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
-
+import re
import src
import src.debug as DBG
except NameError:
pass
+PROPERTY_EXPRESSION = "^.+:.+$"
+
# Define all possible option for the compile command : sat compile <options>
parser = src.options.Options()
parser.add_option('p', 'products', 'list2', 'products',
_('Optional: products to compile. This option can be'
' passed several time to compile several products.'))
+parser.add_option('', 'properties', 'string', 'properties',
+ _('Optional: Filter the products by their properties.\n\tSyntax: '
+ '--properties <property>:<value>'))
parser.add_option('', 'with_fathers', 'boolean', 'fathers',
_("Optional: build all necessary products to the given product (KERNEL is "
"build before building GUI)."), False)
# Construct the list of tuple containing
# the products name and their definition
products_infos = src.product.get_products_infos(products, cfg)
+
+ # if the property option was passed, filter the list
+ if options.properties:
+ [prop, value] = options.properties.split(":")
+ products_infos = [(p_name, p_info) for
+ (p_name, p_info) in products_infos
+ if "properties" in p_info and
+ prop in p_info.properties and
+ p_info.properties[prop] == value]
+
+ # get rid of fixed products
products_infos = [pi for pi in products_infos if not(
src.product.product_is_fixed(pi[1]))]
# check that the command has been called with an application
src.check_config_has_application( runner.cfg )
+ # Verify the --properties option
+ if options.properties:
+ oExpr = re.compile(PROPERTY_EXPRESSION)
+ if not oExpr.search(options.properties):
+ msg = _('WARNING: the "--properties" options must have the '
+ 'following syntax:\n--properties <property>:<value>')
+ logger.write(src.printcolors.printcWarning(msg), 1)
+ logger.write("\n", 1)
+ options.properties = None
+
# Print some informations
logger.write(_('Executing the compile commands in the build '
'directories of the products of '
import os
import subprocess
+import re
import src
import prepare
parser.add_option('p', 'products', 'list2', 'products',
_('Optional: products to get the sources. This option can be'
' passed several time to get the sources of several products.'))
+parser.add_option('', 'properties', 'string', 'properties',
+ _('Optional: Filter the products by their properties.\n\tSyntax: '
+ '--properties <property>:<value>'))
def apply_patch(config, product_info, max_product_name_len, logger):
'''The method called to apply patches on a product
# check that the command has been called with an application
src.check_config_has_application( runner.cfg )
+ # Verify the --properties option
+ if options.properties:
+ oExpr = re.compile(prepare.PROPERTY_EXPRESSION)
+ if not oExpr.search(options.properties):
+ msg = _('WARNING: the "--properties" options must have the '
+ 'following syntax:\n--properties <property>:<value>')
+ logger.write(src.printcolors.printcWarning(msg), 1)
+ logger.write("\n", 1)
+ options.properties = None
+
# Print some informations
logger.write('Patching sources of the application %s\n' %
src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
logger.write(" " + src.printcolors.printc(status), 1, False)
logger.write(" (%s)\n" % res_count, 1, False)
- return len(products_infos) - good_result
\ No newline at end of file
+ return len(products_infos) - good_result
import src
import src.debug as DBG
+PROPERTY_EXPRESSION = "^.+:.+$"
+
# Define all possible option for prepare command : sat prepare <options>
parser = src.options.Options()
parser.add_option('p', 'products', 'list2', 'products',
_('Optional: products to prepare. This option can be'
' passed several time to prepare several products.'))
+parser.add_option('', 'properties', 'string', 'properties',
+ _('Optional: Filter the products by their properties.\n\tSyntax: '
+ '--properties <property>:<value>'))
parser.add_option('f', 'force', 'boolean', 'force',
_("Optional: force to prepare the products in development mode."))
parser.add_option('', 'force_patch', 'boolean', 'force_patch',
# the products name and their definition
products_infos = src.product.get_products_infos(products, cfg)
+ # if the property option was passed, filter the list
+ if options.properties:
+ [prop, value] = options.properties.split(":")
+ products_infos = [(p_name, p_info) for
+ (p_name, p_info) in products_infos
+ if "properties" in p_info and
+ prop in p_info.properties and
+ p_info.properties[prop] == value]
+
return products_infos
def remove_products(arguments, l_products_info, logger):
# check that the command has been called with an application
src.check_config_has_application( runner.cfg )
+ # Verify the --properties option
+ if options.properties:
+ oExpr = re.compile(PROPERTY_EXPRESSION)
+ if not oExpr.search(options.properties):
+ msg = _('WARNING: the "--properties" options must have the '
+ 'following syntax:\n--properties <property>:<value>')
+ logger.write(src.printcolors.printcWarning(msg), 1)
+ logger.write("\n", 1)
+ options.properties = None
+
products_infos = get_products_list(options, runner.cfg, logger)
# Construct the arguments to pass to the clean, source and patch commands
import os
import shutil
+import re
import src
import prepare
parser.add_option('p', 'products', 'list2', 'products',
_('Optional: products from which to get the sources. This option can be'
' passed several time to get the sources of several products.'))
+parser.add_option('', 'properties', 'string', 'properties',
+ _('Optional: Filter the products by their properties.\n\tSyntax: '
+ '--properties <property>:<value>'))
def get_source_for_dev(config, product_info, source_dir, logger, pad):
'''The method called if the product is in development mode
# check that the command has been called with an application
src.check_config_has_application( runner.cfg )
+ # Verify the --properties option
+ if options.properties:
+ oExpr = re.compile(prepare.PROPERTY_EXPRESSION)
+ if not oExpr.search(options.properties):
+ msg = _('WARNING: the "--properties" options must have the '
+ 'following syntax:\n--properties <property>:<value>')
+ logger.write(src.printcolors.printcWarning(msg), 1)
+ logger.write("\n", 1)
+ options.properties = None
+
# Print some informations
logger.write(_('Getting sources of the application %s\n') %
src.printcolors.printcLabel(runner.cfg.VARS.application), 1)
return 0
;;
source)
- opts="--products"
+ opts="--products --properties"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
patch)
- opts="--products"
+ opts="--products --properties"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
prepare)
- opts="--products --force --force_patch"
+ opts="--products --properties --force --force_patch"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
return 0
;;
compile)
- opts="--products --with_fathers --with_children --clean_all --clean_make --install_flags --show --stop_first_fail --check --clean_build_after"
+ opts="--products --properties --with_fathers --with_children --clean_all --clean_make --install_flags --show --stop_first_fail --check --clean_build_after"
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;